aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTianmi Chen <tianmi.chen@intel.com>2015-07-09 16:34:03 +0800
committerPatrick Tjin <pattjin@google.com>2015-07-15 21:55:28 -0700
commit29bf1fc0e43faa3b89b575c83a9db6f0376fa188 (patch)
tree93bd9a91e13013acf7fb4932932229a6a1568ee3
parent7f260ec8dbab85070916345c268def66f949220d (diff)
downloadpsb_video-29bf1fc0e43faa3b89b575c83a9db6f0376fa188.tar.gz
correctly set gralloc usage and remove memset workaround
Correct gralloc usage together with correct lock area trigger cache flushing correctly, to resolve corruption during resolution change. The memset workaround for Bug 19197299 is also removed since we didn't observe it on DDK-1.5. Bug: 22183821 Change-Id: If1c112988a300b7aa9054127aa37cc2cf50d5371 Signed-off-by: Tianmi Chen <tianmi.chen@intel.com>
-rw-r--r--src/android/psb_surface_gralloc.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/android/psb_surface_gralloc.c b/src/android/psb_surface_gralloc.c
index 1fc7013..bc3dc29 100644
--- a/src/android/psb_surface_gralloc.c
+++ b/src/android/psb_surface_gralloc.c
@@ -357,13 +357,13 @@ VAStatus psb_CreateSurfacesFromGralloc(
if (gfx_colorformat == HAL_PIXEL_FORMAT_NV12)
usage |= GRALLOC_USAGE_SW_READ_OFTEN;
else {
-#ifdef PSBVIDEO_MRFL
- usage |= GRALLOC_USAGE_SW_WRITE_OFTEN;
-#endif
+ // video decoder allows app to read/write the buffer
+ usage |= GRALLOC_USAGE_SW_WRITE_RARELY | GRALLOC_USAGE_SW_READ_RARELY;
}
handle = (unsigned long)external_buffers->buffers[i];
pthread_mutex_lock(&gralloc_mutex);
+
if (gralloc_lock((buffer_handle_t)handle, usage, 0, 0, width, height, (void **)&vaddr[GRALLOC_SUB_BUFFER0])) {
vaStatus = VA_STATUS_ERROR_UNKNOWN;
} else {
@@ -417,8 +417,10 @@ VAStatus psb_CreateSurfacesFromGralloc(
}
else {
size = psb_surface->chroma_offset;
- memset((char *)vaddr[GRALLOC_SUB_BUFFER0], 0, size);
- memset((char *)vaddr[GRALLOC_SUB_BUFFER0] + size, 0x80, psb_surface->size - size);
+ // the following memset was used to work-around Bug 19197299 on L.
+ // on DDK-1.5 we didn't observe the problem so comment it out.
+ // memset((char *)vaddr[GRALLOC_SUB_BUFFER0], 0, size);
+ // memset((char *)vaddr[GRALLOC_SUB_BUFFER0] + size, 0x80, psb_surface->size - size);
}
// overlay only support BT.601 and BT.709
if (driver_data->load_csc_matrix == 1) {