summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWang Kun <kun.k.wang@intel.com>2014-05-06 15:44:48 +0800
committerPatrick Tjin <pattjin@google.com>2014-07-21 22:06:38 -0700
commite982f1e85b688d56a63c7e352281a182753f1e7b (patch)
tree25f5eaa5e41e94eb5fdda5751ba7675820409419
parenta7634d944fe745c4061b4b5c0d425cc585b923a2 (diff)
downloadandroid_hardware_intel_img_psb_video-e982f1e85b688d56a63c7e352281a182753f1e7b.tar.gz
android_hardware_intel_img_psb_video-e982f1e85b688d56a63c7e352281a182753f1e7b.tar.bz2
android_hardware_intel_img_psb_video-e982f1e85b688d56a63c7e352281a182753f1e7b.zip
Support VSP Security Compose
BZ: 192662 Support WIDI Security Compose feature. Change-Id: Id2cd8eb649c13a3919fccb876d145feb67c33023 Signed-off-by: Wang Kun <kun.k.wang@intel.com>
-rw-r--r--src/Android.mk3
-rw-r--r--src/android/psb_surface_gralloc.c11
-rw-r--r--src/psb_surface_attrib.c18
-rw-r--r--src/vsp_VPP.c31
-rw-r--r--src/vsp_VPP.h3
-rw-r--r--src/vsp_cmdbuf.h35
-rw-r--r--src/vsp_compose.c213
-rw-r--r--src/vsp_compose.h38
8 files changed, 339 insertions, 13 deletions
diff --git a/src/Android.mk b/src/Android.mk
index 3e1aca6..df54b55 100644
--- a/src/Android.mk
+++ b/src/Android.mk
@@ -96,7 +96,8 @@ LOCAL_SRC_FILES += \
tng_trace.c \
vsp_VPP.c \
vsp_cmdbuf.c \
- vsp_vp8.c
+ vsp_vp8.c \
+ vsp_compose.c
LOCAL_C_INCLUDES += \
$(TARGET_OUT_HEADERS)/pvr \
diff --git a/src/android/psb_surface_gralloc.c b/src/android/psb_surface_gralloc.c
index 4b6a070..5e3e04f 100644
--- a/src/android/psb_surface_gralloc.c
+++ b/src/android/psb_surface_gralloc.c
@@ -267,7 +267,8 @@ VAStatus psb_CreateSurfacesFromGralloc(
/* We only support one format */
if ((VA_RT_FORMAT_YUV420 != format)
- && (VA_RT_FORMAT_YUV422 != format)) {
+ && (VA_RT_FORMAT_YUV422 != format)
+ && (VA_RT_FORMAT_RGB32 != format)) {
vaStatus = VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT;
DEBUG_FAILURE;
return vaStatus;
@@ -285,7 +286,7 @@ VAStatus psb_CreateSurfacesFromGralloc(
IMG_native_handle_t* h = (IMG_native_handle_t*)external_buffers->buffers[0];
int gfx_colorformat = h->iFormat;
- if (gfx_colorformat != HAL_PIXEL_FORMAT_NV12)
+ if (gfx_colorformat != HAL_PIXEL_FORMAT_NV12 && format != VA_RT_FORMAT_RGB32)
height = (height + 0x1f) & ~0x1f;
/* get native window from the reserved field */
@@ -329,6 +330,9 @@ VAStatus psb_CreateSurfacesFromGralloc(
case VA_RT_FORMAT_YUV422:
fourcc = VA_FOURCC_YV16;
break;
+ case VA_RT_FORMAT_RGB32:
+ fourcc = VA_FOURCC_RGBA;
+ break;
case VA_RT_FORMAT_YUV420:
default:
fourcc = VA_FOURCC_NV12;
@@ -364,7 +368,8 @@ VAStatus psb_CreateSurfacesFromGralloc(
obj_surface->share_info = NULL;
if ((gfx_colorformat != HAL_PIXEL_FORMAT_NV12) &&
- (gfx_colorformat != HAL_PIXEL_FORMAT_YV12)) {
+ (gfx_colorformat != HAL_PIXEL_FORMAT_YV12) &&
+ (format != VA_RT_FORMAT_RGB32)) {
obj_surface->share_info = (psb_surface_share_info_t *)vaddr[GRALLOC_SUB_BUFFER1];
memset(obj_surface->share_info, 0, sizeof(struct psb_surface_share_info_s));
// Set clear video the default output method as OUTPUT_FORCE_OVERLAY_FOR_SW_DECODE
diff --git a/src/psb_surface_attrib.c b/src/psb_surface_attrib.c
index b2d924e..2b8cecf 100644
--- a/src/psb_surface_attrib.c
+++ b/src/psb_surface_attrib.c
@@ -60,7 +60,7 @@ VAStatus psb_surface_create_from_ub(
{
int ret = 0;
- if ((fourcc == VA_FOURCC_NV12) || (fourcc == VA_FOURCC_YV16) || (fourcc == VA_FOURCC_IYUV)) {
+ if ((fourcc == VA_FOURCC_NV12) || (fourcc == VA_FOURCC_YV16) || (fourcc == VA_FOURCC_IYUV) || (fourcc == VA_FOURCC_RGBA)) {
if ((width <= 0) || (width * height > 5120 * 5120) || (height <= 0)) {
return VA_STATUS_ERROR_ALLOCATION_FAILED;
}
@@ -106,6 +106,11 @@ VAStatus psb_surface_create_from_ub(
psb_surface->size = ((psb_surface->stride * height) * 3) / 2;
psb_surface->extra_info[4] = VA_FOURCC_IYUV;
}
+ else if (VA_FOURCC_RGBA == fourcc) {
+ psb_surface->size = (psb_surface->stride * height) * 4;
+ psb_surface->extra_info[4] = VA_FOURCC_RGBA;
+ }
+
} else {
return VA_STATUS_ERROR_ALLOCATION_FAILED;
}
@@ -290,7 +295,7 @@ VAStatus psb_CreateSurfacesForUserPtr(
CHECK_SURFACE(surface_list);
/* We only support one format */
- if (VA_RT_FORMAT_YUV420 != format) {
+ if ((VA_RT_FORMAT_YUV420 != format) && (VA_RT_FORMAT_RGB32 != format)) {
vaStatus = VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT;
DEBUG_FAILURE;
return vaStatus;
@@ -305,12 +310,21 @@ VAStatus psb_CreateSurfacesForUserPtr(
vaStatus = psb__checkSurfaceDimensions(driver_data, width, height);
CHECK_VASTATUS();
+ if (VA_RT_FORMAT_YUV420 == format) {
CHECK_INVALID_PARAM((size < width * height * 1.5) ||
(luma_stride < width) ||
(chroma_u_stride * 2 < width) ||
(chroma_v_stride * 2 < width) ||
(chroma_u_offset < luma_offset + width * height) ||
(chroma_v_offset < luma_offset + width * height));
+ } else if (VA_RT_FORMAT_RGB32 == format) {
+ CHECK_INVALID_PARAM((size < width * height * 4) ||
+ (luma_stride < width) ||
+ (chroma_u_stride * 2 < width) ||
+ (chroma_v_stride * 2 < width) ||
+ (chroma_u_offset < luma_offset + width * height) ||
+ (chroma_v_offset < luma_offset + width * height));
+ }
height_origin = height;
diff --git a/src/vsp_VPP.c b/src/vsp_VPP.c
index ccc1237..9e7ba9e 100644
--- a/src/vsp_VPP.c
+++ b/src/vsp_VPP.c
@@ -31,6 +31,7 @@
#include "psb_surface.h"
#include "vsp_cmdbuf.h"
#include "psb_drv_debug.h"
+#include "vsp_compose.h"
#define INIT_DRIVER_DATA psb_driver_data_p driver_data = (psb_driver_data_p) ctx->pDriverData;
#define INIT_CONTEXT_VPP context_VPP_p ctx = (context_VPP_p) obj_context->format_data;
@@ -306,6 +307,8 @@ static VAStatus vsp_VPP_CreateContext(
ctx->param_sz += ctx->sharpen_param_sz;
ctx->frc_param_sz = ALIGN_TO_128(sizeof(struct VssProcFrcParameterBuffer));
ctx->param_sz += ctx->frc_param_sz;
+ ctx->compose_param_sz = ALIGN_TO_128(sizeof(struct VssWiDi_ComposeSequenceParameterBuffer));
+ ctx->param_sz += ctx->compose_param_sz;
/* set offset */
ctx->pic_param_offset = 0;
@@ -315,6 +318,8 @@ static VAStatus vsp_VPP_CreateContext(
ctx->enhancer_param_offset = ctx->denoise_param_offset + ctx->denoise_param_sz;
ctx->sharpen_param_offset = ctx->enhancer_param_offset + ctx->enhancer_param_sz;
ctx->frc_param_offset = ctx->sharpen_param_offset + ctx->sharpen_param_sz;
+ /* For composer, it'll start on 0 */
+ ctx->compose_param_offset = 0;
/* create intermediate buffer */
ctx->intermediate_buf = (psb_buffer_p) calloc(1, sizeof(struct psb_buffer_s));
@@ -445,7 +450,11 @@ static VAStatus vsp__VPP_process_pipeline_param(context_VPP_p ctx, object_contex
goto out;
}
- /* FIXME: no backward reference checking */
+ /* first picture, need to setup the VSP context */
+ if (ctx->obj_context->frame_count == 0)
+ vsp_cmdbuf_vpp_context(cmdbuf, VssGenInitializeContext, CONTEXT_VPP_ID, VSP_APP_ID_FRC_VPP);
+
+ /* get the input surface */
if (!(pipeline_param->pipeline_flags & VA_PIPELINE_FLAG_END)) {
input_surface = SURFACE(pipeline_param->surface);
if (input_surface == NULL) {
@@ -456,7 +465,7 @@ static VAStatus vsp__VPP_process_pipeline_param(context_VPP_p ctx, object_contex
} else {
input_surface = NULL;
}
-
+
/* if it is the first pipeline command */
if (pipeline_param->num_filters != ctx->num_filters || pipeline_param->num_filters == 0) {
if (ctx->num_filters != 0) {
@@ -687,14 +696,21 @@ static VAStatus vsp_VPP_RenderPicture(
{
int i;
INIT_CONTEXT_VPP;
+ VAProcPipelineParameterBuffer *pipeline_param = NULL;
VAStatus vaStatus = VA_STATUS_SUCCESS;
for (i = 0; i < num_buffers; i++) {
object_buffer_p obj_buffer = buffers[i];
+ pipeline_param = (VAProcPipelineParameterBuffer *) obj_buffer->buffer_data;
switch (obj_buffer->type) {
case VAProcPipelineParameterBufferType:
- vaStatus = vsp__VPP_process_pipeline_param(ctx, obj_context, obj_buffer);
+ if (!pipeline_param->num_filters && pipeline_param->blend_state)
+ /* For Security Composer */
+ vaStatus = vsp_compose_process_pipeline_param(ctx, obj_context, obj_buffer);
+ else
+ /* For VPP/FRC */
+ vaStatus = vsp__VPP_process_pipeline_param(ctx, obj_context, obj_buffer);
DEBUG_FAILURE;
break;
default:
@@ -727,10 +743,6 @@ static VAStatus vsp_VPP_BeginPicture(
cmdbuf = obj_context->vsp_cmdbuf;
- /* first picture, need to setup the VSP context */
- if (ctx->obj_context->frame_count == 0)
- vsp_cmdbuf_vpp_context(cmdbuf, VssGenInitializeContext, CONTEXT_VPP_ID, VSP_APP_ID_FRC_VPP);
-
/* map param mem */
vaStatus = psb_buffer_map(&cmdbuf->param_mem, &cmdbuf->param_mem_p);
if (vaStatus) {
@@ -744,6 +756,7 @@ static VAStatus vsp_VPP_BeginPicture(
cmdbuf->enhancer_param_p = cmdbuf->param_mem_p + ctx->enhancer_param_offset;
cmdbuf->sharpen_param_p = cmdbuf->param_mem_p + ctx->sharpen_param_offset;
cmdbuf->frc_param_p = cmdbuf->param_mem_p + ctx->frc_param_offset;
+ cmdbuf->compose_param_p = cmdbuf->param_mem_p + ctx->compose_param_offset;
return VA_STATUS_SUCCESS;
}
@@ -765,6 +778,7 @@ static VAStatus vsp_VPP_EndPicture(
cmdbuf->enhancer_param_p = NULL;
cmdbuf->sharpen_param_p = NULL;
cmdbuf->frc_param_p = NULL;
+ cmdbuf->compose_param_p = NULL;
}
if (vsp_context_flush_cmdbuf(ctx->obj_context)) {
@@ -1089,6 +1103,9 @@ VAStatus vsp_QueryVideoProcPipelineCaps(
goto err;
}
+ /* Blend type */
+ pipeline_caps->blend_flags = VA_BLEND_PREMULTIPLIED_ALPHA;
+
if (getenv("VSP_PIPELINE_CHECK") != NULL)
combination_check = 1;
else
diff --git a/src/vsp_VPP.h b/src/vsp_VPP.h
index f36fbaa..579c762 100644
--- a/src/vsp_VPP.h
+++ b/src/vsp_VPP.h
@@ -34,6 +34,7 @@
#define CONTEXT_VPP_ID 0
#define CONTEXT_VP8_ID 1
+#define CONTEXT_COMPOSE_ID 5
struct context_VPP_s {
object_context_p obj_context; /* back reference */
@@ -71,6 +72,8 @@ struct context_VPP_s {
unsigned int seq_param_offset;
unsigned int ref_param_sz;
unsigned int ref_param_offset;
+ unsigned int compose_param_sz;
+ unsigned int compose_param_offset;
struct VssProcDenoiseParameterBuffer denoise_deblock_param;
struct VssProcColorEnhancementParameterBuffer enhancer_param;
struct VssProcSharpenParameterBuffer sharpen_param;
diff --git a/src/vsp_cmdbuf.h b/src/vsp_cmdbuf.h
index c1a28c1..f412053 100644
--- a/src/vsp_cmdbuf.h
+++ b/src/vsp_cmdbuf.h
@@ -66,12 +66,24 @@ struct vsp_cmdbuf_s {
unsigned char *sharpen_param_p;
unsigned char *frc_param_p;
unsigned char *ref_param_p;
+ unsigned char *compose_param_p;
};
typedef struct vsp_cmdbuf_s *vsp_cmdbuf_p;
#define VSP_RELOC_CMDBUF(dest, offset, buf) vsp_cmdbuf_add_relocation(cmdbuf, (uint32_t*)(dest), buf, offset, 0XFFFFFFFF, 0, 0, 0, (uint32_t *)cmdbuf->cmd_start)
+/**
+ * VSP command:
+ * context
+ * type
+ * buffer
+ * size
+ * buffer_id
+ * irq
+ * reserved6
+ * reserved7
+ */
/* operation number is inserted by DRM */
#define vsp_cmdbuf_insert_command(cmdbuf,context_id, ref_buf,type,offset,size) \
do { *cmdbuf->cmd_idx++ = context_id; *cmdbuf->cmd_idx++ = type;\
@@ -94,6 +106,29 @@ typedef struct vsp_cmdbuf_s *vsp_cmdbuf_p;
*cmdbuf->cmd_idx++ = 0; \
*cmdbuf->cmd_idx++ = 0; \
*cmdbuf->cmd_idx++ = 0; *cmdbuf->cmd_idx++ = 0;} while(0)
+
+#define vsp_cmdbuf_fence_compose_param(cmdbuf, pic_param_handler) \
+ do { \
+ *cmdbuf->cmd_idx++ = 0; \
+ *cmdbuf->cmd_idx++ = VspFenceComposeCommand; \
+ *cmdbuf->cmd_idx++ = pic_param_handler; \
+ *cmdbuf->cmd_idx++ = 0; \
+ *cmdbuf->cmd_idx++ = 0; \
+ *cmdbuf->cmd_idx++ = 0; \
+ *cmdbuf->cmd_idx++ = 0; \
+ *cmdbuf->cmd_idx++ = 0; \
+ } while(0)
+
+#define vsp_cmdbuf_compose_end(cmdbuf) \
+ do { *cmdbuf->cmd_idx++ = 0; \
+ *cmdbuf->cmd_idx++ = VssWiDi_ComposeEndOfSequenceCommand; \
+ *cmdbuf->cmd_idx++ = 0; \
+ *cmdbuf->cmd_idx++ = 0; \
+ *cmdbuf->cmd_idx++ = 0; \
+ *cmdbuf->cmd_idx++ = 0; \
+ *cmdbuf->cmd_idx++ = 0; \
+ *cmdbuf->cmd_idx++ = 0;} while(0)
+
/*
* Create command buffer
*/
diff --git a/src/vsp_compose.c b/src/vsp_compose.c
new file mode 100644
index 0000000..37ad567
--- /dev/null
+++ b/src/vsp_compose.c
@@ -0,0 +1,213 @@
+/*
+ * Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Kun Wang <kun.k.wang@intel.com>
+ *
+ */
+
+#include "vsp_VPP.h"
+#include "vsp_compose.h"
+#include "psb_buffer.h"
+#include "psb_surface.h"
+#include "vsp_cmdbuf.h"
+#include "psb_drv_debug.h"
+
+
+#define INIT_DRIVER_DATA psb_driver_data_p driver_data = (psb_driver_data_p) ctx->pDriverData;
+#define INIT_CONTEXT_VPP context_VPP_p ctx = (context_VPP_p) obj_context->format_data;
+#define CONFIG(id) ((object_config_p) object_heap_lookup( &driver_data->config_heap, id ))
+#define CONTEXT(id) ((object_context_p) object_heap_lookup( &driver_data->context_heap, id ))
+#define BUFFER(id) ((object_buffer_p) object_heap_lookup( &driver_data->buffer_heap, id ))
+
+#define SURFACE(id) ((object_surface_p) object_heap_lookup( &ctx->obj_context->driver_data->surface_heap, id ))
+
+#define ALIGN_TO_128(value) ((value + 128 - 1) & ~(128 - 1))
+#define ALIGN_TO_16(value) ((value + 16 - 1) & ~(16 - 1))
+
+VAStatus vsp_compose_process_pipeline_param(context_VPP_p ctx, object_context_p obj_context, object_buffer_p obj_buffer)
+{
+
+ VAStatus vaStatus = VA_STATUS_SUCCESS;
+ vsp_cmdbuf_p cmdbuf = ctx->obj_context->vsp_cmdbuf;
+ VAProcPipelineParameterBuffer *pipeline_param = (VAProcPipelineParameterBuffer *)obj_buffer->buffer_data;
+ struct VssWiDi_ComposeSequenceParameterBuffer *cell_compose_param = NULL;
+ object_surface_p yuv_surface = NULL;
+ object_surface_p rgb_surface = NULL;
+ object_surface_p output_surface = NULL;
+ int yuv_width = 0, yuv_height = 0, yuv_stride = 0;
+ int rgb_width = 0, rgb_height = 0, rgb_stride = 0;
+ int out_width = 0, out_height = 0, out_stride = 0;
+
+ cell_compose_param = (struct VssWiDi_ComposeSequenceParameterBuffer *)cmdbuf->compose_param_p;
+
+ /* The END command */
+ if (pipeline_param->pipeline_flags & VA_PIPELINE_FLAG_END) {
+ vsp_cmdbuf_compose_end(cmdbuf);
+ /* Destory the VSP context */
+ vsp_cmdbuf_vpp_context(cmdbuf, VssGenDestroyContext, CONTEXT_COMPOSE_ID, 0);
+ goto out;
+ }
+
+ if (pipeline_param->num_additional_outputs <= 0 || !pipeline_param->additional_outputs) {
+ drv_debug_msg(VIDEO_DEBUG_ERROR, "there isn't RGB surface!\n");
+ vaStatus = VA_STATUS_ERROR_UNKNOWN;
+ goto out;
+ }
+
+ /* Init the VSP context */
+ if (ctx->obj_context->frame_count == 0)
+ vsp_cmdbuf_vpp_context(cmdbuf, VssGenInitializeContext, CONTEXT_COMPOSE_ID, VSP_APP_ID_WIDI_ENC);
+
+ yuv_surface = SURFACE(pipeline_param->surface);
+ if (yuv_surface == NULL) {
+ drv_debug_msg(VIDEO_DEBUG_ERROR, "invalid yuv surface %x\n", pipeline_param->surface);
+ vaStatus = VA_STATUS_ERROR_UNKNOWN;
+ goto out;
+ }
+
+ /* The RGB surface will be the first element */
+ rgb_surface = SURFACE(pipeline_param->additional_outputs[0]);
+ if (rgb_surface == NULL) {
+ drv_debug_msg(VIDEO_DEBUG_ERROR, "invalid RGB surface %x\n", pipeline_param->additional_outputs[0]);
+ vaStatus = VA_STATUS_ERROR_UNKNOWN;
+ goto out;
+ }
+
+ output_surface = ctx->obj_context->current_render_target;
+
+ yuv_width = ALIGN_TO_16(yuv_surface->width);
+ yuv_height = yuv_surface->height_origin;
+ yuv_stride = yuv_surface->psb_surface->stride;
+
+ out_width = ALIGN_TO_16(output_surface->width);
+ out_height = output_surface->height_origin;
+ out_stride = output_surface->psb_surface->stride;
+
+ rgb_width = ALIGN_TO_16(rgb_surface->width);
+ rgb_height = rgb_surface->height_origin;
+ rgb_stride = rgb_surface->psb_surface->stride;
+
+ /* RGB related */
+ cell_compose_param->ActualWidth = rgb_width;
+ cell_compose_param->ActualHeight = rgb_height;
+ cell_compose_param->ProcessedWidth = cell_compose_param->ActualWidth;
+ cell_compose_param->ProcessedHeight = cell_compose_param->ActualHeight;
+ cell_compose_param->TotalMBCount = ((cell_compose_param->ProcessedWidth >> 4) * (cell_compose_param->ProcessedHeight >> 4));
+ cell_compose_param->Stride = rgb_stride;
+ vsp_cmdbuf_reloc_pic_param(
+ &(cell_compose_param->RGBA_Buffer),
+ ctx->compose_param_offset,
+ &(rgb_surface->psb_surface->buf),
+ cmdbuf->param_mem_loc,
+ cell_compose_param);
+
+
+ /* Input YUV Video related */
+ cell_compose_param->Video_IN_xsize = yuv_width;
+ cell_compose_param->Video_IN_ysize = yuv_height;
+ cell_compose_param->Video_IN_stride = yuv_stride;
+ cell_compose_param->Video_IN_yuv_format = YUV_4_2_0_NV12;
+ cell_compose_param->Video_TotalMBCount =
+ (((cell_compose_param->Video_IN_xsize + 15) >> 4) * ((cell_compose_param->Video_IN_ysize + 15) >> 4));
+ vsp_cmdbuf_reloc_pic_param(
+ &(cell_compose_param->Video_IN_Y_Buffer),
+ ctx->compose_param_offset,
+ &(yuv_surface->psb_surface->buf),
+ cmdbuf->param_mem_loc,
+ cell_compose_param);
+
+ cell_compose_param->Video_IN_UV_Buffer =
+ cell_compose_param->Video_IN_Y_Buffer +
+ cell_compose_param->Video_IN_ysize * cell_compose_param->Video_IN_stride;
+
+ /* Output Video related */
+ cell_compose_param->Video_OUT_xsize = out_width;
+ cell_compose_param->Video_OUT_ysize = out_height;
+ cell_compose_param->Video_OUT_stride = out_stride;
+ cell_compose_param->Video_OUT_yuv_format = cell_compose_param->Video_IN_yuv_format;
+ vsp_cmdbuf_reloc_pic_param(
+ &(cell_compose_param->Video_OUT_Y_Buffer),
+ ctx->compose_param_offset,
+ &(output_surface->psb_surface->buf),
+ cmdbuf->param_mem_loc,
+ cell_compose_param);
+
+ cell_compose_param->Video_OUT_UV_Buffer =
+ cell_compose_param->Video_OUT_Y_Buffer +
+ cell_compose_param->Video_OUT_ysize * cell_compose_param->Video_OUT_stride;
+
+ /* Blending related params */
+ cell_compose_param->Is_video_the_back_ground = 1;
+ if (cell_compose_param->Is_video_the_back_ground) {
+ cell_compose_param->ROI_width = cell_compose_param->ProcessedWidth;
+ cell_compose_param->ROI_height = cell_compose_param->ProcessedHeight;
+ cell_compose_param->ROI_x1 = 0;
+ cell_compose_param->ROI_y1 = 0;
+ cell_compose_param->ROI_x2 = 0;
+ cell_compose_param->ROI_y2 = 0;
+
+ } else {
+ cell_compose_param->ROI_width = cell_compose_param->Video_IN_xsize;
+ cell_compose_param->ROI_height = cell_compose_param->Video_IN_ysize;
+ cell_compose_param->ROI_x1 = 0;
+ cell_compose_param->ROI_y1 = 0;
+ cell_compose_param->ROI_x2 = 0;
+ cell_compose_param->ROI_y2 = 0;
+ }
+ cell_compose_param->Is_Blending_Enabled = 1;
+ cell_compose_param->alpha1 = 128;
+ cell_compose_param->alpha2 = 255;
+ cell_compose_param->Is_source_1_image_available = 1;
+ cell_compose_param->Is_source_2_image_available = 1;
+ cell_compose_param->Is_alpha_channel_available = 1; /* 0: RGB Planar; 1: RGBA Interleaved */
+ cell_compose_param->CSC_FormatSelect = 0; /* 0: YUV420NV12; 1: YUV444; */
+ cell_compose_param->CSC_InputFormatSelect = 1; /* 0: RGB Planar; 1: RGBA Interleaved */
+
+ /* The first frame */
+ if (obj_context->frame_count == 0) {
+ vsp_cmdbuf_insert_command(cmdbuf,
+ CONTEXT_COMPOSE_ID,
+ &cmdbuf->param_mem,
+ VssWiDi_ComposeSetSequenceParametersCommand,
+ ctx->compose_param_offset,
+ sizeof(struct VssWiDi_ComposeSequenceParameterBuffer));
+ }
+
+ vsp_cmdbuf_insert_command(cmdbuf,
+ CONTEXT_COMPOSE_ID,
+ &cmdbuf->param_mem,
+ VssWiDi_ComposeFrameCommand,
+ ctx->compose_param_offset,
+ sizeof(struct VssWiDi_ComposeSequenceParameterBuffer));
+
+ /* Insert Fence Command */
+ vsp_cmdbuf_fence_compose_param(cmdbuf, wsbmKBufHandle(wsbmKBuf(cmdbuf->param_mem.drm_buf)));
+
+out:
+ free(pipeline_param);
+ obj_buffer->buffer_data = NULL;
+ obj_buffer->size = 0;
+
+ return vaStatus;
+}
diff --git a/src/vsp_compose.h b/src/vsp_compose.h
new file mode 100644
index 0000000..1900ebf
--- /dev/null
+++ b/src/vsp_compose.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Kun Wang <kun.k.wang@intel.com>
+ *
+ */
+
+#ifndef _VSP_COMPOSE_H_
+#define _VSP_COMPOSE_H_
+
+#include "psb_drv_video.h"
+#include "vsp_VPP.h"
+#include <linux/vsp_fw.h>
+
+VAStatus vsp_compose_process_pipeline_param(context_VPP_p ctx, object_context_p obj_context, object_buffer_p obj_buffer);
+
+#endif /* _VSS_VPP_H_ */