aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXigui Wang <xigui.wang@intel.com>2014-11-14 23:42:07 +0800
committerPat Tjin <pattjin@google.com>2014-12-02 21:50:06 +0000
commit02f3955632048eb112d521f9c8e80ab2c911598a (patch)
tree94660c4a92933edc9d8c1de48fc658a883627696
parent3b69182ad93e2631df476f5aebbd5fd0b7832117 (diff)
downloadpsb_video-02f3955632048eb112d521f9c8e80ab2c911598a.tar.gz
Support YV12 format for ISV functions
In current design, all YUV420 surface will be handled with VA_FOURCC_NV12. The correct pixel format will be saved in extra_info[8]. VSP driver will indentify YV12 format with extra_info[8]. BZ: 229811 Bug: 17383204 Change-Id: I405b37bbac273e611b7415781b6dc586808b78ba Signed-off-by: Wang Kun <kun.k.wang@intel.com>
-rw-r--r--src/android/psb_surface_gralloc.c2
-rwxr-xr-xsrc/psb_drv_video.c1
-rw-r--r--src/psb_surface.c2
-rw-r--r--src/psb_surface.h3
-rw-r--r--src/psb_surface_attrib.c6
-rw-r--r--src/vsp_VPP.c21
6 files changed, 32 insertions, 3 deletions
diff --git a/src/android/psb_surface_gralloc.c b/src/android/psb_surface_gralloc.c
index f98aff5..54fe648 100644
--- a/src/android/psb_surface_gralloc.c
+++ b/src/android/psb_surface_gralloc.c
@@ -445,6 +445,8 @@ VAStatus psb_CreateSurfacesFromGralloc(
buffer_stride = psb_surface->stride;
/* by default, surface fourcc is NV12 */
psb_surface->extra_info[4] = fourcc;
+ /* save the pixel format set by application */
+ psb_surface->extra_info[8] = external_buffers->pixel_format;
#ifdef PSBVIDEO_MSVDX_DEC_TILING
psb_surface->extra_info[7] = external_buffers->tiling;
#endif
diff --git a/src/psb_drv_video.c b/src/psb_drv_video.c
index dc4f8f0..930f208 100755
--- a/src/psb_drv_video.c
+++ b/src/psb_drv_video.c
@@ -881,6 +881,7 @@ VAStatus psb_CreateSurfaces2(
buffer_stride = psb_surface->stride;
/* by default, surface fourcc is NV12 */
psb_surface->extra_info[4] = fourcc;
+ psb_surface->extra_info[8] = fourcc;
obj_surface->psb_surface = psb_surface;
}
diff --git a/src/psb_surface.c b/src/psb_surface.c
index 876ea0d..446be3e 100644
--- a/src/psb_surface.c
+++ b/src/psb_surface.c
@@ -183,6 +183,7 @@ VAStatus psb_surface_create_for_userptr(
psb_surface->chroma_offset = chroma_u_offset;
psb_surface->size = size;
psb_surface->extra_info[4] = VA_FOURCC_NV12;
+ psb_surface->extra_info[8] = VA_FOURCC_NV12;
ret = psb_buffer_create(driver_data, psb_surface->size, psb_bt_cpu_vpu_shared, &psb_surface->buf);
@@ -231,6 +232,7 @@ VAStatus psb_surface_create_from_kbuf(
psb_surface->chroma_offset = chroma_u_offset;
psb_surface->size = size;
psb_surface->extra_info[4] = VA_FOURCC_NV12;
+ psb_surface->extra_info[8] = VA_FOURCC_NV12;
ret = psb_kbuffer_reference(driver_data, &psb_surface->buf, kbuf_handle);
diff --git a/src/psb_surface.h b/src/psb_surface.h
index 3eaf53d..5ed0997 100644
--- a/src/psb_surface.h
+++ b/src/psb_surface.h
@@ -69,8 +69,9 @@ struct psb_surface_s {
* extra_info[5]: surface skippeded or not for encode, rotate info for decode
* extra_info[6]: mfld protected surface
* extra_info[7]: linear or tiled
+ * extra_info[8]: the fourcc set by application
*/
- int extra_info[8];
+ int extra_info[9];
int size;
unsigned int bc_buffer;
void *handle;
diff --git a/src/psb_surface_attrib.c b/src/psb_surface_attrib.c
index f30819b..3b2b0fd 100644
--- a/src/psb_surface_attrib.c
+++ b/src/psb_surface_attrib.c
@@ -112,6 +112,8 @@ VAStatus psb_surface_create_from_ub(
psb_surface->extra_info[4] = VA_FOURCC_RGBA;
}
+ psb_surface->extra_info[8] = psb_surface->extra_info[4];
+
} else {
return VA_STATUS_ERROR_ALLOCATION_FAILED;
}
@@ -389,6 +391,7 @@ VAStatus psb_CreateSurfacesForUserPtr(
/* by default, surface fourcc is NV12 */
memset(psb_surface->extra_info, 0, sizeof(psb_surface->extra_info));
psb_surface->extra_info[4] = fourcc;
+ psb_surface->extra_info[8] = fourcc;
#ifdef PSBVIDEO_MSVDX_DEC_TILING
psb_surface->extra_info[7] = tiling;
#endif
@@ -526,6 +529,7 @@ VAStatus psb_CreateSurfaceFromKBuf(
/* by default, surface fourcc is NV12 */
memset(psb_surface->extra_info, 0, sizeof(psb_surface->extra_info));
psb_surface->extra_info[4] = kBuf_fourcc;
+ psb_surface->extra_info[8] = kBuf_fourcc;
#ifdef PSBVIDEO_MSVDX_DEC_TILING
psb_surface->extra_info[7] = tiling;
#endif
@@ -618,6 +622,7 @@ VAStatus psb_CreateSurfaceFromUserspace(
/* by default, surface fourcc is NV12 */
memset(psb_surface->extra_info, 0, sizeof(psb_surface->extra_info));
psb_surface->extra_info[4] = fourcc;
+ psb_surface->extra_info[8] = fourcc;
obj_surface->psb_surface = psb_surface;
/* Error recovery */
@@ -736,6 +741,7 @@ VAStatus psb_CreateSurfaceFromION(
/* by default, surface fourcc is NV12 */
memset(psb_surface->extra_info, 0, sizeof(psb_surface->extra_info));
psb_surface->extra_info[4] = fourcc;
+ psb_surface->extra_info[8] = fourcc;
obj_surface->psb_surface = psb_surface;
/* Error recovery */
diff --git a/src/vsp_VPP.c b/src/vsp_VPP.c
index 772cc87..05ef2b5 100644
--- a/src/vsp_VPP.c
+++ b/src/vsp_VPP.c
@@ -404,6 +404,8 @@ static VAStatus vsp__VPP_process_pipeline_param(context_VPP_p ctx, object_contex
struct psb_surface_s *output_surface;
psb_surface_share_info_p input_share_info = NULL;
psb_surface_share_info_p output_share_info = NULL;
+ enum vsp_format format;
+
psb_driver_data_p driver_data = obj_context->driver_data;
@@ -539,6 +541,21 @@ static VAStatus vsp__VPP_process_pipeline_param(context_VPP_p ctx, object_contex
/* get the tiling flag*/
tiled = GET_SURFACE_INFO_tiling(input_surface->psb_surface);
#endif
+
+ /* get the surface format info */
+ switch (input_surface->psb_surface->extra_info[8]) {
+ case VA_FOURCC_YV12:
+ format = VSP_YV12;
+ break;
+ case VA_FOURCC_NV12:
+ format = VSP_NV12;
+ break;
+ default:
+ vaStatus = VA_STATUS_ERROR_INVALID_PARAMETER;
+ drv_debug_msg(VIDEO_DEBUG_ERROR, "Only support NV12 and YV12 format!\n");
+ goto out;
+ }
+
/* According to VIED's design, the width must be multiple of 16 */
width = ALIGN_TO_16(input_surface->width);
if (width > input_surface->psb_surface->stride)
@@ -557,7 +574,7 @@ static VAStatus vsp__VPP_process_pipeline_param(context_VPP_p ctx, object_contex
cell_proc_picture_param->input_picture[0].width = width;
cell_proc_picture_param->input_picture[0].irq = 0;
cell_proc_picture_param->input_picture[0].stride = input_surface->psb_surface->stride;
- cell_proc_picture_param->input_picture[0].format = ctx->format;
+ cell_proc_picture_param->input_picture[0].format = format;
cell_proc_picture_param->input_picture[0].tiled = tiled;
cell_proc_picture_param->input_picture[0].rot_angle = 0;
@@ -665,7 +682,7 @@ static VAStatus vsp__VPP_process_pipeline_param(context_VPP_p ctx, object_contex
cell_proc_picture_param->output_picture[i].width = width;
cell_proc_picture_param->output_picture[i].stride = stride;
cell_proc_picture_param->output_picture[i].irq = 1;
- cell_proc_picture_param->output_picture[i].format = ctx->format;
+ cell_proc_picture_param->output_picture[i].format = format;
cell_proc_picture_param->output_picture[i].rot_angle = vsp_rotation_angle;
cell_proc_picture_param->output_picture[i].tiled = tiled;