correctly set SW_USAGE for HW codecs

this is to explicitly declare the capability to allow apps
to read/write the video buffer. gralloc module will manage
the cache flushing better when usage flags align between
alloc() and lock().

Bug: 22183821

Change-Id: I185b14a2f97598f68a1c278309ecbffaf6e5c113
Signed-off-by: Tianmi Chen <tianmi.chen@intel.com>
diff --git a/videocodec/OMXVideoDecoderBase.cpp b/videocodec/OMXVideoDecoderBase.cpp
index 40859b4..6270cea 100644
--- a/videocodec/OMXVideoDecoderBase.cpp
+++ b/videocodec/OMXVideoDecoderBase.cpp
@@ -926,7 +926,10 @@
      OMX_ERRORTYPE ret;
      GetAndroidNativeBufferUsageParams *param = (GetAndroidNativeBufferUsageParams*)pStructure;
      CHECK_TYPE_HEADER(param);
-     param->nUsage |= GRALLOC_USAGE_HW_TEXTURE;
+     // hardware usage: consumed by GLES and HWC
+     param->nUsage |= GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_HW_COMPOSER;
+     // software usage: can be read/written by apps
+     param->nUsage |= GRALLOC_USAGE_SW_READ_RARELY | GRALLOC_USAGE_SW_WRITE_RARELY;
      return OMX_ErrorNone;
 }
 OMX_ERRORTYPE OMXVideoDecoderBase::SetNativeBufferUsageSpecific(OMX_PTR) {