VE: create surfaces for gralloc buffer according to its dimension
BZ: 95915
Use gralloc buffer's resolution to create surfaces.
Change-Id: I8b2991d04ce0a01bbb852bb1f618045ac2766eed
Signed-off-by: Chang Ying <ying.chang@intel.com>
Reviewed-on: http://android.intel.com:8080/98533
Reviewed-by: Ding, Haitao <haitao.ding@intel.com>
Tested-by: Ding, Haitao <haitao.ding@intel.com>
Reviewed-by: cactus <cactus@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
diff --git a/videoencoder/Android.mk b/videoencoder/Android.mk
index af21f9f..bf3f8b6 100644
--- a/videoencoder/Android.mk
+++ b/videoencoder/Android.mk
@@ -46,8 +46,8 @@
LOCAL_CPPFLAGS += -DVIDEO_ENC_STATISTICS_ENABLE
endif
-ifeq ($(REF_PRODUCT_NAME),baylake)
- LOCAL_C_FLAGS += -DBAYLAKE
+ifeq ($(ENABLE_IMG_GRAPHICS),true)
+ LOCAL_CFLAGS += -DIMG_GFX
endif
LOCAL_MODULE_TAGS := optional
diff --git a/videoencoder/VideoEncoderBase.cpp b/videoencoder/VideoEncoderBase.cpp
index 64f5a02..2150f6a 100644
--- a/videoencoder/VideoEncoderBase.cpp
+++ b/videoencoder/VideoEncoderBase.cpp
@@ -11,6 +11,9 @@
#include "IntelMetadataBuffer.h"
#include <va/va_tpi.h>
#include <va/va_android.h>
+#ifdef IMG_GFX
+#include <hal/hal_public.h>
+#endif
// API declaration
extern "C" {
@@ -1551,21 +1554,33 @@
LOG_I("gfxhandle = %d\n", map->value);
vaSurfaceAttrib.count = 1;
+#ifdef IMG_GFX
// color fmrat may be OMX_INTEL_COLOR_FormatYUV420PackedSemiPlanar or HAL_PIXEL_FORMAT_NV12
- //IMG_native_handle_t* h = (IMG_native_handle_t*) map->value;
- //LOG_I("IMG_native_handle_t h->iWidth=%d, h->iHeight=%d, h->iFormat=%x\n", h->iWidth, h->iHeight, h->iFormat);
+ IMG_native_handle_t* h = (IMG_native_handle_t*) map->value;
+ LOG_I("IMG_native_handle_t h->iWidth=%d, h->iHeight=%d, h->iFormat=%x\n", h->iWidth, h->iHeight, h->iFormat);
+ vaSurfaceAttrib.luma_stride = h->iWidth;
+ vaSurfaceAttrib.pixel_format = h->iFormat;
+ vaSurfaceAttrib.width = h->iWidth;
+ vaSurfaceAttrib.height = h->iHeight;
+#else
vaSurfaceAttrib.luma_stride = map->vinfo.lumaStride;
vaSurfaceAttrib.pixel_format = map->vinfo.format;
vaSurfaceAttrib.width = map->vinfo.width;
vaSurfaceAttrib.height = map->vinfo.height;
+#endif
vaSurfaceAttrib.type = VAExternalMemoryAndroidGrallocBuffer;
vaSurfaceAttrib.buffers[0] = (uint32_t) map->value;
vaStatus = vaCreateSurfacesWithAttribute(
mVADisplay,
+#ifdef IMG_GFX
+ h->iWidth,
+ h->iHeight,
+#else
map->vinfo.width,
map->vinfo.height,
+#endif
VA_RT_FORMAT_YUV420,
1,
&surface,