aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLajos Molnar <lajos@google.com>2014-11-20 06:46:46 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-11-20 06:46:47 +0000
commite315a136a27cacc173c00e01cb87193262f1d0cd (patch)
tree2e2ce835c705a2bf3515a51f8e2bcb7031854003
parentf84b5e9267d5371c3f9c46add6c6a3fff2165515 (diff)
parentd50cf45fbdb02245b8d45b14935fc5f2f4575653 (diff)
downloadpsb_video-e315a136a27cacc173c00e01cb87193262f1d0cd.tar.gz
Merge "Enable VSP driver" into lmp-mr1-dev
-rw-r--r--src/Android.mk23
-rwxr-xr-xsrc/android/psb_android_glue.cpp14
-rw-r--r--src/android/psb_surface_gralloc.c100
-rwxr-xr-xsrc/psb_drv_video.c194
-rwxr-xr-xsrc/psb_drv_video.h20
-rw-r--r--src/vsp_VPP.c100
-rw-r--r--src/vsp_cmdbuf.c102
-rw-r--r--src/vsp_compose.c6
-rw-r--r--src/vsp_vp8.c3
9 files changed, 323 insertions, 239 deletions
diff --git a/src/Android.mk b/src/Android.mk
index 7eadf68..15b9370 100644
--- a/src/Android.mk
+++ b/src/Android.mk
@@ -93,12 +93,27 @@ LOCAL_SRC_FILES += \
tng_jpegES.c \
tng_slotorder.c \
tng_hostair.c \
- tng_trace.c \
+ tng_trace.c
+
+ifeq ($(TARGET_HAS_ISV),true)
+LOCAL_SRC_FILES += \
vsp_VPP.c \
- vsp_vp8.c \
vsp_cmdbuf.c \
- vsp_compose.c \
+ vsp_vp8.c \
+ vsp_compose.c
+
+LOCAL_CFLAGS += \
+ -DPSBVIDEO_MRFL_VPP \
+ -DPSBVIDEO_VPP_TILING
+endif
+ifeq ($(TARGET_HAS_VPP),true)
+LOCAL_SRC_FILES += \
+ vsp_VPP.c \
+ vsp_vp8.c \
+ vsp_cmdbuf.c \
+ vsp_compose.c
+endif
ifeq ($(TARGET_HAS_VPP),true)
LOCAL_C_INCLUDES += \
@@ -111,7 +126,6 @@ LOCAL_SHARED_LIBRARIES += libvpp_setting
LOCAL_CFLAGS += DPSBVIDEO_MRFL_VPP_SETTING
endif
-
ifeq ($(TARGET_HAS_VPP),true)
LOCAL_CFLAGS += \
-DPSBVIDEO_MRFL_VPP -DPSBVIDEO_MRFL \
@@ -141,6 +155,7 @@ LOCAL_CFLAGS += -DTARGET_HAS_MULTIPLE_DISPLAY
LOCAL_SHARED_LIBRARIES += libmultidisplay
endif
LOCAL_CFLAGS += -Werror
+
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := pvr_drv_video
diff --git a/src/android/psb_android_glue.cpp b/src/android/psb_android_glue.cpp
index 9d5b88e..0ac3f27 100755
--- a/src/android/psb_android_glue.cpp
+++ b/src/android/psb_android_glue.cpp
@@ -44,9 +44,6 @@
#ifdef TARGET_HAS_MULTIPLE_DISPLAY
#include "psb_mds.h"
#endif
-#if defined (PSBVIDEO_MRFL_VPP_SETTING) && !defined (TARGET_HAS_MULTIPLE_DISPLAY)
-#include <VPPSetting.h>
-#endif
#ifdef LOG_TAG
#undef LOG_TAG
@@ -147,14 +144,11 @@ int psb_android_get_mds_vpp_state(void* output) {
#else //TARGET_HAS_MULTIPLE_DISPLAY
#ifdef PSBVIDEO_MRFL_VPP
-
+/* VPP is always enabled. It disables decoder rotate.
+ * TODO: remove the dependency the on libVPP. Get it form ISB configure
+ */
int psb_android_get_vpp_state() {
-#ifdef PSBVIDEO_MRFL_VPP_SETTING
- bool ret = VPPSetting::isVppOn();
- return (ret ? 1 : 0);
-#else
- return 0;
-#endif
+ return 1;
}
#endif
diff --git a/src/android/psb_surface_gralloc.c b/src/android/psb_surface_gralloc.c
index 4093dbb..94554ff 100644
--- a/src/android/psb_surface_gralloc.c
+++ b/src/android/psb_surface_gralloc.c
@@ -44,6 +44,8 @@
#define SURFACE(id) ((object_surface_p) object_heap_lookup( &driver_data->surface_heap, id ))
#define BUFFER(id) ((object_buffer_p) object_heap_lookup( &driver_data->buffer_heap, id ))
+static pthread_mutex_t gralloc_mutex = PTHREAD_MUTEX_INITIALIZER;
+
/*FIXME: include hal_public.h instead of define it here*/
enum {
GRALLOC_SUB_BUFFER0 = 0,
@@ -62,6 +64,7 @@ VAStatus psb_DestroySurfaceGralloc(object_surface_p obj_surface)
usage |= GRALLOC_USAGE_SW_WRITE_OFTEN;
#endif
+ pthread_mutex_lock(&gralloc_mutex);
if (!gralloc_lock(handle, usage, 0, 0,
obj_surface->width, obj_surface->height, (void **)&vaddr[GRALLOC_SUB_BUFFER0])){
if (obj_surface->share_info && vaddr[GRALLOC_SUB_BUFFER1] == obj_surface->share_info) {
@@ -79,6 +82,7 @@ VAStatus psb_DestroySurfaceGralloc(object_surface_p obj_surface)
}
gralloc_unlock(handle);
}
+ pthread_mutex_unlock(&gralloc_mutex);
return VA_STATUS_SUCCESS;
}
@@ -190,6 +194,7 @@ VAStatus psb_CreateSurfacesFromGralloc(
usage |= GRALLOC_USAGE_HW_VIDEO_ENCODER;
handle = (unsigned long)external_buffers->buffers[i];
+ pthread_mutex_lock(&gralloc_mutex);
if (gralloc_lock(handle, usage, 0, 0, width, height, (void **)&vaddr)) {
vaStatus = VA_STATUS_ERROR_UNKNOWN;
} else {
@@ -203,6 +208,7 @@ VAStatus psb_CreateSurfacesFromGralloc(
obj_surface->share_info = NULL;
gralloc_unlock(handle);
}
+ pthread_mutex_unlock(&gralloc_mutex);
if (VA_STATUS_SUCCESS != vaStatus) {
free(psb_surface);
@@ -270,7 +276,7 @@ VAStatus psb_CreateSurfacesFromGralloc(
/* We only support one format */
if ((VA_RT_FORMAT_YUV420 != format)
&& (VA_RT_FORMAT_YUV422 != format)
- && (VA_RT_FORMAT_RGB32 != format)) {
+ && (VA_RT_FORMAT_RGB32 != format)) {
vaStatus = VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT;
DEBUG_FAILURE;
return vaStatus;
@@ -293,7 +299,7 @@ VAStatus psb_CreateSurfacesFromGralloc(
/* get native window from the reserved field */
driver_data->native_window = (void *)external_buffers->reserved[0];
-
+
for (i = 0; i < num_surfaces; i++) {
int surfaceID;
object_surface_p obj_surface;
@@ -332,7 +338,7 @@ VAStatus psb_CreateSurfacesFromGralloc(
case VA_RT_FORMAT_YUV422:
fourcc = VA_FOURCC_YV16;
break;
- case VA_RT_FORMAT_RGB32:
+ case VA_RT_FORMAT_RGB32:
fourcc = VA_FOURCC_RGBA;
break;
case VA_RT_FORMAT_YUV420:
@@ -356,6 +362,7 @@ VAStatus psb_CreateSurfacesFromGralloc(
}
handle = (unsigned long)external_buffers->buffers[i];
+ pthread_mutex_lock(&gralloc_mutex);
if (gralloc_lock((buffer_handle_t)handle, usage, 0, 0, width, height, (void **)&vaddr[GRALLOC_SUB_BUFFER0])) {
vaStatus = VA_STATUS_ERROR_UNKNOWN;
} else {
@@ -371,53 +378,60 @@ VAStatus psb_CreateSurfacesFromGralloc(
if ((gfx_colorformat != HAL_PIXEL_FORMAT_NV12) &&
(gfx_colorformat != HAL_PIXEL_FORMAT_YV12) &&
- (format != VA_RT_FORMAT_RGB32)) {
+ (format != VA_RT_FORMAT_RGB32)) {
+
+ unsigned int init_share_info = (unsigned int)external_buffers->reserved[2];
+ drv_debug_msg(VIDEO_DEBUG_ERROR, "%s : Create graphic buffer initialized share info %d",__FUNCTION__, init_share_info);
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
- // if the video can be decoded by HW, will reset the output method as 0 in psb_BeginPicture
- obj_surface->share_info->force_output_method = protected ? OUTPUT_FORCE_OVERLAY : OUTPUT_FORCE_OVERLAY_FOR_SW_DECODE;
+
+ if (init_share_info) {
+ 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
+ // if the video can be decoded by HW, will reset the output method as 0 in psb_BeginPicture
+ obj_surface->share_info->force_output_method = protected ? OUTPUT_FORCE_OVERLAY : OUTPUT_FORCE_OVERLAY_FOR_SW_DECODE;
#ifdef PSBVIDEO_MSVDX_DEC_TILING
- obj_surface->share_info->tiling = external_buffers->tiling;
+ obj_surface->share_info->tiling = external_buffers->tiling;
#endif
- obj_surface->share_info->width = obj_surface->width;
- obj_surface->share_info->height = obj_surface->height_origin;
-
- obj_surface->share_info->luma_stride = psb_surface->stride;
- obj_surface->share_info->chroma_u_stride = psb_surface->stride;
- obj_surface->share_info->chroma_v_stride = psb_surface->stride;
- obj_surface->share_info->format = VA_FOURCC_NV12;
-
- obj_surface->share_info->khandle = (uint32_t)(wsbmKBufHandle(wsbmKBuf(psb_surface->buf.drm_buf)));
-
- 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];
-
- 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) {
- obj_surface->share_info->crop_width = obj_surface->share_info->width;
- obj_surface->share_info->crop_height = obj_surface->share_info->height;
- } else {
- obj_surface->share_info->crop_width = driver_data->render_rect.width;
- obj_surface->share_info->crop_height = driver_data->render_rect.height;
- }
-
- if (obj_surface->share_info->coded_width == 0 || obj_surface->share_info->coded_height == 0) {
- obj_surface->share_info->coded_width = (obj_surface->share_info->width + 0xf) & ~0xf;
- obj_surface->share_info->coded_height = (obj_surface->share_info->height + 0xf) & ~0xf;
+ obj_surface->share_info->width = obj_surface->width;
+ obj_surface->share_info->height = obj_surface->height_origin;
+
+ obj_surface->share_info->luma_stride = psb_surface->stride;
+ obj_surface->share_info->chroma_u_stride = psb_surface->stride;
+ obj_surface->share_info->chroma_v_stride = psb_surface->stride;
+ obj_surface->share_info->format = VA_FOURCC_NV12;
+
+ obj_surface->share_info->khandle = (uint32_t)(wsbmKBufHandle(wsbmKBuf(psb_surface->buf.drm_buf)));
+
+ 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];
+
+ 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) {
+ obj_surface->share_info->crop_width = obj_surface->share_info->width;
+ obj_surface->share_info->crop_height = obj_surface->share_info->height;
+ } else {
+ obj_surface->share_info->crop_width = driver_data->render_rect.width;
+ obj_surface->share_info->crop_height = driver_data->render_rect.height;
+ }
+
+ if (obj_surface->share_info->coded_width == 0 || obj_surface->share_info->coded_height == 0) {
+ obj_surface->share_info->coded_width = (obj_surface->share_info->width + 0xf) & ~0xf;
+ obj_surface->share_info->coded_height = (obj_surface->share_info->height + 0xf) & ~0xf;
+ }
+
+ drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s : Create graphic buffer success"
+ "surface_id= 0x%x, vaddr[0] (0x%x), vaddr[1] (0x%x)\n",
+ __FUNCTION__, surfaceID, vaddr[GRALLOC_SUB_BUFFER0], vaddr[GRALLOC_SUB_BUFFER1]);
}
-
- drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s : Create graphic buffer success"
- "surface_id= 0x%x, vaddr[0] (0x%x), vaddr[1] (0x%x)\n",
- __FUNCTION__, surfaceID, vaddr[GRALLOC_SUB_BUFFER0], vaddr[GRALLOC_SUB_BUFFER1]);
}
gralloc_unlock((buffer_handle_t)handle);
psb_surface->buf.user_ptr = NULL;
}
-
+ pthread_mutex_unlock(&gralloc_mutex);
+
if (VA_STATUS_SUCCESS != vaStatus) {
free(psb_surface);
object_heap_free(&driver_data->surface_heap, (object_base_p) obj_surface);
@@ -444,7 +458,7 @@ VAStatus psb_CreateSurfacesFromGralloc(
surface_list[i] = VA_INVALID_SURFACE;
}
drv_debug_msg(VIDEO_DEBUG_ERROR, "CreateSurfaces failed\n");
-
+
return vaStatus;
}
diff --git a/src/psb_drv_video.c b/src/psb_drv_video.c
index f261daa..dc4f8f0 100755
--- a/src/psb_drv_video.c
+++ b/src/psb_drv_video.c
@@ -217,10 +217,10 @@ VAStatus psb_QueryConfigEntrypoints(
i == VAEntrypointVideoProc) {
entrypoints++;
*entrypoint_list++ = i;
- } else
+ } else
#endif
#endif
- if (profile != VAProfileNone && driver_data->profile2Format[profile][i]) {
+ if (profile != VAProfileNone && driver_data->profile2Format[profile][i]) {
entrypoints++;
*entrypoint_list++ = i;
}
@@ -440,26 +440,26 @@ VAStatus psb_CreateConfig(
CHECK_VASTATUS();
if ((IS_MFLD(driver_data)) &&
- ((VAEntrypointEncPicture == entrypoint)
- || (VAEntrypointEncSlice == entrypoint))) {
- int active_slc, active_pic;
+ ((VAEntrypointEncPicture == entrypoint)
+ || (VAEntrypointEncSlice == entrypoint))) {
+ int active_slc, active_pic;
/* Only allow one encoding entrypoint at the sametime.
- * But if video encoding request comes when process JPEG encoding,
- * it will wait until current JPEG picture encoding finish.
- * Further JPEG encoding should fall back to software path.*/
- active_slc = psb_get_active_entrypoint_number(ctx, VAEntrypointEncSlice);
- active_pic = psb_get_active_entrypoint_number(ctx, VAEntrypointEncPicture);
-
- if (active_slc > 0) {
- drv_debug_msg(VIDEO_DEBUG_ERROR, "There already is a active video encoding entrypoint."
- "Entrypoint %d isn't available.\n", entrypoint);
- return VA_STATUS_ERROR_HW_BUSY;
- }
- else if (active_pic > 0 && VAEntrypointEncPicture == entrypoint) {
- drv_debug_msg(VIDEO_DEBUG_ERROR, "There already is a active picture encoding entrypoint."
- "Entrypoint %d isn't available.\n", entrypoint);
- return VA_STATUS_ERROR_HW_BUSY;
- }
+ * But if video encoding request comes when process JPEG encoding,
+ * it will wait until current JPEG picture encoding finish.
+ * Further JPEG encoding should fall back to software path.*/
+ active_slc = psb_get_active_entrypoint_number(ctx, VAEntrypointEncSlice);
+ active_pic = psb_get_active_entrypoint_number(ctx, VAEntrypointEncPicture);
+
+ if (active_slc > 0) {
+ drv_debug_msg(VIDEO_DEBUG_ERROR, "There already is a active video encoding entrypoint."
+ "Entrypoint %d isn't available.\n", entrypoint);
+ return VA_STATUS_ERROR_HW_BUSY;
+ }
+ else if (active_pic > 0 && VAEntrypointEncPicture == entrypoint) {
+ drv_debug_msg(VIDEO_DEBUG_ERROR, "There already is a active picture encoding entrypoint."
+ "Entrypoint %d isn't available.\n", entrypoint);
+ return VA_STATUS_ERROR_HW_BUSY;
+ }
}
configID = object_heap_allocate(&driver_data->config_heap);
@@ -510,11 +510,11 @@ VAStatus psb_CreateConfig(
}
if (profile == VAProfileVP8Version0_3 ||
- profile == VAProfileH264Baseline ||
- profile == VAProfileH264Main ||
- profile == VAProfileH264High ||
- profile == VAProfileH264ConstrainedBaseline)
- driver_data->ec_enabled = 1;
+ profile == VAProfileH264Baseline ||
+ profile == VAProfileH264Main ||
+ profile == VAProfileH264High ||
+ profile == VAProfileH264ConstrainedBaseline)
+ driver_data->ec_enabled = 1;
if (!IS_MRFL(driver_data)) {
if (profile == VAProfileMPEG4Simple ||
@@ -589,9 +589,9 @@ void psb__destroy_surface(psb_driver_data_p driver_data, object_surface_p obj_su
/* delete subpicture association */
psb_SurfaceDeassociateSubpict(driver_data, obj_surface);
- obj_surface->is_ref_surface = 0;
+ obj_surface->is_ref_surface = 0;
- psb_surface_sync(obj_surface->psb_surface);
+ psb_surface_sync(obj_surface->psb_surface);
psb_surface_destroy(obj_surface->psb_surface);
if (obj_surface->out_loop_surface) {
@@ -701,6 +701,7 @@ VAStatus psb_CreateSurfaces2(
unsigned long fourcc;
unsigned int flags = 0;
int memory_type = -1;
+ unsigned int initalized_info_flag = 1;
VASurfaceAttribExternalBuffers *pExternalBufDesc = NULL;
PsbSurfaceAttributeTPI attribute_tpi;
@@ -767,6 +768,19 @@ VAStatus psb_CreateSurfaces2(
}
}
break;
+ case VASurfaceAttribUsageHint:
+ {
+ /* Share info is to be initialized when created sufaces by default (for the data producer)
+ * VPP Read indicate we do not NOT touch share info (for data consumer, which share buffer with data
+ * producer, such as of VPP).
+ */
+ drv_debug_msg(VIDEO_DEBUG_GENERAL, "VASurfaceAttribUsageHint.\n");
+ if ((attrib_list->value.value.i & VA_SURFACE_ATTRIB_USAGE_HINT_VPP_READ)!= 0){
+ initalized_info_flag = 0;
+ drv_debug_msg(VIDEO_DEBUG_GENERAL, "explicat not initialized share info.\n");
+ }
+ }
+ break;
default:
drv_debug_msg(VIDEO_DEBUG_ERROR, "Unsupported attribute.\n");
return VA_STATUS_ERROR_INVALID_PARAMETER;
@@ -780,6 +794,8 @@ VAStatus psb_CreateSurfaces2(
}
else if(memory_type !=-1 && pExternalBufDesc != NULL) {
attribute_tpi.type = memory_type;
+ //set initialized share info in reserverd 1, by default we will initialized share_info
+ attribute_tpi.reserved[2] = (unsigned int)initalized_info_flag;
vaStatus = psb_CreateSurfacesWithAttribute(ctx, width, height, format, num_surfaces, surface_list, (VASurfaceAttributeTPI *)&attribute_tpi);
pExternalBufDesc->private_data = (void *)(attribute_tpi.reserved[1]);
if (attribute_tpi.buffers) free(attribute_tpi.buffers);
@@ -804,7 +820,7 @@ VAStatus psb_CreateSurfaces2(
height_origin = height;
height = (height + 0x1f) & ~0x1f;
-
+
for (i = 0; i < num_surfaces; i++) {
int surfaceID;
object_surface_p obj_surface;
@@ -1036,12 +1052,12 @@ VAStatus psb_CreateContext(
object_config_p obj_config;
int cmdbuf_num, encode = 0, proc = 0;
int i;
- drv_debug_msg(VIDEO_DEBUG_INIT, "CreateContext config_id:%d, pic_w:%d, pic_h:%d, flag:%d, num_render_targets:%d.\n",
+ drv_debug_msg(VIDEO_DEBUG_ERROR, "CreateContext config_id:%d, pic_w:%d, pic_h:%d, flag:%d, num_render_targets:%d.\n",
config_id, picture_width, picture_height, flag, num_render_targets);
- CHECK_INVALID_PARAM(num_render_targets <= 0);
+ //CHECK_INVALID_PARAM(num_render_targets <= 0);
- CHECK_SURFACE(render_targets);
+ //CHECK_SURFACE(render_targets);
CHECK_CONTEXT(context);
vaStatus = psb__checkSurfaceDimensions(driver_data, picture_width, picture_height);
@@ -1081,14 +1097,17 @@ VAStatus psb_CreateContext(
#endif
obj_context->scaling_width = 0;
obj_context->scaling_height = 0;
- obj_context->render_targets = (VASurfaceID *) calloc(1, num_render_targets * sizeof(VASurfaceID));
- if (obj_context->render_targets == NULL) {
- vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
- DEBUG_FAILURE;
- object_heap_free(&driver_data->context_heap, (object_base_p) obj_context);
+ if (num_render_targets > 0) {
+ obj_context->render_targets = (VASurfaceID *) calloc(1, num_render_targets * sizeof(VASurfaceID));
+ if (obj_context->render_targets == NULL) {
+ vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
+ DEBUG_FAILURE;
- return vaStatus;
+ object_heap_free(&driver_data->context_heap, (object_base_p) obj_context);
+
+ return vaStatus;
+ }
}
/* allocate buffer points for vaRenderPicture */
@@ -1098,7 +1117,8 @@ VAStatus psb_CreateContext(
vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
DEBUG_FAILURE;
- free(obj_context->render_targets);
+ if (NULL != obj_context->render_targets)
+ free(obj_context->render_targets);
object_heap_free(&driver_data->context_heap, (object_base_p) obj_context);
return vaStatus;
@@ -1131,28 +1151,29 @@ VAStatus psb_CreateContext(
else
cmdbuf_num = PSB_MAX_CMDBUFS;
- for (i = 0; i < num_render_targets; i++) {
- object_surface_p obj_surface = SURFACE(render_targets[i]);
- psb_surface_p psb_surface;
+ if (num_render_targets > 0) {
+ for (i = 0; i < num_render_targets; i++) {
+ object_surface_p obj_surface = SURFACE(render_targets[i]);
+ psb_surface_p psb_surface;
- if (NULL == obj_surface) {
- vaStatus = VA_STATUS_ERROR_INVALID_SURFACE;
- DEBUG_FAILURE;
- break;
- }
+ if (NULL == obj_surface) {
+ vaStatus = VA_STATUS_ERROR_INVALID_SURFACE;
+ DEBUG_FAILURE;
+ break;
+ }
- if (!driver_data->protected && obj_surface->share_info)
- obj_surface->share_info->force_output_method = 0;
+ if (!driver_data->protected && obj_surface->share_info)
+ obj_surface->share_info->force_output_method = 0;
- psb_surface = obj_surface->psb_surface;
+ psb_surface = obj_surface->psb_surface;
- /* Clear format specific surface info */
- obj_context->render_targets[i] = render_targets[i];
- obj_surface->context_id = contextID; /* Claim ownership of surface */
+ /* Clear format specific surface info */
+ obj_context->render_targets[i] = render_targets[i];
+ obj_surface->context_id = contextID; /* Claim ownership of surface */
#ifdef PSBVIDEO_MSVDX_DEC_TILING
- if (GET_SURFACE_INFO_tiling(psb_surface))
+ if (GET_SURFACE_INFO_tiling(psb_surface))
#ifdef BAYTRAIL
- obj_context->msvdx_tile = psb__tile_stride_log2_512(obj_surface->width);
+ obj_context->msvdx_tile = psb__tile_stride_log2_512(obj_surface->width);
#else
if (obj_config->entrypoint == VAEntrypointVideoProc && obj_config->profile == VAProfileNone)
// It's for two pass rotation case
@@ -1166,12 +1187,13 @@ VAStatus psb_CreateContext(
}
#endif
#if 0
- /* for decode, move the surface into |TT */
- if ((encode == 0) && /* decode */
- ((psb_surface->buf.pl_flags & DRM_PSB_FLAG_MEM_RAR) == 0)) /* surface not in RAR */
- psb_buffer_setstatus(&obj_surface->psb_surface->buf,
- WSBM_PL_FLAG_TT | WSBM_PL_FLAG_SHARED, DRM_PSB_FLAG_MEM_MMU);
+ /* for decode, move the surface into |TT */
+ if ((encode == 0) && /* decode */
+ ((psb_surface->buf.pl_flags & DRM_PSB_FLAG_MEM_RAR) == 0)) /* surface not in RAR */
+ psb_buffer_setstatus(&obj_surface->psb_surface->buf,
+ WSBM_PL_FLAG_TT | WSBM_PL_FLAG_SHARED, DRM_PSB_FLAG_MEM_MMU);
#endif
+ }
}
obj_context->va_flags = flag;
@@ -1188,7 +1210,8 @@ VAStatus psb_CreateContext(
obj_context->config_id = -1;
obj_context->picture_width = 0;
obj_context->picture_height = 0;
- free(obj_context->render_targets);
+ if (NULL != obj_context->render_targets)
+ free(obj_context->render_targets);
free(obj_context->buffer_list);
obj_context->num_buffers = 0;
obj_context->render_targets = NULL;
@@ -1342,7 +1365,7 @@ VAStatus psb_CreateContext(
free(obj_context->tng_cmdbuf_list[i]);
obj_context->tng_cmdbuf_list[i] = NULL;
}
-#endif
+#endif
if (obj_context->cmdbuf_list[i]) {
psb_cmdbuf_destroy(obj_context->cmdbuf_list[i]);
free(obj_context->cmdbuf_list[i]);
@@ -1366,14 +1389,15 @@ VAStatus psb_CreateContext(
obj_context->config_id = -1;
obj_context->picture_width = 0;
obj_context->picture_height = 0;
- free(obj_context->render_targets);
+ if (NULL != obj_context->render_targets)
+ free(obj_context->render_targets);
free(obj_context->buffer_list);
obj_context->num_buffers = 0;
obj_context->render_targets = NULL;
obj_context->num_render_targets = 0;
obj_context->va_flags = 0;
object_heap_free(&driver_data->context_heap, (object_base_p) obj_context);
- }
+ }
obj_context->ctp_type = (((obj_config->profile << 8) |
obj_config->entrypoint | driver_data->protected) & 0xffff);
@@ -2039,7 +2063,7 @@ VAStatus psb_BeginPicture(
obj_context = CONTEXT(context);
CHECK_CONTEXT(obj_context);
-
+
/* Must not be within BeginPicture / EndPicture already */
ASSERT(obj_context->current_render_target == NULL);
@@ -2064,7 +2088,7 @@ VAStatus psb_BeginPicture(
vaStatus = obj_context->format_vtable->beginPicture(obj_context);
}
-#ifdef ANDROID
+#ifdef ANDROID
/* want msvdx to do rotate
* but check per-context stream type: interlace or not
*/
@@ -2080,13 +2104,15 @@ VAStatus psb_BeginPicture(
if (obj_context->interlaced_stream || driver_data->disable_msvdx_rotate) {
int i;
obj_context->msvdx_rotate = 0;
- for (i = 0; i < obj_context->num_render_targets; i++) {
- object_surface_p obj_surface = SURFACE(obj_context->render_targets[i]);
- /*we invalidate all surfaces's rotate buffer share info here.*/
- if (obj_surface && obj_surface->share_info) {
- obj_surface->share_info->surface_rotate = 0;
+ if (obj_context->num_render_targets > 0) {
+ for (i = 0; i < obj_context->num_render_targets; i++) {
+ object_surface_p obj_surface = SURFACE(obj_context->render_targets[i]);
+ /*we invalidate all surfaces's rotate buffer share info here.*/
+ if (obj_surface && obj_surface->share_info) {
+ obj_surface->share_info->surface_rotate = 0;
+ }
}
- }
+ }
}
else
obj_context->msvdx_rotate = driver_data->msvdx_rotate_want;
@@ -2117,7 +2143,7 @@ VAStatus psb_BeginPicture(
}
} else
#endif
- vaStatus = psb_CreateRotateSurface(obj_context, obj_surface, obj_context->msvdx_rotate);
+ vaStatus = psb_CreateRotateSurface(obj_context, obj_surface, obj_context->msvdx_rotate);
if (VA_STATUS_SUCCESS !=vaStatus)
ALOGE("%s: fail to allocate out loop surface", __func__);
@@ -2366,7 +2392,7 @@ VAStatus psb_SyncSurface(
vaStatus = psb_surface_sync(obj_surface->out_loop_surface);
else
vaStatus = psb_surface_sync(obj_surface->psb_surface);
- } else
+ } else
#endif
vaStatus = psb_surface_sync(obj_surface->psb_surface);
}
@@ -2553,10 +2579,10 @@ VAStatus psb_QuerySurfaceError(
arg.value = (uint64_t)((unsigned long)decode_status);
ret = drmCommandWriteRead(driver_data->drm_fd, driver_data->getParamIoctlOffset,
&arg, sizeof(arg));
- if (ret != 0) {
- drv_debug_msg(VIDEO_DEBUG_GENERAL,"return value is %d drmCommandWriteRead\n",ret);
- return VA_STATUS_ERROR_UNKNOWN;
- }
+ if (ret != 0) {
+ drv_debug_msg(VIDEO_DEBUG_GENERAL,"return value is %d drmCommandWriteRead\n",ret);
+ return VA_STATUS_ERROR_UNKNOWN;
+ }
#ifndef _FOR_FPGA_
if (decode_status->num_region > MAX_MB_ERRORS) {
drv_debug_msg(VIDEO_DEBUG_GENERAL, "too much mb errors are reported.\n");
@@ -2623,8 +2649,8 @@ VAStatus psb_QuerySurfaceAttributes(VADriverContextP ctx,
if (obj_config->entrypoint == VAEntrypointEncSlice && obj_config->profile == VAProfileVP8Version0_3) {
attribs[i].value.value.i = VA_SURFACE_ATTRIB_MEM_TYPE_VA |
VA_SURFACE_ATTRIB_MEM_TYPE_KERNEL_DRM |
- VA_SURFACE_ATTRIB_MEM_TYPE_ANDROID_GRALLOC |
- VA_SURFACE_ATTRIB_MEM_TYPE_ANDROID_ION;
+ VA_SURFACE_ATTRIB_MEM_TYPE_ANDROID_GRALLOC |
+ VA_SURFACE_ATTRIB_MEM_TYPE_ANDROID_ION;
} else {
attribs[i].value.value.i = VA_SURFACE_ATTRIB_MEM_TYPE_VA |
VA_SURFACE_ATTRIB_MEM_TYPE_KERNEL_DRM |
@@ -3137,7 +3163,7 @@ EXPORT VAStatus __vaDriverInit_0_31(VADriverContextP ctx)
ctx->vtable->vaCreateConfig = psb_CreateConfig;
ctx->vtable->vaDestroyConfig = psb_DestroyConfig;
ctx->vtable->vaGetConfigAttributes = psb_GetConfigAttributes;
- ctx->vtable->vaCreateSurfaces2 = psb_CreateSurfaces2;
+ ctx->vtable->vaCreateSurfaces2 = psb_CreateSurfaces2;
ctx->vtable->vaCreateSurfaces = psb_CreateSurfaces;
ctx->vtable->vaGetSurfaceAttributes = psb_GetSurfaceAttributes;
ctx->vtable->vaDestroySurfaces = psb_DestroySurfaces;
@@ -3196,7 +3222,7 @@ EXPORT VAStatus __vaDriverInit_0_31(VADriverContextP ctx)
tpi = (struct VADriverVTableTPI *)ctx->vtable_tpi;
tpi->vaCreateSurfacesWithAttribute = psb_CreateSurfacesWithAttribute;
tpi->vaPutSurfaceBuf = psb_PutSurfaceBuf;
- tpi->vaSetTimestampForSurface = psb_SetTimestampForSurface;
+ tpi->vaSetTimestampForSurface = psb_SetTimestampForSurface;
ctx->vtable_egl = calloc(1, sizeof(struct VADriverVTableEGL));
if (NULL == ctx->vtable_egl)
@@ -3303,7 +3329,7 @@ EXPORT VAStatus __vaDriverInit_0_31(VADriverContextP ctx)
#ifdef PSBVIDEO_VXD392
if (IS_MRFL(driver_data) || IS_BAYTRAIL(driver_data)) {
drv_debug_msg(VIDEO_DEBUG_GENERAL, "merrifield VXD392 decoder\n");
- driver_data->profile2Format[VAProfileVP8Version0_3][VAEntrypointVLD] = &tng_VP8_vtable;
+ driver_data->profile2Format[VAProfileVP8Version0_3][VAEntrypointVLD] = &tng_VP8_vtable;
driver_data->profile2Format[VAProfileJPEGBaseline][VAEntrypointVLD] = &tng_JPEG_vtable;
driver_data->profile2Format[VAProfileMPEG4Simple][VAEntrypointVLD] = &pnw_MPEG4_vtable;
@@ -3400,7 +3426,7 @@ EXPORT VAStatus __vaDriverInit_0_31(VADriverContextP ctx)
{
if (IS_LEXINGTON(driver_data))
ctx->str_vendor = PSB_STR_VENDOR_LEXINGTON;
- else
+ else
ctx->str_vendor = PSB_STR_VENDOR_MFLD;
}
else
diff --git a/src/psb_drv_video.h b/src/psb_drv_video.h
index 11c24b0..66b7fe5 100755
--- a/src/psb_drv_video.h
+++ b/src/psb_drv_video.h
@@ -377,17 +377,13 @@ struct object_context_s {
struct lnc_cmdbuf_s *lnc_cmdbuf_list[LNC_MAX_CMDBUFS_ENCODE];
struct pnw_cmdbuf_s *pnw_cmdbuf_list[PNW_MAX_CMDBUFS_ENCODE];
struct tng_cmdbuf_s *tng_cmdbuf_list[TNG_MAX_CMDBUFS_ENCODE];
-#ifdef PSBVIDEO_MRFL_VPP
struct vsp_cmdbuf_s *vsp_cmdbuf_list[VSP_MAX_CMDBUFS];
-#endif
struct psb_cmdbuf_s *cmdbuf; /* Current cmd buffer */
struct lnc_cmdbuf_s *lnc_cmdbuf;
struct pnw_cmdbuf_s *pnw_cmdbuf;
struct tng_cmdbuf_s *tng_cmdbuf;
-#ifdef PSBVIDEO_MRFL_VPP
struct vsp_cmdbuf_s *vsp_cmdbuf;
-#endif
int cmdbuf_current;
@@ -545,18 +541,18 @@ struct object_surface_s {
#define SET_CODEDBUF_INFO(flag, aux_info, slice_num) \
do {\
- (aux_info) &= ~(PSB_CODEDBUF_##flag##_MASK<<PSB_CODEDBUF_##flag##_SHIFT);\
- (aux_info) |= ((slice_num) & PSB_CODEDBUF_##flag##_MASK)\
- <<PSB_CODEDBUF_##flag##_SHIFT;\
+ (aux_info) &= ~(PSB_CODEDBUF_##flag##_MASK<<PSB_CODEDBUF_##flag##_SHIFT);\
+ (aux_info) |= ((slice_num) & PSB_CODEDBUF_##flag##_MASK)\
+ <<PSB_CODEDBUF_##flag##_SHIFT;\
} while (0)
#define CLEAR_CODEDBUF_INFO(flag, aux_info) \
do {\
- (aux_info) &= ~(PSB_CODEDBUF_##flag##_MASK<<PSB_CODEDBUF_##flag##_SHIFT);\
+ (aux_info) &= ~(PSB_CODEDBUF_##flag##_MASK<<PSB_CODEDBUF_##flag##_SHIFT);\
} while (0)
#define GET_CODEDBUF_INFO(flag, aux_info) \
- (((aux_info)>>PSB_CODEDBUF_##flag##_SHIFT) & PSB_CODEDBUF_##flag##_MASK)
+ (((aux_info)>>PSB_CODEDBUF_##flag##_SHIFT) & PSB_CODEDBUF_##flag##_MASK)
#define PSB_CODEDBUF_SEGMENT_MAX (9)
@@ -624,8 +620,8 @@ typedef struct _PsbSurfaceAttributeTPI {
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
- */
+ * Android native window pointer 363
+ */
} PsbSurfaceAttributeTPI;
#define MEMSET_OBJECT(ptr, data_struct) \
@@ -710,7 +706,7 @@ inline static char * buffer_type_to_string(int type)
case VAEncMiscParameterBufferType:
return "VAEncMiscParameterBufferType";
case VAProbabilityBufferType:
- return "VAProbabilityBufferType";
+ return "VAProbabilityBufferType";
case VAHuffmanTableBufferType:
return "VAHuffmanTableBufferType";
case VAQMatrixBufferType:
diff --git a/src/vsp_VPP.c b/src/vsp_VPP.c
index 5feb3fc..772cc87 100644
--- a/src/vsp_VPP.c
+++ b/src/vsp_VPP.c
@@ -8,11 +8,11 @@
* 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.
@@ -118,7 +118,7 @@ struct filter_strength {
struct VssProcColorEnhancementParameterBuffer enhancer[RESOLUTION_SET_NUM];
struct VssProcSharpenParameterBuffer sharpen[RESOLUTION_SET_NUM];
};
-
+
enum filter_strength_type {
INVALID_STRENGTH = -1,
LOW_STRENGTH = 0,
@@ -399,9 +399,12 @@ static VAStatus vsp__VPP_process_pipeline_param(context_VPP_p ctx, object_contex
object_surface_p input_surface = NULL;
object_surface_p cur_output_surf = NULL;
unsigned int rotation_angle = 0, vsp_rotation_angle = 0;
- int tiled = 0, width = 0, height = 0, stride = 0;
+ unsigned int tiled = 0, width = 0, height = 0, stride = 0;
unsigned char *src_addr, *dest_addr;
struct psb_surface_s *output_surface;
+ psb_surface_share_info_p input_share_info = NULL;
+ psb_surface_share_info_p output_share_info = NULL;
+
psb_driver_data_p driver_data = obj_context->driver_data;
if (pipeline_param->surface_region != NULL) {
@@ -409,13 +412,13 @@ static VAStatus vsp__VPP_process_pipeline_param(context_VPP_p ctx, object_contex
vaStatus = VA_STATUS_ERROR_UNKNOWN;
goto out;
}
-
+
if (pipeline_param->output_region != NULL) {
drv_debug_msg(VIDEO_DEBUG_ERROR, "Cann't scale\n");
vaStatus = VA_STATUS_ERROR_UNKNOWN;
goto out;
}
-
+
if (pipeline_param->output_background_color != 0) {
drv_debug_msg(VIDEO_DEBUG_ERROR, "Cann't support background color here\n");
vaStatus = VA_STATUS_ERROR_INVALID_PARAMETER;
@@ -538,8 +541,12 @@ static VAStatus vsp__VPP_process_pipeline_param(context_VPP_p ctx, object_contex
#endif
/* According to VIED's design, the width must be multiple of 16 */
width = ALIGN_TO_16(input_surface->width);
- if (width > (int)input_surface->psb_surface->stride)
- width = (int)input_surface->psb_surface->stride;
+ if (width > input_surface->psb_surface->stride)
+ width = input_surface->psb_surface->stride;
+
+ /* get the input share info */
+ input_share_info = input_surface->share_info;
+ drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s The input surface %p share info %p\n", __func__, input_surface,input_surface->share_info);
/* Setup input surface */
cell_proc_picture_param->num_input_pictures = 1;
@@ -633,7 +640,7 @@ static VAStatus vsp__VPP_process_pipeline_param(context_VPP_p ctx, object_contex
/* According to VIED's design, the width must be multiple of 16 */
width = ALIGN_TO_16(cur_output_surf->width);
- if (width > (int)cur_output_surf->psb_surface->stride)
+ if (width > cur_output_surf->psb_surface->stride)
width = cur_output_surf->psb_surface->stride;
height = cur_output_surf->height_origin;
stride = cur_output_surf->psb_surface->stride;
@@ -661,6 +668,33 @@ static VAStatus vsp__VPP_process_pipeline_param(context_VPP_p ctx, object_contex
cell_proc_picture_param->output_picture[i].format = ctx->format;
cell_proc_picture_param->output_picture[i].rot_angle = vsp_rotation_angle;
cell_proc_picture_param->output_picture[i].tiled = tiled;
+
+ /* copy the input share info to output */
+ output_share_info = cur_output_surf->share_info;
+ if (input_share_info != NULL && output_share_info != NULL) {
+ memcpy(output_share_info, input_share_info, sizeof(psb_surface_share_info_t));
+ output_share_info->metadata_rotate = 0;
+ output_share_info->surface_rotate = 0;
+ output_share_info->width_r = 0;
+ output_share_info->height_r = 0;
+ output_share_info->out_loop_khandle = 0;
+ output_share_info->out_loop_luma_stride = 0;
+ output_share_info->out_loop_chroma_u_stride = 0;
+ output_share_info->out_loop_chroma_v_stride = 0;
+
+ output_share_info->khandle = 0;
+
+ output_share_info->scaling_khandle = 0;
+ output_share_info->width_s = 0;
+ output_share_info->height_s = 0;
+ output_share_info->scaling_luma_stride = 0;
+ output_share_info->scaling_chroma_u_stride = 0;
+ output_share_info->scaling_chroma_v_stride = 0;
+
+ drv_debug_msg(VIDEO_DEBUG_GENERAL, "The input/output wxh %dx%d\n",input_share_info->width,input_share_info->height);
+ } else {
+ drv_debug_msg(VIDEO_DEBUG_WARNING, "The input/output share_info is NULL!!\n");
+ }
}
vsp_cmdbuf_insert_command(cmdbuf, CONTEXT_VPP_ID, &cmdbuf->param_mem, VssProcPictureCommand,
@@ -807,10 +841,10 @@ vsp_VPP_EndPicture
};
VAStatus vsp_QueryVideoProcFilters(
- VADriverContextP ctx,
- VAContextID context,
- VAProcFilterType *filters,
- unsigned int *num_filters
+ VADriverContextP ctx,
+ VAContextID context,
+ VAProcFilterType *filters,
+ unsigned int *num_filters
)
{
INIT_DRIVER_DATA;
@@ -875,11 +909,11 @@ err:
}
VAStatus vsp_QueryVideoProcFilterCaps(
- VADriverContextP ctx,
- VAContextID context,
- VAProcFilterType type,
- void *filter_caps,
- unsigned int *num_filter_caps
+ VADriverContextP ctx,
+ VAContextID context,
+ VAProcFilterType type,
+ void *filter_caps,
+ unsigned int *num_filter_caps
)
{
INIT_DRIVER_DATA;
@@ -1001,10 +1035,10 @@ err:
VAStatus vsp_QueryVideoProcPipelineCaps(
VADriverContextP ctx,
- VAContextID context,
- VABufferID *filters,
- unsigned int num_filters,
- VAProcPipelineCaps *pipeline_caps
+ VAContextID context,
+ VABufferID *filters,
+ unsigned int num_filters,
+ VAProcPipelineCaps *pipeline_caps
)
{
INIT_DRIVER_DATA;
@@ -1294,7 +1328,7 @@ static VAStatus vsp_set_pipeline(context_VPP_p ctx)
for (i = 0; i < ctx->num_filters; ++i) {
cur_param = (VAProcFilterParameterBufferBase *)ctx->filter_buf[i]->buffer_data;
switch (cur_param->type) {
- case VAProcFilterNone:
+ case VAProcFilterNone:
goto finished;
break;
case VAProcFilterNoiseReduction:
@@ -1311,7 +1345,7 @@ static VAStatus vsp_set_pipeline(context_VPP_p ctx)
case VAProcFilterFrameRateConversion:
cell_pipeline_param->filter_pipeline[filter_count++] = VssProcFilterFrameRateConversion;
break;
- default:
+ default:
cell_pipeline_param->filter_pipeline[filter_count++] = -1;
vaStatus = VA_STATUS_ERROR_UNKNOWN;
goto out;
@@ -1368,7 +1402,7 @@ static VAStatus vsp_set_filter_param(context_VPP_p ctx)
cell_denoiser_param->type = VssProcDeblock;
vsp_cmdbuf_insert_command(cmdbuf,
- CONTEXT_VPP_ID,
+ CONTEXT_VPP_ID,
&cmdbuf->param_mem,
VssProcDenoiseParameterCommand,
ctx->denoise_param_offset,
@@ -1382,7 +1416,7 @@ static VAStatus vsp_set_filter_param(context_VPP_p ctx)
cell_denoiser_param->type = VssProcDegrain;
vsp_cmdbuf_insert_command(cmdbuf,
- CONTEXT_VPP_ID,
+ CONTEXT_VPP_ID,
&cmdbuf->param_mem,
VssProcDenoiseParameterCommand,
ctx->denoise_param_offset,
@@ -1395,7 +1429,7 @@ static VAStatus vsp_set_filter_param(context_VPP_p ctx)
sizeof(ctx->sharpen_param));
vsp_cmdbuf_insert_command(cmdbuf,
- CONTEXT_VPP_ID,
+ CONTEXT_VPP_ID,
&cmdbuf->param_mem,
VssProcSharpenParameterCommand,
ctx->sharpen_param_offset,
@@ -1408,7 +1442,7 @@ static VAStatus vsp_set_filter_param(context_VPP_p ctx)
sizeof(ctx->enhancer_param));
vsp_cmdbuf_insert_command(cmdbuf,
- CONTEXT_VPP_ID,
+ CONTEXT_VPP_ID,
&cmdbuf->param_mem,
VssProcColorEnhancementParameterCommand,
ctx->enhancer_param_offset,
@@ -1425,7 +1459,7 @@ static VAStatus vsp_set_filter_param(context_VPP_p ctx)
/* set the FRC quality */
/* cell_proc_frc_param->quality = VssFrcMediumQuality; */
cell_proc_frc_param->quality = VssFrcHighQuality;
-
+
/* check if the input fps is in the range of HW capability */
if (ratio == 2)
cell_proc_frc_param->conversion_rate = VssFrc2xConversionRate;
@@ -1433,8 +1467,8 @@ static VAStatus vsp_set_filter_param(context_VPP_p ctx)
cell_proc_frc_param->conversion_rate = VssFrc2_5xConversionRate;
else if (ratio == 4)
cell_proc_frc_param->conversion_rate = VssFrc4xConversionRate;
- else if (ratio == 1.25)
- cell_proc_frc_param->conversion_rate = VssFrc1_25xConversionRate;
+ else if (ratio == 1.25)
+ cell_proc_frc_param->conversion_rate = VssFrc1_25xConversionRate;
else {
drv_debug_msg(VIDEO_DEBUG_ERROR, "invalid frame rate conversion ratio %f \n", ratio);
vaStatus = VA_STATUS_ERROR_UNKNOWN;
@@ -1442,13 +1476,13 @@ static VAStatus vsp_set_filter_param(context_VPP_p ctx)
}
vsp_cmdbuf_insert_command(cmdbuf,
- CONTEXT_VPP_ID,
+ CONTEXT_VPP_ID,
&cmdbuf->param_mem,
VssProcFrcParameterCommand,
ctx->frc_param_offset,
sizeof(struct VssProcFrcParameterBuffer));
break;
- default:
+ default:
vaStatus = VA_STATUS_ERROR_UNKNOWN;
goto out;
}
diff --git a/src/vsp_cmdbuf.c b/src/vsp_cmdbuf.c
index a5a6ee3..d74261c 100644
--- a/src/vsp_cmdbuf.c
+++ b/src/vsp_cmdbuf.c
@@ -8,11 +8,11 @@
* 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.
@@ -34,6 +34,13 @@
#define LLDMA_SIZE (0x2000)
#define RELOC_SIZE (0x3000)
+static int
+vspDRMCmdBuf(int fd, int ioctl_offset, psb_buffer_p *buffer_list, int buffer_count, unsigned cmdBufHandle,
+ unsigned cmdBufOffset, unsigned cmdBufSize,
+ unsigned relocBufHandle, unsigned relocBufOffset,
+ unsigned numRelocs, int damage,
+ unsigned engine, unsigned fence_flags, struct psb_ttm_fence_rep *fence_rep);
+
/*
* Create command buffer
*/
@@ -156,35 +163,34 @@ int vsp_cmdbuf_unmap(vsp_cmdbuf_p cmdbuf)
*/
int vsp_cmdbuf_buffer_ref(vsp_cmdbuf_p cmdbuf, psb_buffer_p buf)
{
- int item_loc = 0;
-
-// while ((item_loc < cmdbuf->buffer_refs_count) && (cmdbuf->buffer_refs[item_loc] != buf)) {
- /*Reserve the same TTM BO twice will cause kernel lock up*/
- while ((item_loc < cmdbuf->buffer_refs_count)
- && (wsbmKBufHandle(wsbmKBuf(cmdbuf->buffer_refs[item_loc]->drm_buf))
- != wsbmKBufHandle(wsbmKBuf(buf->drm_buf)))) {
- item_loc++;
- }
- if (item_loc == cmdbuf->buffer_refs_count) {
- /* Add new entry */
- if (item_loc >= cmdbuf->buffer_refs_allocated) {
- /* Allocate more entries */
- int new_size = cmdbuf->buffer_refs_allocated + 10;
- psb_buffer_p *new_array;
- new_array = (psb_buffer_p *) calloc(1, sizeof(psb_buffer_p) * new_size);
- if (NULL == new_array) {
- return -1; /* Allocation failure */
- }
- memcpy(new_array, cmdbuf->buffer_refs, sizeof(psb_buffer_p) * cmdbuf->buffer_refs_allocated);
- free(cmdbuf->buffer_refs);
- cmdbuf->buffer_refs_allocated = new_size;
- cmdbuf->buffer_refs = new_array;
- }
- cmdbuf->buffer_refs[item_loc] = buf;
- cmdbuf->buffer_refs_count++;
- buf->status = psb_bs_queued;
- }
- return item_loc;
+ int item_loc = 0;
+
+ /*Reserve the same TTM BO twice will cause kernel lock up*/
+ while ((item_loc < cmdbuf->buffer_refs_count)
+ && (wsbmKBufHandle(wsbmKBuf(cmdbuf->buffer_refs[item_loc]->drm_buf))
+ != wsbmKBufHandle(wsbmKBuf(buf->drm_buf)))) {
+ item_loc++;
+ }
+ if (item_loc == cmdbuf->buffer_refs_count) {
+ /* Add new entry */
+ if (item_loc >= cmdbuf->buffer_refs_allocated) {
+ /* Allocate more entries */
+ int new_size = cmdbuf->buffer_refs_allocated + 10;
+ psb_buffer_p *new_array;
+ new_array = (psb_buffer_p *) calloc(1, sizeof(psb_buffer_p) * new_size);
+ if (NULL == new_array) {
+ return -1; /* Allocation failure */
+ }
+ memcpy(new_array, cmdbuf->buffer_refs, sizeof(psb_buffer_p) * cmdbuf->buffer_refs_allocated);
+ free(cmdbuf->buffer_refs);
+ cmdbuf->buffer_refs_allocated = new_size;
+ cmdbuf->buffer_refs = new_array;
+ }
+ cmdbuf->buffer_refs[item_loc] = buf;
+ cmdbuf->buffer_refs_count++;
+ buf->status = psb_bs_queued;
+ }
+ return item_loc;
}
/* Creates a relocation record for a DWORD in the mapped "cmdbuf" at address
@@ -196,14 +202,14 @@ int vsp_cmdbuf_buffer_ref(vsp_cmdbuf_p cmdbuf, psb_buffer_p buf)
* constructed address. The remaining bits will be filled with bits from "background".
*/
void vsp_cmdbuf_add_relocation(vsp_cmdbuf_p cmdbuf,
- uint32_t *addr_in_dst_buffer,/*addr of dst_buffer for the DWORD*/
- psb_buffer_p ref_buffer,
- uint32_t buf_offset,
- uint32_t mask,
- uint32_t background,
- uint32_t align_shift,
- uint32_t dst_buffer,
- uint32_t *start_of_dst_buffer) /*Index of the list refered by cmdbuf->buffer_refs */
+ uint32_t *addr_in_dst_buffer,/*addr of dst_buffer for the DWORD*/
+ psb_buffer_p ref_buffer,
+ uint32_t buf_offset,
+ uint32_t mask,
+ uint32_t background,
+ uint32_t align_shift,
+ uint32_t dst_buffer,
+ uint32_t *start_of_dst_buffer) /*Index of the list refered by cmdbuf->buffer_refs */
{
struct drm_psb_reloc *reloc = cmdbuf->reloc_idx;
uint64_t presumed_offset = wsbmBOOffsetHint(ref_buffer->drm_buf);
@@ -216,13 +222,13 @@ void vsp_cmdbuf_add_relocation(vsp_cmdbuf_p cmdbuf,
reloc->reloc_op = PSB_RELOC_OP_OFFSET;
#ifndef VA_EMULATOR
if (presumed_offset) {
- uint32_t new_val = presumed_offset + buf_offset;
+ uint32_t new_val = presumed_offset + buf_offset;
- new_val = ((new_val >> align_shift) << (align_shift << PSB_RELOC_ALSHIFT_SHIFT));
- new_val = (background & ~mask) | (new_val & mask);
- *addr_in_dst_buffer = new_val;
+ new_val = ((new_val >> align_shift) << (align_shift << PSB_RELOC_ALSHIFT_SHIFT));
+ new_val = (background & ~mask) | (new_val & mask);
+ *addr_in_dst_buffer = new_val;
} else {
- *addr_in_dst_buffer = PSB_RELOC_MAGIC;
+ *addr_in_dst_buffer = PSB_RELOC_MAGIC;
}
#else
/* indicate subscript of relocation buffer */
@@ -282,10 +288,10 @@ int vsp_context_get_next_cmdbuf(object_context_p obj_context)
*/
static int
vspDRMCmdBuf(int fd, int ioctl_offset, psb_buffer_p *buffer_list, int buffer_count, unsigned cmdBufHandle,
- unsigned cmdBufOffset, unsigned cmdBufSize,
- unsigned relocBufHandle, unsigned relocBufOffset,
- unsigned __maybe_unused numRelocs, int __maybe_unused damage,
- unsigned engine, unsigned fence_flags, struct psb_ttm_fence_rep *fence_rep)
+ unsigned cmdBufOffset, unsigned cmdBufSize,
+ unsigned relocBufHandle, unsigned relocBufOffset,
+ unsigned numRelocs, int __maybe_unused damage,
+ unsigned engine, unsigned fence_flags, struct psb_ttm_fence_rep *fence_rep)
{
drm_psb_cmdbuf_arg_t ca;
struct psb_validate_arg *arg_list;
diff --git a/src/vsp_compose.c b/src/vsp_compose.c
index 899361d..62e75b4 100644
--- a/src/vsp_compose.c
+++ b/src/vsp_compose.c
@@ -8,11 +8,11 @@
* 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.
@@ -45,7 +45,7 @@
#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 vsp_compose_process_pipeline_param(context_VPP_p ctx, object_context_p __maybe_unused obj_context, object_buffer_p obj_buffer)
{
VAStatus vaStatus = VA_STATUS_SUCCESS;
diff --git a/src/vsp_vp8.c b/src/vsp_vp8.c
index 2e0315e..a60e9d0 100644
--- a/src/vsp_vp8.c
+++ b/src/vsp_vp8.c
@@ -102,7 +102,7 @@ static void vsp_VP8_DestroyContext(object_context_p obj_context);
static VAStatus vsp__VP8_check_legal_picture(object_context_p obj_context, object_config_p obj_config);
static void vsp_VP8_QueryConfigAttributes(
- VAProfile __maybe_unused profile,
+ VAProfile __maybe_unused profile,
VAEntrypoint __maybe_unused entrypoint,
VAConfigAttrib *attrib_list,
int num_attribs)
@@ -896,4 +896,3 @@ renderPicture:
endPicture:
vsp_VP8_EndPicture
};
-