diff options
author | Tianmi Chen <tianmi.chen@intel.com> | 2014-06-23 14:33:11 +0800 |
---|---|---|
committer | Patrick Tjin <pattjin@google.com> | 2014-07-21 22:06:39 -0700 |
commit | c81215b4bf0f69e83b393d14bd6ffba2ec3f0ee5 (patch) | |
tree | 70151b0d71438d1bed2a5f36407fd1299eb2d6f6 | |
parent | e0c848575cd16a75a6f9b4d038cedbb77fc07873 (diff) | |
download | android_hardware_intel_img_psb_video-c81215b4bf0f69e83b393d14bd6ffba2ec3f0ee5.tar.gz android_hardware_intel_img_psb_video-c81215b4bf0f69e83b393d14bd6ffba2ec3f0ee5.tar.bz2 android_hardware_intel_img_psb_video-c81215b4bf0f69e83b393d14bd6ffba2ec3f0ee5.zip |
psb_video: use private_data to pass share info outside vaCreateSurface
BZ: 204482
use private_data to pass share info, so that we can fill out share info
outside vaCreateSurface, such as assigning crop width, crop height in
mediasdk
Change-Id: Ia98cc307bc00176742383a91b793c1484c900a81
Signed-off-by: Tianmi Chen <tianmi.chen@intel.com>
-rw-r--r-- | src/android/psb_surface_gralloc.c | 8 | ||||
-rwxr-xr-x | src/psb_drv_video.c | 5 | ||||
-rwxr-xr-x | src/psb_drv_video.h | 21 |
3 files changed, 29 insertions, 5 deletions
diff --git a/src/android/psb_surface_gralloc.c b/src/android/psb_surface_gralloc.c index 5e3e04f..9c5671e 100644 --- a/src/android/psb_surface_gralloc.c +++ b/src/android/psb_surface_gralloc.c @@ -242,7 +242,7 @@ VAStatus psb_CreateSurfacesFromGralloc( int format, int num_surfaces, VASurfaceID *surface_list, /* out */ - VASurfaceAttributeTPI *attribute_tpi + PsbSurfaceAttributeTPI *attribute_tpi ) { INIT_DRIVER_DATA @@ -250,7 +250,7 @@ VAStatus psb_CreateSurfacesFromGralloc( int i, height_origin, usage, buffer_stride = 0; int protected = (VA_RT_FORMAT_PROTECTED & format); unsigned long fourcc; - VASurfaceAttributeTPI *external_buffers = NULL; + PsbSurfaceAttributeTPI *external_buffers = NULL; unsigned long handle; int size = num_surfaces * sizeof(unsigned int); void *vaddr[GRALLOC_SUB_BUFFER_MAX]; @@ -390,7 +390,9 @@ VAStatus psb_CreateSurfacesFromGralloc( obj_surface->share_info->renderStatus = 0; obj_surface->share_info->used_by_widi = 0; - obj_surface->share_info->native_window = (void *)external_buffers->reserved[0] ; + obj_surface->share_info->native_window = (void *)external_buffers->reserved[0]; + + attribute_tpi->reserved[1] = (unsigned long)obj_surface->share_info; obj_surface->share_info->surface_protected = driver_data->protected; if (driver_data->render_rect.width == 0 || driver_data->render_rect.height == 0) { diff --git a/src/psb_drv_video.c b/src/psb_drv_video.c index 4aefa14..8ffae2b 100755 --- a/src/psb_drv_video.c +++ b/src/psb_drv_video.c @@ -694,7 +694,7 @@ VAStatus psb_CreateSurfaces2( unsigned int flags = 0; int memory_type = -1; VASurfaceAttribExternalBuffers *pExternalBufDesc = NULL; - VASurfaceAttributeTPI attribute_tpi; + PsbSurfaceAttributeTPI attribute_tpi; CHECK_INVALID_PARAM(num_surfaces <= 0); CHECK_SURFACE(surface_list); @@ -727,7 +727,7 @@ VAStatus psb_CreateSurfaces2( attribute_tpi.luma_offset = pExternalBufDesc->offsets[0]; attribute_tpi.chroma_u_offset = pExternalBufDesc->offsets[1]; attribute_tpi.chroma_v_offset = pExternalBufDesc->offsets[2]; - attribute_tpi.reserved[0] = (unsigned int) pExternalBufDesc->private_data; + attribute_tpi.reserved[0] = (unsigned long) pExternalBufDesc->private_data; if (pExternalBufDesc->flags & VA_SURFACE_EXTBUF_DESC_ENABLE_TILING) attribute_tpi.tiling = 1; else @@ -773,6 +773,7 @@ VAStatus psb_CreateSurfaces2( else if(memory_type !=-1 && pExternalBufDesc != NULL) { attribute_tpi.type = memory_type; vaStatus = psb_CreateSurfacesWithAttribute(ctx, width, height, format, num_surfaces, surface_list, &attribute_tpi); + pExternalBufDesc->private_data = (void *)(attribute_tpi.reserved[1]); if (attribute_tpi.buffers) free(attribute_tpi.buffers); return vaStatus; } diff --git a/src/psb_drv_video.h b/src/psb_drv_video.h index 14627eb..aaf02ac 100755 --- a/src/psb_drv_video.h +++ b/src/psb_drv_video.h @@ -33,6 +33,7 @@ #include <va/va_backend.h> #include <va/va.h> +#include <va/va_tpi.h> #include <va/va_vpp.h> @@ -601,6 +602,26 @@ struct object_subpic_s { unsigned char *surfaces; /* surfaces, associated with this subpicture */ }; +typedef struct _PsbSurfaceAttributeTPI { + VASurfaceMemoryType type; + unsigned int width; + unsigned int height; + unsigned int size; + unsigned int pixel_format; /* buffer format */ + unsigned int tiling; /* the memory is tiling or not */ + unsigned int luma_stride; /* luma stride, could be width aligned with a special value */ + unsigned int chroma_u_stride; /* chroma stride */ + unsigned int chroma_v_stride; + unsigned int luma_offset; /* could be 0 */ + unsigned int chroma_u_offset; /* U offset from the beginning of the memory */ + unsigned int chroma_v_offset; /* V offset from the beginning of the memory */ + unsigned int count; /* buffer count for surface creation */ + unsigned long *buffers; /* buffer handles or user pointers */ + unsigned long reserved[4]; /* used to pass additional information, like 362 + * Android native window pointer 363 + */ +} PsbSurfaceAttributeTPI; + #define MEMSET_OBJECT(ptr, data_struct) \ memset((unsigned char *)ptr + sizeof(struct object_base_s),\ 0, \ |