summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPirama Arumuga Nainar <pirama@google.com>2015-06-18 10:32:21 -0700
committerPirama Arumuga Nainar <pirama@google.com>2015-06-18 10:32:21 -0700
commit31c406a5991858d68886d35b6e9bf03acc0b3288 (patch)
tree9ee86690c65df8bd03bd07bcbece7b7900a73a84
parent589464fc0c334f735dc02d25e9fdfb3b4869d881 (diff)
downloadrs-31c406a5991858d68886d35b6e9bf03acc0b3288.tar.gz
Avoid clobbering of YUV layout for flexible formats
Bug: 21787806 In function DeriveYUVLayout in fw/rs/driver/rsdAllocation.cpp, skip initialization of DrvState if the yuv format is the flexible YCbCr format. Change-Id: Ie2c5253b2ed048887d034ad8793d0558f2cd7d4f
-rw-r--r--driver/rsdAllocation.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/driver/rsdAllocation.cpp b/driver/rsdAllocation.cpp
index 94efab24..790005d7 100644
--- a/driver/rsdAllocation.cpp
+++ b/driver/rsdAllocation.cpp
@@ -252,6 +252,15 @@ static void UploadToBufferObject(const Context *rsc, const Allocation *alloc) {
static size_t DeriveYUVLayout(int yuv, Allocation::Hal::DrvState *state) {
+#ifndef RS_COMPATIBILITY_LIB
+ // For the flexible YCbCr format, layout is initialized during call to
+ // Allocation::ioReceive. Return early and avoid clobberring any
+ // pre-existing layout.
+ if (yuv == HAL_PIXEL_FORMAT_YCbCr_420_888) {
+ return 0;
+ }
+#endif
+
// YUV only supports basic 2d
// so we can stash the plane pointers in the mipmap levels.
size_t uvSize = 0;
@@ -286,11 +295,6 @@ static size_t DeriveYUVLayout(int yuv, Allocation::Hal::DrvState *state) {
uvSize += state->lod[1].stride * state->lod[1].dimY;
state->yuv.step = 2;
break;
-#ifndef RS_COMPATIBILITY_LIB
- case HAL_PIXEL_FORMAT_YCbCr_420_888:
- // This will be filled in by ioReceive()
- break;
-#endif
default:
rsAssert(0);
}