summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Android.mk18
-rw-r--r--src/Makefile.am14
-rw-r--r--src/android/psb_HDMIExtMode.c233
-rw-r--r--src/android/psb_HDMIExtMode.h91
-rwxr-xr-x[-rw-r--r--]src/android/psb_android_glue.cpp123
-rwxr-xr-x[-rw-r--r--]src/android/psb_android_glue.h21
-rw-r--r--src/android/psb_output_android.c579
-rw-r--r--src/android/psb_output_android.h50
-rw-r--r--src/hwdefs/dma_api.h6
-rw-r--r--src/hwdefs/dxva_cmdseq_msg.h6
-rw-r--r--src/hwdefs/dxva_fw_ctrl.h6
-rw-r--r--src/hwdefs/dxva_fw_flags.h6
-rw-r--r--src/hwdefs/dxva_msg.h6
-rw-r--r--src/hwdefs/fwrk_msg_mem_io.h6
-rw-r--r--src/hwdefs/h264_macroblock_mem_io.h6
-rw-r--r--src/hwdefs/img_defs.h6
-rw-r--r--src/hwdefs/img_types.h6
-rw-r--r--src/hwdefs/lldma_defs.h6
-rw-r--r--src/hwdefs/mem_io.h18
-rw-r--r--src/hwdefs/msvdx_cmds_io2.h6
-rw-r--r--src/hwdefs/msvdx_core_regs_io2.h6
-rw-r--r--src/hwdefs/msvdx_defs.h6
-rw-r--r--src/hwdefs/msvdx_dmac_linked_list.h6
-rw-r--r--src/hwdefs/msvdx_dmac_regs_io2.h6
-rw-r--r--src/hwdefs/msvdx_mtx_reg_io2.h6
-rw-r--r--src/hwdefs/msvdx_offsets.h6
-rw-r--r--src/hwdefs/msvdx_rendec_mtx_slice_cntrl_reg_io2.h6
-rw-r--r--src/hwdefs/msvdx_rendec_vc1_reg_io2.h6
-rw-r--r--src/hwdefs/msvdx_vdmc_reg_io2.h6
-rw-r--r--src/hwdefs/msvdx_vec_h264_reg_io2.h6
-rw-r--r--src/hwdefs/msvdx_vec_mpeg2_reg_io2.h6
-rw-r--r--src/hwdefs/msvdx_vec_mpeg4_reg_io2.h6
-rw-r--r--src/hwdefs/msvdx_vec_reg_io2.h6
-rw-r--r--src/hwdefs/msvdx_vec_vc1_reg_io2.h6
-rw-r--r--src/hwdefs/reg_io2.h6
-rw-r--r--src/hwdefs/topazSC_defs.h6
-rw-r--r--src/hwdefs/topaz_defs.h6
-rw-r--r--src/lnc_H263ES.c29
-rw-r--r--src/lnc_H263ES.h6
-rw-r--r--src/lnc_H264ES.c49
-rw-r--r--src/lnc_H264ES.h6
-rw-r--r--src/lnc_MPEG4ES.c30
-rw-r--r--src/lnc_MPEG4ES.h6
-rw-r--r--src/lnc_cmdbuf.c18
-rw-r--r--src/lnc_cmdbuf.h26
-rw-r--r--src/lnc_hostcode.c41
-rw-r--r--src/lnc_hostcode.h24
-rw-r--r--src/lnc_hostheader.c12
-rw-r--r--src/lnc_hostheader.h6
-rw-r--r--src/lnc_ospm.c12
-rw-r--r--src/lnc_ospm.h4
-rw-r--r--src/object_heap.c4
-rw-r--r--src/object_heap.h4
-rw-r--r--src/pnw_H263ES.c36
-rw-r--r--src/pnw_H263ES.h6
-rw-r--r--src/pnw_H264.c77
-rw-r--r--src/pnw_H264.h6
-rw-r--r--src/pnw_H264ES.c69
-rw-r--r--src/pnw_H264ES.h6
-rw-r--r--src/pnw_MPEG2.c31
-rw-r--r--src/pnw_MPEG2.h6
-rw-r--r--src/pnw_MPEG4.c34
-rw-r--r--src/pnw_MPEG4.h6
-rw-r--r--src/pnw_MPEG4ES.c34
-rw-r--r--src/pnw_MPEG4ES.h6
-rw-r--r--src/pnw_VC1.c66
-rw-r--r--src/pnw_VC1.h6
-rw-r--r--src/pnw_cmdbuf.c23
-rw-r--r--src/pnw_cmdbuf.h28
-rw-r--r--src/pnw_hostcode.c59
-rw-r--r--src/pnw_hostcode.h20
-rw-r--r--src/pnw_hostheader.c42
-rw-r--r--src/pnw_hostheader.h30
-rw-r--r--src/pnw_hostjpeg.c12
-rw-r--r--src/pnw_hostjpeg.h18
-rw-r--r--src/pnw_jpeg.c37
-rw-r--r--src/pnw_jpeg.h8
-rw-r--r--src/pnw_rotate.c284
-rw-r--r--src/pnw_rotate.h46
-rwxr-xr-x[-rw-r--r--]src/psb_H264.c88
-rw-r--r--src/psb_H264.h6
-rw-r--r--src/psb_MPEG2.c26
-rw-r--r--src/psb_MPEG2.h6
-rw-r--r--src/psb_MPEG2MC.c20
-rw-r--r--src/psb_MPEG4.c25
-rw-r--r--src/psb_MPEG4.h6
-rw-r--r--src/psb_VC1.c22
-rw-r--r--src/psb_VC1.h6
-rw-r--r--src/psb_buffer.c66
-rw-r--r--src/psb_buffer.h53
-rw-r--r--src/psb_buffer_dm.c207
-rw-r--r--src/psb_cmdbuf.c95
-rw-r--r--src/psb_cmdbuf.h24
-rw-r--r--src/psb_deblock.c10
-rw-r--r--src/psb_def.h13
-rwxr-xr-x[-rw-r--r--]src/psb_drv_video.c669
-rw-r--r--src/psb_drv_video.h108
-rw-r--r--src/psb_output.c377
-rw-r--r--src/psb_output.h10
-rw-r--r--src/psb_overlay.c389
-rw-r--r--src/psb_overlay.h19
-rw-r--r--src/psb_surface.c93
-rw-r--r--src/psb_surface.h32
-rw-r--r--src/psb_surface_ext.h6
-rw-r--r--src/psb_texstreaming.c199
-rw-r--r--src/psb_texstreaming.h16
-rw-r--r--src/psb_texture.c275
-rw-r--r--src/psb_texture.h42
-rw-r--r--src/psb_ws_driver.c4
-rw-r--r--src/psb_ws_driver.h4
-rw-r--r--src/pvr2d.h510
-rw-r--r--src/vc1_defs.h6
-rw-r--r--src/vc1_header.h9
-rw-r--r--src/vc1_idx.c6
-rw-r--r--src/vc1_vlc.c6
-rw-r--r--src/x11/psb_coverlay.c4
-rw-r--r--src/x11/psb_ctexture.c161
-rw-r--r--src/x11/psb_x11.c79
-rw-r--r--src/x11/psb_x11.h4
-rw-r--r--src/x11/psb_xrandr.c12
-rw-r--r--src/x11/psb_xrandr.h4
-rw-r--r--src/x11/psb_xvva.c4
122 files changed, 4146 insertions, 2163 deletions
diff --git a/src/Android.mk b/src/Android.mk
index dc4af02..9ecf638 100644
--- a/src/Android.mk
+++ b/src/Android.mk
@@ -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.
@@ -52,6 +52,7 @@ LOCAL_SRC_FILES := \
psb_texstreaming.c \
psb_texture.c \
android/psb_output_android.c \
+ android/psb_HDMIExtMode.c \
android/psb_android_glue.cpp \
psb_surface.c \
psb_overlay.c \
@@ -70,22 +71,17 @@ LOCAL_SRC_FILES := \
pnw_hostheader.c \
pnw_hostjpeg.c \
pnw_jpeg.c \
- powervr_iep_lite/csc/csc2.c \
- powervr_iep_lite/csc/csc2_data.c \
- powervr_iep_lite/fixedpointmaths/fixedpointmaths.c \
- powervr_iep_lite/iep_lite/iep_lite_api.c \
- powervr_iep_lite/iep_lite/iep_lite_hardware.c \
- powervr_iep_lite/iep_lite/iep_lite_utils.c
+ pnw_rotate.c
LOCAL_CFLAGS := -DLINUX -DANDROID -g -Wall -Wno-unused
LOCAL_C_INCLUDES := \
+ $(TOPDIR)hardware/libhardware/include/hardware \
$(TOPDIR)hardware/intel/include \
$(TOPDIR)hardware/intel/include/eurasia/pvr2d \
$(TARGET_OUT_HEADERS)/libva \
- $(TOPDIR)hardware/intel/include/drm \
+ $(TOPDIR)hardware/intel/linux-2.6/include/drm \
$(TARGET_OUT_HEADERS)/libttm \
- $(TARGET_OUT_HEADERS)/libmemrar \
$(TARGET_OUT_HEADERS)/libwsbm \
$(TARGET_OUT_HEADERS)/libpsb_drm\
$(TARGET_OUT_HEADERS)/opengles \
@@ -99,7 +95,7 @@ LOCAL_C_INCLUDES := \
LOCAL_MODULE_TAGS := eng
LOCAL_MODULE := pvr_drv_video
-LOCAL_SHARED_LIBRARIES := libdl libdrm libwsbm libmemrar libpvr2d libcutils \
+LOCAL_SHARED_LIBRARIES := libdl libdrm libwsbm libpvr2d libcutils \
libui libutils libbinder libsurfaceflinger_client
ifeq ($(strip $(PSBVIDEO_LOG_ENABLE)),true)
diff --git a/src/Makefile.am b/src/Makefile.am
index dda4392..514935d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -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.
@@ -25,7 +25,7 @@
pvr_drv_video_la_LTLIBRARIES = pvr_drv_video.la
pvr_drv_video_ladir = /usr/lib/dri
pvr_drv_video_la_LDFLAGS = -lwsbm -pthread -module -avoid-version -Wl,--no-undefined
-pvr_drv_video_la_LIBADD = -ldrm -lX11 -lXrandr -lva-x11 -lXv -lm -lXext /usr/lib/libmemrar.a -lpvr2d
+pvr_drv_video_la_LIBADD = -ldrm -lX11 -lXrandr -lva-x11 -lXv -lm -lXext -lpvr2d
AM_CFLAGS = -DDEBUG -DLINUX -I$(top_srcdir)/src/hwdefs $(DRM_CFLAGS) \
-I$(top_srcdir)/src/powervr_iep_lite/include \
-I$(top_srcdir)/src/powervr_iep_lite/include/win32 \
@@ -39,20 +39,20 @@ pvr_drv_video_la_SOURCES = psb_drv_video.c object_heap.c psb_buffer.c psb_buffer
vc1_vlc.c vc1_idx.c psb_deblock.c \
lnc_H263ES.c lnc_H264ES.c lnc_MPEG4ES.c lnc_cmdbuf.c \
lnc_hostcode.c lnc_hostheader.c lnc_ospm.c psb_ws_driver.c \
- pnw_hostheader.c pnw_hostcode.c \
+ pnw_hostheader.c pnw_hostcode.c pnw_rotate.c\
pnw_cmdbuf.c pnw_H264ES.c pnw_H263ES.c pnw_MPEG4ES.c \
pnw_H264.c pnw_MPEG2.c pnw_MPEG4.c pnw_hostjpeg.c pnw_jpeg.c pnw_VC1.c\
psb_output.c psb_overlay.c psb_texture.c psb_texstreaming.c\
- x11/psb_x11.c x11/psb_coverlay.c x11/psb_xrandr.c x11/psb_xvva.c x11/psb_ctexture.c
+ x11/psb_x11.c x11/psb_coverlay.c x11/psb_xrandr.c x11/psb_xvva.c x11/psb_ctexture.c
# vc1_ap_i.c vc1_ap_p.c vc1_ap_utils.c vc1_bitplane.c \
-# vc1_shiftreg.c vc1_spmp.c vc1_utils.c
+# vc1_shiftreg.c vc1_spmp.c vc1_utils.c
CFLAGS = -O1 -Wall -ffloat-store -fvisibility=hidden
symbol_info: pvr_drv_video.la
objdump -T .libs/pvr_drv_video.so | grep UND | sort -k 5 > Linker_dependencies.txt
- objdump -T .libs/pvr_drv_video.so | grep -v UND | sort -k 5 > Linker_exports.txt
+ objdump -T .libs/pvr_drv_video.so | grep -v UND | sort -k 5 > Linker_exports.txt
#install-exec-am:
# -rm -f $(pvr_drv_video_ladir)/psb_drv_video.so
diff --git a/src/android/psb_HDMIExtMode.c b/src/android/psb_HDMIExtMode.c
new file mode 100644
index 0000000..4db32a8
--- /dev/null
+++ b/src/android/psb_HDMIExtMode.c
@@ -0,0 +1,233 @@
+/*
+ * Copyright (c) 2011 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:
+ * Jason Hu <jason.hu@intel.com>
+ */
+
+#include "psb_HDMIExtMode.h"
+#include "psb_output_android.h"
+#include "pvr2d.h"
+#include "psb_drv_video.h"
+
+#define INIT_DRIVER_DATA psb_driver_data_p driver_data = (psb_driver_data_p) ctx->pDriverData
+
+VAStatus psb_HDMIExt_get_prop(psb_android_output_p output,
+ unsigned short *xres, unsigned short *yres)
+{
+ psb_HDMIExt_info_p psb_HDMIExt_info = (psb_HDMIExt_info_p)output->psb_HDMIExt_info;
+
+ if (!psb_HDMIExt_info || !psb_HDMIExt_info->hdmi_extvideo_prop ||
+ (psb_HDMIExt_info->hdmi_extvideo_prop->ExtVideoMode == OFF)) {
+ psb__error_message("%s : Failed to get HDMI prop\n", __FUNCTION__);
+ return VA_STATUS_ERROR_UNKNOWN;
+ }
+ *xres = psb_HDMIExt_info->hdmi_extvideo_prop->ExtVideoMode_XRes;
+ *yres = psb_HDMIExt_info->hdmi_extvideo_prop->ExtVideoMode_YRes;
+
+ return VA_STATUS_SUCCESS;
+}
+
+psb_hdmi_mode psb_HDMIExt_get_mode(psb_android_output_p output)
+{
+ psb_HDMIExt_info_p psb_HDMIExt_info = (psb_HDMIExt_info_p)output->psb_HDMIExt_info;
+
+ if (!psb_HDMIExt_info) {
+ psb__error_message("%s : Failed to get HDMI mode\n", __FUNCTION__);
+ return VA_STATUS_ERROR_UNKNOWN;
+ }
+ return psb_HDMIExt_info->hdmi_mode;
+}
+
+VAStatus psb_HDMIExt_update(VADriverContextP ctx, psb_HDMIExt_info_p psb_HDMIExt_info)
+{
+ INIT_DRIVER_DATA;
+ drmModeCrtc *hdmi_crtc = NULL;
+ drmModeConnector *hdmi_connector = NULL;
+ drmModeEncoder *hdmi_encoder = NULL;
+ int width = 0, height = 0;
+ char *strHeight = NULL;
+ struct drm_lnc_video_getparam_arg arg;
+ int hdmi_state = 0;
+ static int hdmi_connected_frame = 0;
+
+ arg.key = IMG_VIDEO_GET_HDMI_STATE;
+ arg.value = (uint64_t)((unsigned int)&hdmi_state);
+ drmCommandWriteRead(driver_data->drm_fd, driver_data->getParamIoctlOffset,
+ &arg, sizeof(arg));
+
+ psb__information_message("%s : hdmi_state = %d\n", __FUNCTION__, hdmi_state);
+ if (hdmi_state == HDMI_MODE_EXT_VIDEO) {
+ psb_HDMIExt_info->hdmi_extvideo_prop->ExtVideoMode = EXTENDED_VIDEO;
+ psb_HDMIExt_info->hdmi_mode = EXTENDED_VIDEO;
+
+ if ((psb_HDMIExt_info->hdmi_extvideo_prop->ExtVideoMode_XRes == 0 ||
+ psb_HDMIExt_info->hdmi_extvideo_prop->ExtVideoMode_YRes == 0)) {
+ psb_extvideo_prop_p hdmi_extvideo_prop = psb_HDMIExt_info->hdmi_extvideo_prop;
+
+ hdmi_connector = drmModeGetConnector(driver_data->drm_fd, psb_HDMIExt_info->hdmi_connector_id);
+ if (!hdmi_connector) {
+ psb__error_message("%s : Failed to get hdmi connector\n", __FUNCTION__);
+ return VA_STATUS_ERROR_UNKNOWN;
+ }
+
+ hdmi_encoder = drmModeGetEncoder(driver_data->drm_fd, hdmi_connector->encoder_id);
+ if (!hdmi_encoder) {
+ psb__error_message("%s : Failed to get hdmi encoder\n", __FUNCTION__);
+ return VA_STATUS_ERROR_UNKNOWN;
+ }
+
+ hdmi_crtc = drmModeGetCrtc(driver_data->drm_fd, hdmi_encoder->crtc_id);
+ if (!hdmi_crtc) {
+ /* No CRTC attached to HDMI. */
+ psb__error_message("%s : Failed to get hdmi crtc\n", __FUNCTION__);
+ return VA_STATUS_ERROR_UNKNOWN;
+ }
+
+ strHeight = strstr(hdmi_crtc->mode.name, "x");
+ hdmi_extvideo_prop->ExtVideoMode_XRes = (unsigned short)atoi(hdmi_crtc->mode.name);
+ hdmi_extvideo_prop->ExtVideoMode_YRes = (unsigned short)atoi(strHeight + 1);
+ psb__information_message("%s : size = %d x %d\n", __FUNCTION__,
+ hdmi_extvideo_prop->ExtVideoMode_XRes, hdmi_extvideo_prop->ExtVideoMode_YRes);
+ drmModeFreeCrtc(hdmi_crtc);
+ drmModeFreeEncoder(hdmi_encoder);
+ drmModeFreeConnector(hdmi_connector);
+ }
+ } else if (hdmi_state == HDMI_MODE_OFF) {
+ psb_HDMIExt_info->hdmi_extvideo_prop->ExtVideoMode = OFF;
+ psb_HDMIExt_info->hdmi_mode = OFF;
+ hdmi_connected_frame = 0;
+ } else {
+ psb_HDMIExt_info->hdmi_extvideo_prop->ExtVideoMode = UNDEFINED;
+ psb_HDMIExt_info->hdmi_mode = UNDEFINED;
+ }
+
+ return VA_STATUS_SUCCESS;
+}
+
+psb_HDMIExt_info_p psb_HDMIExt_init(VADriverContextP ctx, psb_android_output_p output)
+{
+ INIT_DRIVER_DATA;
+ drmModeRes *resources;
+ drmModeConnector *connector = NULL;
+ drmModeEncoder *mipi_encoder = NULL;
+ drmModeCrtc *mipi_crtc = NULL;
+ int mipi_connector_id = 0, mipi_encoder_id = 0, mipi_crtc_id = 0, i;
+ psb_HDMIExt_info_p psb_HDMIExt_info = NULL;
+
+ psb_HDMIExt_info = (psb_HDMIExt_info_p)calloc(1, sizeof(psb_HDMIExt_info_s));
+ if (!psb_HDMIExt_info) {
+ psb__error_message("%s : Failed to create psb_HDMIExt_info.\n", __FUNCTION__);
+ return NULL;
+ }
+ memset(psb_HDMIExt_info, 0, sizeof(psb_HDMIExt_info_s));
+
+ psb_HDMIExt_info->hdmi_extvideo_prop = (psb_extvideo_prop_p)calloc(1, sizeof(psb_extvideo_prop_s));
+ if (!psb_HDMIExt_info->hdmi_extvideo_prop) {
+ psb__error_message("%s : Failed to create hdmi_extvideo_prop.\n", __FUNCTION__);
+ return NULL;
+ }
+ memset(psb_HDMIExt_info->hdmi_extvideo_prop, 0, sizeof(psb_extvideo_prop_s));
+
+ /*Get Resources.*/
+ resources = drmModeGetResources(driver_data->drm_fd);
+ if (!resources) {
+ psb__error_message("%s : drmModeGetResources failed.\n", __FUNCTION__);
+ goto exit;
+ }
+
+ /*Get MIPI and HDMI connector id.*/
+ for (i = 0; i < resources->count_connectors; i++) {
+ connector = drmModeGetConnector(driver_data->drm_fd, resources->connectors[i]);
+
+ if (!connector) {
+ psb__error_message("%s : Failed to get connector %i\n", __FUNCTION__,
+ resources->connectors[i]);
+ continue;
+ }
+
+ if (connector->connector_type == DRM_MODE_CONNECTOR_DVID)
+ psb_HDMIExt_info->hdmi_connector_id = connector->connector_id;
+
+ if ((connector->connector_type == /*DRM_MODE_CONNECTOR_MIPI*/15) &&
+ (!mipi_connector_id)) {
+ mipi_connector_id = connector->connector_id;
+ mipi_encoder_id = connector->encoder_id;
+ }
+
+ drmModeFreeConnector(connector);
+ }
+
+ if (!mipi_connector_id ||
+ !psb_HDMIExt_info->hdmi_connector_id ||
+ !mipi_encoder_id) {
+ psb__error_message("%s : Failed to get connector id or mipi encoder id. mipi_connector_id=%d, hdmi_connector_id=%d, mipi_encoder_id=%d\n", __FUNCTION__,
+ mipi_connector_id, psb_HDMIExt_info->hdmi_connector_id, mipi_encoder_id);
+ goto exit;
+ }
+
+ mipi_encoder = drmModeGetEncoder(driver_data->drm_fd, mipi_encoder_id);
+ if (!mipi_encoder) {
+ psb__error_message("%s : Failed to get mipi encoder %i\n", __FUNCTION__);
+ goto exit;
+ }
+
+ psb_HDMIExt_info->mipi_crtc_id = mipi_encoder->crtc_id;
+ psb__information_message("%s : mipi_crtc_id = %d\n", __FUNCTION__,
+ mipi_crtc_id);
+
+ drmModeFreeEncoder(mipi_encoder);
+
+ if (psb_HDMIExt_update(ctx, psb_HDMIExt_info))
+ goto exit;
+
+ if (resources)
+ drmModeFreeResources(resources);
+
+ return psb_HDMIExt_info;
+
+exit:
+ if (resources)
+ drmModeFreeResources(resources);
+
+ if (connector)
+ drmModeFreeConnector(connector);
+
+ free(psb_HDMIExt_info);
+
+ return NULL;
+}
+
+VAStatus psb_HDMIExt_deinit(psb_android_output_p output)
+{
+ psb_HDMIExt_info_p psb_HDMIExt_info = (psb_HDMIExt_info_p)output->psb_HDMIExt_info;
+
+ if (psb_HDMIExt_info->hdmi_extvideo_prop)
+ free(psb_HDMIExt_info->hdmi_extvideo_prop);
+
+ if (psb_HDMIExt_info)
+ free(psb_HDMIExt_info);
+
+ return VA_STATUS_SUCCESS;
+}
+
diff --git a/src/android/psb_HDMIExtMode.h b/src/android/psb_HDMIExtMode.h
new file mode 100644
index 0000000..91e4183
--- /dev/null
+++ b/src/android/psb_HDMIExtMode.h
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2011 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:
+ * Jason Hu <jason.hu@intel.com>
+ */
+
+#ifndef _PSB_HDMIEXTMODE_H_
+#define _PSB_HDMIEXTMODE_H_
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include "va/va.h"
+#include "va/va_backend.h"
+#include "xf86drm.h"
+#include "xf86drmMode.h"
+#include "psb_output_android.h"
+
+#define DRM_MODE_CONNECTOR_MIPI 15
+#define HDMI_MODE_OFF 0
+#define HDMI_MODE_CLONE 1
+#define HDMI_MODE_EXT_VIDEO 2
+#define HDMI_MODE_EXT_DESKTOP 3
+#define HDMI_MODE_CLONE_ROTATION 4
+
+typedef enum _psb_hdmi_mode {
+ OFF,
+ CLONE,
+ EXTENDED_VIDEO,
+ EXTENDED_DESKTOP,
+ UNDEFINED,
+} psb_hdmi_mode;
+
+typedef struct _psb_extvideo_prop_s {
+ psb_hdmi_mode ExtVideoMode;
+
+ unsigned short ExtVideoMode_XRes;
+ unsigned short ExtVideoMode_YRes;
+ short ExtVideoMode_X_Offset;
+ short ExtVideoMode_Y_Offset;
+} psb_extvideo_prop_s, *psb_extvideo_prop_p;
+
+typedef struct _psb_HDMIExt_info_s {
+ /*MIPI infos*/
+ uint32_t mipi_crtc_id;
+ /*hdmi infos*/
+ uint32_t hdmi_connector_id;
+ uint32_t hdmi_encoder_id;
+ uint32_t hdmi_crtc_id;
+
+ psb_hdmi_mode hdmi_mode;
+ psb_extvideo_prop_p hdmi_extvideo_prop;
+} psb_HDMIExt_info_s, *psb_HDMIExt_info_p;
+
+VAStatus psb_HDMIExt_get_prop(psb_android_output_p output, unsigned short *xres, unsigned short *yres);
+
+psb_hdmi_mode psb_HDMIExt_get_mode(psb_android_output_p output);
+VAStatus psb_HDMIExt_update(VADriverContextP ctx, psb_HDMIExt_info_p psb_HDMIExt_info);
+
+psb_HDMIExt_info_p psb_HDMIExt_init(VADriverContextP ctx, psb_android_output_p output);
+VAStatus psb_HDMIExt_deinit(psb_android_output_p output);
+
+#endif /* _PSB_HDMIEXTMODE_H_*/
diff --git a/src/android/psb_android_glue.cpp b/src/android/psb_android_glue.cpp
index 981747e..459fa27 100644..100755
--- a/src/android/psb_android_glue.cpp
+++ b/src/android/psb_android_glue.cpp
@@ -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.
@@ -35,15 +35,24 @@
#include <surfaceflinger/Surface.h>
#include <surfaceflinger/ISurface.h>
#include <surfaceflinger/SurfaceComposerClient.h>
+#include <surfaceflinger/ISurfaceComposer.h>
#include <binder/MemoryHeapBase.h>
#include "psb_android_glue.h"
#include "psb_texstreaming.h"
#include <cutils/log.h>
+#include <ui/Rect.h>
using namespace android;
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "pvr_drv_video"
+
sp<ISurface> isurface;
ISurface::BufferHeap mBufferHeap;
+unsigned int update_forced;
unsigned char* psb_android_registerBuffers(void** android_isurface, int pid, int width, int height)
{
@@ -86,25 +95,27 @@ int psb_android_register_isurface(void** android_isurface, int bcd_id, int srcw,
isurface = static_cast<ISurface*>(*android_isurface);
if (isurface.get()) {
isurface->createTextureStreamSource();
- LOGD("In psb_android_register_isurface: buffer_device_id is %d.\n", bcd_id);
+ LOGD("In psb_android_register_isurface: buffer_device_id is %d, srcw is %d, srch is %d.\n", bcd_id, srcw, srch);
isurface->setTextureStreamID(bcd_id);
+ isurface->setTextureStreamDim(srcw, srch);
+ isurface->resetTextureStreamParams();
+ update_forced = 1;
return 0;
} else {
return -1;
}
}
+ update_forced = 0;
return 0;
}
-void psb_android_texture_streaming_set_crop(short srcx,
- short srcy,
- unsigned short srcw,
+void psb_android_texture_streaming_set_texture_dim(unsigned short srcw,
unsigned short srch)
{
- static short saved_srcx, saved_srcy, saved_srcw, saved_srch;
+ static short saved_srcw, saved_srch;
if (isurface.get() &&
- ((saved_srcx != srcx) || (saved_srcy != srcy) || (saved_srcw != srcw) || (saved_srch != srch))) {
- isurface->setTextureStreamClipRect(srcx, srcy, srcw, srch);
+ (update_forced || (saved_srcw != srcw) || (saved_srch != srch))) {
+#if 0
/*
Resolve issue - Green line in the bottom of display while video is played
This issue is caused by the buffer size larger than video size and texture linear filtering.
@@ -114,6 +125,26 @@ void psb_android_texture_streaming_set_crop(short srcx,
isurface->setTextureStreamDim(srcw, srch);
else
isurface->setTextureStreamDim(srcw, srch - 1);
+#else
+ LOGD("In psb_android_texture_streaming_set_texture_dim: srcw is %d, srch is %d.\n", srcw, srch);
+ /*surface flinger will do the upper height correction*/
+ isurface->setTextureStreamDim(srcw, srch);
+#endif
+ saved_srcw = srcw;
+ saved_srch = srch;
+ }
+}
+
+void psb_android_texture_streaming_set_crop(short srcx,
+ short srcy,
+ unsigned short srcw,
+ unsigned short srch)
+{
+ static short saved_srcx, saved_srcy, saved_srcw, saved_srch;
+ if (isurface.get() &&
+ (update_forced || (saved_srcx != srcx) || (saved_srcy != srcy) || (saved_srcw != srcw) || (saved_srch != srch))) {
+ /*assume crop will only be called from app layer*/
+ isurface->setTextureStreamClipRect(srcx, srcy, srcw, srch);
saved_srcx = srcx;
saved_srcy = srcy;
saved_srcw = srcw;
@@ -121,6 +152,14 @@ void psb_android_texture_streaming_set_crop(short srcx,
}
}
+
+void psb_android_texture_streaming_set_rotate(int rotate)
+{
+ if (isurface.get()) {
+ isurface->setTextureStreamRotate(rotate);
+ }
+}
+
void psb_android_texture_streaming_set_blend(short destx,
short desty,
unsigned short destw,
@@ -132,8 +171,8 @@ void psb_android_texture_streaming_set_blend(short destx,
static unsigned short saved_destx, saved_desty, saved_destw, saved_desth;
static unsigned int saved_background_color, saved_blend_color;
static int saved_blend_mode = -1;
- unsigned short bg_red, bg_green, bg_blue, bg_alpha;
- unsigned short blend_red, blend_green, blend_blue, blend_alpha;
+ unsigned short bg_red = 0, bg_green = 0, bg_blue = 0, bg_alpha = 0;
+ unsigned short blend_red = 0, blend_green = 0, blend_blue = 0, blend_alpha = 0;
if (saved_background_color != background_color) {
bg_alpha = (background_color & 0xff000000) >> 24;
@@ -152,33 +191,87 @@ void psb_android_texture_streaming_set_blend(short destx,
}
if (isurface.get()) {
- if ((saved_destx != destx) || (saved_desty != desty) || (saved_destw != destw) || (saved_desth != desth)) {
+ if (update_forced || (saved_destx != destx) || (saved_desty != desty) || (saved_destw != destw) || (saved_desth != desth)) {
isurface->setTextureStreamPosRect(destx, desty, destw, desth);
saved_destx = destx;
saved_desty = desty;
saved_destw = destw;
saved_desth = desth;
}
- if (saved_background_color != background_color)
+ if (update_forced || (saved_background_color != background_color))
isurface->setTextureStreamBorderColor(bg_red, bg_green, bg_blue, bg_alpha);
- if (saved_blend_color != blend_color)
+ if (update_forced || (saved_blend_color != blend_color))
isurface->setTextureStreamVideoColor(blend_red, blend_green, blend_blue, blend_alpha);
- if (saved_blend_mode != blend_mode) {
+ if (update_forced || (saved_blend_mode != blend_mode)) {
isurface->setTextureStreamBlendMode(blend_mode);
saved_blend_mode = blend_mode;
}
}
}
+void psb_android_texture_streaming_set_background_color(unsigned int background_color)
+{
+ unsigned short bg_red, bg_green, bg_blue, bg_alpha;
+
+ bg_alpha = (background_color & 0xff000000) >> 24;
+ bg_red = (background_color & 0xff0000) >> 16;
+ bg_green = (background_color & 0xff00) >> 8;
+ bg_blue = background_color & 0xff;
+
+ if (isurface.get()) {
+ isurface->setTextureStreamPosRect(0, 0, 0, 0);
+ isurface->setTextureStreamBorderColor(bg_red, bg_green, bg_blue, bg_alpha);
+ }
+}
+
void psb_android_texture_streaming_display(int buffer_index)
{
if (isurface.get())
isurface->displayTextureStreamBuffer(buffer_index);
}
+void psb_android_texture_streaming_resetParams()
+{
+ if (isurface.get()) {
+ isurface->resetTextureStreamParams();
+ }
+}
+
void psb_android_texture_streaming_destroy()
{
if (isurface.get())
isurface->destroyTextureStreamSource();
+ isurface = NULL;
}
+int psb_android_surfaceflinger_status(void** android_isurface, int *sf_compositioin, int *rotation, int *widi)
+{
+ sp<ISurface> tmp_isurface;
+
+ tmp_isurface = static_cast<ISurface*>(*android_isurface);
+ if (tmp_isurface.get()) {
+ uint32_t pm = tmp_isurface->getVideoPostMethod();
+
+ if ((pm & 0xff) == ISurfaceComposer::eVideoPostOverlay)
+ *sf_compositioin = 0; /* no composition */
+ else
+ *sf_compositioin = 1; /* with composition */
+ *rotation = (pm >> 8) & 0xff;
+ *widi = (pm >> 16) & 0xff;
+ }
+
+ return 0;
+}
+
+void psb_android_get_destbox(short* destx, short* desty, unsigned short* destw, unsigned short* desth)
+{
+ if (isurface.get()) {
+ Rect pm = isurface->getVisibleRect();
+ *destx = pm.left;
+ *desty = pm.top;
+ *destw = pm.width();
+ *desth = pm.height();
+ }
+}
+
+
diff --git a/src/android/psb_android_glue.h b/src/android/psb_android_glue.h
index ff8e151..c9904c2 100644..100755
--- a/src/android/psb_android_glue.h
+++ b/src/android/psb_android_glue.h
@@ -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.
@@ -28,9 +28,9 @@
#ifdef __cplusplus
-extern "C" {
+extern "C"
+{
#endif
-
unsigned char* psb_android_registerBuffers(void** surface, int pid, int width, int height);
void psb_android_postBuffer(int offset);
@@ -39,6 +39,11 @@ extern "C" {
void psb_android_texture_streaming_display(int buffer_index);
+ void psb_android_texture_streaming_set_texture_dim(unsigned short srcw,
+ unsigned short srch);
+
+ void psb_android_texture_streaming_set_rotate(int rotate);
+
void psb_android_texture_streaming_set_crop(short srcx,
short srcy,
unsigned short srcw,
@@ -52,9 +57,17 @@ extern "C" {
unsigned int blend_color,
unsigned short blend_mode);
+ void psb_android_texture_streaming_set_background_color(unsigned int background_color);
+ void psb_android_texture_streaming_resetParams();
void psb_android_texture_streaming_destroy();
int psb_android_register_isurface(void** surface, int bcd_id, int srcw, int srch);
+ int psb_android_surfaceflinger_status(void** surface, int *sf_compostion, int *rotation, int *widi);
+
+ void psb_android_get_destbox(short* destx, short* desty, unsigned short* destw, unsigned short* desth);
+ int psb_android_dynamic_source_init(void** android_isurface, int bcd_id, uint32_t srcw, uint32_t srch, uint32_t stride);
+ void psb_android_dynamic_source_display(int buffer_index, int hdmi_mode);
+ void psb_android_dynamic_source_destroy();
#ifdef __cplusplus
}
diff --git a/src/android/psb_output_android.c b/src/android/psb_output_android.c
index 1a6466f..2b2072a 100644
--- a/src/android/psb_output_android.c
+++ b/src/android/psb_output_android.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.
@@ -38,10 +38,14 @@
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
-#include <cutils/log.h>
#include "psb_android_glue.h"
#include "psb_texstreaming.h"
+#include "psb_output_android.h"
+#include "psb_HDMIExtMode.h"
+#include "pnw_rotate.h"
#include <wsbm/wsbm_manager.h>
+#include <psb_drm.h>
+#include <hardware.h>
#define INIT_DRIVER_DATA psb_driver_data_p driver_data = (psb_driver_data_p) ctx->pDriverData;
#define INIT_OUTPUT_PRIV psb_android_output_p output = (psb_android_output_p)(((psb_driver_data_p)ctx->pDriverData)->ws_priv)
@@ -52,38 +56,55 @@
#define SUBPIC(id) ((object_subpic_p) object_heap_lookup( &driver_data->subpic_heap, id ))
#define CONTEXT(id) ((object_context_p) object_heap_lookup( &driver_data->context_heap, id ))
+#define GET_SURFACE_INFO_rotate(psb_surface) ((int) psb_surface->extra_info[5])
+#define GET_SURFACE_INFO_protect(psb_surface) ((int) psb_surface->extra_info[6])
+#define MAX_OVERLAY_IDLE_FRAME 4
-typedef struct _psb_android_output_s {
- /* information of output display */
- unsigned short screen_width;
- unsigned short screen_height;
+enum {
+ eWidiOff = 1,
+ eWidiClone = 2,
+ eWidiExtendedVideo = 3,
+};
+extern unsigned int update_forced;
- /* for memory heap base used by putsurface */
- unsigned char* heap_addr;
-} psb_android_output_s, *psb_android_output_p;
+inline int va2hw_rotation(int va_rotate)
+{
+ switch (va_rotate) {
+ case VA_ROTATION_90:
+ return HAL_TRANSFORM_ROT_270;
+ case VA_ROTATION_180:
+ return HAL_TRANSFORM_ROT_180;
+ case VA_ROTATION_270:
+ return HAL_TRANSFORM_ROT_90;
+defaut:
+ return 0;
+ }
+ return 0;
+}
-void *psb_android_output_init(VADriverContextP ctx)
+unsigned char *psb_android_output_init(VADriverContextP ctx)
{
INIT_DRIVER_DATA;
char put_surface[1024];
struct drm_psb_register_rw_arg regs;
psb_android_output_p output = calloc(1, sizeof(psb_android_output_s));
-
- struct fb_var_screeninfo vinfo = {0};
+ struct fb_var_screeninfo vinfo;
int fbfd = -1;
int ret;
if (output == NULL) {
psb__error_message("Can't malloc memory\n");
- return VA_STATUS_ERROR_ALLOCATION_FAILED;
+ return NULL;
}
+ memset(output, 0, sizeof(psb_android_output_s));
/* Guess the screen size */
output->screen_width = 800;
output->screen_height = 480;
// Open the frame buffer for reading
+ memset(&vinfo, 0, sizeof(vinfo));
fbfd = open("/dev/graphics/fb0", O_RDONLY);
if (fbfd) {
if (ioctl(fbfd, FBIOGET_VSCREENINFO, &vinfo))
@@ -95,36 +116,45 @@ void *psb_android_output_init(VADriverContextP ctx)
/* TS by default */
driver_data->output_method = PSB_PUTSURFACE_TEXSTREAMING;
- driver_data->color_key = 0x0; /*black*/
-
- /* Init CTEXTURE for vaPutSurfaceBuf */
- driver_data->ctexture = 1;
+ driver_data->color_key = 0x000001; /*light blue*/
+ driver_data->overlay_idle_frame = 1;
- if (psb_parse_config("PSB_VIDEO_COVERLAY", &put_surface[0]) == 0) {
- psb__information_message("Putsurface use client overlay\n");
- driver_data->output_method = PSB_PUTSURFACE_FORCE_COVERLAY;
+ if (psb_parse_config("PSB_VIDEO_CTEXTURES", &put_surface[0]) == 0) {
+ psb__information_message("PSB_VIDEO_CTEXTURES is enabled for vaPutSurfaceBuf\n");
+ driver_data->ctexture = 1; /* Init CTEXTURE for vaPutSurfaceBuf */
}
+ if (psb_parse_config("PSB_VIDEO_TS", &put_surface[0]) == 0) {
+ psb__information_message("Putsurface use texstreaming\n");
+ driver_data->output_method = PSB_PUTSURFACE_FORCE_TEXSTREAMING;
+ }
- if (getenv("PSB_VIDEO_COVERLAY")) {
+ if (psb_parse_config("PSB_VIDEO_COVERLAY", &put_surface[0]) == 0) {
psb__information_message("Putsurface use client overlay\n");
driver_data->output_method = PSB_PUTSURFACE_FORCE_COVERLAY;
}
- /*Alway init coverlay for MDFLD*/
- if (IS_MFLD(driver_data))
+
+ if (IS_MFLD(driver_data)) {
driver_data->coverlay = 1;
- /*set PIPEB(HDMI)source format as RGBA*/
- memset(&regs, 0, sizeof(regs));
- regs.subpicture_enable_mask = REGRWBITS_DSPBCNTR;
- drmCommandWriteRead(driver_data->drm_fd, DRM_PSB_REGISTER_RW, &regs, sizeof(regs));
+ output->psb_HDMIExt_info = psb_HDMIExt_init(ctx, output);
+ if (!output->psb_HDMIExt_info) {
+ psb__error_message("Failed to init psb_HDMIExt.\n");
+ free(output);
+ return NULL;
+ }
+ }
- return output;
+ return (unsigned char *)output;
}
VAStatus psb_android_output_deinit(VADriverContextP ctx)
{
+ INIT_DRIVER_DATA;
INIT_OUTPUT_PRIV;
//psb_android_output_p output = GET_OUTPUT_DATA(ctx);
+ if (IS_MFLD(driver_data)) {
+ psb_HDMIExt_deinit(output);
+ }
return VA_STATUS_SUCCESS;
}
@@ -153,34 +183,19 @@ static VAStatus psb_putsurface_ctexture(
obj_surface = SURFACE(surface);
psb_surface = obj_surface->psb_surface;
-// psb_surface->buf.drm_buf;
-// psb_surface->buf.pl_flags;
-
-#if 0
- printf("pl_flags %x\n", psb_surface->buf.pl_flags);
-
- printf("FIXME: not sure how Android app handle rotation?\n"
- "need to revise width & height here?\n");
-
- printf("FIXME: need to prepare a rotation/RAR surface here?\n");
-
- printf("FIXME: camera preview surface is different, all is \n"
- "just one buffer, so a pre_add is needed\n");
- psb__error_message("srcx %d, srcy %d, srcw %d, srch %d, destx %d, desty %d, destw %d,\n"
- "desth %d, width %d height %d, stride %d drm_buf %x\n",
- srcx, srcy, srcw, srch, destx, desty, destw, desth, obj_surface->width,
- obj_surface->height, psb_surface->stride, psb_surface->buf.drm_buf);
-#endif
- psb_putsurface_textureblit(ctx, data, surface, srcx, srcy, srcw, srch, destx, desty, destw, desth,
+ // psb_surface->buf.drm_buf;
+ // psb_surface->buf.pl_flags;
+ psb_putsurface_textureblit(ctx, data, surface, srcx, srcy, srcw, srch,
+ destx, desty, destw, desth, 0, /* no subtitle */
obj_surface->width, obj_surface->height,
psb_surface->stride, psb_surface->buf.drm_buf,
- psb_surface->buf.pl_flags);
+ psb_surface->buf.pl_flags, 1 /* need wrap dst */);
psb_android_postBuffer(offset);
+
return VA_STATUS_SUCCESS;
}
-
VAStatus psb_putsurface_coverlay(
VADriverContextP ctx,
VASurfaceID surface,
@@ -221,6 +236,8 @@ VAStatus psb_putsurface_coverlay(
destw = _destw;
desth = _desth;
+ psb__information_message("psb_putsurface_overlay: src (%d, %d, %d, %d), destx (%d, %d, %d, %d).\n",
+ srcx, srcy, srcw, srch, destx, desty, destw, desth);
/* display by overlay */
vaStatus = psb_putsurface_overlay(
ctx, surface, srcx, srcy, srcw, srch,
@@ -230,11 +247,12 @@ VAStatus psb_putsurface_coverlay(
return vaStatus;
}
-VAStatus psb_PutSurfaceBuf(
+
+VAStatus psb_putsurface_ts(
VADriverContextP ctx,
VASurfaceID surface,
- unsigned char* data,
- int* data_len,
+ unsigned char *android_isurface,
+ int buffer_index,
short srcx,
short srcy,
unsigned short srcw,
@@ -251,20 +269,253 @@ VAStatus psb_PutSurfaceBuf(
INIT_DRIVER_DATA;
INIT_OUTPUT_PRIV;
object_surface_p obj_surface = SURFACE(surface);
- int offset = 0;
- psb_surface_p psb_surface;
- obj_surface = SURFACE(surface);
- psb_surface = obj_surface->psb_surface;
+ if (driver_data->overlay_idle_frame == 0) {
+ psb_android_texture_streaming_resetParams();
+ update_forced = 1;
+ }
- psb_putsurface_textureblit(ctx, data, surface, srcx, srcy, srcw, srch, destx, desty, destw, desth,
- obj_surface->width, obj_surface->height,
- psb_surface->stride, psb_surface->buf.drm_buf,
- psb_surface->buf.pl_flags);
+ /* blend/positioning setting can be called by app directly, or enable VA_ENABLE_BLEND flag to let driver call */
+ if (flags & VA_ENABLE_BLEND)
+ psb_android_texture_streaming_set_blend(destx, desty, destw, desth,
+ driver_data->clear_color,
+ driver_data->blend_color,
+ driver_data->blend_mode);
+ /*cropping can be also used for dynamic resolution change feature, only high to low resolution*/
+ /*by default, srcw and srch is set to video width and height*/
+ if ((0 == srcw) || (0 == srch)) {
+ srcw = obj_surface->width;
+ srch = obj_surface->height_origin;
+ }
+ psb_android_texture_streaming_set_texture_dim(srcw, srch);
+ if (driver_data->va_rotate)
+ psb_android_texture_streaming_set_rotate(va2hw_rotation(driver_data->va_rotate));
+
+#if 0
+ /* use cliprect for crop */
+ if (cliprects && (number_cliprects == 1))
+ psb_android_texture_streaming_set_crop(cliprects->x, cliprects->y, cliprects->width, cliprects->height);
+#endif
+
+ psb_android_texture_streaming_display(buffer_index);
+
+ driver_data->overlay_idle_frame++;
+ update_forced = 0;
+
+ /* current surface is being displayed */
+ if (driver_data->cur_displaying_surface != VA_INVALID_SURFACE)
+ driver_data->last_displaying_surface = driver_data->cur_displaying_surface;
+
+ obj_surface->display_timestamp = GetTickCount();
+ driver_data->cur_displaying_surface = surface;
return VA_STATUS_SUCCESS;
}
+
+static int psb_update_destbox(
+ VADriverContextP ctx
+)
+{
+ INIT_DRIVER_DATA;
+ INIT_OUTPUT_PRIV;
+ short destx;
+ short desty;
+ unsigned short destw;
+ unsigned short desth;
+ VAStatus vaStatus = VA_STATUS_SUCCESS;
+
+ psb_android_get_destbox(&destx, &desty, &destw, &desth);
+ /*psb__information_message("destbox = (%d,%d,%d,%d)\n", destx, desty, destw, desth);*/
+ if ((destx >= 0) && (desty >= 0) &&
+ ((destx + destw) <= output->screen_width) &&
+ ((desty + desth) <= output->screen_height) &&
+ (output->destx != destx ||
+ output->desty != desty ||
+ output->destw != destw ||
+ output->desth != desth)) {
+ output->destx = destx;
+ output->desty = desty;
+ output->destw = destw;
+ output->desth = desth;
+ output->new_destbox = 1;
+
+ LOGD("==========New Destbox=============\n");
+ LOGD("output->destbox = (%d,%d,%d,%d)\n", output->destx, output->desty, output->destw, output->desth);
+ }
+
+ return vaStatus;
+}
+
+static int psb_check_outputmethod(
+ VADriverContextP ctx,
+ VASurfaceID surface,
+ unsigned short srcw,
+ unsigned short srch,
+ void *android_isurface,
+ psb_hdmi_mode *hdmi_mode
+)
+{
+ INIT_DRIVER_DATA;
+ INIT_OUTPUT_PRIV;
+ psb_HDMIExt_info_p psb_HDMIExt_info = (psb_HDMIExt_info_p)output->psb_HDMIExt_info;
+ object_surface_p obj_surface;
+ int rotation = 0, widi = 0;
+ int delta_rotation = 0;
+ int srf_rotate; /* primary surface rotation */
+ psb_surface_p rotate_surface; /* rotate surface */
+ int rotate_srf_rotate = -1; /* degree of the rotate surface */
+
+ if ((srcw >= 2048) || (srch >= 2048)) {
+ psb__information_message("Clip size extend overlay hw limit, use texstreaming\n");
+ driver_data->output_method = PSB_PUTSURFACE_TEXSTREAMING;
+ return 0;
+ }
+
+ /* use saved status to avoid per-frame checking */
+ if ((driver_data->frame_count % driver_data->outputmethod_checkinterval) != 0) {
+ *hdmi_mode = psb_HDMIExt_get_mode(output);
+ return 0;
+ }
+
+ /* check the status at outputmethod_checkinterval frequency */
+ /* at first check HDMI status */
+ if (psb_HDMIExt_update(ctx, psb_HDMIExt_info)) {
+ psb__error_message("%s: Failed to update HDMIExt info.\n", __FUNCTION__);
+ return -1;
+ }
+
+ *hdmi_mode = psb_HDMIExt_get_mode(output);
+ if ((*hdmi_mode == EXTENDED_VIDEO) || (*hdmi_mode == CLONE)) {
+ unsigned short _destw, _desth;
+ short _pos_x, _pos_y;
+ unsigned short crtc_width = 0, crtc_height = 0;
+ float _slope_xy;
+
+ /* need to handle VA rotation, and set WM rotate to 0
+ * for Android, MIPI0/HDMI has the same WM rotation always
+ */
+ if (driver_data->mipi0_rotation != 0) {
+ driver_data->mipi0_rotation = 0;
+ driver_data->hdmi_rotation = 0;
+ output->new_destbox = 1;
+ psb_RecalcRotate(ctx);
+ }
+
+ psb_HDMIExt_get_prop(output, &crtc_width, &crtc_height);
+
+ /*recalculate the render box to fit the ratio of height/width*/
+ if ((driver_data->extend_rotation == VA_ROTATION_90) ||
+ (driver_data->extend_rotation == VA_ROTATION_270))
+ _slope_xy = (float)srcw / srch;
+ else
+ _slope_xy = (float)srch / srcw;
+
+ _destw = (short)(crtc_height / _slope_xy);
+ _desth = (short)(crtc_width * _slope_xy);
+ if (_destw <= crtc_width) {
+ _desth = crtc_height;
+ _pos_x = (crtc_width - _destw) >> 1;
+ _pos_y = 0;
+ } else {
+ _destw = crtc_width;
+ _pos_x = 0;
+ _pos_y = (crtc_height - _desth) >> 1;
+ }
+ driver_data->render_rect.x = _pos_x;
+ driver_data->render_rect.y = _pos_y;
+ driver_data->render_rect.width = _destw;
+ driver_data->render_rect.height = _desth;
+ psb__information_message("HDMI mode is on (%d), Render Rect: (%d,%d,%d,%d)\n",
+ *hdmi_mode,
+ driver_data->render_rect.x, driver_data->render_rect.y,
+ driver_data->render_rect.width, driver_data->render_rect.height);
+ return 0;
+ }
+
+ /*Update output destbox using layerbuffer's visible region*/
+ psb_update_destbox(ctx);
+
+ if ((driver_data->output_method == PSB_PUTSURFACE_FORCE_COVERLAY)
+ || (driver_data->output_method == PSB_PUTSURFACE_FORCE_TEXSTREAMING))
+ return 0;
+
+ /*If overlay can not get correct destbox, use texstreaming.*/
+ if (output->destw == 0 || output->desth == 0 ||
+ ((output->destw == srcw) && (output->desth == srch))) {
+ psb__information_message("No proper destbox, use texstreaming (%dx%d+%d+%d)\n",
+ output->destw, output->desth, output->destx, output->desty);
+ driver_data->output_method = PSB_PUTSURFACE_TEXSTREAMING;
+ return 0;
+ }
+
+ /* HDMI is not enabled */
+ psb_android_surfaceflinger_status(android_isurface, &output->sf_composition, &rotation, &widi);
+ if (widi == eWidiClone) {
+ psb__information_message("WIDI in clone mode, use texstreaming\n");
+ driver_data->output_method = PSB_PUTSURFACE_TEXSTREAMING;
+ driver_data->msvdx_rotate_want = 0;/* disable msvdx rotae */
+
+ return 0;
+ }
+ if (widi == eWidiExtendedVideo) {
+ psb__information_message("WIDI in extend video mode, disable local displaying\n");
+ driver_data->output_method = PSB_PUTSURFACE_NONE;
+ driver_data->msvdx_rotate_want = 0;/* disable msvdx rotae */
+
+ return 0;
+ }
+
+ /* only care local rotation */
+ delta_rotation = Rotation2Angle(driver_data->mipi0_rotation) - Rotation2Angle(rotation);
+ if ((((abs(delta_rotation) == 90) || (abs(delta_rotation) == 270)) && output->new_destbox) ||
+ (abs(delta_rotation) == 180)) {
+ psb__information_message("New rotation degree %d of MIPI0 WM, Recalc rotation\n", rotation);
+ driver_data->mipi0_rotation = rotation;
+ driver_data->hdmi_rotation = rotation;
+
+ psb_RecalcRotate(ctx);
+ }
+ output->new_destbox = 0;
+
+ obj_surface = SURFACE(surface);
+ if (GET_SURFACE_INFO_protect(obj_surface->psb_surface)) {
+ psb__information_message("Protected surface, use overlay\n");
+ driver_data->output_method = PSB_PUTSURFACE_COVERLAY;
+
+ return 0;
+ }
+
+ if (output->sf_composition) {
+ psb__information_message("Composition is detected, use texstreaming\n");
+ driver_data->output_method = PSB_PUTSURFACE_TEXSTREAMING;
+ return 0;
+ }
+
+ srf_rotate = GET_SURFACE_INFO_rotate(obj_surface->psb_surface);
+ rotate_surface = obj_surface->psb_surface_rotate;
+ if (rotate_surface != NULL)
+ rotate_srf_rotate = GET_SURFACE_INFO_rotate(rotate_surface);
+
+ psb__information_message("SF rotation %d, VA rotation %d, final MSVDX rotation %d\n",
+ rotation, driver_data->va_rotate, driver_data->local_rotation);
+ psb__information_message("Primary surface rotation %d, rotated surface rotation %d\n",
+ srf_rotate, rotate_srf_rotate);
+
+ /* The surface rotation is not same with the final rotation */
+ if ((driver_data->local_rotation != 0) &&
+ ((srf_rotate != driver_data->local_rotation) || (rotate_srf_rotate != driver_data->local_rotation))) {
+ psb__information_message("Use texstreaming due to different VA surface rotation and final rotaion\n",
+ srf_rotate, rotate_srf_rotate);
+ driver_data->output_method = PSB_PUTSURFACE_TEXSTREAMING;
+ return 0;
+ }
+
+ driver_data->output_method = PSB_PUTSURFACE_COVERLAY;
+
+ return 0;
+}
+
VAStatus psb_PutSurface(
VADriverContextP ctx,
VASurfaceID surface,
@@ -286,6 +537,10 @@ VAStatus psb_PutSurface(
INIT_OUTPUT_PRIV;
object_surface_p obj_surface;
VAStatus vaStatus = VA_STATUS_SUCCESS;
+ PsbPortPrivPtr pPriv = (PsbPortPrivPtr)(&driver_data->coverlay_priv);
+ psb_hdmi_mode hdmi_mode = OFF;
+ int sf_composition = 0, buffer_index, i = 0;
+ int ret = 0;
obj_surface = SURFACE(surface);
if (NULL == obj_surface) {
@@ -294,85 +549,155 @@ VAStatus psb_PutSurface(
return vaStatus;
}
+ if ((NULL == cliprects) && (0 != number_cliprects)) {
+ vaStatus = VA_STATUS_ERROR_INVALID_PARAMETER;
+ DEBUG_FAILURE;
+ return vaStatus;
+ }
+
+ if ((srcx < 0) || (srcx > obj_surface->width) || (srcw > (obj_surface->width - srcx)) ||
+ (srcy < 0) || (srcy > obj_surface->height_origin) || (srch > (obj_surface->height_origin - srcy))) {
+ psb__error_message("vaPutSurface: source rectangle passed from upper layer is not correct.\n");
+ return VA_STATUS_ERROR_UNKNOWN;
+ }
+ if ((destx < 0) || (desty < 0)) {
+ psb__error_message("vaPutSurface: dest rectangle passed from upper layer is not correct.\n");
+ return VA_STATUS_ERROR_UNKNOWN;
+ }
+
if (driver_data->dummy_putsurface) {
- LOGD("vaPutSurface: dummy mode, return directly\n");
+ psb__information_message("vaPutSurface: dummy mode, return directly\n");
return VA_STATUS_SUCCESS;
}
- if (driver_data->render_device == VA_RENDER_DEVICE_EXTERNAL) {
- /*Use overlay to render external HDMI display*/
+ /* init overlay */
+ if (!driver_data->coverlay_init &&
+ (driver_data->output_method != PSB_PUTSURFACE_FORCE_TEXSTREAMING)) {
+ ret = psb_coverlay_init(ctx);
+ if (ret != 0) {
+ psb__information_message("vaPutSurface: psb_coverlay_init failed. Fallback to texture streaming.\n");
+ driver_data->output_method = PSB_PUTSURFACE_FORCE_TEXSTREAMING;
+ driver_data->coverlay_init = 0;
+ } else
+ driver_data->coverlay_init = 1;
+ }
+
+ /* set the current displaying video frame into kernel */
+ psb_surface_set_displaying(driver_data, obj_surface->width,
+ obj_surface->height_origin,
+ obj_surface->psb_surface);
+
+ /* get the BCD index of current surface */
+ buffer_index = psb_get_video_bcd(ctx, surface);
+ if (buffer_index == -1)
+ psb__error_message("The surface is not registered in BCD, shoud use overlay\n");
+
+ /* exit MRST path at first */
+ if (IS_MRST(driver_data)) {
+ if (driver_data->output_method == PSB_PUTSURFACE_FORCE_COVERLAY) { /* overlay is for testing, not POR */
+ psb__information_message("Force overlay to display\n");
+ vaStatus = psb_putsurface_coverlay(ctx, surface,
+ srcx, srcy, srcw, srch,
+ destx, desty, destw, desth,
+ flags);
+ } else {
+ psb__information_message("Use texstreaming to display.\n");
+ vaStatus = psb_putsurface_ts(ctx, surface, android_isurface, buffer_index,
+ srcx, srcy, srcw, srch,
+ destx, desty, destw, desth,
+ cliprects, number_cliprects, /* number of clip rects in the clip list */
+ flags);
+ }
+
+ return vaStatus;
+ }
+
+ if (psb_android_register_isurface(android_isurface, driver_data->bcd_id, srcw, srch)) {
+ psb__error_message("In psb_PutSurface, android_isurface is not a valid isurface object.\n");
+ return VA_STATUS_ERROR_UNKNOWN;
+ }
+ driver_data->ts_source_created = 1;
+
+ /* time for MFLD platform */
+ psb_check_outputmethod(ctx, surface, srcw, srch, android_isurface, &hdmi_mode);
+ if (driver_data->output_method == PSB_PUTSURFACE_NONE)
+ return VA_STATUS_SUCCESS;
+
+ if (hdmi_mode == UNDEFINED) {
+ psb__information_message("HDMI: Undefined mode, drop the frame.\n");
+ return vaStatus;
+ }
+
+ /* Extvideo: Use overlay to render external HDMI display */
+ if (hdmi_mode == EXTENDED_VIDEO) {
+ psb__information_message("HDMI: ExtVideo mode enabled, use overlay to render external HDMI display.\n");
+ /*we also need to clear local display if colorkey dirty.*/
+ if (driver_data->overlay_idle_frame != 0) {
+ psb_android_texture_streaming_set_background_color(driver_data->color_key | 0xff000000);
+ psb_android_texture_streaming_display(buffer_index);
+ driver_data->overlay_idle_frame = 0;
+ }
vaStatus = psb_putsurface_overlay(ctx, surface,
srcx, srcy, srcw, srch,
driver_data->render_rect.x, driver_data->render_rect.y,
driver_data->render_rect.width, driver_data->render_rect.height,
flags, OVERLAY_A, PIPEB);
- } else if ((driver_data->render_mode & VA_RENDER_MODE_LOCAL_OVERLAY) ||
- (driver_data->output_method == PSB_PUTSURFACE_FORCE_COVERLAY) ||
- (driver_data->output_method == PSB_PUTSURFACE_COVERLAY)) {
- LOGD("In psb_PutSurface, use overlay to display video.\n");
- LOGD("srcx is %d, srcy is %d, srcw is %d, srch is %d, destx is %d, desty is %d, destw is %d, desth is %d.\n", \
- srcx, srcy, srcw, srch, destx, desty, destw, desth);
- /*Use overlay to render local display*/
- if (destw > output->screen_width)
- destw = output->screen_width;
- if (desth > output->screen_height)
- desth = output->screen_height;
- vaStatus = psb_putsurface_overlay(ctx, surface,
- srcx, srcy, srcw, srch,
- destx, desty, destw, desth,
- flags, OVERLAY_A, PIPEA);
- /*Use overlay to render external HDMI display*/
- if (driver_data->render_device & VA_RENDER_DEVICE_EXTERNAL) {
- vaStatus = psb_putsurface_overlay(ctx, surface,
- srcx, srcy, srcw, srch,
- driver_data->render_rect.x, driver_data->render_rect.y,
- driver_data->render_rect.width, driver_data->render_rect.height,
- flags, OVERLAY_C, PIPEB);
- }
+
+ return vaStatus;
+ }
+
+ /* Clone mode: Use TS to render both MIPI and HDMI display */
+ if (hdmi_mode == CLONE) {
+ psb__information_message("HDMI: Clone mode enabled, use texsteaming for both devices\n");
+ vaStatus = psb_putsurface_ts(ctx, surface, android_isurface, buffer_index,
+ srcx, srcy, srcw, srch,
+ destx, desty, destw, desth,
+ cliprects, number_cliprects, /* number of clip rects in the clip list */
+ flags);
+ return vaStatus;
+ }
+
+ /* local video playback */
+ if ((driver_data->output_method == PSB_PUTSURFACE_TEXSTREAMING) ||
+ (driver_data->output_method == PSB_PUTSURFACE_FORCE_TEXSTREAMING)) {
+ psb__information_message("MIPI: Use texstreaming to display.\n");
+
+ vaStatus = psb_putsurface_ts(ctx, surface, android_isurface, buffer_index,
+ srcx, srcy, srcw, srch,
+ destx, desty, destw, desth,
+ cliprects, number_cliprects, /* number of clip rects in the clip list */
+ flags);
} else {
- LOGD("In psb_PutSurface, use texture streaming to display video.\n");
- LOGD("In psb_PutSurface, call psb_android_register_isurface to create texture streaming source, srcw is %d, srch is %d.\n", srcw, srch);
- if (psb_android_register_isurface(android_isurface, driver_data->bcd_id, srcw, srch)) {
- LOGE("In psb_PutSurface, android_isurface is not a valid isurface object.\n");
- return VA_STATUS_ERROR_UNKNOWN;
- }
- /*blend/positioning setting can be called by app directly, or enable VA_ENABLE_BLEND flag to let driver call*/
- if (flags & VA_ENABLE_BLEND)
- psb_android_texture_streaming_set_blend(destx, desty, destw, desth,
- driver_data->clear_color,
- driver_data->blend_color,
- driver_data->blend_mode);
- /*cropping can be also used for dynamic resolution change feature, only high to low resolution*/
- /*by default, srcw and srch is set to video width and height*/
- if ((0 == srcw) || (0 == srch)) {
- srcw = obj_surface->width;
- srch = obj_surface->height_origin;
- }
- psb_android_texture_streaming_set_crop(srcx, srcy, srcw, srch);
-
- BC_Video_ioctl_package ioctl_package;
- psb_surface_p psb_surface;
- psb_surface = obj_surface->psb_surface;
- ioctl_package.ioctl_cmd = BC_Video_ioctl_get_buffer_index;
- ioctl_package.device_id = driver_data->bcd_id;
- ioctl_package.inputparam = (int)(wsbmKBufHandle(wsbmKBuf(psb_surface->buf.drm_buf)));
-
- if (drmCommandWriteRead(driver_data->drm_fd, driver_data->bcd_ioctrl_num, &ioctl_package, sizeof(ioctl_package)) != 0) {
- psb__error_message("Failed to get buffer index from buffer class video driver (errno=%d).\n", errno);
- return VA_STATUS_ERROR_UNKNOWN;
+ psb__information_message("MIPI: Use overlay to display.\n");
+
+ /*initialize output destbox using default destbox if it has not been initialized until here.*/
+ if (output->destw == 0 || output->desth == 0) {
+ output->destx = (destx > 0) ? destx : 0;
+ output->desty = (desty > 0) ? desty : 0;
+ output->destw = ((output->destx + destw) > output->screen_width) ? (output->screen_width - output->destx) : destw;
+ output->desth = ((output->desty + desth) > output->screen_height) ? (output->screen_height - output->desty) : desth;
}
- LOGD("buffer handle is %d and buffer index is %d.\n", ioctl_package.inputparam, ioctl_package.outputparam);
- psb_android_texture_streaming_display(ioctl_package.outputparam);
-
- /*Use overlay to render external HDMI display*/
- if (driver_data->render_device & VA_RENDER_DEVICE_EXTERNAL) {
- vaStatus = psb_putsurface_overlay(ctx, surface,
- srcx, srcy, srcw, srch,
- driver_data->render_rect.x, driver_data->render_rect.y,
- driver_data->render_rect.width, driver_data->render_rect.height,
- flags, OVERLAY_A, PIPEB);
+
+ /* Hack for repaint color key to black(0,0,0). */
+ if (driver_data->overlay_idle_frame != 0) {
+ psb__information_message("Paint color key to 0x%x\n", driver_data->color_key);
+ psb_android_texture_streaming_set_background_color(driver_data->color_key | 0xff000000);
+ psb_android_texture_streaming_display(buffer_index);
+ driver_data->overlay_idle_frame = 0;
}
+
+ psb__information_message("Overlay position = (%d,%d,%d,%d)\n", output->destx, output->desty, output->destw, output->desth);
+ vaStatus = psb_putsurface_overlay(ctx, surface,
+ srcx, srcy, srcw, srch,
+ output->destx, output->desty, output->destw, output->desth,
+ flags, OVERLAY_A, PIPEA);
}
+ if (driver_data->overlay_idle_frame == MAX_OVERLAY_IDLE_FRAME)
+ psb_coverlay_stop(ctx);
+
+ driver_data->frame_count++;
+
+
return vaStatus;
}
diff --git a/src/android/psb_output_android.h b/src/android/psb_output_android.h
new file mode 100644
index 0000000..6e334d8
--- /dev/null
+++ b/src/android/psb_output_android.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2011 Intel Corporation. All Rights Reserved.
+ * Copyright (c) Imagination Technologies Limited, UK
+ *
+ * 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:
+ * Jason Hu <jason.hu@intel.com>
+ */
+
+#ifndef _PSB_OUTPUT_ANDROID_H_
+#define _PSB_OUTPUT_ANDROID_H_
+
+typedef struct _psb_android_output_s {
+ /* information of output display */
+ unsigned short screen_width;
+ unsigned short screen_height;
+
+ /* for memory heap base used by putsurface */
+ unsigned char* heap_addr;
+
+ void* psb_HDMIExt_info; /* HDMI extend video mode info */
+ int sf_composition; /* surfaceflinger compostion */
+ /* save dest box here */
+ short destx;
+ short desty;
+ unsigned short destw;
+ unsigned short desth;
+ int new_destbox;
+} psb_android_output_s, *psb_android_output_p;
+
+#endif /*_PSB_OUTPUT_ANDROID_H_*/
diff --git a/src/hwdefs/dma_api.h b/src/hwdefs/dma_api.h
index 8bb0535..825e34b 100644
--- a/src/hwdefs/dma_api.h
+++ b/src/hwdefs/dma_api.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/hwdefs/dxva_cmdseq_msg.h b/src/hwdefs/dxva_cmdseq_msg.h
index ad7f36d..dc6fc9d 100644
--- a/src/hwdefs/dxva_cmdseq_msg.h
+++ b/src/hwdefs/dxva_cmdseq_msg.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/hwdefs/dxva_fw_ctrl.h b/src/hwdefs/dxva_fw_ctrl.h
index 66c40da..671469d 100644
--- a/src/hwdefs/dxva_fw_ctrl.h
+++ b/src/hwdefs/dxva_fw_ctrl.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/hwdefs/dxva_fw_flags.h b/src/hwdefs/dxva_fw_flags.h
index 0773ce0..d637923 100644
--- a/src/hwdefs/dxva_fw_flags.h
+++ b/src/hwdefs/dxva_fw_flags.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/hwdefs/dxva_msg.h b/src/hwdefs/dxva_msg.h
index 2769e14..e9da286 100644
--- a/src/hwdefs/dxva_msg.h
+++ b/src/hwdefs/dxva_msg.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/hwdefs/fwrk_msg_mem_io.h b/src/hwdefs/fwrk_msg_mem_io.h
index 3d51a40..53b1152 100644
--- a/src/hwdefs/fwrk_msg_mem_io.h
+++ b/src/hwdefs/fwrk_msg_mem_io.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/hwdefs/h264_macroblock_mem_io.h b/src/hwdefs/h264_macroblock_mem_io.h
index 3d6c294..ee3d5eb 100644
--- a/src/hwdefs/h264_macroblock_mem_io.h
+++ b/src/hwdefs/h264_macroblock_mem_io.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/hwdefs/img_defs.h b/src/hwdefs/img_defs.h
index 9238808..18f4a73 100644
--- a/src/hwdefs/img_defs.h
+++ b/src/hwdefs/img_defs.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/hwdefs/img_types.h b/src/hwdefs/img_types.h
index 9153c2a..8691f94 100644
--- a/src/hwdefs/img_types.h
+++ b/src/hwdefs/img_types.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/hwdefs/lldma_defs.h b/src/hwdefs/lldma_defs.h
index 960d5d8..1069985 100644
--- a/src/hwdefs/lldma_defs.h
+++ b/src/hwdefs/lldma_defs.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/hwdefs/mem_io.h b/src/hwdefs/mem_io.h
index 41583d2..035cfd7 100644
--- a/src/hwdefs/mem_io.h
+++ b/src/hwdefs/mem_io.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -311,12 +311,12 @@ extern "C" {
#define MEMIO_READ_TABLE_FIELD(vpMem, field, ui32TabIndex) \
( MEMIO_CHECK_ALIGNMENT(vpMem), IMG_ASSERT((ui32TabIndex < field##_NO_ENTRIES) || (field##_NO_ENTRIES == 0)), \
((IMG_UINT32)(((*((field##_TYPE *)(((IMG_UINT32)vpMem) + field##_OFFSET + (field##_STRIDE * ui32TabIndex)))) & field##_MASK) >> field##_SHIFT)) ) \
-
+
#else
#define MEMIO_READ_TABLE_FIELD(vpMem, field, ui32TabIndex) \
((IMG_UINT32)(((*((field##_TYPE *)(((IMG_UINT32)vpMem) + field##_OFFSET + (field##_STRIDE * ui32TabIndex)))) & field##_MASK) >> field##_SHIFT)) \
-
+
#endif
@@ -331,12 +331,12 @@ extern "C" {
#define MEMIO_READ_REPEATED_FIELD(vpMem, field, ui32RepIndex) \
( MEMIO_CHECK_ALIGNMENT(vpMem), IMG_ASSERT(ui32RepIndex < field##_NO_REPS), \
((IMG_UINT32)(((*((field##_TYPE *)(((IMG_UINT32)vpMem) + field##_OFFSET))) & (field##_MASK >> (ui32RepIndex * field##_SIZE))) >> (field##_SHIFT - (ui32RepIndex * field##_SIZE)))) ) \
-
+
#else
#define MEMIO_READ_REPEATED_FIELD(vpMem, field, ui32RepIndex) \
( (IMG_UINT32)(((*((field##_TYPE *)(((IMG_UINT32)vpMem) + field##_OFFSET))) & (field##_MASK >> (ui32RepIndex * field##_SIZE))) >> (field##_SHIFT - (ui32RepIndex * field##_SIZE))) ) \
-
+
#endif
/*!
******************************************************************************
@@ -349,12 +349,12 @@ extern "C" {
#define MEMIO_READ_TABLE_REPEATED_FIELD(vpMem, field, ui32TabIndex, ui32RepIndex) \
( MEMIO_CHECK_ALIGNMENT(vpMem), IMG_ASSERT((ui32TabIndex < field##_NO_ENTRIES) || (field##_NO_ENTRIES == 0)), IMG_ASSERT(ui32RepIndex < field##_NO_REPS), \
((IMG_UINT32)(((*((field##_TYPE *)(((IMG_UINT32)vpMem) + field##_OFFSET + (field##_STRIDE * ui32TabIndex)))) & (field##_MASK >> (ui32RepIndex * field##_SIZE))) >> (field##_SHIFT - (ui32RepIndex * field##_SIZE)))) ) \
-
+
#else
#define MEMIO_READ_TABLE_REPEATED_FIELD(vpMem, field, ui32TabIndex, ui32RepIndex) \
((IMG_UINT32)(((*((field##_TYPE *)(((IMG_UINT32)vpMem) + field##_OFFSET + (field##_STRIDE * ui32TabIndex)))) & (field##_MASK >> (ui32RepIndex * field##_SIZE))) >> (field##_SHIFT - (ui32RepIndex * field##_SIZE)))) \
-
+
#endif
/*!
diff --git a/src/hwdefs/msvdx_cmds_io2.h b/src/hwdefs/msvdx_cmds_io2.h
index e24cfc7..215b279 100644
--- a/src/hwdefs/msvdx_cmds_io2.h
+++ b/src/hwdefs/msvdx_cmds_io2.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/hwdefs/msvdx_core_regs_io2.h b/src/hwdefs/msvdx_core_regs_io2.h
index a9b39bd..7bdad02 100644
--- a/src/hwdefs/msvdx_core_regs_io2.h
+++ b/src/hwdefs/msvdx_core_regs_io2.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/hwdefs/msvdx_defs.h b/src/hwdefs/msvdx_defs.h
index 3820b06..19549fa 100644
--- a/src/hwdefs/msvdx_defs.h
+++ b/src/hwdefs/msvdx_defs.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/hwdefs/msvdx_dmac_linked_list.h b/src/hwdefs/msvdx_dmac_linked_list.h
index 2a6a881..76acb18 100644
--- a/src/hwdefs/msvdx_dmac_linked_list.h
+++ b/src/hwdefs/msvdx_dmac_linked_list.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/hwdefs/msvdx_dmac_regs_io2.h b/src/hwdefs/msvdx_dmac_regs_io2.h
index fbdefc3..3df3f60 100644
--- a/src/hwdefs/msvdx_dmac_regs_io2.h
+++ b/src/hwdefs/msvdx_dmac_regs_io2.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/hwdefs/msvdx_mtx_reg_io2.h b/src/hwdefs/msvdx_mtx_reg_io2.h
index d75d8e5..3c8e0cf 100644
--- a/src/hwdefs/msvdx_mtx_reg_io2.h
+++ b/src/hwdefs/msvdx_mtx_reg_io2.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/hwdefs/msvdx_offsets.h b/src/hwdefs/msvdx_offsets.h
index e841e27..3e76fbf 100644
--- a/src/hwdefs/msvdx_offsets.h
+++ b/src/hwdefs/msvdx_offsets.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/hwdefs/msvdx_rendec_mtx_slice_cntrl_reg_io2.h b/src/hwdefs/msvdx_rendec_mtx_slice_cntrl_reg_io2.h
index c2e1257..dd258f7 100644
--- a/src/hwdefs/msvdx_rendec_mtx_slice_cntrl_reg_io2.h
+++ b/src/hwdefs/msvdx_rendec_mtx_slice_cntrl_reg_io2.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/hwdefs/msvdx_rendec_vc1_reg_io2.h b/src/hwdefs/msvdx_rendec_vc1_reg_io2.h
index 288aae9..bf7bab8 100644
--- a/src/hwdefs/msvdx_rendec_vc1_reg_io2.h
+++ b/src/hwdefs/msvdx_rendec_vc1_reg_io2.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/hwdefs/msvdx_vdmc_reg_io2.h b/src/hwdefs/msvdx_vdmc_reg_io2.h
index 7561f1f..6c275e3 100644
--- a/src/hwdefs/msvdx_vdmc_reg_io2.h
+++ b/src/hwdefs/msvdx_vdmc_reg_io2.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/hwdefs/msvdx_vec_h264_reg_io2.h b/src/hwdefs/msvdx_vec_h264_reg_io2.h
index bab945a..672d862 100644
--- a/src/hwdefs/msvdx_vec_h264_reg_io2.h
+++ b/src/hwdefs/msvdx_vec_h264_reg_io2.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/hwdefs/msvdx_vec_mpeg2_reg_io2.h b/src/hwdefs/msvdx_vec_mpeg2_reg_io2.h
index 7a691df..a272bab 100644
--- a/src/hwdefs/msvdx_vec_mpeg2_reg_io2.h
+++ b/src/hwdefs/msvdx_vec_mpeg2_reg_io2.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/hwdefs/msvdx_vec_mpeg4_reg_io2.h b/src/hwdefs/msvdx_vec_mpeg4_reg_io2.h
index cbd4c56..250fa2e 100644
--- a/src/hwdefs/msvdx_vec_mpeg4_reg_io2.h
+++ b/src/hwdefs/msvdx_vec_mpeg4_reg_io2.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/hwdefs/msvdx_vec_reg_io2.h b/src/hwdefs/msvdx_vec_reg_io2.h
index 706998e..5142746 100644
--- a/src/hwdefs/msvdx_vec_reg_io2.h
+++ b/src/hwdefs/msvdx_vec_reg_io2.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/hwdefs/msvdx_vec_vc1_reg_io2.h b/src/hwdefs/msvdx_vec_vc1_reg_io2.h
index 25ffca6..84b35af 100644
--- a/src/hwdefs/msvdx_vec_vc1_reg_io2.h
+++ b/src/hwdefs/msvdx_vec_vc1_reg_io2.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/hwdefs/reg_io2.h b/src/hwdefs/reg_io2.h
index bb8016d..adc32ba 100644
--- a/src/hwdefs/reg_io2.h
+++ b/src/hwdefs/reg_io2.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/hwdefs/topazSC_defs.h b/src/hwdefs/topazSC_defs.h
index 6d163ed..4d6e599 100644
--- a/src/hwdefs/topazSC_defs.h
+++ b/src/hwdefs/topazSC_defs.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/hwdefs/topaz_defs.h b/src/hwdefs/topaz_defs.h
index 92268a6..8af4782 100644
--- a/src/hwdefs/topaz_defs.h
+++ b/src/hwdefs/topaz_defs.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/lnc_H263ES.c b/src/lnc_H263ES.c
index 98c4751..a9cda85 100644
--- a/src/lnc_H263ES.c
+++ b/src/lnc_H263ES.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -83,10 +83,21 @@ static void lnc_H263ES_QueryConfigAttributes(
static VAStatus lnc_H263ES_ValidateConfig(
object_config_p obj_config)
{
- VAStatus vaStatus = VA_STATUS_SUCCESS;
- psb__information_message("lnc_H263ES_ValidateConfig\n");
+ int i;
+ /* Check all attributes */
+ for (i = 0; i < obj_config->attrib_count; i++) {
+ switch (obj_config->attrib_list[i].type) {
+ case VAConfigAttribRTFormat:
+ /* Ignore */
+ break;
+ case VAConfigAttribRateControl:
+ break;
+ default:
+ return VA_STATUS_ERROR_ATTR_NOT_SUPPORTED;
+ }
+ }
- return vaStatus;
+ return VA_STATUS_SUCCESS;
}
@@ -281,7 +292,7 @@ static VAStatus lnc__H263ES_process_picture_param(context_ENC_p ctx, object_buff
*/
cmdbuf->cmd_idx_saved_frameskip = cmdbuf->cmd_idx;
if (!(ctx->sRCParams.RCEnable && ctx->sRCParams.FrameSkip)) {
- lnc__H263_prepare_picture_header(cmdbuf->header_mem_p + ctx->pic_header_ofs,
+ lnc__H263_prepare_picture_header((IMG_UINT32 *)(cmdbuf->header_mem_p + ctx->pic_header_ofs),
ctx->obj_context->frame_count,
pBuffer->picture_type,
SourceFormatType,
@@ -307,7 +318,7 @@ static VAStatus lnc__H263ES_process_slice_param(context_ENC_p ctx, object_buffer
VAEncSliceParameterBuffer *pBuffer;
lnc_cmdbuf_p cmdbuf = ctx->obj_context->lnc_cmdbuf;
PIC_PARAMS *psPicParams = (PIC_PARAMS *)(cmdbuf->pic_params_p);
- int i;
+ unsigned int i;
int slice_param_idx;
ASSERT(obj_buffer->type == VAEncSliceParameterBufferType);
@@ -361,7 +372,7 @@ static VAStatus lnc__H263ES_process_slice_param(context_ENC_p ctx, object_buffer
/* Insert Do Header command, relocation is needed */
if (ctx->obj_context->slice_count) { /*First slice of a frame need not slice header*/
lnc__H263_prepare_GOBslice_header(
- cmdbuf->header_mem_p + ctx->slice_header_ofs + ctx->obj_context->slice_count * HEADER_SIZE,
+ (IMG_UINT32 *)(cmdbuf->header_mem_p + ctx->slice_header_ofs + ctx->obj_context->slice_count * HEADER_SIZE),
ctx->obj_context->slice_count,
ctx->obj_context->frame_count);
diff --git a/src/lnc_H263ES.h b/src/lnc_H263ES.h
index 6e4d07e..d58d3ac 100644
--- a/src/lnc_H263ES.h
+++ b/src/lnc_H263ES.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/lnc_H264ES.c b/src/lnc_H264ES.c
index 9826e73..f725efc 100644
--- a/src/lnc_H264ES.c
+++ b/src/lnc_H264ES.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -50,7 +50,7 @@
#define SURFACE(id) ((object_surface_p) object_heap_lookup( &ctx->obj_context->driver_data->surface_heap, id ))
#define BUFFER(id) ((object_buffer_p) object_heap_lookup( &ctx->obj_context->driver_data->buffer_heap, id ))
-int psb_parse_config(char *env, char *env_value);
+
static void lnc_H264ES_QueryConfigAttributes(
VAProfile profile,
@@ -87,11 +87,21 @@ static void lnc_H264ES_QueryConfigAttributes(
static VAStatus lnc_H264ES_ValidateConfig(
object_config_p obj_config)
{
- VAStatus vaStatus = VA_STATUS_SUCCESS;
- psb__information_message("lnc_H264ES_ValidateConfig\n");
-
- return vaStatus;
+ int i;
+ /* Check all attributes */
+ for (i = 0; i < obj_config->attrib_count; i++) {
+ switch (obj_config->attrib_list[i].type) {
+ case VAConfigAttribRTFormat:
+ /* Ignore */
+ break;
+ case VAConfigAttribRateControl:
+ break;
+ default:
+ return VA_STATUS_ERROR_ATTR_NOT_SUPPORTED;
+ }
+ }
+ return VA_STATUS_SUCCESS;
}
@@ -291,7 +301,7 @@ static VAStatus lnc__H264ES_process_sequence_param(context_ENC_p ctx, object_buf
if (ctx->eCodec == IMG_CODEC_H264_NO_RC)
VUI_Params.CBR = 0;
- lnc__H264_prepare_sequence_header(cmdbuf->header_mem_p + ctx->seq_header_ofs, pSequenceParams->max_num_ref_frames,
+ lnc__H264_prepare_sequence_header((IMG_UINT32 *)(cmdbuf->header_mem_p + ctx->seq_header_ofs), pSequenceParams->max_num_ref_frames,
pSequenceParams->picture_width_in_mbs,
pSequenceParams->picture_height_in_mbs,
pSequenceParams->vui_flag,
@@ -310,8 +320,8 @@ static VAStatus lnc__H264ES_process_sequence_param(context_ENC_p ctx, object_buf
free(pSequenceParams);
return VA_STATUS_ERROR_ALLOCATION_FAILED;
}
- memcpy((void *)ctx->save_seq_header_p,
- (void *)(cmdbuf->header_mem_p + ctx->seq_header_ofs),
+ memcpy((unsigned char *)ctx->save_seq_header_p,
+ (unsigned char *)(cmdbuf->header_mem_p + ctx->seq_header_ofs),
HEADER_SIZE);
}
}
@@ -382,15 +392,15 @@ static VAStatus lnc__H264ES_process_picture_param(context_ENC_p ctx, object_buff
if (need_sps) {
/* reuse the previous SPS */
psb__information_message("TOPAZ: insert a SPS before IDR frame\n");
- memcpy((void *)(cmdbuf->header_mem_p + ctx->seq_header_ofs),
- (void *)ctx->save_seq_header_p,
+ memcpy((unsigned char *)(cmdbuf->header_mem_p + ctx->seq_header_ofs),
+ (unsigned char *)ctx->save_seq_header_p,
HEADER_SIZE);
lnc_cmdbuf_insert_command(cmdbuf, MTX_CMDID_DO_HEADER, 2, 0); /* sequence header */
RELOC_CMDBUF(cmdbuf->cmd_idx++, ctx->seq_header_ofs, &cmdbuf->header_mem);
}
- lnc__H264_prepare_picture_header(cmdbuf->header_mem_p + ctx->pic_header_ofs);
+ lnc__H264_prepare_picture_header((IMG_UINT32 *)(cmdbuf->header_mem_p + ctx->pic_header_ofs));
lnc_cmdbuf_insert_command(cmdbuf, MTX_CMDID_DO_HEADER, 2, 1);/* picture header */
RELOC_CMDBUF(cmdbuf->cmd_idx++, ctx->pic_header_ofs, &cmdbuf->header_mem);
@@ -428,13 +438,13 @@ static VAStatus lnc__H264ES_process_slice_param(context_ENC_p ctx, object_buffer
lnc_cmdbuf_p cmdbuf = ctx->obj_context->lnc_cmdbuf;
unsigned int MBSkipRun, FirstMBAddress;
PIC_PARAMS *psPicParams = (PIC_PARAMS *)(cmdbuf->pic_params_p);
- int i;
+ unsigned int i;
int slice_param_idx;
ASSERT(obj_buffer->type == VAEncSliceParameterBufferType);
cmdbuf = ctx->obj_context->lnc_cmdbuf;
- psPicParams = cmdbuf->pic_params_p;
+ psPicParams = (PIC_PARAMS *)cmdbuf->pic_params_p;
/* Transfer ownership of VAEncPictureParameterBufferH264 data */
pBuffer = (VAEncSliceParameterBuffer *) obj_buffer->buffer_data;
@@ -508,7 +518,7 @@ static VAStatus lnc__H264ES_process_slice_param(context_ENC_p ctx, object_buffer
FirstMBAddress = (pBuffer->start_row_number * ctx->Width) / 16;
/* Insert Do Header command, relocation is needed */
- lnc__H264_prepare_slice_header(cmdbuf->header_mem_p + ctx->slice_header_ofs + ctx->obj_context->slice_count * HEADER_SIZE,
+ lnc__H264_prepare_slice_header((IMG_UINT32 *)(cmdbuf->header_mem_p + ctx->slice_header_ofs + ctx->obj_context->slice_count * HEADER_SIZE),
pBuffer->slice_flags.bits.is_intra,
pBuffer->slice_flags.bits.disable_deblocking_filter_idc,
ctx->obj_context->frame_count,
@@ -621,7 +631,6 @@ static VAStatus lnc__H264ES_process_misc_param(context_ENC_p ctx, object_buffer_
rate_control_param->min_qp = atoi(hardcoded_qp);
if (rate_control_param->initial_qp > 65535 ||
- rate_control_param->initial_qp < 3 ||
rate_control_param->min_qp > 65535 ||
rate_control_param->target_percentage > 65535) {
vaStatus = VA_STATUS_ERROR_INVALID_PARAMETER;
@@ -682,8 +691,8 @@ static VAStatus lnc__H264ES_process_misc_param(context_ENC_p ctx, object_buffer_
break;
}
- if (max_slice_size_param->max_slice_size != 0)
- max_slice_size_param->max_slice_size -= WORST_CASE_SLICE_HEADER_SIZE;
+ if (max_slice_size_param->max_slice_size != 0)
+ max_slice_size_param->max_slice_size -= WORST_CASE_SLICE_HEADER_SIZE;
if (ctx->max_slice_size == max_slice_size_param->max_slice_size)
break;
diff --git a/src/lnc_H264ES.h b/src/lnc_H264ES.h
index 7b1b8ba..f349104 100644
--- a/src/lnc_H264ES.h
+++ b/src/lnc_H264ES.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/lnc_MPEG4ES.c b/src/lnc_MPEG4ES.c
index 0bb7e45..f3813ed 100644
--- a/src/lnc_MPEG4ES.c
+++ b/src/lnc_MPEG4ES.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -86,11 +86,21 @@ static void lnc_MPEG4ES_QueryConfigAttributes(
static VAStatus lnc_MPEG4ES_ValidateConfig(
object_config_p obj_config)
{
- VAStatus vaStatus = VA_STATUS_SUCCESS;
- psb__information_message("lnc_MPEG4ES_ValidateConfig\n");
-
- return vaStatus;
+ int i;
+ /* Check all attributes */
+ for (i = 0; i < obj_config->attrib_count; i++) {
+ switch (obj_config->attrib_list[i].type) {
+ case VAConfigAttribRTFormat:
+ /* Ignore */
+ break;
+ case VAConfigAttribRateControl:
+ break;
+ default:
+ return VA_STATUS_ERROR_ATTR_NOT_SUPPORTED;
+ }
+ }
+ return VA_STATUS_SUCCESS;
}
@@ -239,7 +249,7 @@ static VAStatus lnc__MPEG4ES_process_sequence_param(context_ENC_p ctx, object_bu
}
lnc__MPEG4_prepare_sequence_header(
- cmdbuf->header_mem_p + ctx->seq_header_ofs,
+ (IMG_UINT32 *)(cmdbuf->header_mem_p + ctx->seq_header_ofs),
0, /* BFrame? */
profile, /* sProfile */
seq_params->profile_and_level_indication, /* */
@@ -300,7 +310,7 @@ static VAStatus lnc__MPEG4ES_process_picture_param(context_ENC_p ctx, object_buf
*/
cmdbuf->cmd_idx_saved_frameskip = cmdbuf->cmd_idx;
- lnc__MPEG4_prepare_vop_header(cmdbuf->header_mem_p + ctx->pic_header_ofs,
+ lnc__MPEG4_prepare_vop_header((IMG_UINT32 *)(cmdbuf->header_mem_p + ctx->pic_header_ofs),
bIsVOPCoded,
pBuffer->vop_time_increment, /* In testbench, this should be FrameNum */
4,/* default value is 4,search range */
@@ -322,7 +332,7 @@ static VAStatus lnc__MPEG4ES_process_slice_param(context_ENC_p ctx, object_buffe
VAEncSliceParameterBuffer *pBuffer;
lnc_cmdbuf_p cmdbuf = ctx->obj_context->lnc_cmdbuf;
PIC_PARAMS *psPicParams = (PIC_PARAMS *)(cmdbuf->pic_params_p);
- int i;
+ unsigned int i;
int slice_param_idx;
ASSERT(obj_buffer->type == VAEncSliceParameterBufferType);
diff --git a/src/lnc_MPEG4ES.h b/src/lnc_MPEG4ES.h
index 5a9d36b..75d13b0 100644
--- a/src/lnc_MPEG4ES.h
+++ b/src/lnc_MPEG4ES.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/lnc_cmdbuf.c b/src/lnc_cmdbuf.c
index b96fd06..68a207e 100644
--- a/src/lnc_cmdbuf.c
+++ b/src/lnc_cmdbuf.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -291,7 +291,7 @@ void lnc_cmdbuf_add_relocation(lnc_cmdbuf_p cmdbuf,
reloc->dst_buffer = dst_buffer;
cmdbuf->reloc_idx++;
- ASSERT(((void *)(cmdbuf->reloc_idx)) < RELOC_END(cmdbuf));
+ ASSERT(((unsigned char *)(cmdbuf->reloc_idx)) < RELOC_END(cmdbuf));
}
/*
@@ -395,8 +395,6 @@ lncDRMCmdBuf(int fd, int ioctl_offset, psb_buffer_p *buffer_list, int buffer_cou
ca.engine = engine;
ca.fence_flags = fence_flags;
ca.fence_arg = (uint64_t)((unsigned long)fence_rep);
- ca.damage = damage;
-
do {
ret = drmCommandWrite(fd, ioctl_offset, &ca, sizeof(ca));
@@ -464,7 +462,7 @@ lnc_fence_wait(psb_driver_data_p driver_data,
fence = wsbmFenceCreate(driver_data->fence_mgr, fence_rep->fence_class,
fence_rep->fence_type,
- (void *)fence_rep->handle,
+ (unsigned char *)fence_rep->handle,
0);
if (fence)
*status = wsbmFenceFinish(fence, fence_rep->fence_type, 0);
@@ -535,10 +533,10 @@ int lnc_context_flush_cmdbuf(object_context_p obj_context)
unsigned int reloc_offset;
unsigned int num_relocs;
int ret;
- unsigned int cmdbuffer_size = (void *) cmdbuf->cmd_idx - cmdbuf->cmd_start; /* In bytes */
+ unsigned int cmdbuffer_size = (unsigned char *) cmdbuf->cmd_idx - cmdbuf->cmd_start; /* In bytes */
ASSERT(cmdbuffer_size < CMD_SIZE);
- ASSERT((void *) cmdbuf->cmd_idx < CMD_END(cmdbuf));
+ ASSERT((unsigned char *) cmdbuf->cmd_idx < CMD_END(cmdbuf));
/* LOCK */
ret = LOCK_HARDWARE(driver_data);
if (ret) {
@@ -549,7 +547,7 @@ int lnc_context_flush_cmdbuf(object_context_p obj_context)
/* Now calculate the total number of relocations */
reloc_offset = cmdbuf->reloc_base - cmdbuf->cmd_base;
- num_relocs = (((void *) cmdbuf->reloc_idx) - cmdbuf->reloc_base) / sizeof(struct drm_psb_reloc);
+ num_relocs = (((unsigned char *) cmdbuf->reloc_idx) - cmdbuf->reloc_base) / sizeof(struct drm_psb_reloc);
lnc_cmdbuf_unmap(cmdbuf);
diff --git a/src/lnc_cmdbuf.h b/src/lnc_cmdbuf.h
index dfea4da..02fdf16 100644
--- a/src/lnc_cmdbuf.h
+++ b/src/lnc_cmdbuf.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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,13 +45,13 @@ struct lnc_cmdbuf_s {
unsigned int size;
/* Relocation records */
- void *reloc_base;
+ unsigned char *reloc_base;
struct drm_psb_reloc *reloc_idx;
/* CMD stream data */
int cmd_count;
- void *cmd_base;
- void *cmd_start;
+ unsigned char *cmd_base;
+ unsigned char *cmd_start;
uint32_t *cmd_idx;
uint32_t *cmd_idx_saved_frameskip; /* idx saved for frameskip redo */
@@ -61,24 +61,24 @@ struct lnc_cmdbuf_s {
struct psb_buffer_s *topaz_in_params_I;
struct psb_buffer_s *topaz_in_params_P;
struct psb_buffer_s *topaz_above_bellow_params;
- void *topaz_in_params_I_p;
- void *topaz_in_params_P_p;
- void *topaz_above_bellow_params_p;
+ unsigned char *topaz_in_params_I_p;
+ unsigned char *topaz_in_params_P_p;
+ unsigned char *topaz_above_bellow_params_p;
/* Every frame has its own PIC_PARAMS, SLICE_PARAMS and HEADER mem
*/
/* PicParams: */
struct psb_buffer_s pic_params;
- void *pic_params_p;
+ unsigned char *pic_params_p;
/* SeqHeaderMem PicHeaderMem EOSeqHeaderMem EOStreamHeaderMem SliceHeaderMem[MAX_SLICES_PER_PICTURE]*/
struct psb_buffer_s header_mem;
- void *header_mem_p;
+ unsigned char *header_mem_p;
/*SliceParams[MAX_SLICES_PER_PICTURE] */
struct psb_buffer_s slice_params;
- void *slice_params_p;
+ unsigned char *slice_params_p;
/* Referenced buffers */
psb_buffer_p *buffer_refs;
@@ -141,7 +141,7 @@ void lnc_cmdbuf_add_relocation(lnc_cmdbuf_p cmdbuf,
uint32_t dst_buffer, /*Index of the list refered by cmdbuf->buffer_refs */
uint32_t *start_of_dst_buffer);
-#define RELOC_CMDBUF(dest, offset, buf) lnc_cmdbuf_add_relocation(cmdbuf, (uint32_t*)(dest), buf, offset, 0XFFFFFFFF, 0, 0, 0, cmdbuf->cmd_start)
+#define RELOC_CMDBUF(dest, offset, buf) lnc_cmdbuf_add_relocation(cmdbuf, (uint32_t*)(dest), buf, offset, 0XFFFFFFFF, 0, 0, 0, (uint32_t *)cmdbuf->cmd_start)
/* do relocation in PIC_PARAMS: src/dst Y/UV base, InParamsBase, CodeBase, BellowParamsBase, AboveParamsBase */
#define RELOC_PIC_PARAMS(dest, offset, buf) lnc_cmdbuf_add_relocation(cmdbuf, (uint32_t*)(dest), buf, offset, 0XFFFFFFFF, 0, 0, 1, (uint32_t *)cmdbuf->pic_params_p)
diff --git a/src/lnc_hostcode.c b/src/lnc_hostcode.c
index be88ddc..d944d24 100644
--- a/src/lnc_hostcode.c
+++ b/src/lnc_hostcode.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -258,14 +258,14 @@ VAStatus lnc_RenderPictureParameter(context_ENC_p ctx)
lnc_cmdbuf_p cmdbuf = ctx->obj_context->lnc_cmdbuf;
VAStatus vaStatus = VA_STATUS_ERROR_UNKNOWN;
- psPicParams = cmdbuf->pic_params_p;
+ psPicParams = (PIC_PARAMS *)cmdbuf->pic_params_p;
/* second frame will reuse some rate control parameters (IN_PARAMS_MP4)
* so only memset picture parames except IN_PARAMS
* BUT now IN_RC_PARAMS was reload from the cache, so it now can
* memset entirE PIC_PARAMS
*/
- memset(psPicParams, 0, (int)((void *)&psPicParams->sInParams - (void *)psPicParams));
+ memset(psPicParams, 0, (int)((unsigned char *)&psPicParams->sInParams - (unsigned char *)psPicParams));
src_surface = ctx->src_surface;
if (NULL == src_surface) {
@@ -469,6 +469,7 @@ static VAStatus lnc__PatchBitsConsumedInRCParam(context_ENC_p ctx)
/* PIC_PARAMS *psPicParams = cmdbuf->pic_params_p; */
VAStatus vaStatus;
+ (void)cmdbuf;
/* it will wait until last encode session is done */
/* now it just wait the last session is done and the frame skip
* is */
@@ -517,7 +518,7 @@ static VAStatus lnc_RedoRenderPictureSkippedFrame(context_ENC_p ctx)
FirstMBAddress = (pBuffer->start_row_number * ctx->Width) / 16;
/* Insert Do Header command, relocation is needed */
- lnc__H264_prepare_slice_header(cmdbuf->header_mem_p + ctx->slice_header_ofs + i * HEADER_SIZE,
+ lnc__H264_prepare_slice_header((IMG_UINT32 *)(cmdbuf->header_mem_p + ctx->slice_header_ofs + i * HEADER_SIZE),
0, /*pBuffer->slice_flags.bits.is_intra*/
pBuffer->slice_flags.bits.disable_deblocking_filter_idc,
ctx->obj_context->frame_count,
@@ -538,7 +539,7 @@ static VAStatus lnc_RedoRenderPictureSkippedFrame(context_ENC_p ctx)
break;
case IMG_CODEC_MPEG4_VBR:
case IMG_CODEC_MPEG4_CBR: /* only picture header need redo */
- lnc__MPEG4_prepare_vop_header(cmdbuf->header_mem_p + ctx->pic_header_ofs,
+ lnc__MPEG4_prepare_vop_header((IMG_UINT32 *)(cmdbuf->header_mem_p + ctx->pic_header_ofs),
IMG_FALSE /* bIsVOPCoded is false now */,
ctx->MPEG4_vop_time_increment_frameskip, /* In testbench, this should be FrameNum */
4,/* default value is 4,search range */
@@ -560,7 +561,7 @@ static VAStatus lnc_RedoRenderPictureSkippedFrame(context_ENC_p ctx)
static VAStatus lnc_SetupRCParam(context_ENC_p ctx)
{
lnc_cmdbuf_p cmdbuf = ctx->obj_context->lnc_cmdbuf;
- PIC_PARAMS *psPicParams = cmdbuf->pic_params_p;
+ PIC_PARAMS *psPicParams = (PIC_PARAMS *)cmdbuf->pic_params_p;
int origin_qp;/* in DDK setup_rc will change qp strangly,
* just for keep same with DDK
*/
@@ -576,7 +577,7 @@ static VAStatus lnc_SetupRCParam(context_ENC_p ctx)
ctx->sRCParams.InitialQp = origin_qp;
/* save IN_RC_PARAMS into the cache */
- memcpy(&ctx->in_params_cache, (void *)&psPicParams->sInParams, sizeof(IN_RC_PARAMS));
+ memcpy(&ctx->in_params_cache, (unsigned char *)&psPicParams->sInParams, sizeof(IN_RC_PARAMS));
return VA_STATUS_SUCCESS;
}
@@ -585,7 +586,7 @@ static VAStatus lnc_UpdateRCParam(context_ENC_p ctx)
{
int origin_qp;
lnc_cmdbuf_p cmdbuf = ctx->obj_context->lnc_cmdbuf;
- PIC_PARAMS *psPicParams = cmdbuf->pic_params_p;
+ PIC_PARAMS *psPicParams = (PIC_PARAMS *)cmdbuf->pic_params_p;
origin_qp = ctx->sRCParams.InitialQp;
@@ -604,7 +605,7 @@ static VAStatus lnc_UpdateRCParam(context_ENC_p ctx)
}
/* save IN_RC_PARAMS into the cache */
- memcpy(&ctx->in_params_cache, (void *)&psPicParams->sInParams, sizeof(IN_RC_PARAMS));
+ memcpy(&ctx->in_params_cache, (unsigned char *)&psPicParams->sInParams, sizeof(IN_RC_PARAMS));
return VA_STATUS_SUCCESS;
}
@@ -682,7 +683,7 @@ VAStatus lnc_EndPicture(context_ENC_p ctx)
static void lnc__setup_busize(context_ENC_p ctx)
{
- int old_busize = ctx->sRCParams.BUSize;
+ unsigned int old_busize = ctx->sRCParams.BUSize;
/* it is called at EndPicture, we should now the Slice number */
ctx->Slices = ctx->obj_context->slice_count;
@@ -793,7 +794,7 @@ void lnc__setup_rcdata(
PIC_PARAMS *psPicParams,
IMG_RC_PARAMS *psRCParams)
{
- IMG_INT32 max_bitrate = psContext->Width * psContext->Height * 1.5 * 8 * 60;
+ IMG_UINT32 max_bitrate = psContext->Width * psContext->Height * 1.5 * 8 * 60;
IMG_UINT8 InitialSeInitQP = 0;
/* frameskip is always cleared, specially handled at vaEndPicture */
@@ -1182,7 +1183,7 @@ static void lnc__setup_slice_row_params(
tmp = (CurrentRowY != SliceStartRowY);
- for (Pos = 0; Pos < ctx->Width; Pos += 16, psCurrent++) {
+ for (Pos = 0; Pos < (int)ctx->Width; Pos += 16, psCurrent++) {
memset(psCurrent, 0, sizeof(MTX_CURRENT_IN_PARAMS));
psCurrent->MVValid = 0;
psCurrent->ParamsValid = 0;
@@ -1192,12 +1193,12 @@ static void lnc__setup_slice_row_params(
psCurrent->MVValid = 66;
psCurrent->ParamsValid |= PARAMS_ABOVE_VALID;
- if (Pos + 16 < ctx->Width) {
+ if (Pos + 16 < (int)ctx->Width) {
psCurrent->ParamsValid |= PARAMS_ABOVER_VALID;
psCurrent->MVValid |= 4; /* (1<<2) */
}
- if (Pos > 0 && (Pos < ctx->Width)) {
+ if (Pos > 0 && (Pos < (int)ctx->Width)) {
psCurrent->ParamsValid |= PARAMS_ABOVEL_VALID;
psCurrent->MVValid |= 1; /* (1<<0) */
}
@@ -1210,7 +1211,7 @@ static void lnc__setup_slice_row_params(
psCurrent->MVValid |= 72; /* (1<<3)+(1<<6) */
psCurrent->ParamsValid |= 8; /* (1<<3) */
}
- if (Pos == ctx->Width - 16) {
+ if (Pos == (int)(ctx->Width - 16)) {
/* indicate the last MB in a row */
psCurrent->ParamsValid |= MB_END_OF_ROW;
/* are we the last mb in the slice? */
@@ -1244,7 +1245,7 @@ static void lnc__setup_slice_row_params(
psCurrent->IPEMin[0] = 3;
}
- if ((Pos + 48 + 16) > ctx->Width) {
+ if ((Pos + 48 + 16) > (int)ctx->Width) {
psCurrent->IPEMax[0] = (47 + ctx->Width) - Pos; /* (112 - 1) - ((Pos + 48+16) - ctx->Width); */
psCurrent->RealEdge |= SPE_EDGE_RIGHT;
} else {
@@ -1352,7 +1353,7 @@ IMG_UINT32 lnc__send_encode_slice_params(
IMG_UINT32 MaxSliceSize)
{
SLICE_PARAMS *psSliceParams;
- IMG_INT16 RowOffset;
+ IMG_UINT16 RowOffset;
psb_buffer_p psCoded;
object_surface_p ref_surface;
@@ -1458,7 +1459,7 @@ IMG_UINT32 lnc__send_encode_slice_params(
*/
void lnc_reset_encoder_params(context_ENC_p ctx)
{
- void *Add_Below, *Add_Above;
+ unsigned char *Add_Below, *Add_Above;
lnc_cmdbuf_p cmdbuf = ctx->obj_context->lnc_cmdbuf;
/* all frames share the same Topaz param, in_param/aboveparam/bellow
diff --git a/src/lnc_hostcode.h b/src/lnc_hostcode.h
index 046fca7..b033ccf 100644
--- a/src/lnc_hostcode.h
+++ b/src/lnc_hostcode.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -91,14 +91,14 @@ typedef struct _RC_PARAMS_ {
IMG_UINT32 IntraFreq;
IMG_UINT16 IDRFreq;
- IMG_INT16 MinQP;
+ IMG_UINT16 MinQP;
IMG_BOOL RCEnable;
IMG_BOOL FrameSkip;
IMG_UINT8 Slices;
IMG_UINT8 VCMBitrateMargin;
- IMG_INT32 InitialLevel;
- IMG_INT32 InitialDelay;
+ IMG_UINT32 InitialLevel;
+ IMG_UINT32 InitialDelay;
} IMG_RC_PARAMS;
/*!
@@ -127,7 +127,7 @@ typedef struct {
IMG_INT32 BitRate; /* Bit Rate (bps) */
IMG_INT32 BufferSize; /* Size of Buffer */
- IMG_INT32 InitialLevel; /* Initial Level of Buffer */
+ IMG_UINT32 InitialLevel; /* Initial Level of Buffer */
IMG_INT32 InitialDelay; /* Initial Delay of Buffer */
IMG_UINT8 ScaleFactor; /* Scale Factor (H264 only) */
@@ -158,11 +158,11 @@ struct coded_buf_aux_info {
struct context_ENC_s {
object_context_p obj_context; /* back reference */
- IMG_INT16 Width;
- IMG_INT16 Height;
- IMG_INT16 RawWidth;
- IMG_INT16 RawHeight;
- IMG_INT16 Slices;
+ IMG_UINT32 Width;
+ IMG_UINT32 Height;
+ IMG_UINT16 RawWidth;
+ IMG_UINT16 RawHeight;
+ IMG_UINT16 Slices;
enum drm_lnc_topaz_codec eCodec;
IMG_FORMAT eFormat;
unsigned int FCode;
diff --git a/src/lnc_hostheader.c b/src/lnc_hostheader.c
index d7f7d34..a7a4b93 100644
--- a/src/lnc_hostheader.c
+++ b/src/lnc_hostheader.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -70,7 +70,7 @@ static void Show_Bits(
}
snprintf(Txt, sizeof(Txt), "%s ", Txt);
- printf(Txt);
+ printf("%s", Txt);
if ((uiLp + 1) % 8 == 0) printf("\n");
}
@@ -2071,9 +2071,11 @@ void lnc__H264_prepare_sequence_header(
IMG_UINT8 uiLevel,
IMG_UINT8 uiProfile)
{
- H264_SEQUENCE_HEADER_PARAMS SHParams = {0, };
+ H264_SEQUENCE_HEADER_PARAMS SHParams;
MTX_HEADER_PARAMS *mtx_hdr;
+ memset(&SHParams, 0, sizeof(SHParams));
+
/* Route output elements to memory provided */
mtx_hdr = (MTX_HEADER_PARAMS *) pHeaderMemory;
diff --git a/src/lnc_hostheader.h b/src/lnc_hostheader.h
index e8d3996..baca667 100644
--- a/src/lnc_hostheader.h
+++ b/src/lnc_hostheader.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/lnc_ospm.c b/src/lnc_ospm.c
index 23d9149..6219eb1 100644
--- a/src/lnc_ospm.c
+++ b/src/lnc_ospm.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.
@@ -168,10 +168,11 @@ int lnc_ospm_start(psb_driver_data_p driver_data, int encode)
{
int ret;
- if (getenv("PSB_VIDEO_NO_OSPM"))
+ if (psb_parse_config("PSB_VIDEO_NOPM", NULL) == 0)
return 0;
if (IS_MRST(driver_data)) {
+ /*
psb__information_message("OSPM:send DBUS message to ospm daemon\n");
if (encode)
ret = lnc_ospm_event_send("video_record", "start");
@@ -182,8 +183,10 @@ int lnc_ospm_start(psb_driver_data_p driver_data, int encode)
psb__information_message("lnc_ospm_event_send start error: #%d\n", ret);
else
psb__information_message("lnc_ospm_event_send start ok\n");
+ */
} else if (IS_MFLD(driver_data)) {
psb__information_message("OSPM:set PM_QoS parameters\n");
+ return 0;
/*
if (encode)
lnc_handle_pm_qos(driver_data);
@@ -208,6 +211,7 @@ int lnc_ospm_stop(psb_driver_data_p driver_data, int encode)
return 0;
if (IS_MRST(driver_data)) {
+ /*
psb__information_message("OSPM:send DBUS message to ospm daemon\n");
if (encode)
ret = lnc_ospm_event_send("video_record", "stop");
@@ -218,12 +222,14 @@ int lnc_ospm_stop(psb_driver_data_p driver_data, int encode)
psb__information_message("lnc_ospm_event_send start error: #%d\n", ret);
else
psb__information_message("lnc_ospm_event_send start ok\n");
+ */
} else if (IS_MFLD(driver_data)) {
psb__information_message("OSPM:set PM_QoS parameters\n");
/*
if (encode)
lnc_handle_pm_qos(driver_data);
*/
+ return 0;
}
if (encode) {
diff --git a/src/lnc_ospm.h b/src/lnc_ospm.h
index a6561a7..324fb9e 100644
--- a/src/lnc_ospm.h
+++ b/src/lnc_ospm.h
@@ -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.
diff --git a/src/object_heap.c b/src/object_heap.c
index 4b7d740..75ff375 100644
--- a/src/object_heap.c
+++ b/src/object_heap.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.
diff --git a/src/object_heap.h b/src/object_heap.h
index 265ebd3..bf0d153 100644
--- a/src/object_heap.h
+++ b/src/object_heap.h
@@ -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.
diff --git a/src/pnw_H263ES.c b/src/pnw_H263ES.c
index 1df7227..3d581c2 100644
--- a/src/pnw_H263ES.c
+++ b/src/pnw_H263ES.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -78,10 +78,21 @@ static void pnw_H263ES_QueryConfigAttributes(
static VAStatus pnw_H263ES_ValidateConfig(
object_config_p obj_config)
{
- VAStatus vaStatus = VA_STATUS_SUCCESS;
- psb__information_message("pnw_H263ES_ValidateConfig\n");
+ int i;
+ /* Check all attributes */
+ for (i = 0; i < obj_config->attrib_count; i++) {
+ switch (obj_config->attrib_list[i].type) {
+ case VAConfigAttribRTFormat:
+ /* Ignore */
+ break;
+ case VAConfigAttribRateControl:
+ break;
+ default:
+ return VA_STATUS_ERROR_ATTR_NOT_SUPPORTED;
+ }
+ }
- return vaStatus;
+ return VA_STATUS_SUCCESS;
}
@@ -258,8 +269,8 @@ static VAStatus pnw__H263ES_process_picture_param(context_ENC_p ctx, object_buff
ctx->dest_surface = SURFACE(pBuffer->reconstructed_picture);
ctx->coded_buf = BUFFER(pBuffer->coded_buf);
- ASSERT(ctx->Width == pBuffer->picture_width);
- ASSERT(ctx->Height == pBuffer->picture_height);
+ ctx->RawWidth = pBuffer->picture_width;
+ ctx->RawHeight = pBuffer->picture_height;
/* Insert do_header command here */
@@ -286,8 +297,8 @@ static VAStatus pnw__H263ES_process_picture_param(context_ENC_p ctx, object_buff
pBuffer->picture_type,
SourceFormatType,
ctx->sRCParams.FrameRate,
- ctx->Width,
- ctx->Height);
+ ctx->RawWidth,
+ ctx->RawHeight);
pnw_cmdbuf_insert_command_package(ctx->obj_context,
ctx->ParallelCores - 1, /* Send to the last core as this will complete first */
@@ -312,7 +323,7 @@ static VAStatus pnw__H263ES_process_slice_param(context_ENC_p ctx, object_buffer
VAEncSliceParameterBuffer *pBuffer;
pnw_cmdbuf_p cmdbuf = ctx->obj_context->pnw_cmdbuf;
PIC_PARAMS *psPicParams = (PIC_PARAMS *)(cmdbuf->pic_params_p);
- int i;
+ unsigned int i;
int slice_param_idx;
ASSERT(obj_buffer->type == VAEncSliceParameterBufferType);
@@ -367,8 +378,7 @@ static VAStatus pnw__H263ES_process_slice_param(context_ENC_p ctx, object_buffer
HEADER_SIZE);
pnw__H263_prepare_GOBslice_header(
- cmdbuf->header_mem_p + ctx->slice_header_ofs
- + ctx->obj_context->slice_count * HEADER_SIZE,
+ cmdbuf->header_mem_p + ctx->slice_header_ofs + ctx->obj_context->slice_count * HEADER_SIZE,
ctx->obj_context->slice_count,
ctx->obj_context->frame_count);
diff --git a/src/pnw_H263ES.h b/src/pnw_H263ES.h
index ebd265e..96f8100 100644
--- a/src/pnw_H263ES.h
+++ b/src/pnw_H263ES.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/pnw_H264.c b/src/pnw_H264.c
index e2731d6..01bd545 100644
--- a/src/pnw_H264.c
+++ b/src/pnw_H264.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -32,6 +32,7 @@
#include "psb_def.h"
#include "psb_surface.h"
#include "psb_cmdbuf.h"
+#include "pnw_rotate.h"
#include "hwdefs/reg_io2.h"
#include "hwdefs/msvdx_offsets.h"
@@ -53,6 +54,8 @@
#define SET_SURFACE_INFO_dpb_idx(psb_surface, val) psb_surface->extra_info[2] = val;
#define GET_SURFACE_INFO_colocated_index(psb_surface) ((int) (psb_surface->extra_info[3]))
#define SET_SURFACE_INFO_colocated_index(psb_surface, val) psb_surface->extra_info[3] = (uint32_t) val;
+#define SET_SURFACE_INFO_rotate(psb_surface, rotate) psb_surface->extra_info[5] = (uint32_t) rotate;
+#define GET_SURFACE_INFO_rotate(psb_surface) ((int) psb_surface->extra_info[5])
#define IS_USED_AS_REFERENCE(pic_flags) ( pic_flags & (VA_PICTURE_H264_SHORT_TERM_REFERENCE | VA_PICTURE_H264_LONG_TERM_REFERENCE) )
@@ -483,7 +486,7 @@ static VAStatus pnw_H264_CreateContext(
DEBUG_FAILURE;
}
if (vaStatus == VA_STATUS_SUCCESS) {
- void *vlc_packed_data_address;
+ unsigned char *vlc_packed_data_address;
if (0 == psb_buffer_map(&ctx->vlc_packed_table, &vlc_packed_data_address)) {
memcpy(vlc_packed_data_address, ui16H264VLCTableData, sizeof(ui16H264VLCTableData));
psb_buffer_unmap(&ctx->vlc_packed_table);
@@ -540,8 +543,6 @@ static VAStatus psb__H264_allocate_colocated_buffer(context_H264_p ctx, object_s
{
psb_surface_p surface = obj_surface->psb_surface;
- psb__information_message("pnw_H264: Allocating colocated buffer for surface %08x size = %08x\n", surface, size);
-
if (!GET_SURFACE_INFO_colocated_index(surface)) {
VAStatus vaStatus;
psb_buffer_p buf;
@@ -549,6 +550,9 @@ static VAStatus psb__H264_allocate_colocated_buffer(context_H264_p ctx, object_s
if (index >= ctx->colocated_buffers_size) {
return VA_STATUS_ERROR_UNKNOWN;
}
+
+ psb__information_message("pnw_H264: Allocating colocated buffer for surface %08x size = %08x\n", surface, size);
+
buf = &(ctx->colocated_buffers[index]);
vaStatus = psb_buffer_create(ctx->obj_context->driver_data, size, psb_bt_vpu_only, buf);
if (VA_STATUS_SUCCESS != vaStatus) {
@@ -703,7 +707,7 @@ static VAStatus psb__H264_process_picture_param(context_H264_p ctx, object_buffe
/* Assume SGM_8BIT */
REGIO_WRITE_FIELD_LITE(ctx->reg_SPS0, MSVDX_VEC_H264, CR_VEC_H264_FE_SPS0, H264_FE_SPS0_4BIT_SGM_FLAG, 0);
REGIO_WRITE_FIELD_LITE(ctx->reg_SPS0, MSVDX_VEC_H264, CR_VEC_H264_BE_SPS0, BE_PROFILEIDC, ctx->profile_idc);
- REGIO_WRITE_FIELD_LITE(ctx->reg_SPS0, MSVDX_VEC_H264, CR_VEC_H264_FE_SPS0, MIN_LUMA_BIPRED_SIZE_8X8, pic_params->seq_fields.bits.MinLumaBiPredSize8x8);
+ REGIO_WRITE_FIELD_LITE(ctx->reg_SPS0, MSVDX_VEC_H264, CR_VEC_H264_FE_SPS0, MIN_LUMA_BIPRED_SIZE_8X8, (ctx->picture_width_mb > 80));
REGIO_WRITE_FIELD_LITE(ctx->reg_SPS0, MSVDX_VEC_H264, CR_VEC_H264_FE_SPS0, DIRECT_8X8_INFERENCE_FLAG, pic_params->seq_fields.bits.direct_8x8_inference_flag);
REGIO_WRITE_FIELD_LITE(ctx->reg_SPS0, MSVDX_VEC_H264, CR_VEC_H264_FE_SPS0, CHROMA_FORMAT_IDC, pic_params->seq_fields.bits.chroma_format_idc);
REGIO_WRITE_FIELD_LITE(ctx->reg_SPS0, MSVDX_VEC_H264, CR_VEC_H264_FE_SPS0, FRAME_MBS_ONLY_FLAG, pic_params->seq_fields.bits.frame_mbs_only_flag);
@@ -744,6 +748,8 @@ static VAStatus psb__H264_process_picture_param(context_H264_p ctx, object_buffe
}
}
+ psb_CheckInterlaceRotate(ctx->obj_context, (unsigned char *)pic_params);
+
return VA_STATUS_SUCCESS;
}
@@ -1018,7 +1024,12 @@ static void psb__H264_setup_alternative_frame(context_H264_p ctx)
psb_surface_p rotate_surface = ctx->obj_context->current_render_target->psb_surface_rotate;
object_context_p obj_context = ctx->obj_context;
- if (rotate_surface->extra_info[5] != obj_context->rotate)
+ if (rotate_surface == NULL) {
+ psb__information_message("rotate surface is NULL, abort msvdx rotation\n");
+ return;
+ }
+
+ if (GET_SURFACE_INFO_rotate(rotate_surface) != obj_context->msvdx_rotate)
psb__error_message("Display rotate mode does not match surface rotate mode!\n");
@@ -1036,7 +1047,7 @@ static void psb__H264_setup_alternative_frame(context_H264_p ctx)
REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ALT_PICTURE_ENABLE, 1);
REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ROTATION_ROW_STRIDE, rotate_surface->stride_mode);
REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , RECON_WRITE_DISABLE, 0); /* FIXME Always generate Rec */
- REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ROTATION_MODE, rotate_surface->extra_info[5]);
+ REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ROTATION_MODE, GET_SURFACE_INFO_rotate(rotate_surface));
psb_cmdbuf_rendec_write(cmdbuf, cmd);
*ctx->alt_output_flags = cmd;
@@ -1057,7 +1068,7 @@ static void psb__H264_build_rendec_params(context_H264_p ctx, VASliceParameterBu
psb_surface_p target_surface = ctx->obj_context->current_render_target->psb_surface;
VAPictureParameterBufferH264 *pic_params = ctx->pic_params;
uint32_t reg_value;
- int i;
+ unsigned int i;
/* psb_cmdbuf_rendec_start_block( cmdbuf ); */
@@ -1100,7 +1111,7 @@ static void psb__H264_build_rendec_params(context_H264_p ctx, VASliceParameterBu
psb_cmdbuf_rendec_end(cmdbuf);
-#warning "TODO: MUST be done after fe slice1 (which gives MB address) "
+ //#warning "TODO: MUST be done after fe slice1 (which gives MB address) "
/* REGIO_WRITE_REGISTER(0, MSVDX_VEC_H264, CR_VEC_H264_FE_BASE_ADDR_SGM, gui32SliceGroupType6BaseAddressHack); */
/* CHUNK: SCA */
@@ -1127,8 +1138,8 @@ static void psb__H264_build_rendec_params(context_H264_p ctx, VASliceParameterBu
if (slice_param->slice_type == ST_B || slice_param->slice_type == ST_P) {
psb_cmdbuf_rendec_start(cmdbuf, RENDEC_REGISTER_OFFSET(MSVDX_VEC, H264_CR_VEC_H264_BE_LIST0));
- if (slice_param->num_ref_idx_l0_active_minus1 > (32 - 4)) {
- psb__error_message("num_ref_idx_l0_active_minus1(%d) is too big. Set it with 28\n",
+ if (slice_param->num_ref_idx_l0_active_minus1 > 31) {
+ psb__error_message("num_ref_idx_l0_active_minus1(%d) is too big, limit it to 31.\n",
slice_param->num_ref_idx_l0_active_minus1);
slice_param->num_ref_idx_l0_active_minus1 = 28;
}
@@ -1149,7 +1160,6 @@ static void psb__H264_build_rendec_params(context_H264_p ctx, VASliceParameterBu
/* send DPB information (for P and B slices?) only needed once per frame */
// if ( sh->slice_type == ST_B || sh->slice_type == ST_P )
if (pic_params->num_ref_frames > 0) {
- int i;
IMG_BOOL is_used[16];
psb_cmdbuf_rendec_start(cmdbuf, RENDEC_REGISTER_OFFSET(MSVDX_CMDS, REFERENCE_PICTURE_BASE_ADDRESSES));
@@ -1197,6 +1207,7 @@ static void psb__H264_build_rendec_params(context_H264_p ctx, VASliceParameterBu
}
buffer = ref_surface->psb_surface->ref_buf;
+ /*
psb__information_message("pic_params->ReferenceFrames[%d] = %08x --> %08x frame_idx:0x%08x flags:%02x TopFieldOrderCnt: 0x%08x BottomFieldOrderCnt: 0x%08x %s\n",
i,
pic_params->ReferenceFrames[i].picture_id,
@@ -1206,8 +1217,8 @@ static void psb__H264_build_rendec_params(context_H264_p ctx, VASliceParameterBu
pic_params->ReferenceFrames[i].TopFieldOrderCnt,
pic_params->ReferenceFrames[i].BottomFieldOrderCnt,
is_used[i] ? "used" : "");
-
- if (ref_surface && is_used[i])
+ */
+ if (ref_surface && is_used[i] && buffer)
// GET_SURFACE_INFO_is_used(ref_surface->psb_surface))
{
psb_cmdbuf_rendec_write_address(cmdbuf, buffer,
@@ -1394,8 +1405,13 @@ static void psb__H264_build_rendec_params(context_H264_p ctx, VASliceParameterBu
/* If this a two pass mode deblock, then we will perform the rotation as part of the
* 2nd pass deblock procedure
*/
- if (!ctx->two_pass_mode && ctx->obj_context->rotate != VA_ROTATION_NONE) /* FIXME field coded should not issue */
+ if (!ctx->two_pass_mode && CONTEXT_ROTATE(ctx->obj_context)) {/* FIXME field coded should not issue */
+ psb__information_message("Setup rotate surface (%d) into command stream\n",
+ ctx->obj_context->msvdx_rotate);
+
psb__H264_setup_alternative_frame(ctx);
+ }
+
/* psb_cmdbuf_rendec_end_block( cmdbuf ); */
}
@@ -1407,7 +1423,7 @@ static VAStatus psb__H264_add_slice_param(context_H264_p ctx, object_buffer_p ob
{
ASSERT(obj_buffer->type == VASliceParameterBufferType);
if (ctx->slice_param_list_idx >= ctx->slice_param_list_size) {
- void *new_list;
+ unsigned char *new_list;
ctx->slice_param_list_size += 8;
new_list = realloc(ctx->slice_param_list,
sizeof(object_buffer_p) * ctx->slice_param_list_size);
@@ -1570,7 +1586,7 @@ static const IMG_UINT32 ui32H264VLCTableRegValPair[] = {
static void psb__H264_write_VLC_tables(context_H264_p ctx)
{
psb_cmdbuf_p cmdbuf = ctx->obj_context->cmdbuf;
- int i;
+ unsigned int i;
psb_cmdbuf_skip_start_block(cmdbuf, SKIP_ON_CONTEXT_SWITCH);
@@ -1600,6 +1616,7 @@ static VAStatus psb__H264_process_slice(context_H264_p ctx,
ASSERT((obj_buffer->type == VASliceDataBufferType) || (obj_buffer->type == VAProtectedSliceDataBufferType));
+#if 0
psb__information_message("H264 process slice %d\n", ctx->slice_count);
psb__information_message(" profile = %s\n", profile2str[ctx->profile]);
psb__information_message(" size = %08x offset = %08x\n", slice_param->slice_data_size, slice_param->slice_data_offset);
@@ -1608,6 +1625,7 @@ static VAStatus psb__H264_process_slice(context_H264_p ctx,
psb__information_message(" coded size = %dx%d\n", ctx->picture_width_mb, ctx->picture_height_mb);
psb__information_message(" slice type = %s\n", slice2str[(slice_param->slice_type % 5)]);
psb__information_message(" weighted_pred_flag = %d weighted_bipred_idc = %d\n", ctx->pic_params->pic_fields.bits.weighted_pred_flag, ctx->pic_params->pic_fields.bits.weighted_bipred_idc);
+#endif
if ((slice_param->slice_data_flag == VA_SLICE_DATA_FLAG_BEGIN) ||
(slice_param->slice_data_flag == VA_SLICE_DATA_FLAG_ALL)) {
@@ -1692,7 +1710,7 @@ static VAStatus psb__H264_process_slice_data(context_H264_p ctx, object_buffer_p
VAStatus vaStatus = VA_STATUS_SUCCESS;
VASliceParameterBufferH264 *slice_param;
int buffer_idx = 0;
- int element_idx = 0;
+ unsigned int element_idx = 0;
ASSERT((obj_buffer->type == VASliceDataBufferType) || (obj_buffer->type == VAProtectedSliceDataBufferType));
@@ -1766,32 +1784,32 @@ static VAStatus pnw_H264_RenderPicture(
switch (obj_buffer->type) {
case VAPictureParameterBufferType:
- psb__information_message("pnw_H264_RenderPicture got VAPictureParameterBuffer\n");
+ /* psb__information_message("pnw_H264_RenderPicture got VAPictureParameterBuffer\n"); */
vaStatus = psb__H264_process_picture_param(ctx, obj_buffer);
DEBUG_FAILURE;
break;
case VAIQMatrixBufferType:
- psb__information_message("pnw_H264_RenderPicture got VAIQMatrixBufferType\n");
+ /* psb__information_message("pnw_H264_RenderPicture got VAIQMatrixBufferType\n"); */
vaStatus = psb__H264_process_iq_matrix(ctx, obj_buffer);
DEBUG_FAILURE;
break;
case VASliceGroupMapBufferType:
- psb__information_message("pnw_H264_RenderPicture got VASliceGroupMapBufferType\n");
+ /* psb__information_message("pnw_H264_RenderPicture got VASliceGroupMapBufferType\n"); */
vaStatus = psb__H264_process_slice_group_map(ctx, obj_buffer);
DEBUG_FAILURE;
break;
case VASliceParameterBufferType:
- psb__information_message("pnw_H264_RenderPicture got VASliceParameterBufferType\n");
+ /* psb__information_message("pnw_H264_RenderPicture got VASliceParameterBufferType\n"); */
vaStatus = psb__H264_add_slice_param(ctx, obj_buffer);
DEBUG_FAILURE;
break;
case VASliceDataBufferType:
case VAProtectedSliceDataBufferType:
- psb__information_message("pnw_H264_RenderPicture got %s\n", SLICEDATA_BUFFER_TYPE(obj_buffer->type));
+ /* psb__information_message("pnw_H264_RenderPicture got %s\n", SLICEDATA_BUFFER_TYPE(obj_buffer->type)); */
vaStatus = psb__H264_process_slice_data(ctx, obj_buffer);
DEBUG_FAILURE;
break;
@@ -1821,12 +1839,12 @@ static VAStatus pnw_H264_EndPicture(
uint32_t ext_stride_a = 0;
psb__information_message("pnw_H264_EndPicture got two pass mode frame\n");
- if (ctx->obj_context->rotate != VA_ROTATION_NONE) {
+ if (CONTEXT_ROTATE(ctx->obj_context)) {
ASSERT(rotate_surface);
REGIO_WRITE_FIELD_LITE(rotation_flags, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ALT_PICTURE_ENABLE, 1);
REGIO_WRITE_FIELD_LITE(rotation_flags, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ROTATION_ROW_STRIDE, rotate_surface->stride_mode);
REGIO_WRITE_FIELD_LITE(rotation_flags, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , RECON_WRITE_DISABLE, 0); /* FIXME Always generate Rec */
- REGIO_WRITE_FIELD_LITE(rotation_flags, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ROTATION_MODE, rotate_surface->extra_info[5]);
+ REGIO_WRITE_FIELD_LITE(rotation_flags, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ROTATION_MODE, GET_SURFACE_INFO_rotate(rotate_surface));
}
REGIO_WRITE_FIELD_LITE(ext_stride_a, MSVDX_CMDS, EXTENDED_ROW_STRIDE, EXT_ROW_STRIDE, target_surface->stride / 64);
@@ -1851,12 +1869,13 @@ static VAStatus pnw_H264_EndPicture(
psb_buffer_p buffer_dst;
uint32_t chroma_offset_dst;
- if (ctx->obj_context->rotate == VA_ROTATION_NONE) {
+ if (CONTEXT_ROTATE(ctx->obj_context) == 0) {
buffer_dst = &target_surface->buf;
chroma_offset_dst = target_surface->chroma_offset;
} else {
- if (!rotate_surface)
+ if (!rotate_surface) {
ASSERT(0);
+ }
buffer_dst = &rotate_surface->buf;
chroma_offset_dst = rotate_surface->chroma_offset;
diff --git a/src/pnw_H264.h b/src/pnw_H264.h
index 6abe846..bf2d99a 100644
--- a/src/pnw_H264.h
+++ b/src/pnw_H264.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/pnw_H264ES.c b/src/pnw_H264ES.c
index fdf7b00..4c1bc6f 100644
--- a/src/pnw_H264ES.c
+++ b/src/pnw_H264ES.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -80,11 +80,21 @@ static void pnw_H264ES_QueryConfigAttributes(
static VAStatus pnw_H264ES_ValidateConfig(
object_config_p obj_config)
{
- VAStatus vaStatus = VA_STATUS_SUCCESS;
- psb__information_message("pnw_H264ES_ValidateConfig\n");
-
- return vaStatus;
+ int i;
+ /* Check all attributes */
+ for (i = 0; i < obj_config->attrib_count; i++) {
+ switch (obj_config->attrib_list[i].type) {
+ case VAConfigAttribRTFormat:
+ /* Ignore */
+ break;
+ case VAConfigAttribRateControl:
+ break;
+ default:
+ return VA_STATUS_ERROR_ATTR_NOT_SUPPORTED;
+ }
+ }
+ return VA_STATUS_SUCCESS;
}
@@ -131,6 +141,8 @@ static VAStatus pnw_H264ES_CreateContext(
ctx->sRCParams.RCEnable = IMG_TRUE;
} else
return VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT;
+
+ psb__information_message("eCodec is %d\n", ctx->eCodec);
ctx->eFormat = IMG_CODEC_PL12; /* use default */
ctx->Slices = 1;
@@ -204,6 +216,11 @@ static VAStatus pnw__H264ES_process_sequence_param(context_ENC_p ctx, object_buf
obj_buffer->buffer_data = NULL;
obj_buffer->size = 0;
+ if (!pSequenceParams->bits_per_second) {
+ pSequenceParams->bits_per_second = ctx->Height * ctx->Width * 30 * 12;
+ psb__information_message("bits_per_second is 0, set to %d\n",
+ pSequenceParams->bits_per_second);
+ }
ctx->sRCParams.bBitrateChanged =
(pSequenceParams->bits_per_second == ctx->sRCParams.BitsPerSecond ?
IMG_FALSE : IMG_TRUE);
@@ -306,8 +323,8 @@ static VAStatus pnw__H264ES_process_sequence_param(context_ENC_p ctx, object_buf
free(pSequenceParams);
return VA_STATUS_ERROR_ALLOCATION_FAILED;
}
- memcpy((void *)ctx->save_seq_header_p,
- (void *)(cmdbuf->header_mem_p + ctx->seq_header_ofs),
+ memcpy((unsigned char *)ctx->save_seq_header_p,
+ (unsigned char *)(cmdbuf->header_mem_p + ctx->seq_header_ofs),
HEADER_SIZE);
}
}
@@ -391,8 +408,8 @@ static VAStatus pnw__H264ES_process_picture_param(context_ENC_p ctx, object_buff
if (need_sps) {
psb__information_message("TOPAZ: insert a SPS before IDR frame\n");
/* reuse the previous SPS */
- memcpy((void *)(cmdbuf->header_mem_p + ctx->seq_header_ofs),
- (void *)ctx->save_seq_header_p,
+ memcpy((unsigned char *)(cmdbuf->header_mem_p + ctx->seq_header_ofs),
+ (unsigned char *)ctx->save_seq_header_p,
HEADER_SIZE);
cmdbuf->cmd_idx_saved[PNW_CMDBUF_SEQ_HEADER_IDX] = cmdbuf->cmd_idx;
@@ -412,6 +429,7 @@ static VAStatus pnw__H264ES_process_picture_param(context_ENC_p ctx, object_buff
MTX_CMDID_DO_HEADER,
&cmdbuf->header_mem,
ctx->pic_header_ofs);
+
}
if (ctx->ParallelCores == 1) {
@@ -541,12 +559,12 @@ static VAStatus pnw__H264ES_process_slice_param(context_ENC_p ctx, object_buffer
VAEncSliceParameterBuffer *pBuf_per_core, *pBuffer;
pnw_cmdbuf_p cmdbuf = ctx->obj_context->pnw_cmdbuf;
PIC_PARAMS *psPicParams = (PIC_PARAMS *)(cmdbuf->pic_params_p);
- int i, j, slice_per_core;
+ unsigned int i, j, slice_per_core;
ASSERT(obj_buffer->type == VAEncSliceParameterBufferType);
cmdbuf = ctx->obj_context->pnw_cmdbuf;
- psPicParams = cmdbuf->pic_params_p;
+ psPicParams = (PIC_PARAMS *)cmdbuf->pic_params_p;
/* Transfer ownership of VAEncPictureParameterBufferH264 data */
pBuffer = (VAEncSliceParameterBuffer *) obj_buffer->buffer_data;
@@ -634,7 +652,10 @@ static VAStatus pnw__H264ES_process_misc_param(context_ENC_p ctx, object_buffer_
VAEncMiscParameterFrameRate *frame_rate_param;
VAStatus vaStatus = VA_STATUS_SUCCESS;
-
+ if (ctx->eCodec != IMG_CODEC_H264_VCM) {
+ psb__information_message("Only VCM mode allow rate control setting.Ignore.\n");
+ return VA_STATUS_SUCCESS;
+ }
ASSERT(obj_buffer->type == VAEncMiscParameterBufferType);
/* Transfer ownership of VAEncMiscParameterBuffer data */
@@ -645,7 +666,7 @@ static VAStatus pnw__H264ES_process_misc_param(context_ENC_p ctx, object_buffer_
case VAEncMiscParameterTypeFrameRate:
frame_rate_param = (VAEncMiscParameterFrameRate *)pBuffer->data;
- if (frame_rate_param->framerate > 65535) {
+ if (frame_rate_param->framerate < 1 || frame_rate_param->framerate > 65535) {
vaStatus = VA_STATUS_ERROR_INVALID_PARAMETER;
break;
}
@@ -672,11 +693,18 @@ static VAStatus pnw__H264ES_process_misc_param(context_ENC_p ctx, object_buffer_
break;
}
+ if (rate_control_param->window_size > 65535) {
+ psb__error_message("window_size is too much!\n");
+ vaStatus = VA_STATUS_ERROR_INVALID_PARAMETER;
+ break;
+ }
+
psb__information_message("rate control changed from %d to %d\n",
ctx->sRCParams.BitsPerSecond,
rate_control_param->bits_per_second);
if ((rate_control_param->bits_per_second == ctx->sRCParams.BitsPerSecond) &&
+ (rate_control_param->window_size != 0) &&
(ctx->sRCParams.BufferSize == ctx->sRCParams.BitsPerSecond / 1000 * rate_control_param->window_size) &&
(ctx->sRCParams.MinQP == rate_control_param->min_qp) &&
(ctx->sRCParams.InitialQp == rate_control_param->initial_qp))
@@ -690,7 +718,7 @@ static VAStatus pnw__H264ES_process_misc_param(context_ENC_p ctx, object_buffer_
the maximum bitrate, set it with %d\n",
rate_control_param->bits_per_second,
TOPAZ_H264_MAX_BITRATE);
- } else
+ } else if (rate_control_param->bits_per_second != 0)
ctx->sRCParams.BitsPerSecond = rate_control_param->bits_per_second;
if (rate_control_param->window_size != 0)
@@ -704,6 +732,13 @@ static VAStatus pnw__H264ES_process_misc_param(context_ENC_p ctx, object_buffer_
case VAEncMiscParameterTypeMaxSliceSize:
max_slice_size_param = (VAEncMiscParameterMaxSliceSize *)pBuffer->data;
+ /*The max slice size should not be bigger than 1920x1080x1.5x8 */
+ if (max_slice_size_param->max_slice_size > 24883200) {
+ psb__error_message("Invalid max_slice_size. It should be 1~ 3110400.\n");
+ vaStatus = VA_STATUS_ERROR_INVALID_PARAMETER;
+ break;
+ }
+
if (ctx->max_slice_size == max_slice_size_param->max_slice_size)
break;
@@ -728,7 +763,7 @@ static VAStatus pnw__H264ES_process_misc_param(context_ENC_p ctx, object_buffer_
air_param->air_num_mbs, air_param->air_threshold,
air_param->air_auto);
- if (((ctx->Height * ctx->Width) >> 8) < air_param->air_num_mbs)
+ if (((ctx->Height * ctx->Width) >> 8) < (int)air_param->air_num_mbs)
air_param->air_num_mbs = ((ctx->Height * ctx->Width) >> 8);
if (air_param->air_threshold == 0)
psb__information_message("%s: air threshold is set to zero\n",
diff --git a/src/pnw_H264ES.h b/src/pnw_H264ES.h
index aeda454..6103765 100644
--- a/src/pnw_H264ES.h
+++ b/src/pnw_H264ES.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/pnw_MPEG2.c b/src/pnw_MPEG2.c
index d745ea8..2e30544 100644
--- a/src/pnw_MPEG2.c
+++ b/src/pnw_MPEG2.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -50,6 +50,8 @@
#define SET_SURFACE_INFO_picture_structure(psb_surface, val) psb_surface->extra_info[1] = val;
#define GET_SURFACE_INFO_picture_coding_type(psb_surface) ((int) (psb_surface->extra_info[2]))
#define SET_SURFACE_INFO_picture_coding_type(psb_surface, val) psb_surface->extra_info[2] = (uint32_t) val;
+#define SET_SURFACE_INFO_rotate(psb_surface, rotate) psb_surface->extra_info[5] = (uint32_t) rotate;
+#define GET_SURFACE_INFO_rotate(psb_surface) ((int) psb_surface->extra_info[5])
#define SLICEDATA_BUFFER_TYPE(type) ((type==VASliceDataBufferType)?"VASliceDataBufferType":"VAProtectedSliceDataBufferType")
@@ -71,7 +73,7 @@
/* Format is: opcode, width, symbol. All VLC tables are concatenated. Index */
/* infomation is stored in gui16mpeg2VlcIndexData[] */
#define VLC_PACK(a,b,c) ( ( (a) << 12 ) | ( (b) << 9 ) | (c) )
-const static IMG_UINT16 gaui16mpeg2VlcTableDataPacked[] = {
+static const IMG_UINT16 gaui16mpeg2VlcTableDataPacked[] = {
VLC_PACK(6 , 0 , 0) ,
VLC_PACK(0 , 0 , 6) ,
VLC_PACK(4 , 2 , 4) ,
@@ -659,7 +661,7 @@ static VAStatus pnw_MPEG2_CreateContext(
DEBUG_FAILURE;
}
if (vaStatus == VA_STATUS_SUCCESS) {
- void *vlc_packed_data_address;
+ unsigned char *vlc_packed_data_address;
if (0 == psb_buffer_map(&ctx->vlc_packed_table, &vlc_packed_data_address)) {
memcpy(vlc_packed_data_address, gaui16mpeg2VlcTableDataPacked, sizeof(gaui16mpeg2VlcTableDataPacked));
psb_buffer_unmap(&ctx->vlc_packed_table);
@@ -874,7 +876,7 @@ static VAStatus psb__MPEG2_add_slice_param(context_MPEG2_p ctx, object_buffer_p
{
ASSERT(obj_buffer->type == VASliceParameterBufferType);
if (ctx->slice_param_list_idx >= ctx->slice_param_list_size) {
- void *new_list;
+ unsigned char *new_list;
ctx->slice_param_list_size += 8;
new_list = realloc(ctx->slice_param_list,
sizeof(object_buffer_p) * ctx->slice_param_list_size);
@@ -929,7 +931,12 @@ static void psb__MPEG2_setup_alternative_frame(context_MPEG2_p ctx, IMG_BOOL wri
psb_surface_p rotate_surface = ctx->obj_context->current_render_target->psb_surface_rotate;
object_context_p obj_context = ctx->obj_context;
- if (rotate_surface->extra_info[5] != obj_context->rotate)
+ if (rotate_surface == NULL) {
+ psb__information_message("rotate surface is NULL, abort msvdx rotation\n");
+ return;
+ }
+
+ if (GET_SURFACE_INFO_rotate(rotate_surface) != obj_context->msvdx_rotate)
psb__error_message("Display rotate mode does not match surface rotate mode!\n");
@@ -951,7 +958,7 @@ static void psb__MPEG2_setup_alternative_frame(context_MPEG2_p ctx, IMG_BOOL wri
REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ALT_PICTURE_ENABLE, 1);
REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ROTATION_ROW_STRIDE, rotate_surface->stride_mode);
REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , RECON_WRITE_DISABLE, 0); /* FIXME Always has Rec */
- REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ROTATION_MODE, rotate_surface->extra_info[5]);
+ REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ROTATION_MODE, GET_SURFACE_INFO_rotate(rotate_surface));
psb_cmdbuf_rendec_write(cmdbuf, cmd);
@@ -964,7 +971,7 @@ static void psb__MPEG2_set_operating_mode(context_MPEG2_p ctx)
psb_cmdbuf_p cmdbuf = ctx->obj_context->cmdbuf;
psb_surface_p target_surface = ctx->obj_context->current_render_target->psb_surface;
- if (ctx->obj_context->rotate != VA_ROTATION_NONE)
+ if (CONTEXT_ROTATE(ctx->obj_context))
psb__MPEG2_setup_alternative_frame(ctx, ctx->pic_params->picture_coding_extension.bits.progressive_frame);
psb_cmdbuf_rendec_start(cmdbuf, RENDEC_REGISTER_OFFSET(MSVDX_CMDS, DISPLAY_PICTURE_SIZE));
@@ -1382,7 +1389,7 @@ static VAStatus psb__MPEG2_process_slice_data(context_MPEG2_p ctx, object_buffer
VAStatus vaStatus = VA_STATUS_SUCCESS;
VASliceParameterBufferMPEG2 *slice_param;
int buffer_idx = 0;
- int element_idx = 0;
+ unsigned int element_idx = 0;
ASSERT((obj_buffer->type == VASliceDataBufferType) || (obj_buffer->type == VAProtectedSliceDataBufferType));
@@ -1491,7 +1498,7 @@ static void psb__MEPG2_send_blit_cmd(context_MPEG2_p ctx)
REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ALT_PICTURE_ENABLE, 1);
REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ROTATION_ROW_STRIDE, rotate_surface->stride_mode);
REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , RECON_WRITE_DISABLE, 0);
- REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ROTATION_MODE, rotate_surface->extra_info[5]);
+ REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ROTATION_MODE, GET_SURFACE_INFO_rotate(rotate_surface));
psb_cmdbuf_reg_set(cmdbuf, REGISTER_OFFSET(MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION), cmd);
psb_cmdbuf_reg_end_block(cmdbuf);
@@ -1608,7 +1615,7 @@ static VAStatus pnw_MPEG2_EndPicture(
psb__information_message("pnw_MPEG2_EndPicture\n");
- if (ctx->obj_context->rotate != VA_ROTATION_NONE) {
+ if (CONTEXT_ROTATE(ctx->obj_context)) {
if (!(ctx->pic_params->picture_coding_extension.bits.progressive_frame) &&
!(ctx->pic_params->picture_coding_extension.bits.is_first_field))
psb__MPEG2_insert_blit_cmd_to_rotate(ctx);
diff --git a/src/pnw_MPEG2.h b/src/pnw_MPEG2.h
index 980a6c6..d058b44 100644
--- a/src/pnw_MPEG2.h
+++ b/src/pnw_MPEG2.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/pnw_MPEG4.c b/src/pnw_MPEG4.c
index c6c87d5..94c442b 100644
--- a/src/pnw_MPEG4.c
+++ b/src/pnw_MPEG4.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -52,6 +52,8 @@
#define SET_SURFACE_INFO_picture_coding_type(psb_surface, val) psb_surface->extra_info[2] = (uint32_t) val;
#define GET_SURFACE_INFO_colocated_index(psb_surface) ((int) (psb_surface->extra_info[3]))
#define SET_SURFACE_INFO_colocated_index(psb_surface, val) psb_surface->extra_info[3] = (uint32_t) val;
+#define SET_SURFACE_INFO_rotate(psb_surface, rotate) psb_surface->extra_info[5] = (uint32_t) rotate;
+#define GET_SURFACE_INFO_rotate(psb_surface) ((int) psb_surface->extra_info[5])
#define SLICEDATA_BUFFER_TYPE(type) ((type==VASliceDataBufferType)?"VASliceDataBufferType":"VAProtectedSliceDataBufferType")
@@ -105,7 +107,7 @@ typedef enum {
/* Format is: opcode, width, symbol. All VLC tables are concatenated. */
#define VLC_PACK(a,b,c) ( ( (a) << 12 ) | ( (b) << 9 ) | (c) )
-const static IMG_UINT16 gaui16mpeg4VlcTableDataPacked[] = {
+static const IMG_UINT16 gaui16mpeg4VlcTableDataPacked[] = {
VLC_PACK(4 , 0 , 12), VLC_PACK(5 , 0 , 7), VLC_PACK(4 , 2 , 13), VLC_PACK(4 , 3 , 16), VLC_PACK(5 , 0 , 9), VLC_PACK(4 , 5 , 17),
VLC_PACK(2 , 2 , 1), VLC_PACK(3 , 2 , 0), VLC_PACK(3 , 2 , 0), VLC_PACK(4 , 2 , 36), VLC_PACK(3 , 2 , 0), VLC_PACK(4 , 0 , 0),
VLC_PACK(0 , 0 , 6), VLC_PACK(0 , 0 , 7), VLC_PACK(2 , 1 , 8), VLC_PACK(0 , 1 , 10), VLC_PACK(2 , 1 , 13), VLC_PACK(0 , 2 , 15),
@@ -509,7 +511,7 @@ static VAStatus pnw_MPEG4_CreateContext(
DEBUG_FAILURE;
}
if (vaStatus == VA_STATUS_SUCCESS) {
- void *vlc_packed_data_address;
+ unsigned char *vlc_packed_data_address;
if (0 == psb_buffer_map(&ctx->vlc_packed_table, &vlc_packed_data_address)) {
memcpy(vlc_packed_data_address, gaui16mpeg4VlcTableDataPacked, sizeof(gaui16mpeg4VlcTableDataPacked));
psb_buffer_unmap(&ctx->vlc_packed_table);
@@ -622,11 +624,14 @@ static VAStatus psb__MPEG4_process_picture_param(context_MPEG4_p ctx, object_buf
case PICTURE_CODING_P:
ctx->forward_ref_surface = SURFACE(ctx->pic_params->forward_reference_picture);
ctx->backward_ref_surface = NULL;
- if (NULL == ctx->forward_ref_surface) {
+
+ if (ctx->pic_params->forward_reference_picture == VA_INVALID_SURFACE)
+ ctx->forward_ref_surface = NULL;
+ if (NULL == ctx->forward_ref_surface && ctx->pic_params->forward_reference_picture != VA_INVALID_SURFACE) {
return VA_STATUS_ERROR_INVALID_SURFACE;
}
psb__information_message("PICTURE_CODING_P\nTarget surface = %08x (%08x)\n", ctx->obj_context->current_render_target->psb_surface, ctx->obj_context->current_render_target->base.id);
- psb__information_message("Forward ref = %08x (%08x)\n", ctx->forward_ref_surface->psb_surface, ctx->pic_params->forward_reference_picture);
+ psb__information_message("Forward ref = %08x (%08x)\n", (ctx->forward_ref_surface ? ctx->forward_ref_surface->psb_surface : 0), ctx->pic_params->forward_reference_picture);
psb__information_message("Backward ref = NULL\n");
break;
@@ -874,7 +879,7 @@ static VAStatus psb__MPEG4_add_slice_param(context_MPEG4_p ctx, object_buffer_p
{
ASSERT(obj_buffer->type == VASliceParameterBufferType);
if (ctx->slice_param_list_idx >= ctx->slice_param_list_size) {
- void *new_list;
+ unsigned char *new_list;
ctx->slice_param_list_size += 8;
new_list = realloc(ctx->slice_param_list,
sizeof(object_buffer_p) * ctx->slice_param_list_size);
@@ -953,7 +958,12 @@ static void psb__MPEG4_setup_alternative_frame(context_MPEG4_p ctx)
psb_surface_p rotate_surface = ctx->obj_context->current_render_target->psb_surface_rotate;
object_context_p obj_context = ctx->obj_context;
- if (rotate_surface->extra_info[5] != obj_context->rotate)
+ if (rotate_surface == NULL) {
+ psb__information_message("rotate surface is NULL, abort msvdx rotation\n");
+ return;
+ }
+
+ if (GET_SURFACE_INFO_rotate(rotate_surface) != obj_context->msvdx_rotate)
psb__error_message("Display rotate mode does not match surface rotate mode!\n");
@@ -971,7 +981,7 @@ static void psb__MPEG4_setup_alternative_frame(context_MPEG4_p ctx)
REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ALT_PICTURE_ENABLE, 1);
REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ROTATION_ROW_STRIDE, rotate_surface->stride_mode);
REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , RECON_WRITE_DISABLE, 0); /* FIXME Always generate Rec */
- REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ROTATION_MODE, rotate_surface->extra_info[5]);
+ REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ROTATION_MODE, GET_SURFACE_INFO_rotate(rotate_surface));
psb_cmdbuf_rendec_write(cmdbuf, cmd);
@@ -1016,7 +1026,7 @@ static void psb__MPEG4_set_picture_params(context_MPEG4_p ctx, VASliceParameterB
}
psb_cmdbuf_rendec_end(cmdbuf);
- if (ctx->obj_context->rotate != VA_ROTATION_NONE)
+ if (CONTEXT_ROTATE(ctx->obj_context))
psb__MPEG4_setup_alternative_frame(ctx);
/* Send VDMC and VDEB commands */
@@ -1382,7 +1392,7 @@ static VAStatus psb__MPEG4_process_slice_data(context_MPEG4_p ctx, object_buffer
VAStatus vaStatus = VA_STATUS_SUCCESS;
VASliceParameterBufferMPEG4 *slice_param;
int buffer_idx = 0;
- int element_idx = 0;
+ unsigned int element_idx = 0;
ASSERT((obj_buffer->type == VASliceDataBufferType) || (obj_buffer->type == VAProtectedSliceDataBufferType));
diff --git a/src/pnw_MPEG4.h b/src/pnw_MPEG4.h
index 799746a..62a5c7b 100644
--- a/src/pnw_MPEG4.h
+++ b/src/pnw_MPEG4.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/pnw_MPEG4ES.c b/src/pnw_MPEG4ES.c
index 1ae75ba..639072a 100644
--- a/src/pnw_MPEG4ES.c
+++ b/src/pnw_MPEG4ES.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -81,11 +81,21 @@ static void pnw_MPEG4ES_QueryConfigAttributes(
static VAStatus pnw_MPEG4ES_ValidateConfig(
object_config_p obj_config)
{
- VAStatus vaStatus = VA_STATUS_SUCCESS;
- psb__information_message("pnw_MPEG4ES_ValidateConfig\n");
-
- return vaStatus;
+ int i;
+ /* Check all attributes */
+ for (i = 0; i < obj_config->attrib_count; i++) {
+ switch (obj_config->attrib_list[i].type) {
+ case VAConfigAttribRTFormat:
+ /* Ignore */
+ break;
+ case VAConfigAttribRateControl:
+ break;
+ default:
+ return VA_STATUS_ERROR_ATTR_NOT_SUPPORTED;
+ }
+ }
+ return VA_STATUS_SUCCESS;
}
@@ -277,7 +287,7 @@ static VAStatus pnw__MPEG4ES_process_picture_param(context_ENC_p ctx, object_buf
VAStatus vaStatus = VA_STATUS_SUCCESS;
VAEncPictureParameterBufferMPEG4 *pBuffer;
pnw_cmdbuf_p cmdbuf = ctx->obj_context->pnw_cmdbuf;
- unsigned long *pPictureHeaderMem;
+ unsigned int *pPictureHeaderMem;
MTX_HEADER_PARAMS *psPicHeader;
int i;
IMG_BOOL bIsVOPCoded = IMG_TRUE;
@@ -306,12 +316,12 @@ static VAStatus pnw__MPEG4ES_process_picture_param(context_ENC_p ctx, object_buf
ctx->FCode = 4 - 1; /* 4 is default value of "ui8Search_range" */
- pPictureHeaderMem = cmdbuf->header_mem_p + ctx->pic_header_ofs;
+ pPictureHeaderMem = (unsigned int *)(cmdbuf->header_mem_p + ctx->pic_header_ofs);
psPicHeader = (MTX_HEADER_PARAMS *)pPictureHeaderMem;
memset(pPictureHeaderMem, 0, HEADER_SIZE);
- pnw__MPEG4_prepare_vop_header(pPictureHeaderMem,
+ pnw__MPEG4_prepare_vop_header((unsigned char *)pPictureHeaderMem,
bIsVOPCoded,
pBuffer->vop_time_increment, /* In testbench, this should be FrameNum */
4,/* default value is 4,search range */
@@ -322,7 +332,7 @@ static VAStatus pnw__MPEG4ES_process_picture_param(context_ENC_p ctx, object_buf
psPicHeader->Elements |= 0x100;
pPictureHeaderMem += ((HEADER_SIZE) >> 3);
- pnw__MPEG4_prepare_vop_header(pPictureHeaderMem,
+ pnw__MPEG4_prepare_vop_header((unsigned char *)pPictureHeaderMem,
IMG_FALSE,
pBuffer->vop_time_increment, /* In testbench, this should be FrameNum */
4,/* default value is 4,search range */
@@ -349,7 +359,7 @@ static VAStatus pnw__MPEG4ES_process_slice_param(context_ENC_p ctx, object_buffe
VAEncSliceParameterBuffer *pBuffer;
pnw_cmdbuf_p cmdbuf = ctx->obj_context->pnw_cmdbuf;
PIC_PARAMS *psPicParams = (PIC_PARAMS *)(cmdbuf->pic_params_p);
- int i;
+ unsigned int i;
int slice_param_idx;
ASSERT(obj_buffer->type == VAEncSliceParameterBufferType);
diff --git a/src/pnw_MPEG4ES.h b/src/pnw_MPEG4ES.h
index 359868b..5850381 100644
--- a/src/pnw_MPEG4ES.h
+++ b/src/pnw_MPEG4ES.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/pnw_VC1.c b/src/pnw_VC1.c
index 17c9693..f685b8b 100644
--- a/src/pnw_VC1.c
+++ b/src/pnw_VC1.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -32,6 +32,7 @@
#include "psb_def.h"
#include "psb_surface.h"
#include "psb_cmdbuf.h"
+#include "pnw_rotate.h"
#include "vc1_header.h"
#include "vc1_defs.h"
@@ -58,6 +59,8 @@ static int VC1_Header_Parser_HW = 1;
#define SET_SURFACE_INFO_picture_coding_type(psb_surface, val) psb_surface->extra_info[2] = (uint32_t) val;
#define GET_SURFACE_INFO_colocated_index(psb_surface) ((int) (psb_surface->extra_info[3]))
#define SET_SURFACE_INFO_colocated_index(psb_surface, val) psb_surface->extra_info[3] = (uint32_t) val;
+#define SET_SURFACE_INFO_rotate(psb_surface, rotate) psb_surface->extra_info[5] = (uint32_t) rotate;
+#define GET_SURFACE_INFO_rotate(psb_surface) ((int) psb_surface->extra_info[5])
#define SLICEDATA_BUFFER_TYPE(type) ((type==VASliceDataBufferType)?"VASliceDataBufferType":"VAProtectedSliceDataBufferType")
@@ -489,7 +492,7 @@ static VAStatus pnw_VC1_CreateContext(
}
if (vaStatus == VA_STATUS_SUCCESS) {
- void *preload;
+ unsigned char *preload;
if (0 == psb_buffer_map(&ctx->preload_buffer, &preload)) {
memset(preload, 0, PRELOAD_BUFFER_SIZE);
psb_buffer_unmap(&ctx->preload_buffer);
@@ -532,8 +535,8 @@ static VAStatus pnw_VC1_CreateContext(
DEBUG_FAILURE;
}
if (vaStatus == VA_STATUS_SUCCESS) {
- void *vlc_packed_data_address;
- if (0 == psb_buffer_map(&ctx->vlc_packed_table, &vlc_packed_data_address)) {
+ uint16_t *vlc_packed_data_address;
+ if (0 == psb_buffer_map(&ctx->vlc_packed_table, (unsigned char **)&vlc_packed_data_address)) {
psb__VC1_pack_vlc_tables(vlc_packed_data_address, gaui16vc1VlcTableData, gui16vc1VlcTableSize);
psb_buffer_unmap(&ctx->vlc_packed_table);
psb__VC1_pack_index_table_info(ctx->vlc_packed_index_table, gaui16vc1VlcIndexData);
@@ -792,6 +795,12 @@ static VAStatus psb__VC1_process_picture_param(context_VC1_p ctx, object_buffer_
return vaStatus;
}
}
+
+ //SET_SURFACE_INFO_picture_coding_type(ctx->decoded_surface->psb_surface, pic_params->picture_fields.bits.frame_coding_mode);
+ SET_SURFACE_INFO_picture_coding_type(ctx->obj_context->current_render_target->psb_surface, pic_params->picture_fields.bits.frame_coding_mode);
+ ctx->forward_ref_fcm = pic_params->picture_fields.bits.frame_coding_mode;
+ ctx->backward_ref_fcm = pic_params->picture_fields.bits.frame_coding_mode;
+
/* Lookup surfaces for backward/forward references */
ctx->forward_ref_surface = NULL;
ctx->backward_ref_surface = NULL;
@@ -802,6 +811,12 @@ static VAStatus psb__VC1_process_picture_param(context_VC1_p ctx, object_buffer_
ctx->backward_ref_surface = SURFACE(pic_params->backward_reference_picture);
}
+ if (ctx->forward_ref_surface)
+ ctx->forward_ref_fcm = GET_SURFACE_INFO_picture_coding_type(ctx->forward_ref_surface->psb_surface);
+
+ if (ctx->backward_ref_surface)
+ ctx->backward_ref_fcm = GET_SURFACE_INFO_picture_coding_type(ctx->backward_ref_surface->psb_surface);
+
#if 0
if (NULL == ctx->forward_ref_surface) {
/* for mmu fault protection */
@@ -1300,6 +1315,8 @@ static VAStatus psb__VC1_process_picture_param(context_VC1_p ctx, object_buffer_
}
/************************************************************************************/
+ psb_CheckInterlaceRotate(ctx->obj_context, (void *)ctx->pic_params);
+
return VA_STATUS_SUCCESS;
}
@@ -1328,7 +1345,7 @@ static VAStatus psb__VC1_add_slice_param(context_VC1_p ctx, object_buffer_p obj_
{
ASSERT(obj_buffer->type == VASliceParameterBufferType);
if (ctx->slice_param_list_idx >= ctx->slice_param_list_size) {
- void *new_list;
+ unsigned char *new_list;
ctx->slice_param_list_size += 8;
new_list = realloc(ctx->slice_param_list,
sizeof(object_buffer_p) * ctx->slice_param_list_size);
@@ -1742,7 +1759,7 @@ static void psb__VC1_write_VLC_tables(context_VC1_p ctx)
static void psb__VC1_build_VLC_tables(context_VC1_p ctx)
{
psb_cmdbuf_p cmdbuf = ctx->obj_context->cmdbuf;
- int i;
+ unsigned int i;
uint16_t RAM_location = 0;
uint32_t reg_value;
@@ -1852,7 +1869,12 @@ static void psb__VC1_setup_alternative_frame(context_VC1_p ctx)
psb_surface_p rotate_surface = ctx->obj_context->current_render_target->psb_surface_rotate;
object_context_p obj_context = ctx->obj_context;
- if (rotate_surface->extra_info[5] != obj_context->rotate)
+ if (rotate_surface == NULL) {
+ psb__information_message("rotate surface is NULL, abort msvdx rotation\n");
+ return;
+ }
+
+ if (GET_SURFACE_INFO_rotate(rotate_surface) != obj_context->msvdx_rotate)
psb__error_message("Display rotate mode does not match surface rotate mode!\n");
@@ -1870,7 +1892,7 @@ static void psb__VC1_setup_alternative_frame(context_VC1_p ctx)
REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ALT_PICTURE_ENABLE, 1);
REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ROTATION_ROW_STRIDE, rotate_surface->stride_mode);
REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , RECON_WRITE_DISABLE, 0); /* FIXME Always generate Rec */
- REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ROTATION_MODE, rotate_surface->extra_info[5]);
+ REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ROTATION_MODE, GET_SURFACE_INFO_rotate(rotate_surface));
psb_cmdbuf_rendec_write(cmdbuf, cmd);
@@ -1889,7 +1911,7 @@ static void psb__VC1_program_output_register(context_VC1_p ctx, IMG_BOOL first_t
*ctx->p_range_mapping_base1 = 0;
//rotate_surface = ctx->decoded_surface->psb_surface_rotate;
- if ((first_two_pass == 0) && (obj_context->rotate != VA_ROTATION_NONE)) {
+ if ((first_two_pass == 0) && CONTEXT_ROTATE(obj_context)) {
psb_cmdbuf_rendec_start(cmdbuf, RENDEC_REGISTER_OFFSET(MSVDX_CMDS, VC1_LUMA_RANGE_MAPPING_BASE_ADDRESS));
psb_cmdbuf_rendec_write_address(cmdbuf, &rotate_surface->buf, rotate_surface->buf.buffer_ofs);
psb_cmdbuf_rendec_write_address(cmdbuf, &rotate_surface->buf, rotate_surface->chroma_offset + rotate_surface->buf.buffer_ofs);
@@ -1900,7 +1922,7 @@ static void psb__VC1_program_output_register(context_VC1_p ctx, IMG_BOOL first_t
REGIO_WRITE_FIELD_LITE(alt_output_flags, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ALT_PICTURE_ENABLE, 1);
REGIO_WRITE_FIELD_LITE(alt_output_flags, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ROTATION_ROW_STRIDE, rotate_surface->stride_mode);
REGIO_WRITE_FIELD_LITE(alt_output_flags, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , RECON_WRITE_DISABLE, 0); /* FIXME Always generate Rec */
- REGIO_WRITE_FIELD_LITE(alt_output_flags, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ROTATION_MODE, rotate_surface->extra_info[5]);
+ REGIO_WRITE_FIELD_LITE(alt_output_flags, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ROTATION_MODE, GET_SURFACE_INFO_rotate(rotate_surface));
}
psb_cmdbuf_rendec_start(cmdbuf, RENDEC_REGISTER_OFFSET(MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION));
@@ -2027,7 +2049,7 @@ static void psb__VC1_send_rendec_params(context_VC1_p ctx, VASliceParameterBuffe
/* psb_cmdbuf_rendec_start_block( cmdbuf ); */
-// if(ctx->obj_context->rotate != VA_ROTATION_NONE) /* FIXME field coded should not issue */
+// if(CONTEXT_ROTATE(ctx->obj_context)) /* FIXME field coded should not issue */
// psb__VC1_setup_alternative_frame(ctx);
/* CHUNK: 1 - VC1SEQUENCE00 */
@@ -2098,7 +2120,7 @@ static void psb__VC1_send_rendec_params(context_VC1_p ctx, VASliceParameterBuffe
psb__VC1_program_output_register(ctx, ctx->pic_params->picture_fields.bits.frame_coding_mode != VC1_FCM_P);
- if (ctx->pic_params->picture_fields.bits.frame_coding_mode == VC1_FCM_P && ctx->obj_context->rotate != VA_ROTATION_NONE)
+ if (ctx->pic_params->picture_fields.bits.frame_coding_mode == VC1_FCM_P && CONTEXT_ROTATE(ctx->obj_context))
//deblock_surface = ctx->decoded_surface->psb_surface_rotate;
deblock_surface = ctx->obj_context->current_render_target->psb_surface_rotate;
@@ -2269,9 +2291,13 @@ static void psb__VC1_send_rendec_params(context_VC1_p ctx, VASliceParameterBuffe
/* CR_VEC_VC1_BE_PPS2 */
cmd = 0;
- REGIO_WRITE_FIELD(cmd, MSVDX_VEC_VC1, CR_VEC_VC1_BE_PPS2, VC1_BE_FCM_REF2, ctx->ui8FCM_Ref2Pic);
- REGIO_WRITE_FIELD(cmd, MSVDX_VEC_VC1, CR_VEC_VC1_BE_PPS2, VC1_BE_FCM_REF1, ctx->ui8FCM_Ref1Pic);
- REGIO_WRITE_FIELD(cmd, MSVDX_VEC_VC1, CR_VEC_VC1_BE_PPS2, VC1_BE_FCM_REF0, ctx->ui8FCM_Ref0Pic);
+ //REGIO_WRITE_FIELD(cmd, MSVDX_VEC_VC1, CR_VEC_VC1_BE_PPS2, VC1_BE_FCM_REF2, ctx->ui8FCM_Ref2Pic);
+ //REGIO_WRITE_FIELD(cmd, MSVDX_VEC_VC1, CR_VEC_VC1_BE_PPS2, VC1_BE_FCM_REF1, ctx->ui8FCM_Ref1Pic);
+ //REGIO_WRITE_FIELD(cmd, MSVDX_VEC_VC1, CR_VEC_VC1_BE_PPS2, VC1_BE_FCM_REF0, ctx->ui8FCM_Ref0Pic);
+ REGIO_WRITE_FIELD(cmd, MSVDX_VEC_VC1, CR_VEC_VC1_BE_PPS2, VC1_BE_FCM_REF2, ctx->backward_ref_fcm);
+ REGIO_WRITE_FIELD(cmd, MSVDX_VEC_VC1, CR_VEC_VC1_BE_PPS2, VC1_BE_FCM_REF1, ctx->forward_ref_fcm);
+ //REGIO_WRITE_FIELD(cmd, MSVDX_VEC_VC1, CR_VEC_VC1_BE_PPS2, VC1_BE_FCM_REF0, GET_SURFACE_INFO_picture_coding_type(ctx->decoded_surface->psb_surface));
+ REGIO_WRITE_FIELD(cmd, MSVDX_VEC_VC1, CR_VEC_VC1_BE_PPS2, VC1_BE_FCM_REF0, GET_SURFACE_INFO_picture_coding_type(ctx->obj_context->current_render_target->psb_surface));
REGIO_WRITE_FIELD(cmd, MSVDX_VEC_VC1, CR_VEC_VC1_BE_PPS2, VC1_BE_COLLOCATED_SKIPPED, 0); // @TODO: Really need this?
psb_cmdbuf_rendec_write(cmdbuf, cmd);
@@ -2648,7 +2674,7 @@ static void psb__VC1_Send_Parse_Header_Cmd(context_VC1_p ctx, IMG_BOOL new_pic)
psb_cmdbuf_p cmdbuf = ctx->obj_context->cmdbuf;
//pParseHeaderCMD = (PARSE_HEADER_CMD*)mCtrlAlloc.AllocateSpace(sizeof(PARSE_HEADER_CMD));
- pParseHeaderCMD = (void *)cmdbuf->cmd_idx;
+ pParseHeaderCMD = (PARSE_HEADER_CMD*)cmdbuf->cmd_idx;
cmdbuf->cmd_idx += sizeof(PARSE_HEADER_CMD) / sizeof(uint32_t);
pParseHeaderCMD->ui32Cmd = CMD_PARSE_HEADER;
@@ -2767,8 +2793,6 @@ static void psb__VC1_Send_Parse_Header_Cmd(context_VC1_p ctx, IMG_BOOL new_pic)
pParseHeaderCMD->ui32ICParamData[0] = 0x00010000;
pParseHeaderCMD->ui32ICParamData[1] = 0x00010020;
PARSE_HEADER_CMD tmp = *pParseHeaderCMD;
- tmp;
-
}
static VAStatus psb__VC1_process_slice(context_VC1_p ctx,
@@ -2879,7 +2903,7 @@ static VAStatus psb__VC1_process_slice_data(context_VC1_p ctx, object_buffer_p o
VAStatus vaStatus = VA_STATUS_SUCCESS;
VASliceParameterBufferVC1 *slice_param;
int buffer_idx = 0;
- int element_idx = 0;
+ unsigned int element_idx = 0;
ASSERT((obj_buffer->type == VASliceDataBufferType) || (obj_buffer->type == VAProtectedSliceDataBufferType));
diff --git a/src/pnw_VC1.h b/src/pnw_VC1.h
index cc649b0..bda7201 100644
--- a/src/pnw_VC1.h
+++ b/src/pnw_VC1.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/pnw_cmdbuf.c b/src/pnw_cmdbuf.c
index 1b96bec..51945b8 100644
--- a/src/pnw_cmdbuf.c
+++ b/src/pnw_cmdbuf.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -299,7 +299,7 @@ void pnw_cmdbuf_add_relocation(pnw_cmdbuf_p cmdbuf,
reloc->dst_buffer = dst_buffer;
cmdbuf->reloc_idx++;
- ASSERT(((void *)(cmdbuf->reloc_idx)) < RELOC_END(cmdbuf));
+ ASSERT(((unsigned char *)(cmdbuf->reloc_idx)) < RELOC_END(cmdbuf));
}
/* Prepare one command package */
@@ -427,11 +427,6 @@ pnwDRMCmdBuf(int fd, int ioctl_offset, psb_buffer_p *buffer_list, int buffer_cou
#if 1
req->presumed_gpu_offset = (uint64_t)wsbmBOOffsetHint(buffer_list[i]->drm_buf);
req->presumed_flags = PSB_USE_PRESUMED;
- if ((req->presumed_gpu_offset >> 28) & 0x1) {
- psb__error_message("buffer is at the address topaz can not access\n");
- ret = -1;
- goto out;
- }
#else
req->presumed_flags = 0;
#endif
@@ -452,8 +447,6 @@ pnwDRMCmdBuf(int fd, int ioctl_offset, psb_buffer_p *buffer_list, int buffer_cou
ca.engine = engine;
ca.fence_flags = fence_flags;
ca.fence_arg = (uint64_t)((unsigned long)fence_rep);
- ca.damage = damage;
-
do {
ret = drmCommandWrite(fd, ioctl_offset, &ca, sizeof(ca));
@@ -521,7 +514,7 @@ lnc_fence_wait(psb_driver_data_p driver_data,
fence = wsbmFenceCreate(driver_data->fence_mgr, fence_rep->fence_class,
fence_rep->fence_type,
- (void *)fence_rep->handle,
+ (unsigned char *)fence_rep->handle,
0);
if (fence)
*status = wsbmFenceFinish(fence, fence_rep->fence_type, 0);
@@ -579,10 +572,10 @@ int pnw_context_flush_cmdbuf(object_context_p obj_context)
unsigned int reloc_offset;
unsigned int num_relocs;
int ret;
- unsigned int cmdbuffer_size = (void *) cmdbuf->cmd_idx - cmdbuf->cmd_start; /* In bytes */
+ unsigned int cmdbuffer_size = (unsigned char *) cmdbuf->cmd_idx - cmdbuf->cmd_start; /* In bytes */
ASSERT(cmdbuffer_size < CMD_SIZE);
- ASSERT((void *) cmdbuf->cmd_idx < CMD_END(cmdbuf));
+ ASSERT((unsigned char *) cmdbuf->cmd_idx < CMD_END(cmdbuf));
/* LOCK */
ret = LOCK_HARDWARE(driver_data);
if (ret) {
@@ -593,7 +586,7 @@ int pnw_context_flush_cmdbuf(object_context_p obj_context)
/* Now calculate the total number of relocations */
reloc_offset = cmdbuf->reloc_base - cmdbuf->cmd_base;
- num_relocs = (((void *) cmdbuf->reloc_idx) - cmdbuf->reloc_base) / sizeof(struct drm_psb_reloc);
+ num_relocs = (((unsigned char *) cmdbuf->reloc_idx) - cmdbuf->reloc_base) / sizeof(struct drm_psb_reloc);
pnw_cmdbuf_unmap(cmdbuf);
diff --git a/src/pnw_cmdbuf.h b/src/pnw_cmdbuf.h
index 3f3af0b..dcced06 100644
--- a/src/pnw_cmdbuf.h
+++ b/src/pnw_cmdbuf.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -56,13 +56,13 @@ struct pnw_cmdbuf_s {
unsigned int size;
/* Relocation records */
- void *reloc_base;
+ unsigned char *reloc_base;
struct drm_psb_reloc *reloc_idx;
/* CMD stream data */
int cmd_count;
- void *cmd_base;
- void *cmd_start;
+ unsigned char *cmd_base;
+ unsigned char *cmd_start;
uint32_t *cmd_idx;
uint32_t *cmd_idx_saved[3]; /* idx saved for dual-core adjustion */
@@ -70,32 +70,32 @@ struct pnw_cmdbuf_s {
* AboveParam/BellowParam, and the buffer allocated when the context is created
*/
struct psb_buffer_s *topaz_in_params_I;
- void *topaz_in_params_I_p;
+ unsigned char *topaz_in_params_I_p;
struct psb_buffer_s *topaz_in_params_P;
- void *topaz_in_params_P_p;
+ unsigned char *topaz_in_params_P_p;
struct psb_buffer_s *topaz_below_params;
- void *topaz_below_params_p;
+ unsigned char *topaz_below_params_p;
/* Every frame has its own PIC_PARAMS, SLICE_PARAMS and HEADER mem
*/
/* PicParams: */
struct psb_buffer_s pic_params;
- void *pic_params_p;
+ unsigned char *pic_params_p;
/* SeqHeaderMem PicHeaderMem EOSeqHeaderMem EOStreamHeaderMem SliceHeaderMem[MAX_SLICES_PER_PICTURE]*/
struct psb_buffer_s header_mem;
- void *header_mem_p;
+ unsigned char *header_mem_p;
/*SliceParams[MAX_SLICES_PER_PICTURE] */
struct psb_buffer_s slice_params;
- void *slice_params_p;
+ unsigned char *slice_params_p;
/* AboveParams[MAX_TOPAZ_CORES]; */
struct psb_buffer_s *topaz_above_params;
- void *topaz_above_params_p;
+ unsigned char *topaz_above_params_p;
/* Referenced buffers */
psb_buffer_p *buffer_refs;
@@ -158,7 +158,7 @@ void pnw_cmdbuf_add_relocation(pnw_cmdbuf_p cmdbuf,
uint32_t dst_buffer, /*Index of the list refered by cmdbuf->buffer_refs */
uint32_t *start_of_dst_buffer);
-#define RELOC_CMDBUF_PNW(dest, offset, buf) pnw_cmdbuf_add_relocation(cmdbuf, (uint32_t*)(dest), buf, offset, 0XFFFFFFFF, 0, 0, 0, cmdbuf->cmd_start)
+#define RELOC_CMDBUF_PNW(dest, offset, buf) pnw_cmdbuf_add_relocation(cmdbuf, (uint32_t*)(dest), buf, offset, 0XFFFFFFFF, 0, 0, 0, (uint32_t *)cmdbuf->cmd_start)
/* do relocation in PIC_PARAMS: src/dst Y/UV base, InParamsBase, CodeBase, BellowParamsBase, AboveParamsBase */
#define RELOC_PIC_PARAMS_PNW(dest, offset, buf) pnw_cmdbuf_add_relocation(cmdbuf, (uint32_t*)(dest), buf, offset, 0XFFFFFFFF, 0, 0, 1, (uint32_t *)cmdbuf->pic_params_p)
diff --git a/src/pnw_hostcode.c b/src/pnw_hostcode.c
index 0aed76f..ef9855b 100644
--- a/src/pnw_hostcode.c
+++ b/src/pnw_hostcode.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -56,7 +56,7 @@ IMG_UINT32 MVEARegBase[4] = {0x13000, 0x23000, 0x33000, 0x43000}; /* From TopazS
/* H264 Zero bias */
//#define ZERO_BIAS
-const static IMG_INT8 H263_QPLAMBDA_MAP[31] = {
+static const IMG_INT8 H263_QPLAMBDA_MAP[31] = {
/* For Quality Evaluation: Not using New H263 Table
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
@@ -75,7 +75,7 @@ const static IMG_INT8 H263_QPLAMBDA_MAP[31] = {
};
// New MP4 Lambda table
-const static IMG_INT8 MPEG4_QPLAMBDA_MAP[31] = {
+static const IMG_INT8 MPEG4_QPLAMBDA_MAP[31] = {
0, 0, 1, 2, 3,
3, 4, 4, 5, 5,
6, 6, 7, 7, 8,
@@ -85,7 +85,7 @@ const static IMG_INT8 MPEG4_QPLAMBDA_MAP[31] = {
};
// new H.264 Lambda
-const static IMG_INT8 H264_QPLAMBDA_MAP[40] = {
+static const IMG_INT8 H264_QPLAMBDA_MAP[40] = {
2, 2, 2, 2, 3, 3, 4, 4,
4, 5, 5, 5, 5, 5, 6, 6,
6, 7, 7, 7, 8, 8, 9, 11,
@@ -183,11 +183,12 @@ static void LoadMPEG4Bias(
IMG_INT16 iX;
IMG_UINT32 ui32RegVal;
IMG_UINT8 uiDCScaleL, uiDCScaleC, uiLambda;
- IMG_UINT32 uIPESkipVecBias, iInterMBBias, uSPESkipVecBias, iIntra16Bias;
+ IMG_INT32 uIPESkipVecBias, iInterMBBias, uSPESkipVecBias, iIntra16Bias;
IMG_UINT32 count = 0, cmd_word = 0;
uint32_t *pCount;
- cmd_word = (MTX_CMDID_SW_WRITEREG & MTX_CMDWORD_ID_MASK) << MTX_CMDWORD_ID_SHIFT;
+ cmd_word = ((MTX_CMDID_SW_WRITEREG & MTX_CMDWORD_ID_MASK) << MTX_CMDWORD_ID_SHIFT) |
+ ((i32Core & MTX_CMDWORD_CORE_MASK) << MTX_CMDWORD_CORE_SHIFT);
*cmdbuf->cmd_idx++ = cmd_word;
pCount = cmdbuf->cmd_idx;
cmdbuf->cmd_idx++;
@@ -238,11 +239,12 @@ static void LoadH263Bias(
IMG_INT16 iX;
IMG_UINT32 ui32RegVal;
IMG_UINT8 uiDCScaleL, uiDCScaleC, uiLambda;
- IMG_UINT32 uIPESkipVecBias, iInterMBBias, uSPESkipVecBias, iIntra16Bias;
+ IMG_INT32 uIPESkipVecBias, iInterMBBias, uSPESkipVecBias, iIntra16Bias;
IMG_UINT32 count = 0, cmd_word = 0;
uint32_t *pCount;
- cmd_word = (MTX_CMDID_SW_WRITEREG & MTX_CMDWORD_ID_MASK) << MTX_CMDWORD_ID_SHIFT;
+ cmd_word = ((MTX_CMDID_SW_WRITEREG & MTX_CMDWORD_ID_MASK) << MTX_CMDWORD_ID_SHIFT) |
+ ((i32Core & MTX_CMDWORD_CORE_MASK) << MTX_CMDWORD_CORE_SHIFT);
*cmdbuf->cmd_idx++ = cmd_word;
pCount = cmdbuf->cmd_idx;
cmdbuf->cmd_idx++;
@@ -298,7 +300,8 @@ static void LoadH264Bias(
IMG_UINT32 count = 0, cmd_word = 0;
uint32_t *pCount;
- cmd_word = (MTX_CMDID_SW_WRITEREG & MTX_CMDWORD_ID_MASK) << MTX_CMDWORD_ID_SHIFT;
+ cmd_word = ((MTX_CMDID_SW_WRITEREG & MTX_CMDWORD_ID_MASK) << MTX_CMDWORD_ID_SHIFT) |
+ ((i32Core & MTX_CMDWORD_CORE_MASK) << MTX_CMDWORD_CORE_SHIFT);
*cmdbuf->cmd_idx++ = cmd_word;
pCount = cmdbuf->cmd_idx;
cmdbuf->cmd_idx++;
@@ -470,6 +473,12 @@ void pnw_DestroyContext(object_context_p obj_context)
{
context_ENC_p ctx;
ctx = (context_ENC_p)obj_context->format_data;
+
+ psb_buffer_destroy(&ctx->topaz_in_params_P);
+ psb_buffer_destroy(&ctx->topaz_in_params_I);
+ psb_buffer_destroy(&ctx->topaz_below_params);
+ psb_buffer_destroy(&ctx->topaz_above_params);
+
if (NULL != ctx->slice_param_cache)
free(ctx->slice_param_cache);
if (NULL == ctx->save_seq_header_p)
@@ -734,7 +743,7 @@ VAStatus pnw_RenderPictureParameter(context_ENC_p ctx, int core)
pnw_cmdbuf_p cmdbuf = ctx->obj_context->pnw_cmdbuf;
VAStatus vaStatus = VA_STATUS_ERROR_UNKNOWN;
- psPicParams = cmdbuf->pic_params_p + ctx->pic_params_size * core;
+ psPicParams = (PIC_PARAMS *)(cmdbuf->pic_params_p + ctx->pic_params_size * core);
memset(psPicParams, 0, sizeof(PIC_PARAMS));
/* second frame will reuse some rate control parameters (IN_PARAMS_MP4)
@@ -744,7 +753,7 @@ VAStatus pnw_RenderPictureParameter(context_ENC_p ctx, int core)
*/
/*
- memset(psPicParams, 0, (int)((void *)&psPicParams->sInParams - (void *)psPicParams));
+ memset(psPicParams, 0, (int)((unsigned char *)&psPicParams->sInParams - (unsigned char *)psPicParams));
*/
src_surface = ctx->src_surface;
@@ -923,11 +932,11 @@ VAStatus pnw_RenderPictureParameter(context_ENC_p ctx, int core)
case IMG_CODEC_PL8:
case IMG_CODEC_PL12:
RELOC_PIC_PARAMS_PNW(&psPicParams->SrcUBase,
- srf_buf_offset + src_surface->psb_surface->stride * src_surface->height,
+ srf_buf_offset + src_surface->psb_surface->chroma_offset,
&src_surface->psb_surface->buf);
RELOC_PIC_PARAMS_PNW(&psPicParams->SrcVBase,
- srf_buf_offset + src_surface->psb_surface->stride * src_surface->height + (src_surface->psb_surface->stride / 2) *(src_surface->height / 2),
+ srf_buf_offset + src_surface->psb_surface->chroma_offset * 5 / 4,
&src_surface->psb_surface->buf);
break;
@@ -994,7 +1003,7 @@ VAStatus pnw_RenderPictureParameter(context_ENC_p ctx, int core)
static VAStatus pnw_SetupRCParam(context_ENC_p ctx)
{
pnw_cmdbuf_p cmdbuf = ctx->obj_context->pnw_cmdbuf;
- PIC_PARAMS *psPicParams = cmdbuf->pic_params_p;
+ PIC_PARAMS *psPicParams = (PIC_PARAMS *)cmdbuf->pic_params_p;
PIC_PARAMS *psPicParamsTmp;
int origin_qp, i;/* in DDK setup_rc will change qp strangly,
* just for keep same with DDK
@@ -1010,9 +1019,9 @@ static VAStatus pnw_SetupRCParam(context_ENC_p ctx)
/* Assume IN_RC_PARAMS for each core is identical, and copy for each */
for (i = (ctx->ParallelCores - 1); i > 0; i--) {
- psPicParamsTmp = cmdbuf->pic_params_p + ctx->pic_params_size * i;
- memcpy((void *)&psPicParamsTmp->sInParams,
- (void *)&psPicParams->sInParams,
+ psPicParamsTmp = (PIC_PARAMS *)(cmdbuf->pic_params_p + ctx->pic_params_size * i);
+ memcpy((unsigned char *)&psPicParamsTmp->sInParams,
+ (unsigned char *)&psPicParams->sInParams,
sizeof(IN_RC_PARAMS));
psPicParamsTmp->THSkip = psPicParams->THSkip;
@@ -1020,7 +1029,7 @@ static VAStatus pnw_SetupRCParam(context_ENC_p ctx)
}
/* save IN_RC_PARAMS into the cache */
- memcpy(&ctx->in_params_cache, (void *)&psPicParams->sInParams, sizeof(IN_RC_PARAMS));
+ memcpy(&ctx->in_params_cache, (unsigned char *)&psPicParams->sInParams, sizeof(IN_RC_PARAMS));
ctx->THSkip = psPicParams->THSkip;
ctx->pic_params_flags = psPicParams->Flags & ISRC_I16BIAS;
@@ -1031,7 +1040,7 @@ static VAStatus pnw_SetupRCParam(context_ENC_p ctx)
static VAStatus pnw_DetectFrameSkip(context_ENC_p ctx)
{
int frame_skip = 0;
- void *pBuffer;
+ unsigned char *pBuffer;
IMG_UINT32 *CodedData;
VAStatus vaStatus;
psb_surface_p surface;
@@ -1067,7 +1076,7 @@ VAStatus pnw_EndPicture(context_ENC_p ctx)
VAStatus vaStatus = VA_STATUS_SUCCESS;
int i;
pnw_cmdbuf_p cmdbuf = ctx->obj_context->pnw_cmdbuf;
- PIC_PARAMS *psPicParams = cmdbuf->pic_params_p;
+ PIC_PARAMS *psPicParams = (PIC_PARAMS *)cmdbuf->pic_params_p;
ctx->AccessUnitNum++;
@@ -1078,7 +1087,7 @@ VAStatus pnw_EndPicture(context_ENC_p ctx)
psb__information_message("Bitrate is changed to %d, "
"update the RC data accordingly\n", ctx->sRCParams.BitsPerSecond);
pnw__update_rcdata(ctx, psPicParams, &ctx->sRCParams);
- memcpy(&ctx->in_params_cache, (void *)&psPicParams->sInParams, sizeof(IN_RC_PARAMS));
+ memcpy(&ctx->in_params_cache, (unsigned char *)&psPicParams->sInParams, sizeof(IN_RC_PARAMS));
}
}
@@ -1168,7 +1177,7 @@ VAStatus pnw_EndPicture(context_ENC_p ctx)
static void pnw__setup_busize(context_ENC_p ctx)
{
- int old_busize = ctx->sRCParams.BUSize;
+ unsigned int old_busize = ctx->sRCParams.BUSize;
int slices = ctx->obj_context->slice_count;
/* it is called at EndPicture, we should now the Slice number */
@@ -2030,7 +2039,7 @@ IMG_UINT32 pnw__send_encode_slice_params(
*/
void pnw_reset_encoder_params(context_ENC_p ctx)
{
- void *Add_Below, *Add_Above;
+ unsigned char *Add_Below, *Add_Above;
pnw_cmdbuf_p cmdbuf = ctx->obj_context->pnw_cmdbuf;
/* all frames share the same Topaz param, in_param/aboveparam/bellow
diff --git a/src/pnw_hostcode.h b/src/pnw_hostcode.h
index 18a619a..c513181 100644
--- a/src/pnw_hostcode.h
+++ b/src/pnw_hostcode.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -115,13 +115,13 @@ typedef struct _RC_PARAMS_ {
IMG_UINT32 BitsConsumed;
IMG_UINT32 IntraFreq;
IMG_UINT16 IDRFreq;
- IMG_INT16 MinQP;
+ IMG_UINT16 MinQP;
IMG_BOOL RCEnable;
IMG_BOOL FrameSkip;
IMG_UINT8 Slices;
IMG_UINT32 BitsTransmitted;
- IMG_INT32 InitialLevel;
+ IMG_UINT32 InitialLevel;
IMG_INT32 InitialDelay;
IMG_INT8 QCPOffset;
@@ -156,7 +156,7 @@ typedef struct {
IMG_INT32 BitRate; /* Bit Rate (bps) */
IMG_INT32 BufferSize; /* Size of Buffer */
- IMG_INT32 InitialLevel; /* Initial Level of Buffer */
+ IMG_UINT32 InitialLevel; /* Initial Level of Buffer */
IMG_INT32 InitialDelay; /* Initial Delay of Buffer */
IMG_UINT8 ScaleFactor; /* Scale Factor (H264 only) */
@@ -191,8 +191,8 @@ typedef enum _TH_SKIP_SCALE_ {
struct context_ENC_s {
object_context_p obj_context; /* back reference */
- IMG_INT32 NumCores; /* Number of encode cores in Penwell */
- IMG_INT32 ParallelCores; /* Number of cores to use */
+ IMG_UINT32 NumCores; /* Number of encode cores in Penwell */
+ IMG_UINT32 ParallelCores; /* Number of cores to use */
IMG_INT32 BelowParamsBufIdx;
IMG_INT16 RawWidth;
@@ -201,7 +201,7 @@ struct context_ENC_s {
IMG_INT16 Width; /* ~0xf & (RawWidth + 0xf)*/
IMG_INT16 Height; /* ~0xf & (RawHeight + 0xf */
- IMG_INT16 Slices;
+ IMG_UINT16 Slices;
enum drm_pnw_topaz_codec eCodec;
IMG_FORMAT eFormat;
unsigned int FCode;
@@ -222,7 +222,7 @@ struct context_ENC_s {
IMG_UINT32 IPEControl;
IMG_BOOL SyncSequencer;
- IMG_INT32 SliceToCore; /* Core number to send current slice to */
+ IMG_UINT32 SliceToCore; /* Core number to send current slice to */
IMG_INT32 LastSliceNum[MAX_TOPAZ_CORES]; /* Slice number of last slice sent to core */
object_surface_p src_surface;
diff --git a/src/pnw_hostheader.c b/src/pnw_hostheader.c
index f3ab02d..9c034ec 100644
--- a/src/pnw_hostheader.c
+++ b/src/pnw_hostheader.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -70,7 +70,7 @@ static void Show_Bits(
}
snprintf(Txt, sizeof(Txt), "%s ", Txt);
- printf(Txt);
+ printf("%s", Txt);
if ((uiLp + 1) % 8 == 0) printf("\n");
}
@@ -756,7 +756,8 @@ static void pnw__H264_writebits_sequence_header(
pnw__write_upto8bits_elements(pMTX_Header,
// constrain_set0_flag = 1 for BP constraints
aui32ElementPointers, (0 << 7) |
- (0 << 6) | // constrain_set1_flag = 1 for MP constraints
+ // constrain_set1_flag = 1 for MP constraints and Constrained Baseline profile.
+ ((pSHParams->ucProfile == SH_PROFILE_BP ? 1 : 0) << 6) |
(0 << 5) | // constrain_set2_flag = 1 for HP
// constrain_set3_flag = 1 for level 1b, 0 for others
((pSHParams->ucLevel == SH_LEVEL_1B ? 1 : 0) << 4),
@@ -2407,7 +2408,7 @@ static void pnw__H264_writebits_SEI_picture_timing_header(
if (ui8time_offset_length > 0) {
// Two's complement storage : If time_offset<0 = ((2 ^ v) + time_offset)
- if (i32time_offset < 0)
+ if ((int)i32time_offset < 0)
pnw__write_upto32bits_elements(pMTX_Header,
aui32ElementPointers,
(IMG_UINT32)((2 ^ ui8time_offset_length) + i32time_offset),
@@ -2574,7 +2575,7 @@ void pnw__H264_prepare_SEI_picture_timing_header(
void pnw__H264_prepare_sequence_header(
- IMG_UINT32 *pHeaderMemory,
+ unsigned char *pHeaderMemory,
IMG_UINT32 uiPicWidthInMbs,
IMG_UINT32 uiPicHeightInMbs,
IMG_BOOL VUI_present, H264_VUI_PARAMS *VUI_params,
@@ -2582,10 +2583,11 @@ void pnw__H264_prepare_sequence_header(
IMG_UINT8 uiLevel,
IMG_UINT8 uiProfile)
{
- H264_SEQUENCE_HEADER_PARAMS SHParams = {0, };
+ H264_SEQUENCE_HEADER_PARAMS SHParams;
MTX_HEADER_PARAMS *mtx_hdr;
/* Route output elements to memory provided */
+ memset(&SHParams, 0, sizeof(SHParams));
mtx_hdr = (MTX_HEADER_PARAMS *) pHeaderMemory;
/* Setup Sequence Header information */
@@ -2625,12 +2627,18 @@ void pnw__H264_prepare_sequence_header(
case 31:
SHParams.ucLevel = SH_LEVEL_31;
break;
+ case 32:
+ SHParams.ucLevel = SH_LEVEL_32;
+ break;
case 40:
SHParams.ucLevel = SH_LEVEL_4;
break;
case 41:
SHParams.ucLevel = SH_LEVEL_41;
break;
+ case 42:
+ SHParams.ucLevel = SH_LEVEL_42;
+ break;
default:
SHParams.ucLevel = SH_LEVEL_3;
break;
@@ -2662,7 +2670,7 @@ void pnw__H264_prepare_sequence_header(
pnw__H264_getelements_sequence_header(mtx_hdr, &SHParams, psCropParams);
}
-void pnw__H264_prepare_picture_header(IMG_UINT32 *pHeaderMemory, IMG_BOOL bCabacEnabled, IMG_INT8 CQPOffset)
+void pnw__H264_prepare_picture_header(unsigned char *pHeaderMemory, IMG_BOOL bCabacEnabled, IMG_INT8 CQPOffset)
{
MTX_HEADER_PARAMS *mtx_hdr;
@@ -2686,7 +2694,7 @@ void pnw__H264_prepare_picture_header(IMG_UINT32 *pHeaderMemory, IMG_BOOL bCabac
}
void pnw__H264_prepare_slice_header(
- IMG_UINT32 *pHeaderMemory,
+ unsigned char *pHeaderMemory,
IMG_BOOL bIntraSlice,
IMG_UINT32 uiDisableDeblockingFilterIDC,
IMG_UINT32 uiFrameNumber,
@@ -2698,9 +2706,11 @@ void pnw__H264_prepare_slice_header(
IMG_BOOL bIsLongTermRef,
IMG_UINT16 uiIdrPicId)
{
- H264_SLICE_HEADER_PARAMS SlHParams = {0};
+ H264_SLICE_HEADER_PARAMS SlHParams;
MTX_HEADER_PARAMS *mtx_hdr;
+ memset(&SlHParams, 0, sizeof(SlHParams));
+
/* Route output elements to memory provided */
mtx_hdr = (MTX_HEADER_PARAMS *) pHeaderMemory;
@@ -2771,7 +2781,7 @@ void pnw__H264_prepare_slice_header(
//}
void pnw__MPEG4_prepare_sequence_header(
- IMG_UINT32 *pHeaderMemory,
+ unsigned char *pHeaderMemory,
IMG_BOOL bBFrame,
MPEG4_PROFILE_TYPE sProfile,
IMG_UINT8 Profile_and_level_indication,
@@ -2809,7 +2819,7 @@ void pnw__MPEG4_prepare_sequence_header(
}
void pnw__MPEG4_prepare_vop_header(
- IMG_UINT32 *pHeaderMem,
+ unsigned char *pHeaderMem,
IMG_BOOL bIsVOP_coded,
IMG_UINT32 VOP_time_increment,
IMG_UINT8 sSearch_range,
@@ -2843,7 +2853,7 @@ void pnw__MPEG4_prepare_vop_header(
}
void pnw__H263_prepare_sequence_header(
- IMG_UINT32 *pHeaderMem,
+ unsigned char *pHeaderMem,
IMG_UINT8 Profile_and_level_indication)
{
MTX_HEADER_PARAMS *mtx_hdr;
@@ -2866,7 +2876,7 @@ void pnw__H263_prepare_sequence_header(
}
void pnw__H263_prepare_picture_header(
- IMG_UINT32 *pHeaderMem,
+ unsigned char *pHeaderMem,
IMG_UINT8 Temporal_Ref,
H263_PICTURE_CODING_TYPE PictureCodingType,
H263_SOURCE_FORMAT_TYPE SourceFormatType,
@@ -2898,7 +2908,7 @@ void pnw__H263_prepare_picture_header(
}
void pnw__H263_prepare_GOBslice_header(
- IMG_UINT32 *pHeaderMem,
+ unsigned char *pHeaderMem,
IMG_UINT8 GOBNumber,
IMG_UINT8 GOBFrameId)
{
diff --git a/src/pnw_hostheader.h b/src/pnw_hostheader.h
index 72c3f52..3b6f43d 100644
--- a/src/pnw_hostheader.h
+++ b/src/pnw_hostheader.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -95,7 +95,7 @@ typedef enum _SHPROFILES {
/* Level number definitions (integer level numbers, non-intermediary only.. except level 1b) */
typedef enum _SHLEVELS {
SH_LEVEL_1 = 10,
- SH_LEVEL_1B = 111,
+ SH_LEVEL_1B = 11,
SH_LEVEL_11 = 11,
SH_LEVEL_12 = 12,
SH_LEVEL_13 = 13,
@@ -225,7 +225,7 @@ typedef enum _H263_SOURCE_FORMAT_ENUM {
/* H264 header preparation */
void pnw__H264_prepare_sequence_header(
- IMG_UINT32 *pHeaderMemory,
+ unsigned char *pHeaderMemory,
IMG_UINT32 uiPicWidthInMbs,
IMG_UINT32 uiPicHeightInMbs,
IMG_BOOL VUI_present, H264_VUI_PARAMS *VUI_params,
@@ -233,10 +233,10 @@ void pnw__H264_prepare_sequence_header(
IMG_UINT8 uiLevel,
IMG_UINT8 uiProfile);
-void pnw__H264_prepare_picture_header(IMG_UINT32 *pHeaderMemory, IMG_BOOL bCabacEnaled, IMG_INT8 CQPOffset);
+void pnw__H264_prepare_picture_header(unsigned char *pHeaderMemory, IMG_BOOL bCabacEnaled, IMG_INT8 CQPOffset);
void pnw__H264_prepare_slice_header(
- IMG_UINT32 *pHeaderMemory,
+ unsigned char *pHeaderMemory,
IMG_BOOL bIntraSlice,
IMG_UINT32 uiDisableDeblockingFilterIDC,
IMG_UINT32 uiFrameNumber,
@@ -248,14 +248,14 @@ void pnw__H264_prepare_slice_header(
IMG_BOOL bIsLOngTermRef,
IMG_UINT16 uiIdrPicId);
-void pnw__H264_prepare_eodofstream_header(IMG_UINT32 *pHeaderMemory);
-void pnw__H264_prepare_endofpicture_header(IMG_UINT32 *pHeaderMemory);
-void pnw__H264_prepare_endofsequence_header(IMG_UINT32 *pHeaderMemory);
+void pnw__H264_prepare_eodofstream_header(unsigned char *pHeaderMemory);
+void pnw__H264_prepare_endofpicture_header(unsigned char *pHeaderMemory);
+void pnw__H264_prepare_endofsequence_header(unsigned char *pHeaderMemory);
/* MPEG4 header preparation */
void pnw__MPEG4_prepare_sequence_header(
- IMG_UINT32 *pHeaderMemory,
+ unsigned char *pHeaderMemory,
IMG_BOOL bBFrame,
MPEG4_PROFILE_TYPE sProfile,
IMG_UINT8 Profile_and_level_indication,
@@ -266,7 +266,7 @@ void pnw__MPEG4_prepare_sequence_header(
IMG_UINT32 VopTimeResolution);
void pnw__MPEG4_prepare_vop_header(
- IMG_UINT32 *pHeaderMem,
+ unsigned char *pHeaderMem,
IMG_BOOL bIsVOP_coded,
IMG_UINT32 VOP_time_increment,
IMG_UINT8 sSearch_range,
@@ -276,11 +276,11 @@ void pnw__MPEG4_prepare_vop_header(
/* H263 header preparation */
void pnw__H263_prepare_sequence_header(
- IMG_UINT32 *pHeaderMem,
+ unsigned char *pHeaderMem,
IMG_UINT8 Profile_and_level_indication);
void pnw__H263_prepare_picture_header(
- IMG_UINT32 *pHeaderMem,
+ unsigned char *pHeaderMem,
IMG_UINT8 Temporal_Ref,
H263_PICTURE_CODING_TYPE PictureCodingType,
H263_SOURCE_FORMAT_TYPE SourceFormatType,
@@ -289,7 +289,7 @@ void pnw__H263_prepare_picture_header(
IMG_UINT16 PictureHeigth);
void pnw__H263_prepare_GOBslice_header(
- IMG_UINT32 *pHeaderMem,
+ unsigned char *pHeaderMem,
IMG_UINT8 GOBNumber,
IMG_UINT8 GOBFrameId);
diff --git a/src/pnw_hostjpeg.c b/src/pnw_hostjpeg.c
index ac883dd..3c34c36 100644
--- a/src/pnw_hostjpeg.c
+++ b/src/pnw_hostjpeg.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -495,7 +495,7 @@ IMG_ERRORCODE AllocateCodedDataBuffers(TOPAZSC_JPEG_ENCODER_CONTEXT *pContext)
pContext->sScan_Encode_Info.aBufferTable[ui8Loop].i8MTXNumber = 0; // Indicates buffer is idle
pContext->sScan_Encode_Info.aBufferTable[ui8Loop].ui16ScanNumber = 0; // Indicates buffer is idle
pContext->sScan_Encode_Info.aBufferTable[ui8Loop].pMemInfo =
- pContext->jpeg_coded_buf.pMemInfo + PNW_JPEG_HEADER_MAX_SIZE + ui8Loop * pContext->ui32SizePerCodedBuffer;
+ (unsigned char *)pContext->jpeg_coded_buf.pMemInfo + PNW_JPEG_HEADER_MAX_SIZE + ui8Loop * pContext->ui32SizePerCodedBuffer;
}
@@ -1776,9 +1776,9 @@ IMG_ERRORCODE SubmitScanToMTX(TOPAZSC_JPEG_ENCODER_CONTEXT *pContext,
}
-void pnw_jpeg_set_default_qmatix(void *pMemInfoTableBlock)
+void pnw_jpeg_set_default_qmatix(unsigned char *pMemInfoTableBlock)
{
- JPEG_MTX_QUANT_TABLE *pQTable = pMemInfoTableBlock;
+ JPEG_MTX_QUANT_TABLE *pQTable = (JPEG_MTX_QUANT_TABLE *)pMemInfoTableBlock;
memcpy(pQTable->aui8LumaQuantParams, gQuantLuma, QUANT_TABLE_SIZE_BYTES);
memcpy(pQTable->aui8ChromaQuantParams, gQuantChroma, QUANT_TABLE_SIZE_BYTES);
return;
diff --git a/src/pnw_hostjpeg.h b/src/pnw_hostjpeg.h
index 363d291..f9182c5 100644
--- a/src/pnw_hostjpeg.h
+++ b/src/pnw_hostjpeg.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -64,7 +64,7 @@
: (core))
#define JPEG_MCU_PER_SCAN(width, height, core, eFormat) \
- ((JPEG_MCU_PER_CORE(width, height, core, eFormat) > JPEG_MAX_MCU_PER_SCAN) ? \
+ ((JPEG_MCU_PER_CORE(width, height, core, eFormat) > JPEG_MAX_MCU_PER_SCAN) ? \
JPEG_MAX_MCU_PER_SCAN : JPEG_MCU_PER_CORE(width, height, core, eFormat))
/*The start address of every segment must align 128bits -- DMA burst width*/
@@ -573,7 +573,7 @@ typedef struct {
//////////////////////////////////////////////////////////////////////////////////////////////
typedef struct {
- void * pMemInfo;
+ unsigned char * pMemInfo;
IMG_UINT16 ui16ScanNumber;
IMG_UINT32 ui32WriteBackVal;
IMG_INT8 i8MTXNumber; // Doubles as status indicator ( <0 = Awaiting output to CB, 0 = Idle, >0 = Being filled by MTX)
@@ -612,10 +612,10 @@ typedef struct context_jpeg_ENC_s {
IMG_UINT32 ui32InitialCBOffset;
object_surface_p pSourceSurface;
- void * pMemInfoMTXSetup;
+ unsigned char * pMemInfoMTXSetup;
JPEG_MTX_DMA_SETUP* pMTXSetup;
- void * pMemInfoTableBlock;
+ unsigned char * pMemInfoTableBlock;
JPEG_MTX_QUANT_TABLE *psTablesBlock;
IMG_UINT32 ui32Offsets[MTX_MAX_COMPONENTS];
@@ -624,7 +624,7 @@ typedef struct context_jpeg_ENC_s {
IMG_CODED_BUFFER jpeg_coded_buf;
- void *ctx;
+ unsigned char *ctx;
IMG_UINT32 ui32SizePerCodedBuffer;
IMG_UINT8 ui8ScanNum;
} TOPAZSC_JPEG_ENCODER_CONTEXT;
@@ -670,6 +670,6 @@ IMG_ERRORCODE IMG_JPEG_AllocateCodedBuffer(IMG_UINT32 ui32CBufferSize, IMG_CODED
IMG_ERRORCODE InitializeJpegEncode(TOPAZSC_JPEG_ENCODER_CONTEXT * pContext, object_surface_p pTFrame);
IMG_ERRORCODE SetupJPEGTables(TOPAZSC_JPEG_ENCODER_CONTEXT * pContext, IMG_CODED_BUFFER *pCBuffer, object_surface_p pTFrame);
IMG_ERRORCODE SubmitScanToMTX(TOPAZSC_JPEG_ENCODER_CONTEXT *pContext, IMG_UINT16 ui16BCnt, IMG_INT8 i8MTXNumber, IMG_UINT32 ui32NoMCUsToEncode);
-void pnw_jpeg_set_default_qmatix(void *pMemInfoTableBlock);
+void pnw_jpeg_set_default_qmatix(unsigned char *pMemInfoTableBlock);
void fPutBitsToBuffer(STREAMTYPEW *BitStream, IMG_UINT8 NoOfBytes, IMG_UINT32 ActualBits);
#endif /*_HOST_JPEG_H_*/
diff --git a/src/pnw_jpeg.c b/src/pnw_jpeg.c
index 4138a5e..17e880c 100644
--- a/src/pnw_jpeg.c
+++ b/src/pnw_jpeg.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -74,10 +74,21 @@ static void pnw_jpeg_QueryConfigAttributes(
static VAStatus pnw_jpeg_ValidateConfig(
object_config_p obj_config)
{
- VAStatus vaStatus = VA_STATUS_SUCCESS;
- psb__information_message("pnw_jpeg_ValidateConfig\n");
+ int i;
+ /* Check all attributes */
+ for (i = 0; i < obj_config->attrib_count; i++) {
+ switch (obj_config->attrib_list[i].type) {
+ case VAConfigAttribRTFormat:
+ /* Ignore */
+ break;
+ case VAConfigAttribRateControl:
+ break;
+ default:
+ return VA_STATUS_ERROR_ATTR_NOT_SUPPORTED;
+ }
+ }
- return vaStatus;
+ return VA_STATUS_SUCCESS;
}
@@ -157,7 +168,7 @@ static VAStatus pnw_jpeg_CreateContext(
/*It will be figured out when known the size of whole coded buffer.*/
jpeg_ctx_p->ui32SizePerCodedBuffer = 0;
- jpeg_ctx_p->ctx = ctx;
+ jpeg_ctx_p->ctx = (unsigned char *)ctx;
/*Reuse header_mem(76*4 bytes) and pic_params_size(256 bytes)
* as pMemInfoMTXSetup(JPEG_MTX_DMA_SETUP 24x4 bytes) and
* pMemInfoTableBlock JPEG_MTX_QUANT_TABLE(128byes)*/
@@ -309,7 +320,7 @@ static VAStatus pnw__jpeg_process_picture_param(context_ENC_p ctx, object_buffer
"coded segment size per scan is %d\n",
ctx->coded_buf->size, jpeg_ctx->ui32SizePerCodedBuffer);
- vaStatus = psb_buffer_map(ctx->coded_buf->psb_buffer, &jpeg_ctx->jpeg_coded_buf.pMemInfo);
+ vaStatus = psb_buffer_map(ctx->coded_buf->psb_buffer, (unsigned char **)&jpeg_ctx->jpeg_coded_buf.pMemInfo);
if (vaStatus) {
psb__error_message("ERROR: Map coded_buf failed!");
return vaStatus;
@@ -464,6 +475,12 @@ static VAStatus pnw_jpeg_EndPicture(
ui32RemainMCUs -= ui32NoMCUsToEncode;
}
+ pnw_cmdbuf_insert_command_package(ctx->obj_context,
+ 1 ,
+ MTX_CMDID_NULL,
+ NULL,
+ 0);
+
psb_buffer_unmap(&cmdbuf->pic_params);
cmdbuf->pic_params_p = NULL;
@@ -482,14 +499,14 @@ static VAStatus pnw_jpeg_EndPicture(
return VA_STATUS_SUCCESS;
}
-VAStatus pnw_jpeg_AppendMarkers(object_context_p obj_context, void *raw_coded_buf)
+VAStatus pnw_jpeg_AppendMarkers(object_context_p obj_context, unsigned char *raw_coded_buf)
{
INIT_CONTEXT_JPEG;
IMG_UINT16 ui16BCnt;
TOPAZSC_JPEG_ENCODER_CONTEXT *pContext = ctx->jpeg_ctx;
BUFFER_HEADER* pBufHeader;
STREAMTYPEW s_streamW;
- void *pSegStart = raw_coded_buf;
+ unsigned char *pSegStart = raw_coded_buf;
if (pSegStart == NULL) {
return VA_STATUS_ERROR_UNKNOWN;
diff --git a/src/pnw_jpeg.h b/src/pnw_jpeg.h
index 2ddf87f..88d4d02 100644
--- a/src/pnw_jpeg.h
+++ b/src/pnw_jpeg.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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,6 @@
#define PNW_JPEG_MAX_SCAN_NUM 7
extern struct format_vtable_s pnw_JPEG_vtable;
-extern VAStatus pnw_jpeg_AppendMarkers(object_context_p obj_context, void *raw_coded_buf);
+extern VAStatus pnw_jpeg_AppendMarkers(object_context_p obj_context, unsigned char *raw_coded_buf);
#endif /* _PNW_MPEG4ES_H_ */
diff --git a/src/pnw_rotate.c b/src/pnw_rotate.c
new file mode 100644
index 0000000..082f811
--- /dev/null
+++ b/src/pnw_rotate.c
@@ -0,0 +1,284 @@
+/*
+ * Copyright (c) 2011 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:
+ * Zeng Li <zeng.li@intel.com>
+ * Jason Hu <jason.hu@intel.com>
+ * Shengquan Yuan <shengquan.yuan@intel.com>
+ */
+
+#include <va/va.h>
+#include <va/va_backend.h>
+#include <va/va_backend_tpi.h>
+#include <va/va_backend_egl.h>
+#include <va/va_dricommon.h>
+
+#include "psb_drv_video.h"
+#include "psb_output.h"
+#include "vc1_defs.h"
+#include <stdio.h>
+#include <string.h>
+#include <stdarg.h>
+#include <time.h>
+#include <unistd.h>
+#include <wsbm/wsbm_pool.h>
+#include <wsbm/wsbm_manager.h>
+#include <wsbm/wsbm_util.h>
+#include <wsbm/wsbm_fencemgr.h>
+
+#define INIT_DRIVER_DATA psb_driver_data_p driver_data = (psb_driver_data_p) ctx->pDriverData
+
+#define SET_SURFACE_INFO_rotate(psb_surface, rotate) psb_surface->extra_info[5] = (uint32_t) rotate;
+#define GET_SURFACE_INFO_rotate(psb_surface) ((int) psb_surface->extra_info[5])
+#define CHECK_SURFACE_REALLOC(psb_surface, msvdx_rotate, need) \
+do { \
+ int old_rotate = GET_SURFACE_INFO_rotate(psb_surface); \
+ switch (msvdx_rotate) { \
+ case 2: /* 180 */ \
+ if (old_rotate == 180) \
+ need = 0; \
+ else \
+ need = 1; \
+ break; \
+ case 1: /* 90 */ \
+ case 3: /* 270 */ \
+ if (old_rotate == 1 || old_rotate == 3) \
+ need = 0; \
+ else \
+ need = 1; \
+ break; \
+ } \
+} while (0)
+
+void psb_InitRotate(VADriverContextP ctx)
+{
+ char env_value[64];
+ INIT_DRIVER_DATA;
+
+ /* VA rotate from APP */
+ driver_data->va_rotate = VA_ROTATION_NONE;
+
+ /* window manager rotation from OS */
+ driver_data->mipi0_rotation = VA_ROTATION_NONE;
+ driver_data->mipi1_rotation = VA_ROTATION_NONE;
+ driver_data->hdmi_rotation = VA_ROTATION_NONE;
+
+ /* final rotation of VA rotate+WM rotate */
+ driver_data->local_rotation = VA_ROTATION_NONE;
+ driver_data->extend_rotation = VA_ROTATION_NONE;
+
+ /* MSVDX rotate */
+ driver_data->msvdx_rotate_want = ROTATE_VA2MSVDX(VA_ROTATION_NONE);
+
+ if (psb_parse_config("PSB_VIDEO_NOROTATE", &env_value[0]) == 0) {
+ psb__information_message("MSVDX: disable MSVDX rotation\n");
+ driver_data->disable_msvdx_rotate = 1;
+ }
+}
+
+void psb_RecalcRotate(VADriverContextP ctx)
+{
+ INIT_DRIVER_DATA;
+ int angle, new_rotate;
+ int old_rotate = driver_data->msvdx_rotate_want;
+
+ /* calc VA rotation and WM rotation, and assign to the final rotation degree */
+ angle = Rotation2Angle(driver_data->va_rotate) + Rotation2Angle(driver_data->mipi0_rotation);
+ driver_data->local_rotation = Angle2Rotation(angle);
+ angle = Rotation2Angle(driver_data->va_rotate) + Rotation2Angle(driver_data->hdmi_rotation);
+ driver_data->extend_rotation = Angle2Rotation(angle);
+
+ /* for any case that local and extened rotation are not same, fallback to GPU */
+ if ((driver_data->mipi1_rotation != VA_ROTATION_NONE) ||
+ ((driver_data->local_rotation != VA_ROTATION_NONE) &&
+ (driver_data->extend_rotation != VA_ROTATION_NONE) &&
+ (driver_data->local_rotation != driver_data->extend_rotation))) {
+ new_rotate = ROTATE_VA2MSVDX(driver_data->local_rotation);
+ if (driver_data->is_android == 0) /*fallback to texblit path*/
+ driver_data->output_method = PSB_PUTSURFACE_CTEXTURE;
+ } else {
+ if (driver_data->local_rotation == VA_ROTATION_NONE)
+ new_rotate = driver_data->extend_rotation;
+ else
+ new_rotate = driver_data->local_rotation;
+
+ if (driver_data->is_android == 0) {
+ if (driver_data->output_method != PSB_PUTSURFACE_FORCE_CTEXTURE)
+ driver_data->output_method = PSB_PUTSURFACE_COVERLAY;
+ }
+ }
+
+ if (old_rotate != new_rotate) {
+ psb__information_message("MSVDX: new rotation %d desired\n", new_rotate);
+ driver_data->msvdx_rotate_want = new_rotate;
+ }
+
+}
+
+
+void psb_CheckInterlaceRotate(object_context_p obj_context, unsigned char *pic_param_tmp)
+{
+ int interaced_stream;
+
+ switch (obj_context->profile) {
+ case VAProfileMPEG2Simple:
+ case VAProfileMPEG2Main:
+ break;
+ case VAProfileMPEG4Simple:
+ case VAProfileMPEG4AdvancedSimple:
+ case VAProfileMPEG4Main:
+ case VAProfileH263Baseline: {
+ VAPictureParameterBufferMPEG4 *pic_params = (VAPictureParameterBufferMPEG4 *)pic_param_tmp;
+
+ if (pic_params->vol_fields.bits.interlaced)
+ obj_context->interlaced_stream = 1; /* is it the right way to check? */
+ break;
+ }
+ case VAProfileH264Baseline:
+ case VAProfileH264Main:
+ case VAProfileH264High:
+ case VAProfileH264ConstrainedBaseline: {
+ VAPictureParameterBufferH264 *pic_params = (VAPictureParameterBufferH264 *)pic_param_tmp;
+ /* is it the right way to check? */
+ if (pic_params->pic_fields.bits.field_pic_flag || pic_params->seq_fields.bits.mb_adaptive_frame_field_flag)
+ obj_context->interlaced_stream = 1;
+
+ break;
+ }
+ case VAProfileVC1Simple:
+ case VAProfileVC1Main:
+ case VAProfileVC1Advanced: {
+ VAPictureParameterBufferVC1 *pic_params = (VAPictureParameterBufferVC1 *)pic_param_tmp;
+
+ /* is it the right way to check? */
+ if (pic_params->sequence_fields.bits.interlace && (pic_params->picture_fields.bits.frame_coding_mode == VC1_FCM_FLDI))
+ obj_context->interlaced_stream = 1;
+
+ break;
+ }
+ default:
+ break;
+ }
+
+ if (obj_context->interlaced_stream) {
+ object_surface_p obj_surface = obj_context->current_render_target;
+
+ psb__information_message("Intelaced stream, no MSVDX rotate\n");
+
+ SET_SURFACE_INFO_rotate(obj_surface->psb_surface, 0);
+ obj_context->msvdx_rotate = 0;
+ }
+}
+
+
+/*
+ * Detach a surface from obj_surface
+ */
+VAStatus psb_DestroyRotateSurface(
+ VADriverContextP ctx,
+ object_surface_p obj_surface,
+ int rotate
+)
+{
+ INIT_DRIVER_DATA;
+ psb_surface_p psb_surface = obj_surface->psb_surface_rotate;
+ VAStatus vaStatus = VA_STATUS_SUCCESS;
+
+ /* Allocate alternative output surface */
+ if (psb_surface) {
+ psb__information_message("Try to allocate surface for alternative rotate output\n");
+ psb_surface_destroy(obj_surface->psb_surface_rotate);
+ free(psb_surface);
+
+ obj_surface->psb_surface_rotate = NULL;
+ obj_surface->width_r = obj_surface->width;
+ obj_surface->height_r = obj_surface->height;
+ }
+
+ return vaStatus;
+}
+
+/*
+ * Create and attach a rotate surface to obj_surface
+ */
+VAStatus psb_CreateRotateSurface(
+ VADriverContextP ctx,
+ object_surface_p obj_surface,
+ int msvdx_rotate
+)
+{
+ int width, height;
+ psb_surface_p psb_surface;
+ VAStatus vaStatus = VA_STATUS_SUCCESS;
+ int need_realloc = 0, protected = 0;
+
+ INIT_DRIVER_DATA;
+
+ psb_surface = obj_surface->psb_surface_rotate;
+ if (psb_surface) {
+ CHECK_SURFACE_REALLOC(psb_surface, msvdx_rotate, need_realloc);
+ if (need_realloc == 0) {
+ SET_SURFACE_INFO_rotate(psb_surface, msvdx_rotate);
+ return VA_STATUS_SUCCESS;
+ } else { /* free the old rotate surface */
+ /*FIX ME: No sync mechanism to hold surface buffer b/w msvdx and display(overlay).
+ So Disable dynamic surface destroy/create for avoiding buffer corruption.
+ psb_surface_destroy(obj_surface->psb_surface_rotate);
+ memset(psb_surface, 0, sizeof(*psb_surface));*/
+ return VA_STATUS_SUCCESS;
+ }
+ } else
+ psb_surface = (psb_surface_p) calloc(1, sizeof(struct psb_surface_s));
+
+ psb__information_message("Try to allocate surface for alternative rotate output\n");
+
+ width = obj_surface->width;
+ height = obj_surface->height;
+
+ if (msvdx_rotate == 2 /* VA_ROTATION_180 */) {
+ vaStatus = psb_surface_create(driver_data, width, height, VA_FOURCC_NV12,
+ protected, psb_surface);
+ obj_surface->width_r = width;
+ obj_surface->height_r = height;
+ } else {
+ vaStatus = psb_surface_create(driver_data, obj_surface->height_origin, ((width + 0x1f) & ~0x1f), VA_FOURCC_NV12,
+ protected, psb_surface);
+ obj_surface->width_r = obj_surface->height_origin;
+ obj_surface->height_r = ((width + 0x1f) & ~0x1f);
+ }
+
+ if (VA_STATUS_SUCCESS != vaStatus) {
+ free(psb_surface);
+ obj_surface->psb_surface_rotate = NULL;
+ vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
+ DEBUG_FAILURE;
+ return vaStatus;
+ }
+
+ SET_SURFACE_INFO_rotate(psb_surface, msvdx_rotate);
+ obj_surface->psb_surface_rotate = psb_surface;
+
+ return vaStatus;
+}
+
+
diff --git a/src/pnw_rotate.h b/src/pnw_rotate.h
new file mode 100644
index 0000000..014c866
--- /dev/null
+++ b/src/pnw_rotate.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2011 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:
+ * Zeng Li <zeng.li@intel.com>
+ * Jason Hu <jason.hu@intel.com>
+ * Shengquan Yuan <shengquan.yuan@intel.com>
+ */
+
+void psb_InitRotate(VADriverContextP ctx);
+void psb_RecalcRotate(VADriverContextP ctx);
+void psb_CheckInterlaceRotate(object_context_p obj_context, unsigned char *pic_param_tmp);
+VAStatus psb_DestroyRotateSurface(
+ VADriverContextP ctx,
+ object_surface_p obj_surface,
+ int rotate
+);
+VAStatus psb_CreateRotateSurface(
+ VADriverContextP ctx,
+ object_surface_p obj_surface,
+ int msvdx_rotate
+);
+
+
+
+
diff --git a/src/psb_H264.c b/src/psb_H264.c
index 62243c4..1a3889c 100644..100755
--- a/src/psb_H264.c
+++ b/src/psb_H264.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -54,6 +54,8 @@
#define SET_SURFACE_INFO_dpb_idx(psb_surface, val) psb_surface->extra_info[2] = val;
#define GET_SURFACE_INFO_colocated_index(psb_surface) ((int) (psb_surface->extra_info[3]))
#define SET_SURFACE_INFO_colocated_index(psb_surface, val) psb_surface->extra_info[3] = (uint32_t) val;
+#define SET_SURFACE_INFO_rotate(psb_surface, rotate) psb_surface->extra_info[5] = (uint32_t) rotate;
+#define GET_SURFACE_INFO_rotate(psb_surface) ((int) psb_surface->extra_info[5])
#define IS_USED_AS_REFERENCE(pic_flags) ( pic_flags & (VA_PICTURE_H264_SHORT_TERM_REFERENCE | VA_PICTURE_H264_LONG_TERM_REFERENCE) )
@@ -468,7 +470,7 @@ static VAStatus psb_H264_CreateContext(
DEBUG_FAILURE;
}
if (vaStatus == VA_STATUS_SUCCESS) {
- void *vlc_packed_data_address;
+ unsigned char *vlc_packed_data_address;
if (0 == psb_buffer_map(&ctx->vlc_packed_table, &vlc_packed_data_address)) {
memcpy(vlc_packed_data_address, ui16H264VLCTableData, sizeof(ui16H264VLCTableData));
psb_buffer_unmap(&ctx->vlc_packed_table);
@@ -555,8 +557,6 @@ static VAStatus psb__H264_allocate_colocated_buffer(context_H264_p ctx, object_s
{
psb_surface_p surface = obj_surface->psb_surface;
- psb__information_message("psb_H264: Allocating colocated buffer for surface %08x size = %08x\n", surface, size);
-
if (!GET_SURFACE_INFO_colocated_index(surface)) {
VAStatus vaStatus;
psb_buffer_p buf;
@@ -564,6 +564,8 @@ static VAStatus psb__H264_allocate_colocated_buffer(context_H264_p ctx, object_s
if (index >= ctx->colocated_buffers_size) {
return VA_STATUS_ERROR_UNKNOWN;
}
+ psb__information_message("psb_H264: Allocating colocated buffer for surface %08x size = %08x\n", surface, size);
+
buf = &(ctx->colocated_buffers[index]);
vaStatus = psb_buffer_create(ctx->obj_context->driver_data, size, psb_bt_vpu_only, buf);
if (VA_STATUS_SUCCESS != vaStatus) {
@@ -577,11 +579,12 @@ static VAStatus psb__H264_allocate_colocated_buffer(context_H264_p ctx, object_s
static psb_buffer_p psb__H264_lookup_colocated_buffer(context_H264_p ctx, psb_surface_p surface)
{
- psb__information_message("psb_H264: Looking up colocated buffer for surface %08x\n", surface);
+ /* psb__information_message("psb_H264: Looking up colocated buffer for surface %08x\n", surface); */
int index = GET_SURFACE_INFO_colocated_index(surface);
if (!index) {
return NULL;
}
+
return &(ctx->colocated_buffers[index-1]); /* 0 means unset, index is offset by 1 */
}
@@ -621,7 +624,9 @@ static VAStatus psb__H264_process_picture_param(context_H264_p ctx, object_buffe
if ((obj_buffer->num_elements != 1) ||
(obj_buffer->size != sizeof(VAPictureParameterBufferH264)) ||
- (NULL == target_surface)) {
+ (NULL == target_surface) ||
+ (NULL == obj_buffer->buffer_data)) {
+ psb__error_message("picture parameter buffer is not valid.\n");
return VA_STATUS_ERROR_UNKNOWN;
}
@@ -662,7 +667,10 @@ static VAStatus psb__H264_process_picture_param(context_H264_p ctx, object_buffe
ctx->size_mb = ctx->picture_width_mb * ctx->picture_height_mb; /* (7-25) */
//uint32_t colocated_size = (ctx->picture_width_mb + extra_size) * (ctx->picture_height_mb + extra_size) * 192;
- uint32_t colocated_size = ((ctx->size_mb + 100) * 128 + 0xfff) & ~0xfff;
+ /*for resolution change feature, need allocat co-located buffer according the size of surface*/
+ uint32_t size_mb = ((ctx->obj_context->current_render_target->width + 15) / 16) *
+ ((ctx->obj_context->current_render_target->height + 15) / 16);
+ uint32_t colocated_size = ((size_mb + 100) * 128 + 0xfff) & ~0xfff;
vaStatus = psb__H264_allocate_colocated_buffer(ctx, ctx->obj_context->current_render_target, colocated_size);
if (VA_STATUS_SUCCESS != vaStatus) {
@@ -777,7 +785,9 @@ static VAStatus psb__H264_process_iq_matrix(context_H264_p ctx, object_buffer_p
ASSERT(obj_buffer->size == sizeof(VAIQMatrixBufferH264));
if ((obj_buffer->num_elements != 1) ||
- (obj_buffer->size != sizeof(VAIQMatrixBufferH264))) {
+ (obj_buffer->size != sizeof(VAIQMatrixBufferH264)) ||
+ (NULL == obj_buffer->buffer_data)) {
+ psb__error_message("iq matrix buffer is not valid.\n");
return VA_STATUS_ERROR_UNKNOWN;
}
@@ -798,7 +808,8 @@ static VAStatus psb__H264_process_slice_group_map(context_H264_p ctx, object_buf
ASSERT(obj_buffer->num_elements == 1);
// ASSERT(obj_buffer->size == ...);
- if (obj_buffer->num_elements != 1) {
+ if ((obj_buffer->num_elements != 1) ||
+ (NULL == obj_buffer->psb_buffer)) {
return VA_STATUS_ERROR_UNKNOWN;
}
@@ -1040,7 +1051,7 @@ static void psb__H264_setup_alternative_frame(context_H264_p ctx)
psb_surface_p rotate_surface = ctx->obj_context->current_render_target->psb_surface_rotate;
object_context_p obj_context = ctx->obj_context;
- if (rotate_surface->extra_info[5] != obj_context->rotate)
+ if (GET_SURFACE_INFO_rotate(rotate_surface) != obj_context->msvdx_rotate)
psb__error_message("Display rotate mode does not match surface rotate mode!\n");
@@ -1058,7 +1069,7 @@ static void psb__H264_setup_alternative_frame(context_H264_p ctx)
REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ALT_PICTURE_ENABLE, 1);
REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ROTATION_ROW_STRIDE, rotate_surface->stride_mode);
REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , RECON_WRITE_DISABLE, 0); /* FIXME Always generate Rec */
- REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ROTATION_MODE, rotate_surface->extra_info[5]);
+ REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ROTATION_MODE, GET_SURFACE_INFO_rotate(rotate_surface));
psb_cmdbuf_rendec_write(cmdbuf, cmd);
@@ -1072,7 +1083,7 @@ static void psb__H264_build_rendec_params(context_H264_p ctx, VASliceParameterBu
psb_surface_p target_surface = ctx->obj_context->current_render_target->psb_surface;
VAPictureParameterBufferH264 *pic_params = ctx->pic_params;
uint32_t reg_value;
- int i;
+ unsigned int i;
psb_cmdbuf_rendec_start_block(cmdbuf);
@@ -1115,7 +1126,7 @@ static void psb__H264_build_rendec_params(context_H264_p ctx, VASliceParameterBu
psb_cmdbuf_rendec_end_chunk(cmdbuf);
-#warning "TODO: MUST be done after fe slice1 (which gives MB address) "
+ //#warning "TODO: MUST be done after fe slice1 (which gives MB address) "
/* REGIO_WRITE_REGISTER(0, MSVDX_VEC_H264, CR_VEC_H264_FE_BASE_ADDR_SGM, gui32SliceGroupType6BaseAddressHack); */
/* CHUNK: SCA */
@@ -1142,8 +1153,8 @@ static void psb__H264_build_rendec_params(context_H264_p ctx, VASliceParameterBu
if (slice_param->slice_type == ST_B || slice_param->slice_type == ST_P) {
psb_cmdbuf_rendec_start_chunk(cmdbuf, RENDEC_REGISTER_OFFSET(MSVDX_VEC, H264_CR_VEC_H264_BE_LIST0));
- if (slice_param->num_ref_idx_l0_active_minus1 > (32 - 4)) {
- psb__error_message("num_ref_idx_l0_active_minus1(%d) is too big. Set it with 28\n",
+ if (slice_param->num_ref_idx_l0_active_minus1 > 31) {
+ psb__error_message("num_ref_idx_l0_active_minus1(%d) is too big, limit it to 31.\n",
slice_param->num_ref_idx_l0_active_minus1);
slice_param->num_ref_idx_l0_active_minus1 = 28;
}
@@ -1164,7 +1175,6 @@ static void psb__H264_build_rendec_params(context_H264_p ctx, VASliceParameterBu
/* send DPB information (for P and B slices?) only needed once per frame */
// if ( sh->slice_type == ST_B || sh->slice_type == ST_P )
if (pic_params->num_ref_frames > 0) {
- int i;
IMG_BOOL is_used[16];
psb_cmdbuf_rendec_start_chunk(cmdbuf, RENDEC_REGISTER_OFFSET(MSVDX_CMDS, REFERENCE_PICTURE_BASE_ADDRESSES));
@@ -1210,7 +1220,7 @@ static void psb__H264_build_rendec_params(context_H264_p ctx, VASliceParameterBu
__FUNCTION__, __LINE__);
/* return; */
}
-
+ /*
psb__information_message("pic_params->ReferenceFrames[%d] = %08x --> %08x frame_idx:0x%08x flags:%02x TopFieldOrderCnt: 0x%08x BottomFieldOrderCnt: 0x%08x %s\n",
i,
pic_params->ReferenceFrames[i].picture_id,
@@ -1220,8 +1230,8 @@ static void psb__H264_build_rendec_params(context_H264_p ctx, VASliceParameterBu
pic_params->ReferenceFrames[i].TopFieldOrderCnt,
pic_params->ReferenceFrames[i].BottomFieldOrderCnt,
is_used[i] ? "used" : "");
-
- if (ref_surface && is_used[i])
+ */
+ if (ref_surface && is_used[i] && ref_surface->psb_surface->ref_buf)
// GET_SURFACE_INFO_is_used(ref_surface->psb_surface))
{
buffer = ref_surface->psb_surface->ref_buf;
@@ -1322,7 +1332,7 @@ static void psb__H264_build_rendec_params(context_H264_p ctx, VASliceParameterBu
/* If this a two pass mode deblock, then we will perform the rotation as part of the
* 2nd pass deblock procedure
*/
- if (/*!ctx->two_pass_mode &&*/ ctx->obj_context->rotate != VA_ROTATION_NONE) /* FIXME field coded should not issue */
+ if (/*!ctx->two_pass_mode &&*/ CONTEXT_ROTATE(ctx->obj_context)) /* FIXME field coded should not issue */
psb__H264_setup_alternative_frame(ctx);
/* CHUNK: SEQ Commands 1 */
@@ -1422,7 +1432,7 @@ static VAStatus psb__H264_add_slice_param(context_H264_p ctx, object_buffer_p ob
{
ASSERT(obj_buffer->type == VASliceParameterBufferType);
if (ctx->slice_param_list_idx >= ctx->slice_param_list_size) {
- void *new_list;
+ unsigned char *new_list;
ctx->slice_param_list_size += 8;
new_list = realloc(ctx->slice_param_list,
sizeof(object_buffer_p) * ctx->slice_param_list_size);
@@ -1539,7 +1549,7 @@ static const IMG_UINT32 ui32H264VLCTableRegValPair[] = {
static void psb__H264_write_VLC_tables(context_H264_p ctx)
{
psb_cmdbuf_p cmdbuf = ctx->obj_context->cmdbuf;
- int i;
+ unsigned int i;
psb_cmdbuf_skip_start_block(cmdbuf, SKIP_ON_CONTEXT_SWITCH);
@@ -1589,6 +1599,7 @@ static VAStatus psb__H264_process_slice(context_H264_p ctx,
ASSERT((obj_buffer->type == VASliceDataBufferType) || (obj_buffer->type == VAProtectedSliceDataBufferType));
+#if 0
psb__information_message("H264 process slice %d\n", ctx->slice_count);
psb__information_message(" profile = %s\n", profile2str[ctx->profile]);
psb__information_message(" size = %08x offset = %08x\n", slice_param->slice_data_size, slice_param->slice_data_offset);
@@ -1597,6 +1608,7 @@ static VAStatus psb__H264_process_slice(context_H264_p ctx,
psb__information_message(" coded size = %dx%d\n", ctx->picture_width_mb, ctx->picture_height_mb);
psb__information_message(" slice type = %s\n", slice2str[(slice_param->slice_type % 5)]);
psb__information_message(" weighted_pred_flag = %d weighted_bipred_idc = %d\n", ctx->pic_params->pic_fields.bits.weighted_pred_flag, ctx->pic_params->pic_fields.bits.weighted_bipred_idc);
+#endif
if ((slice_param->slice_data_flag == VA_SLICE_DATA_FLAG_BEGIN) ||
(slice_param->slice_data_flag == VA_SLICE_DATA_FLAG_ALL)) {
@@ -1695,25 +1707,35 @@ static VAStatus psb__H264_process_slice_data(context_H264_p ctx, object_buffer_p
VAStatus vaStatus = VA_STATUS_SUCCESS;
VASliceParameterBufferH264 *slice_param;
int buffer_idx = 0;
- int element_idx = 0;
+ unsigned int element_idx = 0;
ASSERT((obj_buffer->type == VASliceDataBufferType) || (obj_buffer->type == VAProtectedSliceDataBufferType));
ASSERT(ctx->pic_params);
ASSERT(ctx->slice_param_list_idx);
- if (!ctx->pic_params) {
+ if ((!ctx->pic_params) || (!ctx->slice_param_list_idx)) {
/* Picture params missing */
+ psb__error_message("picture/slice parameter buffer should not be empty.\n");
return VA_STATUS_ERROR_UNKNOWN;
}
if ((NULL == obj_buffer->psb_buffer) ||
(0 == obj_buffer->size)) {
/* We need to have data in the bitstream buffer */
+ psb__error_message("bitstream buffer should not be empty.\n");
return VA_STATUS_ERROR_UNKNOWN;
}
while (buffer_idx < ctx->slice_param_list_idx) {
object_buffer_p slice_buf = ctx->slice_param_list[buffer_idx];
+ /*need check whether slice parameter buffer is valid*/
+ if ((NULL == slice_buf) ||
+ (NULL == slice_buf->buffer_data) ||
+ (slice_buf->size != sizeof(VASliceParameterBufferH264))) {
+ psb__error_message("slice parameter buffer is not valid.\n");
+ return VA_STATUS_ERROR_UNKNOWN;
+ }
+
if (element_idx >= slice_buf->num_elements) {
/* Move to next buffer */
element_idx = 0;
@@ -1767,32 +1789,32 @@ static VAStatus psb_H264_RenderPicture(
switch (obj_buffer->type) {
case VAPictureParameterBufferType:
- psb__information_message("psb_H264_RenderPicture got VAPictureParameterBuffer\n");
+ /* psb__information_message("psb_H264_RenderPicture got VAPictureParameterBuffer\n"); */
vaStatus = psb__H264_process_picture_param(ctx, obj_buffer);
DEBUG_FAILURE;
break;
case VAIQMatrixBufferType:
- psb__information_message("psb_H264_RenderPicture got VAIQMatrixBufferType\n");
+ /* psb__information_message("psb_H264_RenderPicture got VAIQMatrixBufferType\n"); */
vaStatus = psb__H264_process_iq_matrix(ctx, obj_buffer);
DEBUG_FAILURE;
break;
case VASliceGroupMapBufferType:
- psb__information_message("psb_H264_RenderPicture got VASliceGroupMapBufferType\n");
+ /* psb__information_message("psb_H264_RenderPicture got VASliceGroupMapBufferType\n"); */
vaStatus = psb__H264_process_slice_group_map(ctx, obj_buffer);
DEBUG_FAILURE;
break;
case VASliceParameterBufferType:
- psb__information_message("psb_H264_RenderPicture got VASliceParameterBufferType\n");
+ /* psb__information_message("psb_H264_RenderPicture got VASliceParameterBufferType\n"); */
vaStatus = psb__H264_add_slice_param(ctx, obj_buffer);
DEBUG_FAILURE;
break;
case VASliceDataBufferType:
case VAProtectedSliceDataBufferType:
- psb__information_message("psb_H264_RenderPicture got %s\n", SLICEDATA_BUFFER_TYPE(obj_buffer->type));
+ /* psb__information_message("psb_H264_RenderPicture got %s\n", SLICEDATA_BUFFER_TYPE(obj_buffer->type)); */
vaStatus = psb__H264_process_slice_data(ctx, obj_buffer);
DEBUG_FAILURE;
break;
@@ -1855,8 +1877,8 @@ static VAStatus psb_H264_EndPicture(
}
#endif
- if (ctx->two_pass_mode && (ctx->obj_context->rotate == VA_ROTATION_NONE)) {
- void *pMbData = NULL;
+ if (ctx->two_pass_mode && (CONTEXT_ROTATE(ctx->obj_context) == 0)) {
+ unsigned char *pMbData = NULL;
psb_surface_p target_surface = ctx->obj_context->current_render_target->psb_surface;
psb_buffer_p colocated_target_buffer = psb__H264_lookup_colocated_buffer(ctx, target_surface);
diff --git a/src/psb_H264.h b/src/psb_H264.h
index df57f63..c46ffa0 100644
--- a/src/psb_H264.h
+++ b/src/psb_H264.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/psb_MPEG2.c b/src/psb_MPEG2.c
index af2a577..ded4d0e 100644
--- a/src/psb_MPEG2.c
+++ b/src/psb_MPEG2.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -50,6 +50,8 @@
#define SET_SURFACE_INFO_picture_structure(psb_surface, val) psb_surface->extra_info[1] = val;
#define GET_SURFACE_INFO_picture_coding_type(psb_surface) ((int) (psb_surface->extra_info[2]))
#define SET_SURFACE_INFO_picture_coding_type(psb_surface, val) psb_surface->extra_info[2] = (uint32_t) val;
+#define SET_SURFACE_INFO_rotate(psb_surface, rotate) psb_surface->extra_info[5] = (uint32_t) rotate;
+#define GET_SURFACE_INFO_rotate(psb_surface) ((int) psb_surface->extra_info[5])
#define SLICEDATA_BUFFER_TYPE(type) ((type==VASliceDataBufferType)?"VASliceDataBufferType":"VAProtectedSliceDataBufferType")
@@ -70,7 +72,7 @@
/* Format is: opcode, width, symbol. All VLC tables are concatenated. Index */
/* infomation is stored in gui16mpeg2VlcIndexData[] */
#define VLC_PACK(a,b,c) ( ( (a) << 12 ) | ( (b) << 9 ) | (c) )
-const static IMG_UINT16 gaui16mpeg2VlcTableDataPacked[] = {
+static const IMG_UINT16 gaui16mpeg2VlcTableDataPacked[] = {
VLC_PACK(6 , 0 , 0) ,
VLC_PACK(0 , 0 , 6) ,
VLC_PACK(4 , 2 , 4) ,
@@ -655,7 +657,7 @@ static VAStatus psb_MPEG2_CreateContext(
DEBUG_FAILURE;
}
if (vaStatus == VA_STATUS_SUCCESS) {
- void *vlc_packed_data_address;
+ unsigned char *vlc_packed_data_address;
if (0 == psb_buffer_map(&ctx->vlc_packed_table, &vlc_packed_data_address)) {
memcpy(vlc_packed_data_address, gaui16mpeg2VlcTableDataPacked, sizeof(gaui16mpeg2VlcTableDataPacked));
psb_buffer_unmap(&ctx->vlc_packed_table);
@@ -870,7 +872,7 @@ static VAStatus psb__MPEG2_add_slice_param(context_MPEG2_p ctx, object_buffer_p
{
ASSERT(obj_buffer->type == VASliceParameterBufferType);
if (ctx->slice_param_list_idx >= ctx->slice_param_list_size) {
- void *new_list;
+ unsigned char *new_list;
ctx->slice_param_list_size += 8;
new_list = realloc(ctx->slice_param_list,
sizeof(object_buffer_p) * ctx->slice_param_list_size);
@@ -922,7 +924,7 @@ static void psb__MPEG2_setup_alternative_frame(context_MPEG2_p ctx)
psb_surface_p rotate_surface = ctx->obj_context->current_render_target->psb_surface_rotate;
object_context_p obj_context = ctx->obj_context;
- if (rotate_surface->extra_info[5] != obj_context->rotate)
+ if (GET_SURFACE_INFO_rotate(rotate_surface) != obj_context->msvdx_rotate)
psb__error_message("Display rotate mode does not match surface rotate mode!\n");
@@ -940,7 +942,7 @@ static void psb__MPEG2_setup_alternative_frame(context_MPEG2_p ctx)
REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ALT_PICTURE_ENABLE, 1);
REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ROTATION_ROW_STRIDE, rotate_surface->stride_mode);
REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , RECON_WRITE_DISABLE, 0); /* FIXME Always generate Rec */
- REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ROTATION_MODE, rotate_surface->extra_info[5]);
+ REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ROTATION_MODE, GET_SURFACE_INFO_rotate(rotate_surface));
psb_cmdbuf_rendec_write(cmdbuf, cmd);
@@ -954,7 +956,7 @@ static void psb__MPEG2_set_operating_mode(context_MPEG2_p ctx)
psb_cmdbuf_rendec_start_block(cmdbuf);
- if (ctx->obj_context->rotate != VA_ROTATION_NONE)
+ if (CONTEXT_ROTATE(ctx->obj_context))
psb__MPEG2_setup_alternative_frame(ctx);
psb_cmdbuf_rendec_start_chunk(cmdbuf, RENDEC_REGISTER_OFFSET(MSVDX_CMDS, DISPLAY_PICTURE_SIZE));
@@ -1369,7 +1371,7 @@ static VAStatus psb__MPEG2_process_slice_data(context_MPEG2_p ctx, object_buffer
VAStatus vaStatus = VA_STATUS_SUCCESS;
VASliceParameterBufferMPEG2 *slice_param;
int buffer_idx = 0;
- int element_idx = 0;
+ unsigned int element_idx = 0;
ASSERT((obj_buffer->type == VASliceDataBufferType) || (obj_buffer->type == VAProtectedSliceDataBufferType));
@@ -1475,7 +1477,7 @@ static void psb__MEPG2_send_blit_cmd(context_MPEG2_p ctx)
REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ALT_PICTURE_ENABLE, 1);
REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ROTATION_ROW_STRIDE, rotate_surface->stride_mode);
REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , RECON_WRITE_DISABLE, 0);
- REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ROTATION_MODE, rotate_surface->extra_info[5]);
+ REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ROTATION_MODE, GET_SURFACE_INFO_rotate(rotate_surface));
psb_cmdbuf_reg_set(cmdbuf, REGISTER_OFFSET(MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION), cmd);
psb_cmdbuf_reg_end_block(cmdbuf);
@@ -1575,7 +1577,7 @@ static VAStatus psb_MPEG2_EndPicture(
psb__information_message("psb_MPEG2_EndPicture\n");
- if (ctx->obj_context->rotate != VA_ROTATION_NONE) {
+ if (CONTEXT_ROTATE(ctx->obj_context)) {
if (!(ctx->pic_params->picture_coding_extension.bits.progressive_frame) &&
!(ctx->pic_params->picture_coding_extension.bits.is_first_field))
psb__MPEG2_insert_blit_cmd_to_rotate(ctx);
diff --git a/src/psb_MPEG2.h b/src/psb_MPEG2.h
index af06632..f7f3c29 100644
--- a/src/psb_MPEG2.h
+++ b/src/psb_MPEG2.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/psb_MPEG2MC.c b/src/psb_MPEG2MC.c
index a75a01a..c081a77 100644
--- a/src/psb_MPEG2MC.c
+++ b/src/psb_MPEG2MC.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -860,13 +860,13 @@ static VAStatus psb__MPEG2MC_process_mbs_interPB(
while (mb_pending || skip_count) {
uint32_t mb_in_buffer = (ctx->picture_width_mb);
psb_cmdbuf_p cmdbuf;
- void *cmd_start;
+ unsigned char *cmd_start;
ctx->fstmb_slice = IMG_TRUE;
psb_context_get_next_cmdbuf(ctx->obj_context);
cmdbuf = ctx->obj_context->cmdbuf;
- cmd_start = (void *) cmdbuf->cmd_idx;
+ cmd_start = (unsigned char *) cmdbuf->cmd_idx;
/* Build the high-level commands */
psb__MPEG2MC_send_highlevel_commands(ctx);
@@ -924,7 +924,7 @@ static VAStatus psb__MPEG2MC_process_mbs_interPB(
psb_context_submit_cmdbuf(ctx->obj_context);
/* check if the remained cmdbuf size can fill the commands of next slice */
- if (1 || (cmdbuf->lldma_base - (void *) cmdbuf->cmd_idx) < ((void *) cmdbuf->cmd_idx - cmd_start))
+ if (1 || (cmdbuf->lldma_base - (unsigned char *) cmdbuf->cmd_idx) < ((unsigned char *) cmdbuf->cmd_idx - cmd_start))
psb_context_flush_cmdbuf(ctx->obj_context);
}
@@ -1056,13 +1056,13 @@ static VAStatus psb__MPEG2MC_process_mbs_intra(
while (mb_pending) { /* one slice per loop */
uint32_t mb_in_buffer = min(mb_pending, ctx->picture_width_mb);
psb_cmdbuf_p cmdbuf;
- void *cmd_start;
+ unsigned char *cmd_start;
mb_pending -= mb_in_buffer;
psb_context_get_next_cmdbuf(ctx->obj_context);
cmdbuf = ctx->obj_context->cmdbuf;
- cmd_start = (void *) cmdbuf->cmd_idx;
+ cmd_start = (unsigned char *) cmdbuf->cmd_idx;
ctx->fstmb_slice = IMG_TRUE;
@@ -1103,7 +1103,7 @@ static VAStatus psb__MPEG2MC_process_mbs_intra(
psb_context_submit_cmdbuf(ctx->obj_context);
/* check if the remained cmdbuf size can fill the commands of next slice */
- if (1 || (cmdbuf->lldma_base - (void *) cmdbuf->cmd_idx) < ((void *) cmdbuf->cmd_idx - cmd_start))
+ if (1 || (cmdbuf->lldma_base - (unsigned char *) cmdbuf->cmd_idx) < ((unsigned char *) cmdbuf->cmd_idx - cmd_start))
psb_context_flush_cmdbuf(ctx->obj_context);
}
@@ -1356,7 +1356,7 @@ static VAStatus psb_MPEG2MC_BeginPicture(
INIT_CONTEXT_MPEG2MC;
#if 0 /* clear surface for debugging */
- void *surface_data = NULL;
+ unsigned char *surface_data = NULL;
static psb_surface_p target_surface = NULL;
psb_surface_p tmp = ctx->obj_context->current_render_target->psb_surface;
if (target_surface != tmp) { /* for field picture, only reset one time */
diff --git a/src/psb_MPEG4.c b/src/psb_MPEG4.c
index c86650c..0b3fa45 100644
--- a/src/psb_MPEG4.c
+++ b/src/psb_MPEG4.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -31,6 +31,7 @@
#include "psb_def.h"
#include "psb_surface.h"
#include "psb_cmdbuf.h"
+#include "pnw_rotate.h"
#include "hwdefs/reg_io2.h"
#include "hwdefs/msvdx_offsets.h"
@@ -51,6 +52,8 @@
#define SET_SURFACE_INFO_picture_coding_type(psb_surface, val) psb_surface->extra_info[2] = (uint32_t) val;
#define GET_SURFACE_INFO_colocated_index(psb_surface) ((int) (psb_surface->extra_info[3]))
#define SET_SURFACE_INFO_colocated_index(psb_surface, val) psb_surface->extra_info[3] = (uint32_t) val;
+#define SET_SURFACE_INFO_rotate(psb_surface, rotate) psb_surface->extra_info[5] = (uint32_t) rotate;
+#define GET_SURFACE_INFO_rotate(psb_surface) ((int) psb_surface->extra_info[5])
#define SLICEDATA_BUFFER_TYPE(type) ((type==VASliceDataBufferType)?"VASliceDataBufferType":"VAProtectedSliceDataBufferType")
@@ -104,7 +107,7 @@ typedef enum {
/* Format is: opcode, width, symbol. All VLC tables are concatenated. */
#define VLC_PACK(a,b,c) ( ( (a) << 12 ) | ( (b) << 9 ) | (c) )
-const static IMG_UINT16 gaui16mpeg4VlcTableDataPacked[] = {
+static const IMG_UINT16 gaui16mpeg4VlcTableDataPacked[] = {
VLC_PACK(4 , 0 , 12), VLC_PACK(5 , 0 , 7), VLC_PACK(4 , 2 , 13), VLC_PACK(4 , 3 , 16), VLC_PACK(5 , 0 , 9), VLC_PACK(4 , 5 , 17),
VLC_PACK(2 , 2 , 1), VLC_PACK(3 , 2 , 0), VLC_PACK(3 , 2 , 0), VLC_PACK(4 , 2 , 36), VLC_PACK(3 , 2 , 0), VLC_PACK(4 , 0 , 0),
VLC_PACK(0 , 0 , 6), VLC_PACK(0 , 0 , 7), VLC_PACK(2 , 1 , 8), VLC_PACK(0 , 1 , 10), VLC_PACK(2 , 1 , 13), VLC_PACK(0 , 2 , 15),
@@ -500,7 +503,7 @@ static VAStatus psb_MPEG4_CreateContext(
DEBUG_FAILURE;
}
if (vaStatus == VA_STATUS_SUCCESS) {
- void *vlc_packed_data_address;
+ unsigned char *vlc_packed_data_address;
if (0 == psb_buffer_map(&ctx->vlc_packed_table, &vlc_packed_data_address)) {
memcpy(vlc_packed_data_address, gaui16mpeg4VlcTableDataPacked, sizeof(gaui16mpeg4VlcTableDataPacked));
psb_buffer_unmap(&ctx->vlc_packed_table);
@@ -780,6 +783,8 @@ static VAStatus psb__MPEG4_process_picture_param(context_MPEG4_p ctx, object_buf
REGIO_WRITE_FIELD_LITE(ctx->BE_PICSH_PPS0, MSVDX_VEC_MPEG4, CR_VEC_MPEG4_BE_PICSH_PPS0, BE_PICSH_CODING_TYPE, ctx->pic_params->vop_fields.bits.vop_coding_type);
}
+ psb_CheckInterlaceRotate(ctx->obj_context, (unsigned char *)ctx->pic_params);
+
return VA_STATUS_SUCCESS;
}
@@ -865,7 +870,7 @@ static VAStatus psb__MPEG4_add_slice_param(context_MPEG4_p ctx, object_buffer_p
{
ASSERT(obj_buffer->type == VASliceParameterBufferType);
if (ctx->slice_param_list_idx >= ctx->slice_param_list_size) {
- void *new_list;
+ unsigned char *new_list;
ctx->slice_param_list_size += 8;
new_list = realloc(ctx->slice_param_list,
sizeof(object_buffer_p) * ctx->slice_param_list_size);
@@ -941,7 +946,7 @@ static void psb__MPEG4_setup_alternative_frame(context_MPEG4_p ctx)
psb_surface_p rotate_surface = ctx->obj_context->current_render_target->psb_surface_rotate;
object_context_p obj_context = ctx->obj_context;
- if (rotate_surface->extra_info[5] != obj_context->rotate)
+ if (GET_SURFACE_INFO_rotate(rotate_surface) != obj_context->msvdx_rotate)
psb__error_message("Display rotate mode does not match surface rotate mode!\n");
@@ -959,7 +964,7 @@ static void psb__MPEG4_setup_alternative_frame(context_MPEG4_p ctx)
REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ALT_PICTURE_ENABLE, 1);
REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ROTATION_ROW_STRIDE, rotate_surface->stride_mode);
REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , RECON_WRITE_DISABLE, 0); /* FIXME Always generate Rec */
- REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ROTATION_MODE, rotate_surface->extra_info[5]);
+ REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ROTATION_MODE, GET_SURFACE_INFO_rotate(rotate_surface));
psb_cmdbuf_rendec_write(cmdbuf, cmd);
@@ -999,7 +1004,7 @@ static void psb__MPEG4_set_picture_params(context_MPEG4_p ctx, VASliceParameterB
}
psb_cmdbuf_rendec_end_chunk(cmdbuf);
- if (ctx->obj_context->rotate != VA_ROTATION_NONE)
+ if (CONTEXT_ROTATE(ctx->obj_context))
psb__MPEG4_setup_alternative_frame(ctx);
/* Send VDMC and VDEB commands */
@@ -1329,7 +1334,7 @@ static VAStatus psb__MPEG4_process_slice_data(context_MPEG4_p ctx, object_buffer
VAStatus vaStatus = VA_STATUS_SUCCESS;
VASliceParameterBufferMPEG4 *slice_param;
int buffer_idx = 0;
- int element_idx = 0;
+ unsigned int element_idx = 0;
ASSERT((obj_buffer->type == VASliceDataBufferType) || (obj_buffer->type == VAProtectedSliceDataBufferType));
diff --git a/src/psb_MPEG4.h b/src/psb_MPEG4.h
index a044526..5078843 100644
--- a/src/psb_MPEG4.h
+++ b/src/psb_MPEG4.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/psb_VC1.c b/src/psb_VC1.c
index 80a6d05..98a8010 100644
--- a/src/psb_VC1.c
+++ b/src/psb_VC1.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -56,6 +56,8 @@
#define SET_SURFACE_INFO_picture_coding_type(psb_surface, val) psb_surface->extra_info[2] = (uint32_t) val;
#define GET_SURFACE_INFO_colocated_index(psb_surface) ((int) (psb_surface->extra_info[3]))
#define SET_SURFACE_INFO_colocated_index(psb_surface, val) psb_surface->extra_info[3] = (uint32_t) val;
+#define SET_SURFACE_INFO_rotate(psb_surface, rotate) psb_surface->extra_info[5] = (uint32_t) rotate;
+#define GET_SURFACE_INFO_rotate(psb_surface) ((int) psb_surface->extra_info[5])
#define SLICEDATA_BUFFER_TYPE(type) ((type==VASliceDataBufferType)?"VASliceDataBufferType":"VAProtectedSliceDataBufferType")
@@ -501,8 +503,8 @@ static VAStatus psb_VC1_CreateContext(
}
if (vaStatus == VA_STATUS_SUCCESS) {
void *vlc_packed_data_address;
- if (0 == psb_buffer_map(&ctx->vlc_packed_table, &vlc_packed_data_address)) {
- psb__VC1_pack_vlc_tables(vlc_packed_data_address, gaui16vc1VlcTableData, gui16vc1VlcTableSize);
+ if (0 == psb_buffer_map(&ctx->vlc_packed_table, (unsigned char **)&vlc_packed_data_address)) {
+ psb__VC1_pack_vlc_tables((unsigned short *)vlc_packed_data_address, gaui16vc1VlcTableData, gui16vc1VlcTableSize);
psb_buffer_unmap(&ctx->vlc_packed_table);
psb__VC1_pack_index_table_info(ctx->vlc_packed_index_table, gaui16vc1VlcIndexData);
} else {
@@ -1285,7 +1287,7 @@ static VAStatus psb__VC1_add_slice_param(context_VC1_p ctx, object_buffer_p obj_
{
ASSERT(obj_buffer->type == VASliceParameterBufferType);
if (ctx->slice_param_list_idx >= ctx->slice_param_list_size) {
- void *new_list;
+ unsigned char *new_list;
ctx->slice_param_list_size += 8;
new_list = realloc(ctx->slice_param_list,
sizeof(object_buffer_p) * ctx->slice_param_list_size);
@@ -1809,7 +1811,7 @@ static void psb__VC1_setup_alternative_frame(context_VC1_p ctx)
psb_surface_p rotate_surface = ctx->obj_context->current_render_target->psb_surface_rotate;
object_context_p obj_context = ctx->obj_context;
- if (rotate_surface->extra_info[5] != obj_context->rotate)
+ if (GET_SURFACE_INFO_rotate(rotate_surface) != obj_context->msvdx_rotate)
psb__error_message("Display rotate mode does not match surface rotate mode!\n");
@@ -1827,7 +1829,7 @@ static void psb__VC1_setup_alternative_frame(context_VC1_p ctx)
REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ALT_PICTURE_ENABLE, 1);
REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ROTATION_ROW_STRIDE, rotate_surface->stride_mode);
REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , RECON_WRITE_DISABLE, 0); /* FIXME Always generate Rec */
- REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ROTATION_MODE, rotate_surface->extra_info[5]);
+ REGIO_WRITE_FIELD_LITE(cmd, MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION , ROTATION_MODE, GET_SURFACE_INFO_rotate(rotate_surface));
psb_cmdbuf_rendec_write(cmdbuf, cmd);
@@ -1950,7 +1952,7 @@ static void psb__VC1_send_rendec_params(context_VC1_p ctx, VASliceParameterBuffe
psb_cmdbuf_rendec_start_block(cmdbuf);
- if (ctx->obj_context->rotate != VA_ROTATION_NONE) /* FIXME field coded should not issue */
+ if (CONTEXT_ROTATE(ctx->obj_context)) /* FIXME field coded should not issue */
psb__VC1_setup_alternative_frame(ctx);
/* CHUNK: 1 - VC1SEQUENCE00 */
@@ -2595,7 +2597,7 @@ static VAStatus psb__VC1_process_slice_data(context_VC1_p ctx, object_buffer_p o
VAStatus vaStatus = VA_STATUS_SUCCESS;
VASliceParameterBufferVC1 *slice_param;
int buffer_idx = 0;
- int element_idx = 0;
+ unsigned int element_idx = 0;
ASSERT((obj_buffer->type == VASliceDataBufferType) || (obj_buffer->type == VAProtectedSliceDataBufferType));
diff --git a/src/psb_VC1.h b/src/psb_VC1.h
index 070ba2c..843011b 100644
--- a/src/psb_VC1.h
+++ b/src/psb_VC1.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/psb_buffer.c b/src/psb_buffer.c
index 4230215..d32f177 100644
--- a/src/psb_buffer.c
+++ b/src/psb_buffer.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -97,11 +97,11 @@ VAStatus psb_buffer_create(psb_driver_data_p driver_data,
break;
case psb_bt_camera:
allignment = 1;
- placement = DRM_PSB_FLAG_MEM_CI | WSBM_PL_FLAG_SHARED;
+ placement = TTM_PL_FLAG_CI | WSBM_PL_FLAG_SHARED;
break;
case psb_bt_rar:
allignment = 1;
- placement = DRM_PSB_FLAG_MEM_RAR | WSBM_PL_FLAG_SHARED;
+ placement = TTM_PL_FLAG_RAR | WSBM_PL_FLAG_SHARED;
break;
default:
vaStatus = VA_STATUS_ERROR_UNKNOWN;
@@ -215,7 +215,45 @@ VAStatus psb_buffer_reference(psb_driver_data_p driver_data,
return VA_STATUS_SUCCESS;
}
+VAStatus psb_kbuffer_reference(psb_driver_data_p driver_data,
+ psb_buffer_p buf,
+ int kbuf_handle
+ )
+{
+ int ret = 0;
+ VAStatus vaStatus = VA_STATUS_SUCCESS;
+
+ buf->drm_buf = NULL;
+
+ ret = LOCK_HARDWARE(driver_data);
+ if (ret) {
+ UNLOCK_HARDWARE(driver_data);
+ vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
+ DEBUG_FAILURE_RET;
+ return vaStatus;
+ }
+
+ ret = wsbmGenBuffers(driver_data->main_pool,
+ 1,
+ &buf->drm_buf,
+ 4096, /* page alignment */
+ 0);
+ if (!buf->drm_buf) {
+ psb__error_message("failed to gen wsbm buffers\n");
+ UNLOCK_HARDWARE(driver_data);
+ return VA_STATUS_ERROR_ALLOCATION_FAILED;
+ }
+
+ ret = wsbmBOSetReferenced(buf->drm_buf, kbuf_handle);
+ UNLOCK_HARDWARE(driver_data);
+ if (ret) {
+ psb__error_message("failed to alloc wsbm buffers\n");
+ return VA_STATUS_ERROR_ALLOCATION_FAILED;
+ }
+ buf->pl_flags = wsbmBOPlacementHint(buf->drm_buf);
+ return VA_STATUS_SUCCESS;
+}
/*
* Destroy buffer
*/
@@ -228,7 +266,7 @@ void psb_buffer_destroy(psb_buffer_p buf)
ASSERT(buf->driver_data);
wsbmBOUnreference(&buf->drm_buf);
if (buf->rar_handle)
- psb_buffer_destroy_rar(buf->driver_data, buf);
+ buf->rar_handle = 0;
buf->driver_data = NULL;
buf->status = psb_bs_unfinished;
}
@@ -239,7 +277,7 @@ void psb_buffer_destroy(psb_buffer_p buf)
*
* Returns 0 on success
*/
-int psb_buffer_map(psb_buffer_p buf, void **address /* out */)
+int psb_buffer_map(psb_buffer_p buf, unsigned char **address /* out */)
{
int ret;
@@ -318,7 +356,7 @@ int psb_codedbuf_map_mangle(
object_context_p obj_context = obj_buffer->context;
INIT_DRIVER_DATA;
VACodedBufferSegment *p = &obj_buffer->codedbuf_mapinfo[0];
- void *raw_codedbuf;
+ unsigned char *raw_codedbuf;
VAStatus vaStatus = VA_STATUS_SUCCESS;
unsigned int next_buf_off;
int i;
@@ -349,7 +387,7 @@ int psb_codedbuf_map_mangle(
p->status = *((unsigned long *) raw_codedbuf + 1); /* 2nd DW
* is rc status */
p->reserved = 0;
- p->buf = (void *)((unsigned long *) raw_codedbuf + 4); /* skip 4DWs */
+ p->buf = (unsigned char *)((unsigned long *) raw_codedbuf + 4); /* skip 4DWs */
lnc_H264_append_aux_info(obj_context,
obj_buffer,
(unsigned char *)p->buf,
@@ -378,7 +416,7 @@ int psb_codedbuf_map_mangle(
case VAProfileMPEG4Main:
/* one segment */
p->size = *((unsigned long *) raw_codedbuf);
- p->buf = (void *)((unsigned long *) raw_codedbuf + 4); /* skip 4DWs */
+ p->buf = (unsigned char *)((unsigned long *) raw_codedbuf + 4); /* skip 4DWs */
psb__information_message("coded buffer size %d\n", p->size);
break;
@@ -388,7 +426,7 @@ int psb_codedbuf_map_mangle(
case VAProfileH264ConstrainedBaseline:
/* 1st segment */
p->size = *((unsigned long *) raw_codedbuf);
- p->buf = (void *)((unsigned long *) raw_codedbuf + 4); /* skip 4DWs */
+ p->buf = (unsigned char *)((unsigned long *) raw_codedbuf + 4); /* skip 4DWs */
psb__information_message("1st segment coded buffer size %d\n", p->size);
if (pnw_get_parallel_core_number(obj_context) == 2) {
@@ -401,7 +439,7 @@ int psb_codedbuf_map_mangle(
p[1].buf = p->buf;
p[1].next = NULL;
p->size = *(unsigned long *)((unsigned long)raw_codedbuf + next_buf_off);
- p->buf = (void *)(((unsigned long *)((unsigned long)raw_codedbuf + next_buf_off)) + 4); /* skip 4DWs */
+ p->buf = (unsigned char *)(((unsigned long *)((unsigned long)raw_codedbuf + next_buf_off)) + 4); /* skip 4DWs */
psb__information_message("2nd segment coded buffer offset: 0x%08x, size: %d\n",
next_buf_off, p->size);
} else
@@ -411,7 +449,7 @@ int psb_codedbuf_map_mangle(
case VAProfileH263Baseline:
/* one segment */
p->size = *((unsigned long *) raw_codedbuf);
- p->buf = (void *)((unsigned long *) raw_codedbuf + 4); /* skip 4DWs */
+ p->buf = (unsigned char *)((unsigned long *) raw_codedbuf + 4); /* skip 4DWs */
psb__information_message("coded buffer size %d\n", p->size);
break;
@@ -423,7 +461,7 @@ int psb_codedbuf_map_mangle(
/*Max resolution 4096x4096 use 6 segments*/
for (i = 0; i < PNW_JPEG_MAX_SCAN_NUM + 1; i++) {
p->size = *(unsigned long *)((unsigned long)raw_codedbuf + next_buf_off);
- p->buf = (void *)((unsigned long *)((unsigned long)raw_codedbuf + next_buf_off) + 4); /* skip 4DWs */
+ p->buf = (unsigned char *)((unsigned long *)((unsigned long)raw_codedbuf + next_buf_off) + 4); /* skip 4DWs */
next_buf_off = *((unsigned long *)((unsigned long)raw_codedbuf + next_buf_off) + 3);
psb__information_message("JPEG coded buffer segment %d size: %d\n", i, p->size);
diff --git a/src/psb_buffer.h b/src/psb_buffer.h
index c8d4f8e..366d153 100644
--- a/src/psb_buffer.h
+++ b/src/psb_buffer.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -32,8 +32,6 @@
#include "psb_drv_video.h"
-#include <RAR/rar.h>
-
//#include "xf86mm.h"
/* For TopazSC, it indicates the next frame should be skipped */
@@ -72,7 +70,7 @@ struct psb_buffer_s {
uint32_t rar_handle;
unsigned int buffer_ofs; /* several buffers may share one BO (camera/RAR), and use offset to distinguish it */
struct psb_buffer_s *next;
- void *user_ptr; /* user pointer for user buffers */
+ unsigned char *user_ptr; /* user pointer for user buffers */
psb_driver_data_p driver_data; /* for RAR buffer release */
};
@@ -98,6 +96,13 @@ VAStatus psb_buffer_reference(psb_driver_data_p driver_data,
psb_buffer_p buf,
psb_buffer_p reference_buf
);
+/*
+ *
+ */
+VAStatus psb_kbuffer_reference(psb_driver_data_p driver_data,
+ psb_buffer_p buf,
+ int kbuf_handle
+ );
/*
* Suspend buffer
@@ -114,7 +119,7 @@ void psb_buffer_destroy(psb_buffer_p buf);
*
* Returns 0 on success
*/
-int psb_buffer_map(psb_buffer_p buf, void **address /* out */);
+int psb_buffer_map(psb_buffer_p buf, unsigned char **address /* out */);
int psb_buffer_sync(psb_buffer_p buf);
@@ -142,28 +147,6 @@ VAStatus psb_buffer_create_camera(psb_driver_data_p driver_data,
);
/*
- * Create RAR buffer
- */
-VAStatus psb_buffer_create_rar(psb_driver_data_p driver_data,
- unsigned int size,
- psb_buffer_p buf
- );
-
-/*
- * Destroy RAR buffer
- */
-VAStatus psb_buffer_destroy_rar(psb_driver_data_p driver_data,
- psb_buffer_p buf
- );
-
-/*
- * Reference one RAR buffer from handle
- */
-VAStatus psb_buffer_reference_rar(psb_driver_data_p driver_data,
- uint32_t rar_handle,
- psb_buffer_p buf
- );
-/*
* Create one buffer from user buffer
* id_or_ofs is CI frame ID (actually now is frame offset), or V4L2 buffer offset
* user_ptr :virtual address of user buffer start.
@@ -173,12 +156,10 @@ VAStatus psb_buffer_create_camera_from_ub(psb_driver_data_p driver_data,
int id_or_ofs,
int size,
const unsigned long * user_ptr);
-#ifdef ANDROID
-#define DRM_PSB_FLAG_MEM_CI (1<<9)
-#define DRM_PSB_FLAG_MEM_RAR (1<<10)
-#else
-#define DRM_PSB_FLAG_MEM_CI (1 << 3) /* TTM_PL_FLAG_PRIV0 */
-#define DRM_PSB_FLAG_MEM_RAR (1 << 5) /* TTM_PL_FLAG_PRIV2 */
-#endif
+
+VAStatus psb_buffer_reference_imr(psb_driver_data_p driver_data,
+ uint32_t imr_offset,
+ psb_buffer_p buf
+ );
#endif /* _PSB_BUFFER_H_ */
diff --git a/src/psb_buffer_dm.c b/src/psb_buffer_dm.c
index ec06dda..a433fe1 100644
--- a/src/psb_buffer_dm.c
+++ b/src/psb_buffer_dm.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.
@@ -33,7 +33,6 @@
#include <stdlib.h>
#include <unistd.h>
#include <wsbm/wsbm_manager.h>
-/* #include <linux/rar_register.h> */
#include "psb_drm.h"
#include "psb_def.h"
@@ -180,7 +179,7 @@ VAStatus psb_buffer_create_camera_from_ub(psb_driver_data_p driver_data,
buf->rar_handle = 0;
buf->buffer_ofs = 0;
buf->type = psb_bt_user_buffer;
- buf->user_ptr = (void *)user_ptr;
+ buf->user_ptr = (unsigned char *)user_ptr;
buf->driver_data = driver_data;
allignment = 4096;
@@ -202,7 +201,7 @@ VAStatus psb_buffer_create_camera_from_ub(psb_driver_data_p driver_data,
#ifndef ANDROID
extern int wsbmBODataUB(struct _WsbmBufferObject * buf,
- unsigned size, const void * data,
+ unsigned size, const unsigned char * data,
struct _WsbmBufferPool * newPool, uint32_t placement, const unsigned long * user_ptr);
/* here use the placement when gen buffer setted */
@@ -224,7 +223,6 @@ VAStatus psb_buffer_create_camera_from_ub(psb_driver_data_p driver_data,
return VA_STATUS_SUCCESS;
}
-
static int psb_buffer_info_rar(psb_driver_data_p driver_data)
{
struct drm_lnc_video_getparam_arg arg;
@@ -240,6 +238,7 @@ static int psb_buffer_info_rar(psb_driver_data_p driver_data)
if (ret == 0) {
driver_data->rar_phyaddr = rar_info[0];
driver_data->rar_size = rar_info[1];
+ driver_data->rar_size = driver_data->rar_size & 0xfffff000; /* page align */
psb__information_message("RAR region physical address = 0x%08x, size=%dK\n",
driver_data->rar_phyaddr, driver_data->rar_size / 1024);
@@ -251,62 +250,20 @@ static int psb_buffer_info_rar(psb_driver_data_p driver_data)
}
-static int psb_buffer_offset_rar(psb_driver_data_p driver_data,
- psb_buffer_p buf,
- uint32_t rar_handle,
- unsigned int *bo_offset
- )
+static VAStatus psb_buffer_init_imr(psb_driver_data_p driver_data)
{
- struct drm_lnc_video_getparam_arg arg;
- unsigned long offset;
int ret = 0;
- *bo_offset = 0;
-
- arg.key = LNC_VIDEO_GETPARAM_RAR_HANDLER_OFFSET;
- arg.arg = (uint64_t)((unsigned long) & rar_handle);
- arg.value = (uint64_t)((unsigned long) & offset);
- ret = drmCommandWriteRead(driver_data->drm_fd, driver_data->getParamIoctlOffset,
- &arg, sizeof(arg));
- if (ret == 0) {
- *bo_offset = offset;
-
- return ret;
- }
-
- psb__information_message("RAR buffer 0x%08x, get offset failed\n", rar_handle);
- return ret;
-}
-
-
-static VAStatus psb_buffer_init_rar(psb_driver_data_p driver_data)
-{
- int ret = 0;
- RAR_desc_t *rar_rd;
-
- /* hasn't grab RAR device memory region
- * grab the whole 8M RAR device memory
+ /* hasn't grab IMR device memory region
+ * grab the whole IMR3 device memory
*/
driver_data->rar_bo = calloc(1, sizeof(struct psb_buffer_s));
if (driver_data->rar_bo == NULL)
goto exit_error;
- driver_data->rar_rd = calloc(1, sizeof(RAR_desc_t));
- if (driver_data->rar_rd == NULL)
- goto exit_error;
-
- memset(driver_data->rar_rd, 0, sizeof(RAR_desc_t));
-
- psb__information_message("Init RAR device\n");
-
- ret = RAR_init(driver_data->rar_rd);
- if (ret != 0) {
- psb__error_message("RAR device init failed\n");
- goto exit_error;
- }
-
+ psb__information_message("Init IMR device\n");
if (psb_buffer_info_rar(driver_data)) {
- psb__error_message("Get RAR region size failed\n");
+ psb__error_message("Get IMR region size failed\n");
goto exit_error;
}
@@ -314,169 +271,63 @@ static VAStatus psb_buffer_init_rar(psb_driver_data_p driver_data)
ret = psb_buffer_create(driver_data, driver_data->rar_size, psb_bt_rar, (psb_buffer_p) driver_data->rar_bo);
if (ret != VA_STATUS_SUCCESS) {
- psb__error_message("Grab RAR device memory failed\n");
+ psb__error_message("Grab IMR device memory failed\n");
goto exit_error;
}
return VA_STATUS_SUCCESS;
exit_error:
- rar_rd = driver_data->rar_rd;
-
- if (rar_rd) {
- if (rar_rd->mrfd)
- RAR_fini(driver_data->rar_rd);
- free(rar_rd);
- }
-
if (driver_data->rar_bo)
free(driver_data->rar_bo);
driver_data->rar_bo = NULL;
- driver_data->rar_rd = NULL;
return VA_STATUS_ERROR_ALLOCATION_FAILED;
}
-
/*
- * Create RAR buffer
- * Only used when create a protected surface
+ * Reference one IMR buffer from offset
+ * only used to reference a slice IMR buffer which is created outside of video driver
*/
-VAStatus psb_buffer_create_rar(psb_driver_data_p driver_data,
- unsigned int size,
- psb_buffer_p buf
- )
-{
- VAStatus vaStatus;
- uint32_t rar_handle = 0;
- unsigned int rar_offset = 0;
- RAR_desc_t *rar_rd;
- int ret;
-
- if (driver_data->rar_rd == NULL) {
- vaStatus = psb_buffer_init_rar(driver_data);
- if (vaStatus != VA_STATUS_SUCCESS) {
- psb__error_message("RAR init failed!\n");
- return vaStatus;
- }
- }
-
- rar_rd = driver_data->rar_rd;
-
- /* Call RAR interface to allocate RAR buffers */
- ret = RAR_reserve(rar_rd, size, RAR_TYPE_VIDEO, &rar_handle);
- if (ret != 0) {
- psb__error_message("RAR reserver memory failed\n");
- RAR_fini(rar_rd);
-
- return VA_STATUS_ERROR_UNKNOWN;
- }
-
- ret = psb_buffer_offset_rar(driver_data, buf, rar_handle, &rar_offset);
- if (ret != 0) {
- psb__error_message("Get buffer offset of RAR device memory failed!\n");
- return ret;
- }
-
- /* reference the global RAR BO */
- ret = psb_buffer_reference(driver_data, buf, (psb_buffer_p) driver_data->rar_bo);
- if (ret != VA_STATUS_SUCCESS) {
- psb__error_message("Reference RAR device memory failed\n");
- return ret;
- }
-
- buf->rar_handle = rar_handle;
- buf->buffer_ofs = rar_offset;
-
- /* reference the global RAR buffer, reset buffer type */
- buf->type = psb_bt_rar_surface; /* need RAR_release */
-
- psb__information_message("Create RAR buffer, handle 0x%08x, RAR region offset =0x%08x, RAR BO GPU offset hint=0x%08x\n",
- rar_handle, rar_offset, wsbmBOOffsetHint(buf->drm_buf));
-
- return VA_STATUS_SUCCESS;
-}
-
-
-/*
- * Destroy RAR buffer
- */
-VAStatus psb_buffer_destroy_rar(psb_driver_data_p driver_data,
- psb_buffer_p buf
- )
-{
- RAR_desc_t *rar_rd;
- int ret;
-
- ASSERT(driver_data->rar_rd);
-
- if (buf->type == psb_bt_rar_slice) {
- psb__information_message("return RAR slice buffer to application\n");
- buf->rar_handle = 0;
- return VA_STATUS_SUCCESS;
- }
-
-
- rar_rd = driver_data->rar_rd;
-
- ret = RAR_release(rar_rd, buf->rar_handle);
- if (ret != 0)
- psb__error_message("RAR release memory failed\n");
-
- buf->rar_handle = 0;
-
- return VA_STATUS_SUCCESS;
-}
-
-/*
- * Reference one RAR buffer from handle
- * only used to reference a slice RAR buffer which is created outside of video driver
- */
-VAStatus psb_buffer_reference_rar(psb_driver_data_p driver_data,
- uint32_t rar_handle,
+VAStatus psb_buffer_reference_imr(psb_driver_data_p driver_data,
+ uint32_t imr_offset,
psb_buffer_p buf
)
{
VAStatus vaStatus;
- unsigned int rar_offset = 0;
int ret;
- if (driver_data->rar_rd == NULL) {
- vaStatus = psb_buffer_init_rar(driver_data);
+ if (driver_data->rar_bo == NULL) {
+ vaStatus = psb_buffer_init_imr(driver_data);
if (vaStatus != VA_STATUS_SUCCESS) {
- psb__error_message("RAR init failed!\n");
+ psb__error_message("IMR init failed!\n");
return vaStatus;
}
}
- /* don't need to assign the handle to buffer
+ /* don't need to assign the offset to buffer
* so that when destroy the buffer, we just
* need to unreference
*/
- /* buf->rar_handle = rar_handle; */
+ /* buf->imr_offset = imr_offset; */
- ret = psb_buffer_offset_rar(driver_data, buf, rar_handle, &rar_offset);
- if (ret != VA_STATUS_SUCCESS) {
- psb__error_message("Get surfae offset of RAR device memory failed!\n");
- return ret;
- }
-
- /* reference the global RAR BO */
+ /* reference the global IMR BO */
ret = psb_buffer_reference(driver_data, buf, (psb_buffer_p) driver_data->rar_bo);
if (ret != VA_STATUS_SUCCESS) {
- psb__error_message("Reference RAR device memory failed\n");
+ psb__error_message("Reference IMR device memory failed\n");
return ret;
}
- buf->rar_handle = rar_handle;
- buf->buffer_ofs = rar_offset;
- /* reference the global RAR buffer, reset buffer type */
- buf->type = psb_bt_rar_slice; /* don't need to RAR_release */
+ buf->rar_handle = imr_offset;
+ buf->buffer_ofs = imr_offset;
+
+ /* reference the global IMR buffer, reset buffer type */
+ buf->type = psb_bt_rar_slice; /* don't need to IMR_release */
- psb__information_message("Reference RAR buffer, handle 0x%08x, RAR region offset =0x%08x, RAR BO GPU offset hint=0x%08x\n",
- rar_handle, rar_offset, wsbmBOOffsetHint(buf->drm_buf));
+ psb__information_message("Reference IMR buffer, IMR region offset =0x%08x, IMR BO GPU offset hint=0x%08x\n",
+ imr_offset, wsbmBOOffsetHint(buf->drm_buf));
return VA_STATUS_SUCCESS;
}
diff --git a/src/psb_cmdbuf.c b/src/psb_cmdbuf.c
index a4eb6ba..2e3f2a2 100644
--- a/src/psb_cmdbuf.c
+++ b/src/psb_cmdbuf.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -342,12 +342,12 @@ void psb_cmdbuf_add_relocation(psb_cmdbuf_p cmdbuf,
/* Check that address is within buffer range */
if (dst_buffer) {
- ASSERT(((void *)(addr_in_cmdbuf)) >= cmdbuf->cmd_base);
- ASSERT(((void *)(addr_in_cmdbuf)) < LLDMA_END(cmdbuf));
+ ASSERT(((unsigned char *)(addr_in_cmdbuf)) >= cmdbuf->cmd_base);
+ ASSERT(((unsigned char *)(addr_in_cmdbuf)) < LLDMA_END(cmdbuf));
reloc->where = addr_in_cmdbuf - (uint32_t *) cmdbuf->cmd_base; /* Location in DWORDs */
} else {
- ASSERT(((void *)(addr_in_cmdbuf)) >= cmdbuf->MTX_msg);
- ASSERT(((void *)(addr_in_cmdbuf)) < MTXMSG_END(cmdbuf));
+ ASSERT(((unsigned char *)(addr_in_cmdbuf)) >= cmdbuf->MTX_msg);
+ ASSERT(((unsigned char *)(addr_in_cmdbuf)) < MTXMSG_END(cmdbuf));
reloc->where = addr_in_cmdbuf - (uint32_t *) cmdbuf->MTX_msg; /* Location in DWORDs */
}
@@ -376,7 +376,7 @@ void psb_cmdbuf_add_relocation(psb_cmdbuf_p cmdbuf,
reloc->dst_buffer = dst_buffer;
cmdbuf->reloc_idx++;
- ASSERT(((void *)(cmdbuf->reloc_idx)) < RELOC_END(cmdbuf));
+ ASSERT(((unsigned char *)(cmdbuf->reloc_idx)) < RELOC_END(cmdbuf));
}
/*
@@ -494,17 +494,10 @@ psbDRMCmdBuf(int fd, int ioctl_offset, psb_buffer_p *buffer_list, int buffer_cou
ca.reloc_offset = relocBufOffset;
ca.num_relocs = numRelocs;
- ca.damage = damage;
ca.fence_flags = fence_flags;
ca.engine = engine;
- ca.feedback_ops = 0;
- ca.feedback_handle = 0;
- ca.feedback_offset = 0;
- ca.feedback_breakpoints = 0;
- ca.feedback_size = 0;
-
-#if 1
+#if 0
psb__information_message("PSB submit: buffer_list = %08x\n", ca.buffer_list);
psb__information_message("PSB submit: clip_rects = %08x\n", ca.clip_rects);
psb__information_message("PSB submit: cmdbuf_handle = %08x\n", ca.cmdbuf_handle);
@@ -540,8 +533,6 @@ psbDRMCmdBuf(int fd, int ioctl_offset, psb_buffer_p *buffer_list, int buffer_cou
}
} while ((ret == EAGAIN) && (psbTimeDiff(&now, &then) < PSB_TIMEOUT_USEC));
- psb__information_message("command write return is %d\n", ret);
-
if (ret) {
psb__information_message("command write return is %d\n", ret);
goto out;
@@ -606,14 +597,14 @@ out:
#ifdef DEBUG_TRACE
#define DBH(fmt, arg...) psb__trace_message(fmt, ##arg)
-#define DB(fmt, arg1, arg...) psb__trace_message("[%08x] %08x = " fmt, ((void *) arg1) - cmd_start, *arg1, ##arg)
+#define DB(fmt, arg1, arg...) psb__trace_message("[%08x] %08x = " fmt, ((unsigned char *) arg1) - cmd_start, *arg1, ##arg)
/* See also MsvdxGpuSim() in msvdxgpu.c */
static void debug_dump_cmdbuf(uint32_t *cmd_idx, uint32_t cmd_size_in_bytes)
{
uint32_t cmd_size = cmd_size_in_bytes / sizeof(uint32_t);
uint32_t *cmd_end = cmd_idx + cmd_size;
- void *cmd_start = cmd_idx;
+ unsigned char *cmd_start = cmd_idx;
struct {
unsigned int start;
unsigned int end;
@@ -781,7 +772,7 @@ psb_fence_wait(psb_driver_data_p driver_data,
fence = wsbmFenceCreate(driver_data->fence_mgr, fence_rep->fence_class,
fence_rep->fence_type,
- (void *)fence_rep->handle,
+ (unsigned char *)fence_rep->handle,
0);
if (fence)
*status = wsbmFenceFinish(fence, fence_rep->fence_type, 0);
@@ -835,7 +826,7 @@ static void psb__hexdump2(unsigned char *p, int offset, int size)
psb__trace_message("\n");
}
-static void psb__hexdump(void *addr, int size)
+static void psb__hexdump(unsigned char *addr, int size)
{
unsigned char *p = (unsigned char *) addr;
@@ -879,8 +870,8 @@ void psb__debug_schedule_hexdump(const char *name, psb_buffer_p buf, uint32_t of
*/
static void psb_cmdbuf_close_segment(psb_cmdbuf_p cmdbuf)
{
- uint32_t bytes_used = ((void *) cmdbuf->cmd_idx - cmdbuf->cmd_start) % MTX_SEG_SIZE;
- void *segment_start = (void *) cmdbuf->cmd_idx - bytes_used;
+ uint32_t bytes_used = ((unsigned char *) cmdbuf->cmd_idx - cmdbuf->cmd_start) % MTX_SEG_SIZE;
+ unsigned char *segment_start = (unsigned char *) cmdbuf->cmd_idx - bytes_used;
uint32_t lldma_record_offset = psb_cmdbuf_lldma_create(cmdbuf,
&(cmdbuf->buf), (segment_start - cmdbuf->cmd_base) /* offset */,
bytes_used,
@@ -895,7 +886,7 @@ int psb_context_submit_deblock(object_context_p obj_context)
{
psb_cmdbuf_p cmdbuf = obj_context->cmdbuf;
uint32_t msg_size = FW_VA_DEBLOCK_SIZE;
- uint32_t *msg = cmdbuf->MTX_msg;
+ uint32_t *msg = (uint32_t *)cmdbuf->MTX_msg;
DEBLOCKPARAMS* pdbParams;
psb__information_message("Send two pass deblock cmd\n");
@@ -948,7 +939,7 @@ int psb_context_submit_hw_deblock(object_context_p obj_context,
else
item_size = FW_VA_RENDER_SIZE;
- uint32_t *msg = cmdbuf->MTX_msg + item_size * cmdbuf->cmd_count;
+ uint32_t *msg = (uint32_t *)(cmdbuf->MTX_msg + item_size * cmdbuf->cmd_count);
memset(msg, 0, sizeof(FW_VA_DEBLOCK_MSG));
deblock_msg = (FW_VA_DEBLOCK_MSG *)msg;
@@ -990,7 +981,7 @@ int psb_context_submit_oold(object_context_p obj_context,
{
psb_cmdbuf_p cmdbuf = obj_context->cmdbuf;
uint32_t msg_size = FW_VA_OOLD_SIZE;
- uint32_t *msg = cmdbuf->MTX_msg + cmdbuf->cmd_count * FW_VA_RENDER_SIZE;
+ uint32_t *msg = (uint32_t *)(cmdbuf->MTX_msg + cmdbuf->cmd_count * FW_VA_RENDER_SIZE);
FW_VA_OOLD_MSG *oold_msg;
if (NULL == src_buf || NULL == dst_buf || NULL == colocate_buffer) {
@@ -1033,15 +1024,15 @@ int psb_context_submit_host_be_opp(object_context_p obj_context, psb_buffer_p ds
psb_cmdbuf_p cmdbuf = obj_context->cmdbuf;
uint32_t msg_size = FW_VA_HOST_BE_OPP_SIZE;
- if ((NULL == cmdbuf) || ((0 == cmdbuf->cmd_count) && (0 == cmdbuf->host_be_opp_count) &&
- (0 == cmdbuf->deblock_count) || (0 == cmdbuf->frame_info_count))) {
+ if ((NULL == cmdbuf) || (((0 == cmdbuf->cmd_count) && (0 == cmdbuf->host_be_opp_count) &&
+ (0 == cmdbuf->deblock_count)) || (0 == cmdbuf->frame_info_count))) {
psb_context_get_next_cmdbuf(obj_context);
cmdbuf = obj_context->cmdbuf;
}
- uint32_t *msg = cmdbuf->MTX_msg + cmdbuf->cmd_count * FW_VA_RENDER_SIZE +
- cmdbuf->oold_count * FW_VA_OOLD_SIZE + cmdbuf->frame_info_count * FW_VA_FRAME_INFO_SIZE;
+ uint32_t *msg = (uint32_t *)(cmdbuf->MTX_msg + cmdbuf->cmd_count * FW_VA_RENDER_SIZE +
+ cmdbuf->oold_count * FW_VA_OOLD_SIZE + cmdbuf->frame_info_count * FW_VA_FRAME_INFO_SIZE);
- psb__information_message("Send host be opp cmd\n");
+ /* psb__information_message("Send host be opp cmd\n"); */
cmdbuf->host_be_opp_count++;
memset(msg, 0, msg_size);
@@ -1064,9 +1055,9 @@ int psb_context_submit_frame_info(object_context_p obj_context, psb_buffer_p dst
psb_cmdbuf_p cmdbuf = obj_context->cmdbuf;
uint32_t msg_size = FW_VA_FRAME_INFO_SIZE;
- uint32_t *msg = cmdbuf->MTX_msg;
+ uint32_t *msg = (uint32_t *)cmdbuf->MTX_msg;
- psb__information_message("Send frame info cmd\n");
+ /* psb__information_message("Send frame info cmd\n"); */
cmdbuf->frame_info_count++;
memset(msg, 0, msg_size);
@@ -1100,7 +1091,7 @@ int psb_context_submit_cmdbuf(object_context_p obj_context)
else
item_size = FW_VA_RENDER_SIZE;
- uint32_t cmdbuffer_size = (void *) cmdbuf->cmd_idx - cmdbuf->cmd_start; // In bytes
+ uint32_t cmdbuffer_size = (unsigned char *) cmdbuf->cmd_idx - cmdbuf->cmd_start; // In bytes
if (cmdbuf->last_next_segment_cmd) {
cmdbuffer_size = cmdbuf->first_segment_size;
@@ -1108,11 +1099,11 @@ int psb_context_submit_cmdbuf(object_context_p obj_context)
}
uint32_t msg_size = item_size;
- uint32_t *msg = cmdbuf->MTX_msg + cmdbuf->cmd_count * msg_size + cmdbuf->frame_info_count * FW_VA_FRAME_INFO_SIZE;
+ uint32_t *msg = (uint32_t *)(cmdbuf->MTX_msg + cmdbuf->cmd_count * msg_size + cmdbuf->frame_info_count * FW_VA_FRAME_INFO_SIZE);
#ifdef DEBUG_TRACE
debug_cmd_start[cmdbuf->cmd_count] = cmdbuf->cmd_start - cmdbuf->cmd_base;
- debug_cmd_size[cmdbuf->cmd_count] = (void *) cmdbuf->cmd_idx - cmdbuf->cmd_start;
+ debug_cmd_size[cmdbuf->cmd_count] = (unsigned char *) cmdbuf->cmd_idx - cmdbuf->cmd_start;
debug_cmd_count = cmdbuf->cmd_count + 1;
#endif
@@ -1135,7 +1126,7 @@ int psb_context_submit_cmdbuf(object_context_p obj_context)
*cmdbuf->cmd_idx = 0; // Add a trailing 0 just in case.
ASSERT(cmdbuffer_size < CMD_SIZE);
- ASSERT((void *) cmdbuf->cmd_idx < CMD_END(cmdbuf));
+ ASSERT((unsigned char *) cmdbuf->cmd_idx < CMD_END(cmdbuf));
MEMIO_WRITE_FIELD(msg, FWRK_GENMSG_SIZE, msg_size);
MEMIO_WRITE_FIELD(msg, FWRK_GENMSG_ID, VA_MSGID_RENDER);
@@ -1187,16 +1178,16 @@ int psb_context_submit_cmdbuf(object_context_p obj_context)
((uint32_t *)cmdbuf->lldma_idx)[1] = 0;
#endif
- cmdbuf->cmd_start = cmdbuf->cmd_idx;
+ cmdbuf->cmd_start = (unsigned char *)cmdbuf->cmd_idx;
#ifdef DEBUG_TRACE
return psb_context_flush_cmdbuf(obj_context);
#else
if ((cmdbuf->cmd_count >= MAX_CMD_COUNT) ||
- (MTXMSG_END(cmdbuf) - (void *) msg < MTXMSG_MARGIN) ||
- (CMD_END(cmdbuf) - (void *) cmdbuf->cmd_idx < CMD_MARGIN) ||
+ (MTXMSG_END(cmdbuf) - (unsigned char *) msg < MTXMSG_MARGIN) ||
+ (CMD_END(cmdbuf) - (unsigned char *) cmdbuf->cmd_idx < CMD_MARGIN) ||
(LLDMA_END(cmdbuf) - cmdbuf->lldma_idx < LLDMA_MARGIN) ||
- (RELOC_END(cmdbuf) - (void *) cmdbuf->reloc_idx < RELOC_MARGIN)) {
+ (RELOC_END(cmdbuf) - (unsigned char *) cmdbuf->reloc_idx < RELOC_MARGIN)) {
return psb_context_flush_cmdbuf(obj_context);
}
#endif
@@ -1229,7 +1220,7 @@ int psb_context_flush_cmdbuf(object_context_p obj_context)
}
uint32_t msg_size = 0;
- uint32_t *msg = cmdbuf->MTX_msg;
+ uint32_t *msg = (uint32_t *)cmdbuf->MTX_msg;
int i;
/* LOCK */
@@ -1320,11 +1311,11 @@ int psb_context_flush_cmdbuf(object_context_p obj_context)
/* Now calculate the total number of relocations */
reloc_offset = cmdbuf->reloc_base - cmdbuf->MTX_msg;
- num_relocs = (((void *) cmdbuf->reloc_idx) - cmdbuf->reloc_base) / sizeof(struct drm_psb_reloc);
+ num_relocs = (((unsigned char *) cmdbuf->reloc_idx) - cmdbuf->reloc_base) / sizeof(struct drm_psb_reloc);
#ifdef DEBUG_TRACE
psb__information_message("Cmdbuf MTXMSG size = %08x [%08x]\n", msg_size, MTXMSG_SIZE);
- psb__information_message("Cmdbuf CMD size = %08x - %d[%08x]\n", (void *) cmdbuf->cmd_idx - cmdbuf->cmd_base, cmdbuf->cmd_count, CMD_SIZE);
+ psb__information_message("Cmdbuf CMD size = %08x - %d[%08x]\n", (unsigned char *) cmdbuf->cmd_idx - cmdbuf->cmd_base, cmdbuf->cmd_count, CMD_SIZE);
psb__information_message("Cmdbuf LLDMA size = %08x [%08x]\n", cmdbuf->lldma_idx - cmdbuf->lldma_base, LLDMA_SIZE);
psb__information_message("Cmdbuf RELOC size = %08x [%08x]\n", num_relocs * sizeof(struct drm_psb_reloc), RELOC_SIZE);
#endif
@@ -1414,7 +1405,7 @@ int psb_context_flush_cmdbuf(object_context_p obj_context)
psb__trace_message("debug_dump_count = %d\n", debug_dump_count);
for (i = 0; i < debug_dump_count; i++) {
- void *buf_addr;
+ unsigned char *buf_addr;
psb__trace_message("Buffer %d = '%s' offset = %08x size = %08x\n", i, debug_dump_name[i], debug_dump_offset[i], debug_dump_size[i]);
if (debug_dump_buf[i]->rar_handle
|| (psb_buffer_map(debug_dump_buf[i], &buf_addr) != 0)) {
@@ -1660,7 +1651,7 @@ uint32_t psb_cmdbuf_lldma_create(psb_cmdbuf_p cmdbuf,
uint32_t dest_offset,
LLDMA_TYPE cmd)
{
- uint32_t lldma_record_offset = (((void*)cmdbuf->lldma_idx) - ((void *) cmdbuf->cmd_base));
+ uint32_t lldma_record_offset = (((unsigned char *)cmdbuf->lldma_idx) - ((unsigned char *) cmdbuf->cmd_base));
psb_cmdbuf_lldma_create_internal(cmdbuf, 0, bitstream_buf, buffer_offset, size,
dest_offset, cmd);
return lldma_record_offset;
@@ -1805,7 +1796,7 @@ static void psb_cmdbuf_lldma_create_internal(psb_cmdbuf_p cmdbuf,
}
/* Keep pointer in case we need to chain another LLDMA command */
- cmdbuf->lldma_last = (void *) pasDmaList;
+ cmdbuf->lldma_last = (unsigned char *) pasDmaList;
DMA_LL_SET_WD0(pasDmaList, DMA_BSWAP_NO_SWAP,
(pDmaDetail->eDMADir == HOST_TO_MSVDX) ? DMA_DIR_MEM_TO_PERIPH : DMA_DIR_PERIPH_TO_MEM ,
@@ -1820,7 +1811,7 @@ static void psb_cmdbuf_lldma_create_internal(psb_cmdbuf_p cmdbuf,
}
/* there can be up to 3 Bytes of padding after header */
- cmdbuf->lldma_idx = (void *)pasDmaList;
+ cmdbuf->lldma_idx = (unsigned char *)pasDmaList;
}
@@ -1917,7 +1908,7 @@ void psb_cmdbuf_rendec_write_block(psb_cmdbuf_p cmdbuf,
uint32_t size)
{
ASSERT((size & 0x3) == 0);
- int i;
+ unsigned int i;
for (i = 0; i < size; i += 4) {
uint32_t val = block[i] | (block[i+1] << 8) | (block[i+2] << 16) | (block[i+3] << 24);
psb_cmdbuf_rendec_write(cmdbuf, val);
@@ -1989,7 +1980,7 @@ void psb_cmdbuf_rendec_end_block(psb_cmdbuf_p cmdbuf)
*/
uint32_t psb_cmdbuf_segment_space(psb_cmdbuf_p cmdbuf)
{
- uint32_t bytes_used = (void *) cmdbuf->cmd_idx - cmdbuf->cmd_start;
+ uint32_t bytes_used = (unsigned char *) cmdbuf->cmd_idx - cmdbuf->cmd_start;
return (MTX_SEG_SIZE - (bytes_used % MTX_SEG_SIZE)) / sizeof(uint32_t);
}
@@ -2005,7 +1996,7 @@ void psb_cmdbuf_next_segment(psb_cmdbuf_p cmdbuf)
if (cmdbuf->last_next_segment_cmd) {
psb_cmdbuf_close_segment(cmdbuf);
} else {
- cmdbuf->first_segment_size = (void *) cmdbuf->cmd_idx - cmdbuf->cmd_start;
+ cmdbuf->first_segment_size = (unsigned char *) cmdbuf->cmd_idx - cmdbuf->cmd_start;
}
cmdbuf->cmd_idx += words_free; /* move pui32CmdBuffer to start of next segment */
diff --git a/src/psb_cmdbuf.h b/src/psb_cmdbuf.h
index d7bc481..e404120 100644
--- a/src/psb_cmdbuf.h
+++ b/src/psb_cmdbuf.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -54,13 +54,13 @@ struct psb_cmdbuf_s {
struct psb_buffer_s regio_buf;
unsigned int regio_size;
- void * regio_base;
+ unsigned char * regio_base;
uint32_t *regio_idx;
/* MTX msg */
- void *MTX_msg;
+ unsigned char *MTX_msg;
/* Relocation records */
- void *reloc_base;
+ unsigned char *reloc_base;
struct drm_psb_reloc *reloc_idx;
/* CMD stream data */
@@ -69,14 +69,14 @@ struct psb_cmdbuf_s {
int oold_count;
int host_be_opp_count;
int frame_info_count;
- void *cmd_base;
- void *cmd_start;
+ unsigned char *cmd_base;
+ unsigned char *cmd_start;
uint32_t *cmd_idx;
uint32_t *cmd_bitstream_size; /* Pointer to bitstream size field in last SR_SETUP */
/* LLDMA records */
- void *lldma_base;
- void *lldma_idx;
- void *lldma_last; /* Pointer to last LLDMA record */
+ unsigned char *lldma_base;
+ unsigned char *lldma_idx;
+ unsigned char *lldma_last; /* Pointer to last LLDMA record */
/* Referenced buffers */
psb_buffer_p *buffer_refs;
@@ -338,7 +338,7 @@ void psb_cmdbuf_rendec_end(psb_cmdbuf_p cmdbuf);
*/
int psb_cmdbuf_second_pass(object_context_p obj_context,
uint32_t OperatingModeCmd,
- void * pvParamBase,
+ unsigned char * pvParamBase,
uint32_t PicWidthInMbs,
uint32_t FrameHeightInMbs,
psb_buffer_p target_buffer,
diff --git a/src/psb_deblock.c b/src/psb_deblock.c
index 5c7137d..e3c2db1 100644
--- a/src/psb_deblock.c
+++ b/src/psb_deblock.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -545,7 +545,7 @@ int h264_secondPass(
int psb_cmdbuf_second_pass(object_context_p obj_context,
uint32_t OperatingModeCmd,
- void * pvParamBase,
+ unsigned char * pvParamBase,
uint32_t PicWidthInMbs,
uint32_t FrameHeightInMbs,
psb_buffer_p target_buffer,
@@ -564,7 +564,7 @@ int psb_cmdbuf_second_pass(object_context_p obj_context,
item_loc = psb_cmdbuf_buffer_ref(cmdbuf, &cmdbuf->regio_buf);
- cmdbuf->regio_idx = cmdbuf->regio_base;
+ cmdbuf->regio_idx = (uint32_t *)cmdbuf->regio_base;
cmd_size = cmdbuf->regio_idx++;
h264_pollForSpaceForNCommands(4);
diff --git a/src/psb_def.h b/src/psb_def.h
index e1b3d97..4c9b131 100644
--- a/src/psb_def.h
+++ b/src/psb_def.h
@@ -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.
@@ -37,9 +37,7 @@
/* #define DEBUG_TRACE */
/* #define DEBUG_TRACE_VERBOSE */
-
#ifdef DEBUG_TRACE
-
#ifndef ASSERT
#define ASSERT assert
#endif
@@ -52,7 +50,6 @@
#undef ASSERT
#undef IMG_ASSERT
-
#define ASSERT(x)
#define IMG_ASSERT(x)
@@ -69,6 +66,12 @@
void psb__error_message(const char *msg, ...);
void psb__information_message(const char *msg, ...);
+#ifdef ANDROID
+#define psb__android_message(format, ...) \
+ LOGD(format, ##__VA_ARGS__)
+#else
+#define psb__android_message(format, ...)
+#endif
void psb__trace_message(const char *msg, ...);
diff --git a/src/psb_drv_video.c b/src/psb_drv_video.c
index 5ea21e2..e275201 100644..100755
--- a/src/psb_drv_video.c
+++ b/src/psb_drv_video.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -33,6 +33,7 @@
#include <va/va_dricommon.h>
#include "psb_drv_video.h"
+#include "psb_texture.h"
#include "psb_cmdbuf.h"
#include "lnc_cmdbuf.h"
#include "pnw_cmdbuf.h"
@@ -66,17 +67,19 @@
#include <wsbm/wsbm_fencemgr.h>
#include <linux/videodev2.h>
#include <sys/mman.h>
+#include <errno.h>
#include "psb_def.h"
#include "psb_ws_driver.h"
#include "ci_va.h"
+#include "pnw_rotate.h"
#ifndef PSB_PACKAGE_VERSION
#define PSB_PACKAGE_VERSION "Undefined"
#endif
#define PSB_DRV_VERSION PSB_PACKAGE_VERSION
-#define PSB_CHG_REVISION "(0X0000005E)"
+#define PSB_CHG_REVISION "(0X00000071)"
#define PSB_STR_VENDOR_MRST "Intel GMA500-MRST-" PSB_DRV_VERSION " " PSB_CHG_REVISION
#define PSB_STR_VENDOR_MFLD "Intel GMA500-MFLD-" PSB_DRV_VERSION " " PSB_CHG_REVISION
@@ -106,8 +109,18 @@
#define IMAGE_ID_OFFSET 0x05000000
#define SUBPIC_ID_OFFSET 0x06000000
+#define SET_SURFACE_INFO_rotate(psb_surface, rotate) psb_surface->extra_info[5] = (uint32_t) rotate;
+#define GET_SURFACE_INFO_rotate(psb_surface) ((int) psb_surface->extra_info[5])
+
static int psb_get_device_info(VADriverContextP ctx);
+
+void psb_init_surface_pvr2dbuf(psb_driver_data_p driver_data);
+void psb_free_surface_pvr2dbuf(psb_driver_data_p driver_data);
+
+static FILE *psb_video_debug_fp = NULL;
+static int debug_fp_count = 0;
+
/*
* read a config "env" for libva.conf or from environment setting
* liva.conf has higher priority
@@ -121,7 +134,7 @@ int psb_parse_config(char *env, char *env_value)
FILE *fp = NULL;
char *env_ptr;
- if (env_value == NULL)
+ if (env == NULL)
return 1;
fp = fopen("/etc/psbvideo.conf", "r");
@@ -157,30 +170,13 @@ int psb_parse_config(char *env, char *env_value)
return 1;
}
-static FILE *psb_video_debug_fp = NULL;
-
-static void psb__open_log(void)
-{
- char log_fn[1024];
-
- if (psb_parse_config("PSB_VIDEO_DEBUG", &log_fn[0]) == 0) {
- unsigned int suffix = 0xffff & ((unsigned int)time(NULL));
- if (strcmp(log_fn, "/dev/stdout") != 0)
- sprintf(log_fn + strlen(log_fn), ".%d", suffix);
- psb_video_debug_fp = fopen(log_fn, "w");
- }
-}
-
-static void psb__close_log(void)
-{
- if (psb_video_debug_fp != NULL)
- fclose(psb_video_debug_fp);
-}
-
void psb__error_message(const char *msg, ...)
{
va_list args;
FILE *fp;
+ char tag[128];
+
+ (void)tag;
if (psb_video_debug_fp == NULL) /* not set the debug */
fp = stderr;
@@ -191,6 +187,10 @@ void psb__error_message(const char *msg, ...)
GetTickCount(), getpid(), pthread_self());
va_start(args, msg);
vfprintf(fp, msg, args);
+#ifdef ANDROID
+ sprintf(tag, "pvr_drv_video[%d:0x%08lx]", getpid(), pthread_self());
+ __android_log_vprint(ANDROID_LOG_ERROR, tag, msg, args);
+#endif
va_end(args);
fflush(fp);
@@ -201,50 +201,66 @@ void psb__information_message(const char *msg, ...)
{
if (psb_video_debug_fp) {
va_list args;
+ char tag[128];
+
+ (void)tag;
fprintf(psb_video_debug_fp, "[0x%08lx]psb_drv_video(%d:0x%08lx) ",
GetTickCount(), getpid(), pthread_self());
va_start(args, msg);
vfprintf(psb_video_debug_fp, msg, args);
+#ifdef ANDROID
+ sprintf(tag, "pvr_drv_video[%d:0x%08lx]", getpid(), pthread_self());
+ __android_log_vprint(ANDROID_LOG_DEBUG, tag, msg, args);
+#endif
va_end(args);
fflush(psb_video_debug_fp);
fsync(fileno(psb_video_debug_fp));
}
}
-static int Angle2Rotation(int angle)
+
+static void psb__open_log(void)
{
- angle %= 360;
- switch (angle) {
- case 0:
- return VA_ROTATION_NONE;
- case 90:
- return VA_ROTATION_90;
- case 180:
- return VA_ROTATION_180;
- case 270:
- return VA_ROTATION_270;
- default:
- return -1;
+ char log_fn[1024];
+ unsigned int suffix;
+
+ if ((psb_video_debug_fp != NULL) && (psb_video_debug_fp != stderr)) {
+ debug_fp_count++;
+ return;
+ }
+
+ if (psb_parse_config("PSB_VIDEO_DEBUG", &log_fn[0]) != 0)
+ return;
+
+ suffix = 0xffff & ((unsigned int)time(NULL));
+ snprintf(log_fn + strnlen(log_fn, 1024),
+ (1024 - 8 - strnlen(log_fn, 1024)),
+ ".%d.%d", getpid(), suffix);
+ psb_video_debug_fp = fopen(log_fn, "w");
+ if (psb_video_debug_fp == 0) {
+ psb__error_message("Log file %s open failed, reason %s, fall back to stderr\n",
+ log_fn, strerror(errno));
+ psb_video_debug_fp = stderr;
+ } else {
+ psb__information_message("Log file %s open successfully\n", log_fn);
+ debug_fp_count++;
}
}
-static int Rotation2Angle(int rotation)
+static void psb__close_log(void)
{
- switch (rotation) {
- case VA_ROTATION_NONE:
- return 0;
- case VA_ROTATION_90:
- return 90;
- case VA_ROTATION_180:
- return 180;
- case VA_ROTATION_270:
- return 270;
- default:
- return -1;
+ if ((psb_video_debug_fp != NULL) & (psb_video_debug_fp != stderr)) {
+ debug_fp_count--;
+ if (debug_fp_count == 0)
+ fclose(psb_video_debug_fp);
}
+
+ return;
+
}
+
#ifdef DEBUG_TRACE
void psb__trace_message(const char *msg, ...)
{
@@ -258,9 +274,6 @@ void psb__trace_message(const char *msg, ...)
if (psb_parse_config("PSB_VIDEO_TRACE", &trace_fn[0]) == 0)
trace_file = trace_fn;
- if (getenv("PSB_VIDEO_TRACE"))
- trace_file = getenv("PSB_VIDEO_TRACE");
-
if (trace_file) {
trace = fopen(trace_file, "w");
if (trace) {
@@ -491,6 +504,36 @@ static VAStatus psb__validate_config(object_config_p obj_config)
return VA_STATUS_SUCCESS;
}
+static int psb_get_active_entrypoint_number(
+ VADriverContextP ctx,
+ unsigned int entrypoint)
+{
+ INIT_DRIVER_DATA;
+ struct drm_lnc_video_getparam_arg arg;
+ int count = 0;
+ int ret;
+
+ if (VAEntrypointVLD > entrypoint ||
+ entrypoint > VAEntrypointEncPicture) {
+ psb__error_message("%s :Invalid entrypoint %d.\n",
+ __FUNCTION__, entrypoint);
+ return -1;
+ }
+
+ arg.key = PNW_VIDEO_QUERY_ENTRY;
+ arg.value = (uint64_t)((unsigned long) &count);
+ arg.arg = (uint64_t)((unsigned int)&entrypoint);
+ ret = drmCommandWriteRead(driver_data->drm_fd, driver_data->getParamIoctlOffset,
+ &arg, sizeof(arg));
+ if (ret) {
+ psb__error_message("%s drmCommandWriteRead fails %d.\n",
+ __FUNCTION__, ret);
+ return -1;
+ }
+
+ return count;
+}
+
VAStatus psb_CreateConfig(
VADriverContextP ctx,
VAProfile profile,
@@ -523,10 +566,20 @@ VAStatus psb_CreateConfig(
}
}
+ if (NULL == config_id) {
+ vaStatus = VA_STATUS_ERROR_INVALID_PARAMETER;
+ return vaStatus;
+ }
+
if (num_attribs < 0) {
vaStatus = VA_STATUS_ERROR_INVALID_PARAMETER;
}
+ if (NULL == attrib_list) {
+ vaStatus = VA_STATUS_ERROR_INVALID_PARAMETER;
+ return vaStatus;
+ }
+
if (NULL == format_vtable) {
vaStatus = psb__error_unsupported_profile_entrypoint(driver_data, profile, entrypoint);
}
@@ -535,12 +588,25 @@ VAStatus psb_CreateConfig(
return vaStatus;
}
+ if ((IS_MFLD(driver_data)) &&
+ (VAEntrypointEncPicture == entrypoint)) {
+ /*Only allow one encoding entrypoint at the sametime.*/
+ if (psb_get_active_entrypoint_number(ctx, VAEntrypointEncSlice) > 0 ||
+ psb_get_active_entrypoint_number(ctx, VAEntrypointEncPicture)) {
+ psb__error_message("There already is a active encoding entrypoint %d.\n",
+ entrypoint);
+ return VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
+ }
+ }
+
configID = object_heap_allocate(&driver_data->config_heap);
obj_config = CONFIG(configID);
if (NULL == obj_config) {
vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
return vaStatus;
}
+
+
MEMSET_OBJECT(obj_config, struct object_config_s);
obj_config->profile = profile;
@@ -551,7 +617,7 @@ VAStatus psb_CreateConfig(
obj_config->attrib_count = 1;
for (i = 0; i < num_attribs; i++) {
- if (attrib_list[i].type < VAConfigAttribRTFormat || attrib_list[i].type > VAConfigAttribRateControl)
+ if (attrib_list[i].type > VAConfigAttribRateControl)
return VA_STATUS_ERROR_ATTR_NOT_SUPPORTED;
vaStatus = psb__update_attribute(obj_config, &(attrib_list[i]));
@@ -576,7 +642,9 @@ VAStatus psb_CreateConfig(
}
/* only VAProfileH264ConstrainedBaseline profile enable error concealment*/
- if ((getenv("PSB_VIDEO_NOEC") == NULL) && (profile == VAProfileH264ConstrainedBaseline)) {
+ if (IS_MRST(driver_data) &&
+ (getenv("PSB_VIDEO_NOEC") == NULL)
+ && (profile == VAProfileH264ConstrainedBaseline)) {
psb__information_message("profile is VAProfileH264ConstrainedBaseline, error concealment is enabled. \n");
driver_data->ec_enabled = 1;
} else {
@@ -704,8 +772,10 @@ VAStatus psb_CreateSurfaces(
INIT_DRIVER_DATA
VAStatus vaStatus = VA_STATUS_SUCCESS;
int i, height_origin, buffer_stride = 0;
+ int protected = (VA_RT_FORMAT_PROTECTED & format);
unsigned long fourcc;
+ format = format & (~VA_RT_FORMAT_PROTECTED);
if (num_surfaces <= 0) {
vaStatus = VA_STATUS_ERROR_INVALID_PARAMETER;
DEBUG_FAILURE;
@@ -780,9 +850,7 @@ VAStatus psb_CreateSurfaces(
}
vaStatus = psb_surface_create(driver_data, width, height, fourcc,
- (VA_RT_FORMAT_PROTECTED & format), psb_surface
- );
-
+ protected, psb_surface);
if (VA_STATUS_SUCCESS != vaStatus) {
free(psb_surface);
object_heap_free(&driver_data->surface_heap, (object_base_p) obj_surface);
@@ -797,48 +865,6 @@ VAStatus psb_CreateSurfaces(
psb_surface->extra_info[4] = fourcc;
obj_surface->psb_surface = psb_surface;
-
- /* Allocate alternative output surface */
- if (driver_data->rotate != VA_ROTATION_NONE) {
- psb__information_message("Try to allocate surface for alternative rotate output\n");
- psb_surface = (psb_surface_p) calloc(1, sizeof(struct psb_surface_s));
- if (NULL == psb_surface) {
- psb_surface_destroy(obj_surface->psb_surface);
- obj_surface->surface_id = VA_INVALID_SURFACE;
- /* object_heap_free( &driver_data->surface_heap, (object_base_p) obj_surface); */
-
- vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
-
- DEBUG_FAILURE;
- break;
- }
-
- if (driver_data->rotate == VA_ROTATION_180)
- vaStatus = psb_surface_create(driver_data, width, height, VA_FOURCC_NV12,
- (VA_RT_FORMAT_PROTECTED & format), psb_surface);
- else {
- vaStatus = psb_surface_create(driver_data, height_origin, ((width + 0x1f) & ~0x1f), VA_FOURCC_NV12,
- (VA_RT_FORMAT_PROTECTED & format), psb_surface
- );
- obj_surface->width_r = height_origin;
- obj_surface->height_r = ((width + 0x1f) & ~0x1f);
- }
- if (VA_STATUS_SUCCESS != vaStatus) {
- free(psb_surface);
- object_heap_free(&driver_data->surface_heap, (object_base_p) obj_surface);
- obj_surface->surface_id = VA_INVALID_SURFACE;
- psb_surface_destroy(obj_surface->psb_surface);
-
- DEBUG_FAILURE;
- break;
- }
- /* by default, surface fourcc is NV12 */
- memset(psb_surface->extra_info, 0, sizeof(psb_surface->extra_info));
- psb_surface->extra_info[4] = VA_FOURCC_NV12;
- psb_surface->extra_info[5] = driver_data->rotate;
-
- obj_surface->psb_surface_rotate = psb_surface;
- }
}
/* Error recovery */
@@ -849,9 +875,13 @@ VAStatus psb_CreateSurfaces(
psb__destroy_surface(driver_data, obj_surface);
surface_list[i] = VA_INVALID_SURFACE;
}
+ psb__error_message("CreateSurfaces failed\n");
+ return vaStatus;
}
- vaStatus = psb_register_video_bcd(ctx, width, height, buffer_stride, num_surfaces, surface_list);
+ if (fourcc == VA_FOURCC_NV12)
+ psb_add_video_bcd(ctx, width, height, buffer_stride,
+ num_surfaces, surface_list);
return vaStatus;
}
@@ -985,6 +1015,17 @@ VAStatus psb_DestroySurfaces(
}
if (NULL == surface_list) {
+ /* This is a workaround for bug 3419. If libva surfaces and context are pre-allocated,
+ * mix call the function with NULL & 0 parameters to notify video driver when decoder is destroyed.
+ */
+#ifdef ANDROID
+#include "android/psb_android_glue.h"
+ if (driver_data->ts_source_created) {
+ psb__information_message("In psb_release_video_bcd, call psb_android_texture_streaming_destroy to destroy texture streaming source.\n");
+ psb_android_texture_streaming_destroy();
+ driver_data->ts_source_created = 0;
+ }
+#endif
return VA_STATUS_ERROR_INVALID_SURFACE;
}
@@ -992,10 +1033,8 @@ VAStatus psb_DestroySurfaces(
if (VA_STATUS_SUCCESS != psb_release_video_bcd(ctx))
return VA_STATUS_ERROR_UNKNOWN;
- /* This is work around.
- Add sufficient delay for gfx to release surface pages,
- Avoid page leak message in TTM */
- usleep(1000*100);
+ /* Free PVR2D buffer wrapped from the surfaces */
+ psb_free_surface_pvr2dbuf(driver_data);
/* Make validation happy */
for (i = 0; i < num_surfaces; i++) {
@@ -1014,6 +1053,7 @@ VAStatus psb_DestroySurfaces(
if (driver_data->cur_displaying_surface == surface_list[i]) {
/* Surface is being displaying. Need to stop overlay here */
+ psb_coverlay_stop(ctx);
}
psb__destroy_surface(driver_data, obj_surface);
@@ -1116,8 +1156,6 @@ VAStatus psb_CreateContext(
obj_context->driver_data = driver_data;
obj_context->current_render_target = NULL;
obj_context->is_oold = driver_data->is_oold;
- obj_context->rotate = driver_data->rotate;
-
obj_context->context_id = contextID;
obj_context->config_id = config_id;
obj_context->picture_width = picture_width;
@@ -1161,8 +1199,6 @@ VAStatus psb_CreateContext(
for (i = 0; i < num_render_targets; i++) {
object_surface_p obj_surface = SURFACE(render_targets[i]);
psb_surface_p psb_surface;
- unsigned char *p;
- int ret;
if (NULL == obj_surface) {
vaStatus = VA_STATUS_ERROR_INVALID_SURFACE;
@@ -1268,7 +1304,7 @@ VAStatus psb_CreateContext(
obj_context->slice_count = 0;
obj_context->msvdx_context = ((driver_data->msvdx_context_base & 0xff0000) >> 16) |
((contextID & 0xff000000) >> 16);
-
+ obj_context->profile = obj_config->profile;
obj_context->entry_point = obj_config->entrypoint;
/* Error recovery */
@@ -1329,7 +1365,7 @@ static VAStatus psb__allocate_malloc_buffer(object_buffer_p obj_buffer, int size
static VAStatus psb__unmap_buffer(object_buffer_p obj_buffer);
-static VAStatus psb__allocate_BO_buffer(psb_driver_data_p driver_data, object_buffer_p obj_buffer, int size, void *data, VABufferType type)
+static VAStatus psb__allocate_BO_buffer(psb_driver_data_p driver_data, object_buffer_p obj_buffer, int size, unsigned char *data, VABufferType type)
{
VAStatus vaStatus = VA_STATUS_SUCCESS;
@@ -1354,7 +1390,7 @@ static VAStatus psb__allocate_BO_buffer(psb_driver_data_p driver_data, object_bu
}
}
- if (obj_buffer->alloc_size < size) {
+ if (obj_buffer->alloc_size < (unsigned int)size) {
psb__information_message("Buffer size mismatch: Need %d, currently have %d\n", size, obj_buffer->alloc_size);
if (obj_buffer->psb_buffer) {
if (obj_buffer->buffer_data) {
@@ -1378,9 +1414,10 @@ static VAStatus psb__allocate_BO_buffer(psb_driver_data_p driver_data, object_bu
* should be shared between two process
*/
vaStatus = psb_buffer_create(driver_data, size, psb_bt_cpu_vpu_shared, obj_buffer->psb_buffer);
- else if (obj_buffer->type == VAProtectedSliceDataBufferType)
- vaStatus = psb_buffer_reference_rar(driver_data, (uint32_t)data, obj_buffer->psb_buffer);
- else
+ else if (obj_buffer->type == VAProtectedSliceDataBufferType) {
+ if (IS_MFLD(driver_data))
+ vaStatus = psb_buffer_reference_imr(driver_data, (uint32_t)data, obj_buffer->psb_buffer);
+ } else
vaStatus = psb_buffer_create(driver_data, size, psb_bt_cpu_vpu, obj_buffer->psb_buffer);
if (VA_STATUS_SUCCESS != vaStatus) {
free(obj_buffer->psb_buffer);
@@ -1454,7 +1491,6 @@ void psb__suspend_buffer(psb_driver_data_p driver_data, object_buffer_p obj_buff
psb__information_message("Adding buffer %08x type %s to unused list. unused count = %d\n", obj_buffer->base.id,
buffer_type_to_string(obj_buffer->type), obj_context->buffers_unused_count[type]);
-
object_heap_suspend_object((object_base_p) obj_buffer, 1); /* suspend */
return;
}
@@ -1504,6 +1540,14 @@ static void psb__destroy_context(psb_driver_data_p driver_data, object_context_p
}
}
+ for (i = 0; i < LNC_MAX_CMDBUFS_ENCODE; i++) {
+ if (obj_context->pnw_cmdbuf_list[i]) {
+ pnw_cmdbuf_destroy(obj_context->pnw_cmdbuf_list[i]);
+ free(obj_context->pnw_cmdbuf_list[i]);
+ obj_context->pnw_cmdbuf_list[i] = NULL;
+ }
+ }
+
for (i = 0; i < PSB_MAX_CMDBUFS; i++) {
if (obj_context->cmdbuf_list[i]) {
psb_cmdbuf_destroy(obj_context->cmdbuf_list[i]);
@@ -1559,7 +1603,7 @@ VAStatus psb__CreateBuffer(
VABufferType type, /* in */
unsigned int size, /* in */
unsigned int num_elements, /* in */
- void *data, /* in */
+ unsigned char *data, /* in */
VABufferID *buf_desc /* out */
)
{
@@ -1586,10 +1630,13 @@ VAStatus psb__CreateBuffer(
psb__information_message("Requesting buffer creation, size=%d,elements=%d,type=%s\n", size, num_elements,
buffer_type_to_string(type));
+ /* on MFLD, data is IMR offset, and could be 0 */
+ /*
if ((type == VAProtectedSliceDataBufferType) && (data == NULL)) {
psb__error_message("RAR: Create protected slice buffer, but RAR handle is NULL\n");
return VA_STATUS_ERROR_UNSUPPORTED_BUFFERTYPE ;
}
+ */
if (obj_buffer && obj_buffer->psb_buffer) {
if (psb_bs_queued == obj_buffer->psb_buffer->status) {
@@ -1600,6 +1647,10 @@ VAStatus psb__CreateBuffer(
/* Buffer was used for this frame, allocate new buffer instead */
psb__information_message("Skipping idle buffer %08x, recently used. Unused = %d\n", obj_buffer->base.id, unused_count);
obj_buffer = NULL;
+ } else if (obj_context->frame_count - obj_buffer->last_used < 5) {
+ /* Buffer was used for previous frame, allocate new buffer instead */
+ psb__information_message("Skipping idle buffer %08x used by frame %d. Unused = %d\n", obj_buffer->base.id, obj_buffer->last_used, unused_count);
+ obj_buffer = NULL;
}
}
@@ -1769,7 +1820,6 @@ VAStatus psb_CreateBuffer(
VAStatus psb_BufferInfo(
VADriverContextP ctx,
- VAContextID context, /* in */
VABufferID buf_id, /* in */
VABufferType *type, /* out */
unsigned int *size, /* out */
@@ -1854,7 +1904,7 @@ VAStatus psb_MapBuffer(
*/
if (obj_buffer->type == VAEncCodedBufferType)
psb_codedbuf_map_mangle(ctx, obj_buffer, pbuf);
- /* *(IMG_UINT32 *)((void *)obj_buffer->buffer_data + 4) = 16; */
+ /* *(IMG_UINT32 *)((unsigned char *)obj_buffer->buffer_data + 4) = 16; */
} else {
vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
}
@@ -1900,50 +1950,6 @@ VAStatus psb_DestroyBuffer(
return vaStatus;
}
-static VAStatus psb__create_surface_rotation(VADriverContextP ctx, object_surface_p obj_surface, int protected)
-{
- INIT_DRIVER_DATA
- int width, height;
- psb_surface_p psb_surface = (psb_surface_p) calloc(1, sizeof(struct psb_surface_s));
- VAStatus vaStatus = VA_STATUS_SUCCESS;
-
- psb__information_message("Try to allocate surface for alternative rotate output\n");
-
- if (NULL == psb_surface) {
- vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
- DEBUG_FAILURE;
- return vaStatus;
- }
-
- width = obj_surface->width;
- height = obj_surface->height;
-
- if (driver_data->rotate == VA_ROTATION_180) {
- vaStatus = psb_surface_create(driver_data, width, height, VA_FOURCC_NV12,
- protected, psb_surface);
- obj_surface->width_r = width;
- obj_surface->height_r = height;
- } else {
- vaStatus = psb_surface_create(driver_data, obj_surface->height_origin, ((width + 0x1f) & ~0x1f), VA_FOURCC_NV12,
- protected, psb_surface
- );
- obj_surface->width_r = obj_surface->height_origin;
- obj_surface->height_r = ((width + 0x1f) & ~0x1f);
- }
- if (VA_STATUS_SUCCESS != vaStatus) {
- free(psb_surface);
- vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
- DEBUG_FAILURE;
- return vaStatus;
- }
- /* by default, surface fourcc is NV12 */
- memset(psb_surface->extra_info, 0, sizeof(psb_surface->extra_info));
- psb_surface->extra_info[4] = VA_FOURCC_NV12;
- psb_surface->extra_info[5] = driver_data->rotate;
-
- obj_surface->psb_surface_rotate = psb_surface;
- return vaStatus;
-}
VAStatus psb_BeginPicture(
VADriverContextP ctx,
@@ -1989,50 +1995,21 @@ VAStatus psb_BeginPicture(
vaStatus = obj_context->format_vtable->beginPicture(obj_context);
}
- if (driver_data->xrandr_dirty & PSB_NEW_ROTATION) {
- int angle;
- angle = Rotation2Angle(driver_data->video_rotate) + Rotation2Angle(driver_data->mipi0_rotation);
- driver_data->local_rotation = Angle2Rotation(angle);
- angle = Rotation2Angle(driver_data->video_rotate) + Rotation2Angle(driver_data->hdmi_rotation);
- driver_data->extend_rotation = Angle2Rotation(angle);
-#ifndef ANDROID
- if ((driver_data->mipi1_rotation != VA_ROTATION_NONE) ||
- ((driver_data->local_rotation != VA_ROTATION_NONE) &&
- (driver_data->extend_rotation != VA_ROTATION_NONE) &&
- (driver_data->local_rotation != driver_data->extend_rotation))) {
- driver_data->rotate = driver_data->video_rotate;
- /*fallback to texblit path*/
- driver_data->output_method = PSB_PUTSURFACE_CTEXTURE;
- } else {
- if (driver_data->output_method != PSB_PUTSURFACE_FORCE_CTEXTURE) {
- driver_data->output_method = PSB_PUTSURFACE_COVERLAY;
- driver_data->rotate = (driver_data->local_rotation == 0) ? driver_data->extend_rotation : driver_data->local_rotation;
- }
- }
-#endif
- if (driver_data->rotate == VA_ROTATION_270)
- driver_data->rotate = 3; /* Match with hw definition */
-
- driver_data->xrandr_dirty &= ~PSB_NEW_ROTATION;
- }
- /* Create surface for rotation if needed */
- if (driver_data->rotate == VA_ROTATION_NONE && obj_surface->psb_surface_rotate) {
- psb_surface_destroy(obj_surface->psb_surface_rotate);
- obj_surface->psb_surface_rotate = NULL;
- obj_surface->width_r = obj_surface->width;
- obj_surface->height_r = obj_surface->height;
- obj_context->rotate = driver_data->rotate;
- } else if (driver_data->rotate != VA_ROTATION_NONE &&
- (!obj_surface->psb_surface_rotate ? 1 : (obj_surface->psb_surface_rotate->extra_info[5] != driver_data->rotate))) {
- if (!obj_surface->psb_surface_rotate) {
- psb__create_surface_rotation(ctx, obj_surface, obj_surface->psb_surface->buf.type == psb_bt_rar_surface);
- } else {
- psb_surface_destroy(obj_surface->psb_surface_rotate);
- free(obj_surface->psb_surface_rotate);
- psb__create_surface_rotation(ctx, obj_surface, obj_surface->psb_surface->buf.type == psb_bt_rar_surface);
- }
- obj_context->rotate = driver_data->rotate;
- }
+ /* want msvdx to do rotate
+ * but check per-context stream type: interlace or not
+ */
+ if (obj_context->interlaced_stream || driver_data->disable_msvdx_rotate)
+ obj_context->msvdx_rotate = 0;
+ else
+ obj_context->msvdx_rotate = driver_data->msvdx_rotate_want;
+
+ /* the main surface track current rotate information
+ * try to reuse the allocated rotate surfaces and don't destroy them
+ * thus the rotation info in obj_surface->psb_surface_rotate may not be updated
+ */
+ SET_SURFACE_INFO_rotate(obj_surface->psb_surface, obj_context->msvdx_rotate);
+ if (IS_MFLD(driver_data) && CONTEXT_ROTATE(obj_context))
+ psb_CreateRotateSurface(ctx, obj_surface, obj_context->msvdx_rotate);
if (driver_data->is_oold && !obj_surface->psb_surface->in_loop_buf) {
psb_surface_p psb_surface = obj_surface->psb_surface;
@@ -2125,6 +2102,8 @@ VAStatus psb_RenderPicture(
return vaStatus;
}
buffer_list[i] = obj_buffer;
+ psb__information_message("Render buffer %08x type %s\n", obj_buffer->base.id,
+ buffer_type_to_string(obj_buffer->type));
}
}
@@ -2234,6 +2213,8 @@ VAStatus psb_SyncSurface(
object_surface_p obj_surface;
int decode = 0, encode = 0, rc_enable = 0;
+ psb__information_message("psb_SyncSurface: 0x%08x\n", render_target);
+
obj_surface = SURFACE(render_target);
if (NULL == obj_surface) {
vaStatus = VA_STATUS_ERROR_INVALID_SURFACE;
@@ -2389,7 +2370,7 @@ VAStatus psb_QuerySurfaceError(
arg.key = IMG_VIDEO_MB_ERROR;
arg.arg = (uint64_t)((unsigned long) & handle);
- arg.value = (uint64_t)decode_status;
+ arg.value = (uint64_t)((unsigned long)decode_status);
ret = drmCommandWriteRead(driver_data->drm_fd, driver_data->getParamIoctlOffset,
&arg, sizeof(arg));
@@ -2430,7 +2411,7 @@ VAStatus psb_LockSurface(
{
INIT_DRIVER_DATA
VAStatus vaStatus = VA_STATUS_SUCCESS;
- void *surface_data;
+ unsigned char *surface_data;
int ret;
object_surface_p obj_surface = SURFACE(surface);
@@ -2442,9 +2423,8 @@ VAStatus psb_LockSurface(
}
psb_surface = obj_surface->psb_surface;
- if (buffer_name) {
- /* todo */
- }
+ if (buffer_name)
+ *buffer_name = (uint32_t)(wsbmKBufHandle(wsbmKBuf(psb_surface->buf.drm_buf)));
if (buffer) { /* map the surface buffer */
uint32_t srf_buf_ofs = 0;
@@ -2510,7 +2490,7 @@ VAStatus psb_GetEGLClientBufferFromSurface(
}
psb_surface_p psb_surface = obj_surface->psb_surface;
- *buffer = (void *)psb_surface->bc_buffer;
+ *buffer = (unsigned char *)psb_surface->bc_buffer;
return vaStatus;
}
@@ -2640,8 +2620,8 @@ VAStatus psb_CreateSurfaceFromV4L2Buf(
VAStatus psb_CreateSurfacesForUserPtr(
VADriverContextP ctx,
- int width,
- int height,
+ int Width,
+ int Height,
int format,
int num_surfaces,
VASurfaceID *surface_list, /* out */
@@ -2660,6 +2640,10 @@ VAStatus psb_CreateSurfacesForUserPtr(
int i, height_origin;
unsigned long buffer_stride;
+ /* silient compiler warning */
+ unsigned int width = (unsigned int)Width;
+ unsigned int height = (unsigned int)Height;
+
psb__information_message("Create surface: width %d, height %d, format 0x%08x"
"\n\t\t\t\t\tnum_surface %d, buffer size %d, fourcc 0x%08x"
"\n\t\t\t\t\tluma_stride %d, chroma u stride %d, chroma v stride %d"
@@ -2689,6 +2673,13 @@ VAStatus psb_CreateSurfacesForUserPtr(
return vaStatus;
}
+ /* We only support NV12/YV12 */
+ if (((VA_RT_FORMAT_YUV420 == format) && (fourcc != VA_FOURCC_NV12)) ||
+ ((VA_RT_FORMAT_YUV422 == format) && (fourcc != VA_FOURCC_YV16))) {
+ psb__error_message("Only support NV12/YV16 format\n");
+ return VA_STATUS_ERROR_UNKNOWN;
+ }
+
vaStatus = psb__checkSurfaceDimensions(driver_data, width, height);
if (VA_STATUS_SUCCESS != vaStatus) {
DEBUG_FAILURE;
@@ -2795,6 +2786,180 @@ VAStatus psb_CreateSurfacesForUserPtr(
return vaStatus;
}
+VAStatus psb_CreateSurfaceFromKbuf(
+ VADriverContextP ctx,
+ int _width,
+ int _height,
+ int format,
+ VASurfaceID *surface, /* out */
+ unsigned int kbuf_handle, /* kernel buffer handle*/
+ unsigned size, /* kernel buffer size */
+ unsigned int kBuf_fourcc, /* expected fourcc */
+ 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, /* UV offset from the beginning of the memory */
+ unsigned int chroma_v_offset
+)
+{
+ INIT_DRIVER_DATA
+ VAStatus vaStatus = VA_STATUS_SUCCESS;
+ int i ;
+ unsigned long buffer_stride;
+
+ /* silient compiler warning */
+ unsigned int width = (unsigned int)_width;
+ unsigned int height = (unsigned int)_height;
+
+ psb__information_message("Create surface: width %d, height %d, format 0x%08x"
+ "\n\t\t\t\t\tnum_surface %d, buffer size %d, fourcc 0x%08x"
+ "\n\t\t\t\t\tluma_stride %d, chroma u stride %d, chroma v stride %d"
+ "\n\t\t\t\t\tluma_offset %d, chroma u offset %d, chroma v offset %d\n",
+ width, height, format,
+ size, kBuf_fourcc,
+ luma_stride, chroma_u_stride, chroma_v_stride,
+ luma_offset, chroma_u_offset, chroma_v_offset);
+
+ if (NULL == surface) {
+ vaStatus = VA_STATUS_ERROR_INVALID_SURFACE;
+ DEBUG_FAILURE;
+ return vaStatus;
+ }
+
+ /* We only support one format */
+ if ((VA_RT_FORMAT_YUV420 != format)
+ && (VA_RT_FORMAT_YUV422 != format)) {
+ vaStatus = VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT;
+ DEBUG_FAILURE;
+ return vaStatus;
+ }
+
+ /* We only support NV12/YV12 */
+
+ if (((VA_RT_FORMAT_YUV420 == format) && (kBuf_fourcc != VA_FOURCC_NV12)) ||
+ ((VA_RT_FORMAT_YUV422 == format) && (kBuf_fourcc != VA_FOURCC_YV16))) {
+ psb__error_message("Only support NV12/YV16 format\n");
+ return VA_STATUS_ERROR_UNKNOWN;
+ }
+
+ vaStatus = psb__checkSurfaceDimensions(driver_data, width, height);
+ if (VA_STATUS_SUCCESS != vaStatus) {
+ DEBUG_FAILURE;
+ return vaStatus;
+ }
+
+ if ((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)) {
+
+ vaStatus = VA_STATUS_ERROR_INVALID_PARAMETER;
+ DEBUG_FAILURE;
+ return vaStatus;
+ }
+
+ int surfaceID;
+ object_surface_p obj_surface;
+ psb_surface_p psb_surface;
+
+ surfaceID = object_heap_allocate(&driver_data->surface_heap);
+ obj_surface = SURFACE(surfaceID);
+ if (NULL == obj_surface) {
+ vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
+ DEBUG_FAILURE;
+ }
+ MEMSET_OBJECT(obj_surface, struct object_surface_s);
+
+ obj_surface->surface_id = surfaceID;
+ *surface = surfaceID;
+ obj_surface->context_id = -1;
+ obj_surface->width = width;
+ obj_surface->height = height;
+ obj_surface->width_r = width;
+ obj_surface->height_r = height;
+ obj_surface->height_origin = height;
+
+ psb_surface = (psb_surface_p) calloc(1, sizeof(struct psb_surface_s));
+ if (NULL == psb_surface) {
+ object_heap_free(&driver_data->surface_heap, (object_base_p) obj_surface);
+ obj_surface->surface_id = VA_INVALID_SURFACE;
+
+ vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
+
+ DEBUG_FAILURE;
+ }
+
+ vaStatus = psb_surface_create_from_kbuf(driver_data, width, height,
+ size,
+ kBuf_fourcc,
+ kbuf_handle,
+ luma_stride,
+ chroma_u_stride,
+ chroma_v_stride,
+ luma_offset,
+ chroma_u_offset,
+ chroma_v_offset,
+ psb_surface);
+
+ if (VA_STATUS_SUCCESS != vaStatus) {
+ free(psb_surface);
+ object_heap_free(&driver_data->surface_heap, (object_base_p) obj_surface);
+ obj_surface->surface_id = VA_INVALID_SURFACE;
+
+ DEBUG_FAILURE;
+ }
+ buffer_stride = psb_surface->stride;
+ /* by default, surface fourcc is NV12 */
+ memset(psb_surface->extra_info, 0, sizeof(psb_surface->extra_info));
+ psb_surface->extra_info[4] = kBuf_fourcc;
+ obj_surface->psb_surface = psb_surface;
+
+ /* Error recovery */
+ if (VA_STATUS_SUCCESS != vaStatus) {
+ object_surface_p obj_surface = SURFACE(surfaceID);
+ psb__destroy_surface(driver_data, obj_surface);
+ *surface = VA_INVALID_SURFACE;
+ }
+
+ return vaStatus;
+}
+
+
+VAStatus psb_PutSurfaceBuf(
+ VADriverContextP ctx,
+ VASurfaceID surface,
+ unsigned char* data,
+ int* data_len,
+ short srcx,
+ short srcy,
+ unsigned short srcw,
+ unsigned short srch,
+ short destx,
+ short desty,
+ unsigned short destw,
+ unsigned short desth,
+ VARectangle *cliprects, /* client supplied clip list */
+ unsigned int number_cliprects, /* number of clip rects in the clip list */
+ unsigned int flags /* de-interlacing flags */
+)
+{
+ INIT_DRIVER_DATA;
+ object_surface_p obj_surface = SURFACE(surface);
+ psb_surface_p psb_surface;
+
+ obj_surface = SURFACE(surface);
+ psb_surface = obj_surface->psb_surface;
+
+ psb_putsurface_textureblit(ctx, data, surface, srcx, srcy, srcw, srch, destx, desty, destw, desth, 1, /* check subpicture */
+ obj_surface->width, obj_surface->height,
+ psb_surface->stride, psb_surface->buf.drm_buf,
+ psb_surface->buf.pl_flags, 1 /* wrap dst */);
+
+ return VA_STATUS_SUCCESS;
+}
int LOCK_HARDWARE(psb_driver_data_p driver_data)
@@ -2831,6 +2996,7 @@ int UNLOCK_HARDWARE(psb_driver_data_p driver_data)
static void psb__deinitDRM(VADriverContextP ctx)
{
INIT_DRIVER_DATA
+ struct dri_state *dri_state = (struct dri_state *)ctx->dri_state;
if (driver_data->main_pool) {
driver_data->main_pool->takeDown(driver_data->main_pool);
@@ -2845,7 +3011,7 @@ static void psb__deinitDRM(VADriverContextP ctx)
wsbmTakedown();
close(driver_data->drm_fd);
- driver_data->drm_fd = -1;
+ driver_data->drm_fd = dri_state->fd = -1;
}
@@ -2997,6 +3163,9 @@ VAStatus psb_Terminate(VADriverContextP ctx)
object_heap_destroy(&driver_data->buffer_heap);
/* Clean up left over surfaces */
+
+ /* Free PVR2D buffer wrapped from the surfaces */
+ psb_free_surface_pvr2dbuf(driver_data);
obj_surface = (object_surface_p) object_heap_first(&driver_data->surface_heap, &iter);
while (obj_surface) {
psb__information_message("vaTerminate: surfaceID %08x still allocated, destroying\n", obj_surface->base.id);
@@ -3030,16 +3199,6 @@ VAStatus psb_Terminate(VADriverContextP ctx)
driver_data->rar_bo = NULL;
}
- if (driver_data->rar_rd) {
- RAR_desc_t *rar_rd = driver_data->rar_rd;
-
- psb__information_message("vaTerminate: tear down RAR device\n");
-
- RAR_fini(rar_rd);
- free(driver_data->rar_rd);
- driver_data->rar_rd = NULL;
- }
-
if (driver_data->ws_priv) {
psb__information_message("vaTerminate: tear down output portion\n");
@@ -3057,9 +3216,15 @@ VAStatus psb_Terminate(VADriverContextP ctx)
if (driver_data->surface_mb_error)
free(driver_data->surface_mb_error);
+ if (driver_data->bcd_buffer_surfaces)
+ free(driver_data->bcd_buffer_surfaces);
+
free(ctx->pDriverData);
+ free(ctx->vtable_egl);
+ free(ctx->vtable_tpi);
+
ctx->pDriverData = NULL;
- psb__information_message("vaTerminate: cleanup successfully, goodbye\n\n");
+ psb__information_message("vaTerminate: goodbye\n\n");
psb__close_log();
@@ -3147,10 +3312,8 @@ EXPORT VAStatus __vaDriverInit_0_31(VADriverContextP ctx)
tpi->vaCreateSurfaceFromCIFrame = psb_CreateSurfaceFromCIFrame;
tpi->vaCreateSurfaceFromV4L2Buf = psb_CreateSurfaceFromV4L2Buf;
tpi->vaCreateSurfacesForUserPtr = psb_CreateSurfacesForUserPtr;
-
-#ifdef ANDROID
+ tpi->vaCreateSurfaceFromKBuf = psb_CreateSurfaceFromKbuf;
tpi->vaPutSurfaceBuf = psb_PutSurfaceBuf;
-#endif
ctx->vtable_egl = calloc(1, sizeof(struct VADriverVTableEGL));
if (NULL == ctx->vtable_egl)
@@ -3160,7 +3323,7 @@ EXPORT VAStatus __vaDriverInit_0_31(VADriverContextP ctx)
va_egl->vaGetEGLClientBufferFromSurface = psb_GetEGLClientBufferFromSurface;
driver_data = (psb_driver_data_p) calloc(1, sizeof(*driver_data));
- ctx->pDriverData = (void *) driver_data;
+ ctx->pDriverData = (unsigned char *) driver_data;
if (NULL == driver_data) {
if (ctx->vtable_tpi)
free(ctx->vtable_tpi);
@@ -3219,12 +3382,8 @@ EXPORT VAStatus __vaDriverInit_0_31(VADriverContextP ctx)
driver_data->hd_decode_supported = 1;
}
- driver_data->use_xrandr_thread = 0;
- driver_data->xrandr_thread_id = 0;
- driver_data->rotate = VA_ROTATION_NONE;
- driver_data->video_rotate = VA_ROTATION_NONE;
- driver_data->xrandr_dirty = 0;
- driver_data->xrandr_update = 0;
+ psb_init_surface_pvr2dbuf(driver_data);
+
struct dri_state *dri_state = (struct dri_state *)ctx->dri_state;
if (dri_state->driConnectedFlag == VA_DRI1 ||
dri_state->driConnectedFlag == VA_DRI2 ||
@@ -3317,7 +3476,6 @@ EXPORT VAStatus __vaDriverInit_0_31(VADriverContextP ctx)
else
ctx->str_vendor = PSB_STR_VENDOR_MRST;
- psb__information_message("vaInitilize: succeeded!\n\n");
driver_data->msvdx_decode_status = calloc(1, sizeof(drm_psb_msvdx_decode_status_t));
if (NULL == driver_data->msvdx_decode_status) {
@@ -3328,6 +3486,8 @@ EXPORT VAStatus __vaDriverInit_0_31(VADriverContextP ctx)
return VA_STATUS_ERROR_ALLOCATION_FAILED;
}
+ psb__information_message("vaInitilize: succeeded!\n\n");
+
return VA_STATUS_SUCCESS;
}
@@ -3354,19 +3514,24 @@ static int psb_get_device_info(VADriverContextP ctx)
arg.value = (uint64_t)((unsigned long) & device_info);
ret = drmCommandWriteRead(driver_data->drm_fd, driver_data->getParamIoctlOffset,
&arg, sizeof(arg));
- if (ret == 0) {
- pci_device = (device_info >> 16) & 0xffff;
- video_capability = device_info & 0xffff;
+ if (ret != 0) {
+ psb__information_message("failed to get video device info\n");
+ return ret;
+ }
- driver_data->dev_id = pci_device;
- psb__information_message("Retrieve Device ID 0x%04x\n", driver_data->dev_id);
+ pci_device = (device_info >> 16) & 0xffff;
+ video_capability = device_info & 0xffff;
- if ((IS_MRST(driver_data) && (pci_device != 0x4101)) ||
- IS_MFLD(driver_data))
- driver_data->encode_supported = 1;
- else /* 0x4101 or other device hasn't encode support */
- driver_data->encode_supported = 0;
+ driver_data->dev_id = pci_device;
+ psb__information_message("Retrieve Device ID 0x%04x\n", driver_data->dev_id);
+ if ((IS_MRST(driver_data) && (pci_device != 0x4101)) ||
+ IS_MFLD(driver_data))
+ driver_data->encode_supported = 1;
+ else /* 0x4101 or other device hasn't encode support */
+ driver_data->encode_supported = 0;
+
+ if (IS_MRST(driver_data)) {
driver_data->decode_supported = !(video_capability & 0x2);
driver_data->hd_decode_supported = !(video_capability & 0x3);
driver_data->hd_encode_supported = !(video_capability & 0x4);
@@ -3379,11 +3544,11 @@ static int psb_get_device_info(VADriverContextP ctx)
driver_data->encode_supported ? "support" : "not support",
driver_data->hd_encode_supported ? "support" : "not support");
-
- return ret;
+ } else {
+ driver_data->decode_supported = 1;
+ driver_data->hd_decode_supported = 1;
+ driver_data->hd_encode_supported = 1;
}
- psb__information_message("failed to get video device info\n");
-
return ret;
}
diff --git a/src/psb_drv_video.h b/src/psb_drv_video.h
index 727d538..87ba039 100644
--- a/src/psb_drv_video.h
+++ b/src/psb_drv_video.h
@@ -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.
@@ -49,6 +49,9 @@
#else
#define XID unsigned int
#define INT16 unsigned int
+#include <cutils/log.h>
+#undef LOG_TAG
+#define LOG_TAG "pvr_drv_video"
#endif
#include "hwdefs/dxva_fw_flags.h"
#include <wsbm/wsbm_pool.h>
@@ -60,6 +63,7 @@
#ifndef max
#define max(a, b) ((a) > (b)) ? (a) : (b)
#endif
+
/*
* WORKAROUND_DMA_OFF_BY_ONE: LLDMA requests may access one additional byte which can cause
* a MMU fault if the next byte after the buffer end is on a different page that isn't mapped.
@@ -105,7 +109,6 @@ enum psb_output_method_t {
PSB_PUTSURFACE_COVERLAY,/* client overlay */
PSB_PUTSURFACE_CTEXTURE,/* client textureblit */
PSB_PUTSURFACE_TEXSTREAMING,/* texsteaming */
-
PSB_PUTSURFACE_FORCE_TEXTURE,/* force texture xvideo */
PSB_PUTSURFACE_FORCE_OVERLAY,/* force overlay xvideo */
PSB_PUTSURFACE_FORCE_CTEXTURE,/* force client textureblit */
@@ -129,6 +132,8 @@ struct psb_driver_data_s {
char * bus_id;
uint32_t dev_id;
int drm_fd;
+ int dup_drm_fd;
+
/* PM_QoS */
int pm_qos_fd;
int dri2;
@@ -142,13 +147,12 @@ struct psb_driver_data_s {
uint32_t msvdx_context_base;
int video_sd_disabled;
int video_hd_disabled;
- void * camera_bo;
+ unsigned char * camera_bo;
uint32_t camera_phyaddr;
uint32_t camera_size;
- void * rar_bo;
+ unsigned char * rar_bo;
uint32_t rar_phyaddr;
uint32_t rar_size;
- void * rar_rd;
int encode_supported;
int decode_supported;
@@ -165,6 +169,7 @@ struct psb_driver_data_s {
/* whether the post-processing use client overlay or not */
int coverlay;
+ int coverlay_init;
PsbPortPrivRec coverlay_priv;
@@ -178,7 +183,7 @@ struct psb_driver_data_s {
struct psb_texstreaing ctexstreaing_priv;
*/
- void *ws_priv; /* window system related data structure */
+ unsigned char *ws_priv; /* window system related data structure */
VASurfaceID cur_displaying_surface;
@@ -216,12 +221,11 @@ struct psb_driver_data_s {
pthread_t xrandr_thread_id;
int extend_fullscreen;
- int rotate;
- int video_rotate;
int drawable_info;
int dummy_putsurface;
int fixed_fps;
unsigned int frame_count;
+ unsigned int overlay_idle_frame;
uint32_t blend_mode;
uint32_t blend_color;
@@ -229,14 +233,27 @@ struct psb_driver_data_s {
uint32_t color_key;
/*output rotation info*/
- int mipi0_rotation;
- int mipi1_rotation;
- int hdmi_rotation;
- int local_rotation;
- int extend_rotation;
+ int disable_msvdx_rotate;
+ int msvdx_rotate_want; /* msvdx rotate info programed to msvdx */
+ int va_rotate; /* VA rotate passed from APP */
+ int mipi0_rotation; /* window manager rotation */
+ int mipi1_rotation; /* window manager rotation */
+ int hdmi_rotation; /* window manager rotation */
+ int local_rotation; /* final device rotate: VA rotate+wm rotate */
+ int extend_rotation; /* final device rotate: VA rotate+wm rotate */
+
+ unsigned int outputmethod_checkinterval;
+
uint32_t bcd_id;
uint32_t bcd_ioctrl_num;
uint32_t bcd_registered;
+ uint32_t bcd_buffer_num;
+ int bcd_buffer_width;
+ int bcd_buffer_height;
+ int bcd_buffer_stride;
+ VASurfaceID *bcd_buffer_surfaces;
+ uint32_t ts_source_created;
+
uint32_t xrandr_dirty;
uint32_t xrandr_update;
/*only VAProfileH264ConstrainedBaseline profile enable error concealment*/
@@ -246,6 +263,15 @@ struct psb_driver_data_s {
psb_decode_info_t decode_info;
drm_psb_msvdx_decode_status_t *msvdx_decode_status;
VASurfaceDecodeMBErrors *surface_mb_error;
+
+ unsigned char *hPVR2DContext;
+
+ VAGenericID wrapped_surface_id[VIDEO_BUFFER_NUM];
+ VAGenericID wrapped_subpic_id[VIDEO_BUFFER_NUM];
+ PVR2DMEMINFO *videoBuf[VIDEO_BUFFER_NUM];
+ PVR2DMEMINFO *subpicBuf[VIDEO_BUFFER_NUM];
+
+ int is_android;
};
#define IS_MRST(driver_data) ((driver_data->dev_id & 0xFFFC) == 0x4100)
@@ -264,6 +290,7 @@ struct object_context_s {
struct object_base_s base;
VAContextID context_id;
VAConfigID config_id;
+ VAProfile profile;
VAEntrypoint entry_point;
int picture_width;
int picture_height;
@@ -275,7 +302,7 @@ struct object_context_s {
VASurfaceID current_render_surface_id;
psb_driver_data_p driver_data;
format_vtable_p format_vtable;
- void *format_data;
+ unsigned char *format_data;
struct psb_cmdbuf_s *cmdbuf_list[PSB_MAX_CMDBUFS];
struct lnc_cmdbuf_s *lnc_cmdbuf_list[LNC_MAX_CMDBUFS_ENCODE];
struct pnw_cmdbuf_s *pnw_cmdbuf_list[PNW_MAX_CMDBUFS_ENCODE];
@@ -308,7 +335,8 @@ struct object_context_s {
uint32_t last_mb;
int is_oold;
- int rotate;
+ int msvdx_rotate;
+ int interlaced_stream;
uint32_t msvdx_context;
@@ -317,6 +345,9 @@ struct object_context_s {
uint32_t slice_count;
};
+#define ROTATE_VA2MSVDX(va_rotate) (va_rotate)
+#define CONTEXT_ROTATE(obj_context) (obj_context->msvdx_rotate != ROTATE_VA2MSVDX(VA_ROTATION_NONE))
+
struct object_surface_s {
struct object_base_s base;
VASurfaceID surface_id;
@@ -339,12 +370,12 @@ struct object_buffer_s {
object_buffer_p ptr_next; /* Generic ptr for linked list */
object_buffer_p *pptr_prev_next; /* Generic ptr for linked list */
struct psb_buffer_s *psb_buffer;
- void *buffer_data;
+ unsigned char *buffer_data;
VACodedBufferSegment codedbuf_mapinfo[8]; /* for VAEncCodedBufferType */
unsigned int size;
unsigned int alloc_size;
- int max_num_elements;
- int num_elements;
+ unsigned int max_num_elements;
+ unsigned int num_elements;
object_context_p context;
VABufferType type;
uint32_t last_used;
@@ -375,11 +406,11 @@ struct object_subpic_s {
/* flags */
unsigned int flags; /* see below */
- void *surfaces; /* surfaces, associated with this subpicture */
+ unsigned char *surfaces; /* surfaces, associated with this subpicture */
};
#define MEMSET_OBJECT(ptr, data_struct) \
- memset((void *)ptr + sizeof(struct object_base_s),\
+ memset((unsigned char *)ptr + sizeof(struct object_base_s),\
0, \
sizeof(data_struct) - sizeof(struct object_base_s))
@@ -463,6 +494,41 @@ inline static char * buffer_type_to_string(int type)
}
}
+inline static int Angle2Rotation(int angle)
+{
+ angle %= 360;
+ switch (angle) {
+ case 0:
+ return VA_ROTATION_NONE;
+ case 90:
+ return VA_ROTATION_90;
+ case 180:
+ return VA_ROTATION_180;
+ case 270:
+ return VA_ROTATION_270;
+ default:
+ return -1;
+ }
+}
+
+inline static int Rotation2Angle(int rotation)
+{
+ switch (rotation) {
+ case VA_ROTATION_NONE:
+ return 0;
+ case VA_ROTATION_90:
+ return 90;
+ case VA_ROTATION_180:
+ return 180;
+ case VA_ROTATION_270:
+ return 270;
+ default:
+ return -1;
+ }
+}
+
+int psb_parse_config(char *env, char *env_value);
+
int LOCK_HARDWARE(psb_driver_data_p driver_data);
int UNLOCK_HARDWARE(psb_driver_data_p driver_data);
diff --git a/src/psb_output.c b/src/psb_output.c
index bf8732a..9dfd385 100644
--- a/src/psb_output.c
+++ b/src/psb_output.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.
@@ -31,6 +31,7 @@
#ifndef ANDROID
#include <X11/Xutil.h>
#include <X11/extensions/Xrandr.h>
+#include <va/va_dricommon.h>
#include "x11/psb_x11.h"
#include "x11/psb_xrandr.h"
#endif
@@ -41,6 +42,7 @@
#include "psb_surface.h"
#include "psb_buffer.h"
#include "psb_surface_ext.h"
+#include "pnw_rotate.h"
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
@@ -51,9 +53,6 @@
#include <sys/ioctl.h>
#define INIT_DRIVER_DATA psb_driver_data_p driver_data = (psb_driver_data_p) ctx->pDriverData;
-#ifndef ANDROID
-#define INIT_OUTPUT_PRIV psb_x11_output_p output = (psb_x11_output_p)(((psb_driver_data_p)ctx->pDriverData)->ws_priv)
-#endif
#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 ))
@@ -71,21 +70,21 @@ typedef struct _subpic_surface {
static VAImageFormat psb__SubpicFormat[] = {
psb__ImageRGBA,
- psb__ImageAYUV,
- psb__ImageAI44
+ //psb__ImageAYUV,
+ //psb__ImageAI44
};
static VAImageFormat psb__CreateImageFormat[] = {
psb__ImageNV12,
psb__ImageRGBA,
- psb__ImageAYUV,
- psb__ImageAI44,
+ //psb__ImageAYUV,
+ //psb__ImageAI44,
psb__ImageYV16
};
-void *psb_x11_output_init(VADriverContextP ctx);
+unsigned char *psb_x11_output_init(VADriverContextP ctx);
VAStatus psb_x11_output_deinit(VADriverContextP ctx);
-void *psb_android_output_init(VADriverContextP ctx);
+unsigned char *psb_android_output_init(VADriverContextP ctx);
VAStatus psb_android_output_deinit(VADriverContextP ctx);
int psb_coverlay_init(VADriverContextP ctx);
@@ -94,62 +93,53 @@ int psb_coverlay_deinit(VADriverContextP ctx);
VAStatus psb_initOutput(VADriverContextP ctx)
{
INIT_DRIVER_DATA;
- void *ws_priv = NULL;
+ unsigned char *ws_priv = NULL;
char *fps = NULL;
+ char env_value[1024];
pthread_mutex_init(&driver_data->output_mutex, NULL);
- if (getenv("PSB_VIDEO_PUTSURFACE_DUMMY")) {
+ if (psb_parse_config("PSB_VIDEO_PUTSURFACE_DUMMY", &env_value[0]) == 0) {
psb__information_message("vaPutSurface: dummy mode, return directly\n");
driver_data->dummy_putsurface = 0;
return VA_STATUS_SUCCESS;
}
- if (getenv("PSB_VIDEO_EXTEND_FULLSCREEN")) {
- driver_data->extend_fullscreen = 1;
- }
-
- if (getenv("PSB_VIDEO_NOTRD") || IS_MRST(driver_data)) {
- psb__information_message("Force not to start psb xrandr thread.\n");
- driver_data->use_xrandr_thread = 0;
- } else {
- psb__information_message("By default, use psb xrandr thread.\n");
- driver_data->use_xrandr_thread = 1;
- }
-
- fps = getenv("PSB_VIDEO_FPS");
- if (fps != NULL) {
- driver_data->fixed_fps = atoi(fps);
+ if (psb_parse_config("PSB_VIDEO_FPS", &env_value[0]) == 0) {
+ driver_data->fixed_fps = atoi(env_value);
psb__information_message("Throttling at FPS=%d\n", driver_data->fixed_fps);
} else
driver_data->fixed_fps = 0;
+ driver_data->outputmethod_checkinterval = 1;
+ if (psb_parse_config("PSB_VIDEO_INTERVAL", &env_value[0]) == 0) {
+ driver_data->outputmethod_checkinterval = atoi(env_value);
+ psb__information_message("Check output method at %d frames interval\n",
+ driver_data->outputmethod_checkinterval);
+ }
+
driver_data->cur_displaying_surface = VA_INVALID_SURFACE;
driver_data->last_displaying_surface = VA_INVALID_SURFACE;
+ psb_InitRotate(ctx);
+
#ifdef ANDROID
ws_priv = psb_android_output_init(ctx);
+ driver_data->is_android = 1;
#else
ws_priv = psb_x11_output_init(ctx);
+ driver_data->is_android = 0;
#endif
driver_data->ws_priv = ws_priv;
- /* use client overlay */
- if (driver_data->coverlay == 1) {
-#ifndef ANDROID
- psb_x11_output_p output = (psb_x11_output_p)(((psb_driver_data_p)ctx->pDriverData)->ws_priv);
- output->pClipBoxList = NULL;
- output->ui32NumClipBoxList = 0;
- output->frame_count = 0;
- output->bIsVisible = 0;
-#endif
- psb_coverlay_init(ctx);
- }
//use client textureblit
- if (driver_data->ctexture == 1)
- psb_ctexture_init(ctx);
+ if (driver_data->ctexture == 1) {
+ int ret = psb_ctexture_init(ctx);
+ if (ret != 0)
+ driver_data->ctexture = 0;
+ }
/*
//use texture streaming
@@ -167,18 +157,15 @@ VAStatus psb_deinitOutput(
INIT_DRIVER_DATA;
//use client textureblit
- if (driver_data->ctexture == 1) {
+ if (driver_data->ctexture == 1)
psb_ctexture_deinit(ctx);
- }
-#ifndef ANDROID
- INIT_OUTPUT_PRIV;
-
- if (driver_data->coverlay == 1) {
- psb_x11_freeWindowClipBoxList(output->pClipBoxList);
+ if (driver_data->coverlay_init) {
psb_coverlay_deinit(ctx);
+ driver_data->coverlay_init = 0;
}
+#ifndef ANDROID
psb_x11_output_deinit(ctx);
#else
psb_android_output_deinit(ctx);
@@ -191,6 +178,8 @@ VAStatus psb_deinitOutput(
if (driver_data->ctexstreaming == 1)
psb_ctexstreaing_deinit(ctx);
*/
+ /* clean the displaying surface information in kernel */
+ psb_surface_set_displaying(driver_data, 0, 0, NULL);
pthread_mutex_destroy(&driver_data->output_mutex);
@@ -229,8 +218,8 @@ static void psb__VAImageCheckRegion(
int *src_y,
int *dest_x,
int *dest_y,
- unsigned int *width,
- unsigned int *height
+ int *width,
+ int *height
)
{
/* check for image */
@@ -308,6 +297,11 @@ VAStatus psb_CreateImage(
if (img_fmt == NULL)
return VA_STATUS_ERROR_UNKNOWN;
+ if (NULL == image) {
+ vaStatus = VA_STATUS_ERROR_INVALID_PARAMETER;
+ return vaStatus;
+ }
+
imageID = object_heap_allocate(&driver_data->image_heap);
obj_image = IMAGE(imageID);
if (NULL == obj_image) {
@@ -447,6 +441,11 @@ VAStatus psb_DeriveImage(
return vaStatus;
}
+ if (NULL == image) {
+ vaStatus = VA_STATUS_ERROR_INVALID_PARAMETER;
+ return vaStatus;
+ }
+
fourcc = obj_surface->psb_surface->extra_info[4];
for (i = 0; i < PSB_MAX_IMAGE_FORMATS; i++) {
if (psb__CreateImageFormat[i].fourcc == fourcc) {
@@ -720,10 +719,11 @@ VAStatus psb_GetImage(
return vaStatus;
}
- psb__VAImageCheckRegion(obj_surface, &obj_image->image, &src_x, &src_y, &dest_x, &dest_y, &width, &height);
+ psb__VAImageCheckRegion(obj_surface, &obj_image->image, &src_x, &src_y, &dest_x, &dest_y,
+ (int *)&width, (int *)&height);
psb_surface_p psb_surface = obj_surface->psb_surface;
- void *surface_data;
+ unsigned char *surface_data;
ret = psb_buffer_map(&psb_surface->buf, &surface_data);
if (ret) {
return VA_STATUS_ERROR_UNKNOWN;
@@ -736,7 +736,7 @@ VAStatus psb_GetImage(
return vaStatus;
}
- void *image_data;
+ unsigned char *image_data;
ret = psb_buffer_map(obj_buffer->psb_buffer, &image_data);
if (ret) {
psb__error_message("Map buffer failed\n");
@@ -750,7 +750,7 @@ VAStatus psb_GetImage(
switch (obj_image->image.format.fourcc) {
case VA_FOURCC_NV12: {
unsigned char *source_y, *src_uv, *dst_y, *dst_uv;
- int i;
+ unsigned int i;
/* copy Y plane */
dst_y = image_data;
source_y = surface_data + y * psb_surface->stride + x;
@@ -842,10 +842,11 @@ static VAStatus psb_PutImage2(
return vaStatus;
}
- psb__VAImageCheckRegion(obj_surface, &obj_image->image, &src_x, &src_y, &dest_x, &dest_y, &width, &height);
+ psb__VAImageCheckRegion(obj_surface, &obj_image->image, &src_x, &src_y, &dest_x, &dest_y,
+ (int *)&width, (int *)&height);
psb_surface_p psb_surface = obj_surface->psb_surface;
- void *surface_data;
+ unsigned char *surface_data;
ret = psb_buffer_map(&psb_surface->buf, &surface_data);
if (ret) {
return VA_STATUS_ERROR_UNKNOWN;
@@ -858,7 +859,7 @@ static VAStatus psb_PutImage2(
return vaStatus;
}
- void *image_data;
+ unsigned char *image_data;
ret = psb_buffer_map(obj_buffer->psb_buffer, &image_data);
if (ret) {
psb_buffer_unmap(&psb_surface->buf);
@@ -869,7 +870,7 @@ static VAStatus psb_PutImage2(
switch (obj_image->image.format.fourcc) {
case VA_FOURCC_NV12: {
- char *source_y, *src_uv, *dst_y, *dst_uv;
+ unsigned char *source_y, *src_uv, *dst_y, *dst_uv;
unsigned int i;
/* copy Y plane */
@@ -949,8 +950,8 @@ static void psb__VAImageCheckRegion2(
unsigned int *src_height,
int *dest_x,
int *dest_y,
- unsigned int *dest_width,
- unsigned int *dest_height
+ int *dest_width,
+ int *dest_height
)
{
/* check for image */
@@ -968,8 +969,8 @@ static void psb__VAImageCheckRegion2(
if (*dest_y < 0) *dest_y = 0;
if (*dest_y > surface->height) *dest_y = surface->height - 1;
- if (((*dest_width) + (*dest_x)) > surface->width) *dest_width = surface->width - *dest_x;
- if (((*dest_height) + (*dest_y)) > surface->height) *dest_height = surface->height - *dest_x;
+ if (((*dest_width) + (*dest_x)) > (int)surface->width) *dest_width = surface->width - *dest_x;
+ if (((*dest_height) + (*dest_y)) > (int)surface->height) *dest_height = surface->height - *dest_x;
}
VAStatus psb_PutImage(
@@ -1017,10 +1018,10 @@ VAStatus psb_PutImage(
psb__VAImageCheckRegion2(obj_surface, &obj_image->image,
&src_x, &src_y, &src_width, &src_height,
- &dest_x, &dest_y, &dest_width, &dest_height);
+ &dest_x, &dest_y, (int *)&dest_width, (int *)&dest_height);
psb_surface_p psb_surface = obj_surface->psb_surface;
- void *surface_data;
+ unsigned char *surface_data;
ret = psb_buffer_map(&psb_surface->buf, &surface_data);
if (ret) {
return VA_STATUS_ERROR_UNKNOWN;
@@ -1033,7 +1034,7 @@ VAStatus psb_PutImage(
return vaStatus;
}
- void *image_data;
+ unsigned char *image_data;
ret = psb_buffer_map(obj_buffer->psb_buffer, &image_data);
if (ret) {
psb_buffer_unmap(&psb_surface->buf);
@@ -1050,9 +1051,9 @@ VAStatus psb_PutImage(
float yratio = (float) src_height / dest_height;
/* dst_y/dst_uv: Y/UV plane of destination */
- dst_y = surface_data + dest_y * psb_surface->stride + dest_x;
- dst_uv = surface_data + psb_surface->stride * obj_surface->height
- + (dest_y / 2) * psb_surface->stride + dest_x;
+ dst_y = (unsigned char *)(surface_data + dest_y * psb_surface->stride + dest_x);
+ dst_uv = (unsigned short *)(surface_data + psb_surface->stride * obj_surface->height
+ + (dest_y / 2) * psb_surface->stride + dest_x);
for (j = 0; j < dest_height; j++) {
unsigned char *dst_y_tmp = dst_y;
@@ -1079,7 +1080,7 @@ VAStatus psb_PutImage(
dst_y += psb_surface->stride;
if (j & 1)
- dst_uv = (unsigned short *)((void *)dst_uv + psb_surface->stride);
+ dst_uv = (unsigned short *)((unsigned char *)dst_uv + psb_surface->stride);
}
break;
}
@@ -1187,10 +1188,10 @@ static VAStatus psb__LinkSubpictIntoSurface(
if (found == 0) { /* new node, link into the list */
if (NULL == obj_surface->subpictures) {
- obj_surface->subpictures = surface_subpic;
+ obj_surface->subpictures = (void *)surface_subpic;
} else { /* insert as the head */
- surface_subpic->next = obj_surface->subpictures;
- obj_surface->subpictures = surface_subpic;
+ surface_subpic->next = (PsbVASurfacePtr)obj_surface->subpictures;
+ obj_surface->subpictures = (void *)surface_subpic;
}
obj_surface->subpic_count++;
}
@@ -1227,10 +1228,10 @@ static VAStatus psb__LinkSurfaceIntoSubpict(
subpic_surface->next = NULL;
if (NULL == obj_subpic->surfaces) {
- obj_subpic->surfaces = subpic_surface;
+ obj_subpic->surfaces = (void *)subpic_surface;
} else { /* insert as the head */
- subpic_surface->next = obj_subpic->surfaces;
- obj_subpic->surfaces = subpic_surface;
+ subpic_surface->next = (subpic_surface_p)obj_subpic->surfaces;
+ obj_subpic->surfaces = (void *)subpic_surface;
}
return VA_STATUS_SUCCESS;
@@ -1259,7 +1260,7 @@ static VAStatus psb__DelinkSubpictFromSurface(
if (found == 1) {
if (pre_surface_subpic == NULL) { /* remove the first node */
- obj_surface->subpictures = surface_subpic->next;
+ obj_surface->subpictures = (void *)surface_subpic->next;
} else {
pre_surface_subpic->next = surface_subpic->next;
}
@@ -1294,7 +1295,7 @@ static VAStatus psb__DelinkSurfaceFromSubpict(
if (found == 1) {
if (pre_subpic_surface == NULL) { /* remove the first node */
- obj_subpic->surfaces = subpic_surface->next;
+ obj_subpic->surfaces = (void *)subpic_surface->next;
} else {
pre_subpic_surface->next = subpic_surface->next;
}
@@ -1379,6 +1380,7 @@ VAStatus psb_CreateSubpicture(
obj_subpic->subpic_id = subpicID;
obj_subpic->image_id = obj_image->image.image_id;
obj_subpic->surfaces = NULL;
+ obj_subpic->global_alpha = 255;
obj_image->subpic_ref ++;
@@ -1508,7 +1510,17 @@ VAStatus psb_SetSubpictureChromakey(
INIT_DRIVER_DATA;
(void)driver_data;
/* TODO */
- return VA_STATUS_ERROR_UNKNOWN;
+ if ((chromakey_mask < chromakey_min) || (chromakey_mask > chromakey_max)) {
+ psb__error_message("Invalid chromakey value %d, chromakey value should between min and max\n", chromakey_mask);
+ return VA_STATUS_ERROR_INVALID_PARAMETER;
+ }
+ object_subpic_p obj_subpic = SUBPIC(subpicture);
+ if (NULL == obj_subpic) {
+ psb__error_message("Invalid subpicture value %d\n", subpicture);
+ return VA_STATUS_ERROR_INVALID_SUBPICTURE;
+ }
+
+ return VA_STATUS_SUCCESS;
}
VAStatus psb_SetSubpictureGlobalAlpha(
@@ -1518,9 +1530,21 @@ VAStatus psb_SetSubpictureGlobalAlpha(
)
{
INIT_DRIVER_DATA;
- (void)driver_data;
- /* TODO */
- return VA_STATUS_ERROR_UNKNOWN;
+
+ if (global_alpha < 0 || global_alpha > 1) {
+ psb__error_message("Invalid global alpha value %07f, global alpha value should between 0 and 1\n", global_alpha);
+ return VA_STATUS_ERROR_INVALID_PARAMETER;
+ }
+
+ object_subpic_p obj_subpic = SUBPIC(subpicture);
+ if (NULL == obj_subpic) {
+ psb__error_message("Invalid subpicture value %d\n", subpicture);
+ return VA_STATUS_ERROR_INVALID_SUBPICTURE;
+ }
+
+ obj_subpic->global_alpha = global_alpha * 255;
+
+ return VA_STATUS_SUCCESS;
}
@@ -1762,6 +1786,98 @@ static VADisplayAttribute psb__DisplayAttribute[] = {
0x00000000,
VA_DISPLAY_ATTRIB_GETTABLE | VA_DISPLAY_ATTRIB_SETTABLE
},
+ {
+ VADisplayAttribRotation,
+ VA_ROTATION_NONE,
+ VA_ROTATION_270,
+ VA_ROTATION_NONE,
+ VA_DISPLAY_ATTRIB_GETTABLE | VA_DISPLAY_ATTRIB_SETTABLE
+ },
+ {
+ VADisplayAttribOutofLoopDeblock,
+ VA_OOL_DEBLOCKING_FALSE,
+ VA_OOL_DEBLOCKING_TRUE,
+ VA_OOL_DEBLOCKING_FALSE,
+ VA_DISPLAY_ATTRIB_GETTABLE | VA_DISPLAY_ATTRIB_SETTABLE
+ },
+ {
+ VADisplayAttribBLEBlackMode,
+ 0x00000000,
+ 0xffffffff,
+ 0x00000000,
+ VA_DISPLAY_ATTRIB_GETTABLE | VA_DISPLAY_ATTRIB_SETTABLE
+ },
+ {
+ VADisplayAttribBLEWhiteMode,
+ 0x00000000,
+ 0xffffffff,
+ 0x00000000,
+ VA_DISPLAY_ATTRIB_GETTABLE | VA_DISPLAY_ATTRIB_SETTABLE
+ },
+
+ {
+ VADisplayAttribBlueStretch,
+ 0x00000000,
+ 0xffffffff,
+ 0x00000000,
+ VA_DISPLAY_ATTRIB_GETTABLE | VA_DISPLAY_ATTRIB_SETTABLE
+ },
+ {
+ VADisplayAttribSkinColorCorrection,
+ 0x00000000,
+ 0xffffffff,
+ 0x00000000,
+ VA_DISPLAY_ATTRIB_GETTABLE | VA_DISPLAY_ATTRIB_SETTABLE
+ },
+ {
+ VADisplayAttribBlendColor,
+ 0x00000000,
+ 0xffffffff,
+ 0x00000000,
+ VA_DISPLAY_ATTRIB_GETTABLE | VA_DISPLAY_ATTRIB_SETTABLE
+ },
+ {
+ VADisplayAttribOverlayColorKey,
+ 0x00000000,
+ 0xffffffff,
+ 0x00000000,
+ VA_DISPLAY_ATTRIB_GETTABLE | VA_DISPLAY_ATTRIB_SETTABLE
+ },
+ {
+ VADisplayAttribOverlayAutoPaintColorKey,
+ 0x00000000,
+ 0xffffffff,
+ 0x00000000,
+ VA_DISPLAY_ATTRIB_GETTABLE | VA_DISPLAY_ATTRIB_SETTABLE
+ },
+ {
+ VADisplayAttribCSCMatrix,
+ 0x00000000,
+ 0xffffffff,
+ 0x00000000,
+ VA_DISPLAY_ATTRIB_GETTABLE | VA_DISPLAY_ATTRIB_SETTABLE
+ },
+ {
+ VADisplayAttribRenderDevice,
+ 0x00000000,
+ 0xffffffff,
+ 0x00000000,
+ VA_DISPLAY_ATTRIB_GETTABLE | VA_DISPLAY_ATTRIB_SETTABLE
+ },
+ {
+ VADisplayAttribRenderMode,
+ 0x00000000,
+ 0xffffffff,
+ 0x00000000,
+ VA_DISPLAY_ATTRIB_GETTABLE | VA_DISPLAY_ATTRIB_SETTABLE
+ },
+ {
+ VADisplayAttribRenderRect,
+ 0x00000000,
+ 0xffffffff,
+ 0x00000000,
+ VA_DISPLAY_ATTRIB_GETTABLE | VA_DISPLAY_ATTRIB_SETTABLE
+ }
};
/*
@@ -1789,8 +1905,7 @@ VAStatus psb_QueryDisplayAttributes(
return vaStatus;
}
*num_attributes = min(*num_attributes, PSB_MAX_DISPLAY_ATTRIBUTES);
- memcpy(attr_list, psb__DisplayAttribute, *num_attributes);
-
+ memcpy(attr_list, psb__DisplayAttribute, (*num_attributes)*sizeof(VADisplayAttribute));
return VA_STATUS_SUCCESS;
}
@@ -1863,6 +1978,40 @@ VAStatus psb_GetDisplayAttributes(
p->min_value = 0;
p->max_value = 1;
break;
+ case VADisplayAttribRotation:
+ p->value = driver_data->va_rotate = p->value;
+ p->min_value = VA_ROTATION_NONE;
+ p->max_value = VA_ROTATION_270;
+ break;
+ case VADisplayAttribOutofLoopDeblock:
+ p->value = driver_data->is_oold = p->value;
+ p->min_value = VA_OOL_DEBLOCKING_FALSE;
+ p->max_value = VA_OOL_DEBLOCKING_TRUE;
+ break;
+ case VADisplayAttribCSCMatrix:
+ p->value = driver_data->load_csc_matrix = p->value;
+ p->min_value = 0;
+ p->max_value = 255;
+ break;
+ case VADisplayAttribRenderDevice:
+ p->value = driver_data->render_device = p->value;
+ p->min_value = 0;
+ p->max_value = 255;
+ break;
+ case VADisplayAttribRenderMode:
+ p->value = driver_data->render_mode = p->value;
+ p->min_value = 0;
+ p->max_value = 255;
+ break;
+ case VADisplayAttribRenderRect:
+ ((VARectangle *)(p->value))->x = driver_data->render_rect.x = ((VARectangle *)(p->value))->x;
+ ((VARectangle *)(p->value))->y = driver_data->render_rect.y = ((VARectangle *)(p->value))->y;
+ ((VARectangle *)(p->value))->width = driver_data->render_rect.width = ((VARectangle *)(p->value))->width;
+ ((VARectangle *)(p->value))->height = driver_data->render_rect.height = ((VARectangle *)(p->value))->height;
+ p->min_value = 0;
+ p->max_value = 255;
+ break;
+
default:
break;
}
@@ -1872,39 +2021,6 @@ VAStatus psb_GetDisplayAttributes(
return VA_STATUS_SUCCESS;
}
-static int Angle2Rotation(int angle)
-{
- angle %= 360;
- switch (angle) {
- case 0:
- return VA_ROTATION_NONE;
- case 90:
- return VA_ROTATION_90;
- case 180:
- return VA_ROTATION_180;
- case 270:
- return VA_ROTATION_270;
- default:
- return -1;
- }
-}
-
-static int Rotation2Angle(int rotation)
-{
- switch (rotation) {
- case VA_ROTATION_NONE:
- return 0;
- case VA_ROTATION_90:
- return 90;
- case VA_ROTATION_180:
- return 180;
- case VA_ROTATION_270:
- return 270;
- default:
- return -1;
- }
-}
-
/*
* Set display attributes
* Only attributes returned with VA_DISPLAY_ATTRIB_SETTABLE set in the "flags" field
@@ -1931,7 +2047,6 @@ VAStatus psb_SetDisplayAttributes(
VADisplayAttribute *p = attr_list;
int i, update_coeffs = 0;
- int angle;
if (num_attributes <= 0) {
return VA_STATUS_ERROR_INVALID_PARAMETER;
@@ -1990,36 +2105,25 @@ VAStatus psb_SetDisplayAttributes(
driver_data->is_oold = p->value;
break;
case VADisplayAttribRotation:
- driver_data->video_rotate = p->value;
- angle = Rotation2Angle(driver_data->video_rotate) + Rotation2Angle(driver_data->mipi0_rotation);
- driver_data->local_rotation = Angle2Rotation(angle);
- angle = Rotation2Angle(driver_data->video_rotate) + Rotation2Angle(driver_data->hdmi_rotation);
- driver_data->extend_rotation = Angle2Rotation(angle);
-#ifndef ANDROID
- if (driver_data->local_rotation == driver_data->extend_rotation) {
- driver_data->rotate = driver_data->local_rotation;
- } else {
- driver_data->rotate = driver_data->video_rotate;
- /*fallback to texblit path*/
- driver_data->output_method = PSB_PUTSURFACE_FORCE_CTEXTURE;
- }
-#endif
- if (driver_data->rotate == VA_ROTATION_270)
- driver_data->rotate = 3; /* Match with hw definition */
+ driver_data->va_rotate = p->value;
+ psb_RecalcRotate(ctx);
break;
+
case VADisplayAttribCSCMatrix:
driver_data->load_csc_matrix = 1;
- memcpy(&(driver_data->csc_matrix[0][0]), (void *)p->value, sizeof(signed int) * 9);
+ memcpy(&(driver_data->csc_matrix[0][0]), (unsigned char *)p->value, sizeof(signed int) * 9);
break;
+
case VADisplayAttribBlendColor:
driver_data->blend_color = p->value;
break;
case VADisplayAttribOverlayColorKey:
- driver_data->color_key = p->value;
+ overlay_priv->colorKey = driver_data->color_key = p->value;
break;
case VADisplayAttribOverlayAutoPaintColorKey:
driver_data->overlay_auto_paint_color_key = p->value;
break;
+
case VADisplayAttribRenderDevice:
driver_data->render_device = p->value & VA_RENDER_DEVICE_MASK;
case VADisplayAttribRenderMode:
@@ -2028,7 +2132,7 @@ VAStatus psb_SetDisplayAttributes(
return VA_STATUS_ERROR_INVALID_PARAMETER;
}
if (((p->value & VA_RENDER_MODE_LOCAL_OVERLAY) && (p->value & VA_RENDER_MODE_LOCAL_GPU)) ||
- ((p->value & VA_RENDER_MODE_EXTERNAL_OVERLAY) && (p->value & VA_RENDER_MODE_EXTERNAL_GPU))) {
+ ((p->value & VA_RENDER_MODE_EXTERNAL_OVERLAY) && (p->value & VA_RENDER_MODE_EXTERNAL_GPU))) {
psb__error_message("%s:Invalid parameter. Conflict setting for VADisplayAttribRenderMode.\n", __FUNCTION__);
return VA_STATUS_ERROR_INVALID_PARAMETER;
}
@@ -2040,6 +2144,7 @@ VAStatus psb_SetDisplayAttributes(
driver_data->render_rect.width = ((VARectangle *)(p->value))->width;
driver_data->render_rect.height = ((VARectangle *)(p->value))->height;
break;
+
default:
break;
}
diff --git a/src/psb_output.h b/src/psb_output.h
index 0c7fa29..731e259 100644
--- a/src/psb_output.h
+++ b/src/psb_output.h
@@ -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.
@@ -47,9 +47,9 @@
#define LOG_TAG "pvr_drv_video"
#endif
-#define PSB_MAX_IMAGE_FORMATS 5 /* sizeof(psb__CreateImageFormat)/sizeof(VAImageFormat) */
+#define PSB_MAX_IMAGE_FORMATS 3 /* sizeof(psb__CreateImageFormat)/sizeof(VAImageFormat) */
#define PSB_MAX_SUBPIC_FORMATS 3 /* sizeof(psb__SubpicFormat)/sizeof(VAImageFormat) */
-#define PSB_MAX_DISPLAY_ATTRIBUTES 6 /* sizeof(psb__DisplayAttribute)/sizeof(VADisplayAttribute) */
+#define PSB_MAX_DISPLAY_ATTRIBUTES 18 /* sizeof(psb__DisplayAttribute)/sizeof(VADisplayAttribute) */
#define VA_SUBPICTURE_DESTINATION_IS_SCREEN_COORD 0x0004
#define PSB_SUPPORTED_SUBPIC_FLAGS VA_SUBPICTURE_DESTINATION_IS_SCREEN_COORD /* No alpha or chroma key support */
@@ -156,7 +156,7 @@ VAStatus psb__CreateBuffer(
VABufferType type, /* in */
unsigned int size, /* in */
unsigned int num_elements, /* in */
- void *data, /* in */
+ unsigned char *data, /* in */
VABufferID *buf_desc /* out */
);
diff --git a/src/psb_overlay.c b/src/psb_overlay.c
index 40fcc21..f674106 100644
--- a/src/psb_overlay.c
+++ b/src/psb_overlay.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.
@@ -44,12 +44,15 @@
#include "psb_overlay.h"
#ifdef ANDROID
-#define psb_xrandr_single_mode() 1
+#define psb_xrandr_single_mode() 0
+#else
+int psb_xrandr_single_mode();
#endif
#define INIT_DRIVER_DATA psb_driver_data_p driver_data = (psb_driver_data_p) ctx->pDriverData
#define SURFACE(id) ((object_surface_p) object_heap_lookup( &driver_data->surface_heap, id ))
#define CONTEXT(id) ((object_context_p) object_heap_lookup( &driver_data->context_heap, id ))
+#define GET_SURFACE_INFO_rotate(psb_surface) ((int) (psb_surface)->extra_info[5])
#ifndef VA_FOURCC_I420
#define VA_FOURCC_I420 0x30323449
@@ -70,11 +73,9 @@ I830ResetVideo(VADriverContextP ctx, PsbPortPrivPtr pPriv)
I830OverlayRegPtr overlayC = (I830OverlayRegPtr)(pPriv->regmap[1]);
long offsetA = wsbmBOOffsetHint(pPriv->wsbo[0]) & 0x0FFFFFFF;
long offsetC = wsbmBOOffsetHint(pPriv->wsbo[1]) & 0x0FFFFFFF;
- struct drm_psb_register_rw_arg regs;
memset(overlayA, 0, sizeof(*overlayA));
memset(overlayC, 0, sizeof(*overlayC));
- memset(&regs, 0, sizeof(regs));
overlayA->OCLRC0 = (pPriv->contrast.Value << 18) | (pPriv->brightness.Value & 0xff);
overlayA->OCLRC1 = pPriv->saturation.Value;
@@ -100,22 +101,6 @@ I830ResetVideo(VADriverContextP ctx, PsbPortPrivPtr pPriv)
overlayC->DWINSZ = 0x00000000;
overlayC->OCONFIG = CC_OUT_8BIT;
- regs.overlay_read_mask = OVC_REGRWBITS_OVADD;
- drmCommandWriteRead(driver_data->drm_fd, DRM_PSB_REGISTER_RW, &regs, sizeof(regs));
- regs.overlay_read_mask = 0;
- regs.overlay_write_mask = OVC_REGRWBITS_OVADD;
- regs.overlay.OVADD &= ~(0xffff << 16);
- regs.overlay.OVADD |= offsetC;
- drmCommandWriteRead(driver_data->drm_fd, DRM_PSB_REGISTER_RW, &regs, sizeof(regs));
-
- memset(&regs, 0, sizeof(regs));
- regs.overlay_read_mask = OV_REGRWBITS_OVADD;
- drmCommandWriteRead(driver_data->drm_fd, DRM_PSB_REGISTER_RW, &regs, sizeof(regs));
- regs.overlay_read_mask = 0;
- regs.overlay_write_mask = OV_REGRWBITS_OVADD;
- regs.overlay.OVADD &= ~(0xffff << 16);
- regs.overlay.OVADD |= offsetA;
- drmCommandWriteRead(driver_data->drm_fd, DRM_PSB_REGISTER_RW, &regs, sizeof(regs));
}
static uint32_t I830BoundGammaElt(uint32_t elt, uint32_t eltPrev)
@@ -173,15 +158,19 @@ static void I830StopVideo(VADriverContextP ctx)
{
INIT_DRIVER_DATA;
PsbPortPrivPtr pPriv = (PsbPortPrivPtr)(&driver_data->coverlay_priv);
- long offsetA = wsbmBOOffsetHint(pPriv->wsbo[0]) & 0x0FFFFFFF;
- I830OverlayRegPtr overlayA = (I830OverlayRegPtr)(pPriv->regmap[0]);
- I830OverlayRegPtr overlayC = (I830OverlayRegPtr)(pPriv->regmap[1]);
+ I830OverlayRegPtr overlayA, overlayC;
struct drm_psb_register_rw_arg regs;
+ if (!pPriv->overlayA_enabled && !pPriv->overlayC_enabled) {
+ psb__information_message("I830StopVideo : no overlay has been enabled, do nothing.\n");
+ return;
+ }
+
+ overlayA = (I830OverlayRegPtr)(pPriv->regmap[0]);
+ overlayC = (I830OverlayRegPtr)(pPriv->regmap[1]);
#if 0
REGION_EMPTY(pScrn->pScreen, &pPriv->clip);
#endif
-
memset(&regs, 0, sizeof(regs));
if (pPriv->subpicture_enabled) {
regs.subpicture_disable_mask = pPriv->subpicture_enable_mask;
@@ -196,9 +185,11 @@ static void I830StopVideo(VADriverContextP ctx)
regs.overlay_read_mask = OVC_REGRWBITS_OVADD;
drmCommandWriteRead(driver_data->drm_fd, DRM_PSB_REGISTER_RW, &regs, sizeof(regs));
+ overlayC->DWINSZ = 0x00000000;
overlayC->OCMD &= ~OVERLAY_ENABLE;
regs.overlay_read_mask = 0;
regs.overlay_write_mask = OVC_REGRWBITS_OVADD;
+ regs.overlay.b_wait_vblank = 1;
drmCommandWriteRead(driver_data->drm_fd, DRM_PSB_REGISTER_RW, &regs, sizeof(regs));
memset(&regs, 0, sizeof(regs));
@@ -208,17 +199,25 @@ static void I830StopVideo(VADriverContextP ctx)
regs.overlay_read_mask = OV_REGRWBITS_OVADD;
drmCommandWriteRead(driver_data->drm_fd, DRM_PSB_REGISTER_RW, &regs, sizeof(regs));
+ overlayA->DWINSZ = 0x00000000;
overlayA->OCMD &= ~OVERLAY_ENABLE;
regs.overlay_read_mask = 0;
regs.overlay_write_mask = OV_REGRWBITS_OVADD;
+ regs.overlay.b_wait_vblank = 1;
drmCommandWriteRead(driver_data->drm_fd, DRM_PSB_REGISTER_RW, &regs, sizeof(regs));
pPriv->overlayA_enabled = 0;
}
} else {
+ regs.overlay_read_mask = OV_REGRWBITS_OVADD;
+ drmCommandWriteRead(driver_data->drm_fd, DRM_PSB_REGISTER_RW, &regs, sizeof(regs));
+
+ overlayA->DWINSZ = 0x00000000;
+ overlayA->OCMD &= ~OVERLAY_ENABLE;
+ regs.overlay_read_mask = 0;
regs.overlay_write_mask = OV_REGRWBITS_OVADD;
- regs.overlay.OVADD = offsetA;
- pPriv->overlayA_enabled = 0;
+ regs.overlay.b_wait_vblank = 1;
drmCommandWriteRead(driver_data->drm_fd, DRM_PSB_REGISTER_RW, &regs, sizeof(regs));
+ pPriv->overlayA_enabled = 0;
}
}
@@ -423,6 +422,22 @@ i830_display_video(
int i32EnableIEP = 0;
int i32EnableIEPBLE = 0;
+ /*before enabling overlay, make sure overlay is disabled first.*/
+ if ((overlayId == OVERLAY_A) && !pPriv->overlayA_enabled) {
+ memset(&regs, 0, sizeof(regs));
+ regs.overlay_read_mask = OV_REGRWBITS_OVADD;
+ drmCommandWriteRead(driver_data->drm_fd, DRM_PSB_REGISTER_RW, &regs, sizeof(regs));
+
+ overlay->OCMD &= ~OVERLAY_ENABLE;
+ regs.overlay_read_mask = 0;
+ regs.overlay_write_mask = OV_REGRWBITS_OVADD;
+ drmCommandWriteRead(driver_data->drm_fd, DRM_PSB_REGISTER_RW, &regs, sizeof(regs));
+ }
+
+ /* FIXME: don't know who and why add this
+ * comment it for full screen scale issue
+ * any concern contact qiang.miao@intel.com
+ */
#if 0
if (drw_w >= 800) {
x2 = x2 / 4;
@@ -757,9 +772,9 @@ i830_display_video(
}
if (pPriv->is_mfld) {
- i32EnableIEP = 0;
+ i32EnableIEP = 0;
- i32EnableIEPBLE = 0;
+ i32EnableIEPBLE = 0;
if (i32EnableIEP == 0) {
overlay->OCONFIG = CC_OUT_8BIT;
@@ -767,7 +782,8 @@ i830_display_video(
overlay->OCONFIG |= IEP_LITE_BYPASS;
regs.overlay.OVADD = offset | 1;
regs.overlay.IEP_ENABLED = 0;
- }
+ regs.overlay.buffer_handle = wsbmKBufHandle(wsbmKBuf(pPriv->wsbo[overlayId]));
+ }
} else {
overlay->OCONFIG = CC_OUT_8BIT;
overlay->OCONFIG |= IEP_LITE_BYPASS;
@@ -808,6 +824,156 @@ i830_display_video(
}
}
+
+static void I830PutImageFlipRotateSurface(
+ VADriverContextP ctx,
+ object_surface_p obj_surface,
+ int *src_w_new, int *src_h_new,
+ int *width_new, int *height_new,
+ psb_surface_p *psb_surface_new,
+ int pipeId)
+{
+ int src_w = *src_w_new, src_h = *src_h_new;
+ int width = *width_new, height = *height_new;
+ int tmp = 0;
+
+ psb_surface_p psb_surface = NULL;
+ INIT_DRIVER_DATA;
+ PsbPortPrivPtr pPriv;
+
+ /* local/extend display doesn't have render rotation */
+ if (((pipeId == PIPEA) && (driver_data->local_rotation == VA_ROTATION_NONE)) ||
+ ((pipeId == PIPEB) && (driver_data->extend_rotation == VA_ROTATION_NONE)))
+ return;
+
+ pPriv = (PsbPortPrivPtr)(&driver_data->coverlay_priv);
+
+ if (pipeId == PIPEA) {
+ if (driver_data->local_rotation != VA_ROTATION_NONE) {
+ psb_surface = obj_surface->psb_surface_rotate;
+ width = obj_surface->width_r;
+ height = obj_surface->height_r;
+ if (driver_data->local_rotation != VA_ROTATION_180) {
+ tmp = src_w;
+ src_w = src_h;
+ src_h = tmp;
+ }
+ }
+ if ((driver_data->local_rotation == VA_ROTATION_NONE) ||
+ (driver_data->local_rotation == VA_ROTATION_180)) {
+ pPriv->width_save = pPriv->display_width;
+ pPriv->height_save = pPriv->display_height;
+ } else {
+ pPriv->width_save = pPriv->display_height;
+ pPriv->height_save = pPriv->display_width;
+ }
+ if (driver_data->is_android == 0)
+ pPriv->rotation = driver_data->local_rotation;
+ else
+ pPriv->rotation = 0;
+ } else if (pipeId == PIPEB) {
+ if (driver_data->extend_rotation != VA_ROTATION_NONE) {
+ psb_surface = obj_surface->psb_surface_rotate;
+ width = obj_surface->width_r;
+ height = obj_surface->height_r;
+ if (driver_data->extend_rotation != VA_ROTATION_180) {
+ tmp = src_w;
+ src_w = src_h;
+ src_h = tmp;
+ }
+ }
+ if ((driver_data->extend_rotation == VA_ROTATION_NONE) ||
+ (driver_data->extend_rotation == VA_ROTATION_180)) {
+ pPriv->width_save = pPriv->extend_display_width;
+ pPriv->height_save = pPriv->extend_display_height;
+ } else {
+ pPriv->width_save = pPriv->extend_display_height;
+ pPriv->height_save = pPriv->extend_display_width;
+ }
+ if (driver_data->is_android == 0)
+ pPriv->rotation = driver_data->extend_rotation;
+ else
+ pPriv->rotation = 0;
+ }
+
+ *src_w_new = src_w;
+ *src_h_new = src_h;
+ *width_new = width;
+ *height_new = height;
+ *psb_surface_new = psb_surface;
+}
+
+
+static void I830PutImageFlipRotateDebug(
+ VADriverContextP ctx,
+ VASurfaceID surface,
+ short src_x, short src_y,
+ short src_w, short src_h,
+ short drw_x, short drw_y,
+ short drw_w, short drw_h,
+ int fourcc, int flags,
+ int overlayId,
+ int pipeId)
+{
+ INIT_DRIVER_DATA;
+ object_surface_p obj_surface = SURFACE(surface);
+ psb_surface_p psb_surface = NULL;
+
+ if (pipeId != 0)
+ return;
+
+ psb_surface = obj_surface->psb_surface_rotate;
+ psb_buffer_p buf = &psb_surface->buf;
+ unsigned char *data, *chroma, *buffer, *header;
+ static FILE *pf = NULL;
+ int ret, i;
+ if (!psb_surface)
+ goto dump_out;
+ if (pf == NULL)
+ if ((pf = fopen("/home/dump.yuv", "w+")) == NULL)
+ printf("Open yuv file fails\n");
+
+ ret = psb_buffer_map(buf, &data);
+
+ if (ret)
+ printf("Map buffer fail\n");
+
+ for (i = 0; i < obj_surface->height_r; i++) {
+ fwrite(data, 1, obj_surface->width_r, pf);
+ data += psb_surface->stride;
+ }
+
+ buffer = malloc(obj_surface->height_r * obj_surface->width_r);
+ if (!buffer)
+ printf("Alloc chroma buffer fail\n");
+
+ header = buffer;
+ chroma = data;
+ for (i = 0; i < obj_surface->height_r / 2; i++) {
+ int j;
+ for (j = 0; j < obj_surface->width_r / 2; j++) {
+ *buffer++ = data[j*2];
+ }
+ data += psb_surface->stride;
+ }
+
+ data = chroma;
+ for (i = 0; i < obj_surface->height_r / 2; i++) {
+ int j;
+ for (j = 0; j < obj_surface->width_r / 2; j++) {
+ *buffer++ = data[j*2 + 1];
+ }
+ data += psb_surface->stride;
+ }
+
+ fwrite(header, obj_surface->height_r / 2, obj_surface->width_r, pf);
+ free(header);
+ psb_buffer_unmap(buf);
+dump_out:
+ ;
+}
+
+
/*
* The source rectangle of the video is defined by (src_x, src_y, src_w, src_h).
* The dest rectangle of the video is defined by (drw_x, drw_y, drw_w, drw_h).
@@ -824,10 +990,10 @@ i830_display_video(
static int I830PutImage(
VADriverContextP ctx,
VASurfaceID surface,
- short src_x, short src_y,
- short src_w, short src_h,
- short drw_x, short drw_y,
- short drw_w, short drw_h,
+ int src_x, int src_y,
+ int src_w, int src_h,
+ int drw_x, int drw_y,
+ int drw_w, int drw_h,
int fourcc, int flags,
int overlayId,
int pipeId)
@@ -837,7 +1003,6 @@ static int I830PutImage(
int width, height;
int top, left, npixels;
int pitch = 0, pitch2 = 0;
- short tmp;
unsigned int pre_add;
unsigned int gtt_ofs;
struct _WsbmBufferObject *drm_buf;
@@ -850,59 +1015,6 @@ static int I830PutImage(
if (NULL == obj_surface)
return 1;
-#if 0
- if (pipeId == 0) {
- psb_surface = obj_surface->psb_surface_rotate;
- psb_buffer_p buf = &psb_surface->buf;
- unsigned char *data, *chroma, *buffer, *header;
- static FILE *pf = NULL;
- int ret, i;
- if (!psb_surface)
- goto dump_out;
- if (pf == NULL)
- if ((pf = fopen("/home/dump.yuv", "w+")) == NULL)
- printf("Open yuv file fails\n");
-
- ret = psb_buffer_map(buf, &data);
-
- if (ret)
- printf("Map buffer fail\n");
-
- for (i = 0; i < obj_surface->height_r; i++) {
- fwrite(data, 1, obj_surface->width_r, pf);
- data += psb_surface->stride;
- }
-
- buffer = malloc(obj_surface->height_r * obj_surface->width_r);
- if (!buffer)
- printf("Alloc chroma buffer fail\n");
-
- header = buffer;
- chroma = data;
- for (i = 0; i < obj_surface->height_r / 2; i++) {
- int j;
- for (j = 0; j < obj_surface->width_r / 2; j++) {
- *buffer++ = data[j*2];
- }
- data += psb_surface->stride;
- }
-
- data = chroma;
- for (i = 0; i < obj_surface->height_r / 2; i++) {
- int j;
- for (j = 0; j < obj_surface->width_r / 2; j++) {
- *buffer++ = data[j*2 + 1];
- }
- data += psb_surface->stride;
- }
-
- fwrite(header, obj_surface->height_r / 2, obj_surface->width_r, pf);
- free(header);
- psb_buffer_unmap(buf);
-dump_out:
- ;
- }
-#endif
pPriv = (PsbPortPrivPtr)(&driver_data->coverlay_priv);
switch (fourcc) {
@@ -920,52 +1032,17 @@ dump_out:
* and for oold also?
*/
psb_surface = obj_surface->psb_surface;
+ I830PutImageFlipRotateSurface(ctx, obj_surface,
+ &src_w, &src_h, &width, &height,
+ &psb_surface, pipeId);
- if (pipeId == PIPEA) {
- if (driver_data->local_rotation != VA_ROTATION_NONE) {
- psb_surface = obj_surface->psb_surface_rotate;
- width = obj_surface->width_r;
- height = obj_surface->height_r;
- if (driver_data->local_rotation != VA_ROTATION_180) {
- tmp = src_w;
- src_w = src_h;
- src_h = tmp;
- }
- }
- if ((driver_data->mipi0_rotation == VA_ROTATION_NONE) ||
- (driver_data->mipi0_rotation == VA_ROTATION_180)) {
- pPriv->width_save = pPriv->display_width;
- pPriv->height_save = pPriv->display_height;
- } else {
- pPriv->width_save = pPriv->display_height;
- pPriv->height_save = pPriv->display_width;
- }
- pPriv->rotation = driver_data->mipi0_rotation;
- } else if (pipeId == PIPEB) {
- if (driver_data->extend_rotation != VA_ROTATION_NONE) {
- psb_surface = obj_surface->psb_surface_rotate;
- width = obj_surface->width_r;
- height = obj_surface->height_r;
- if (driver_data->extend_rotation != VA_ROTATION_180) {
- tmp = src_w;
- src_w = src_h;
- src_h = tmp;
- }
- }
- if ((driver_data->hdmi_rotation == VA_ROTATION_NONE) ||
- (driver_data->hdmi_rotation == VA_ROTATION_180)) {
- pPriv->width_save = pPriv->extend_display_width;
- pPriv->height_save = pPriv->extend_display_height;
- } else {
- pPriv->width_save = pPriv->extend_display_height;
- pPriv->height_save = pPriv->extend_display_width;
- }
- pPriv->rotation = driver_data->hdmi_rotation;
- }
-
- if (!psb_surface)
- psb_surface = obj_surface->psb_surface;
+ if ((pipeId == PIPEB) && (driver_data->extend_rotation != VA_ROTATION_NONE) &&
+ (NULL == psb_surface)) {
+ /*BZ:9432. rotate surface may not be ready, so we have to discard this frame.*/
+ psb__information_message("Android HDMI video mode: discard this frame if rotate surface hasn't be ready.\n");
+ return 1;
+ }
width = (width <= 1920) ? width : 1920;
/* If dst width and height are less than 1/8th the src size, the
@@ -1070,6 +1147,15 @@ dump_out:
drm_buf = psb_surface->buf.drm_buf;
gtt_ofs = wsbmBOOffsetHint(drm_buf) & 0x0FFFFFFF;
+ /*skip pad bytes.*/
+ if (driver_data->local_rotation == VA_ROTATION_90) {
+ left += ((src_w + 0xf) & ~0xf) - src_w;
+ } else if (driver_data->local_rotation == VA_ROTATION_270) {
+ top += ((src_h + 0xf) & ~0xf) - src_h;
+ } else if (driver_data->local_rotation == VA_ROTATION_180) {
+ left += ((src_w + 0xf) & ~0xf) - src_w;
+ top += ((src_h + 0xf) & ~0xf) - src_h;
+ }
pPriv->YBuf0offset = pre_add + gtt_ofs + top * pitch2 + left;
pPriv->YBuf1offset = pPriv->YBuf0offset;
pPriv->UBuf0offset = pre_add + gtt_ofs + (pitch2 * height) + top * (pitch2 / 2) + left;
@@ -1149,8 +1235,7 @@ static void psbPortPrivCreate(PsbPortPrivPtr pPriv)
static void
psbPortPrivDestroy(VADriverContextP ctx, PsbPortPrivPtr pPriv)
{
- if (pPriv->overlayA_enabled)
- I830StopVideo(ctx);
+ I830StopVideo(ctx);
wsbmBOUnmap(pPriv->wsbo[0]);
wsbmBOUnreference(&pPriv->wsbo[0]);
@@ -1163,7 +1248,7 @@ psbPortPrivDestroy(VADriverContextP ctx, PsbPortPrivPtr pPriv)
pPriv->p_iep_lite_context = NULL;
}
-static PsbPortPrivPtr
+static int
psbSetupImageVideoOverlay(VADriverContextP ctx, PsbPortPrivPtr pPriv)
{
INIT_DRIVER_DATA;
@@ -1251,17 +1336,35 @@ out_err_bo0:
wsbmBOUnreference(&pPriv->wsbo[0]);
out_err:
- return 0;
+ return -1;
}
int psb_coverlay_init(VADriverContextP ctx)
{
INIT_DRIVER_DATA;
PsbPortPrivPtr pPriv = &driver_data->coverlay_priv;
+ struct drm_psb_register_rw_arg regs;
+ int ret;
memset(pPriv, 0, sizeof(PsbPortPrivRec));
pPriv->is_mfld = IS_MFLD(driver_data);
- psbSetupImageVideoOverlay(ctx, pPriv);
+
+ ret = psbSetupImageVideoOverlay(ctx, pPriv);
+ if (ret != 0) {
+ psb__error_message("psb_coverlay_init : Create overlay cmd buffer failed.\n");
+ return -1;
+ }
+
+ if (pPriv->is_mfld && driver_data->is_android) {
+ psb__information_message("Android ExtVideo: set PIPEB(HDMI)display plane on the bottom.\n");
+
+ memset(&regs, 0, sizeof(regs));
+ regs.display_read_mask = REGRWBITS_DSPBCNTR;
+ drmCommandWriteRead(driver_data->drm_fd, DRM_PSB_REGISTER_RW, &regs, sizeof(regs));
+ regs.display.dspcntr_b |= DISPPLANE_BOTTOM;
+ regs.display_write_mask = REGRWBITS_DSPBCNTR;
+ drmCommandWriteRead(driver_data->drm_fd, DRM_PSB_REGISTER_RW, &regs, sizeof(regs));
+ }
I830ResetVideo(ctx, pPriv);
I830UpdateGamma(ctx, pPriv);
@@ -1279,6 +1382,18 @@ int psb_coverlay_deinit(VADriverContextP ctx)
{
INIT_DRIVER_DATA;
PsbPortPrivPtr pPriv = &driver_data->coverlay_priv;
+ struct drm_psb_register_rw_arg regs;
+
+ if (pPriv->is_mfld && driver_data->is_android) {
+ psb__information_message("Android ExtVideo: set PIPEB(HDMI)display plane normal.\n");
+
+ memset(&regs, 0, sizeof(regs));
+ regs.display_read_mask = REGRWBITS_DSPBCNTR;
+ drmCommandWriteRead(driver_data->drm_fd, DRM_PSB_REGISTER_RW, &regs, sizeof(regs));
+ regs.display.dspcntr_b &= ~DISPPLANE_BOTTOM;
+ regs.display_write_mask = REGRWBITS_DSPBCNTR;
+ drmCommandWriteRead(driver_data->drm_fd, DRM_PSB_REGISTER_RW, &regs, sizeof(regs));
+ }
psbPortPrivDestroy(ctx, pPriv);
diff --git a/src/psb_overlay.h b/src/psb_overlay.h
index c37c99c..d105144 100644
--- a/src/psb_overlay.h
+++ b/src/psb_overlay.h
@@ -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.
@@ -77,6 +77,19 @@
#define CLAMP_ATTR(a,max,min) (a>max?max:(a<min?min:a))
+/*DSPCNTR - Display Control Register*/
+#define DISPLAY_PLANE_ENABLE (1<<31)
+#define DISPLAY_PLANE_DISABLE 0
+#define DISPPLANE_GAMMA_ENABLE (1<<30)
+#define DISPPLANE_GAMMA_DISABLE 0
+#define DISPPLANE_PIXFORMAT_MASK (0xf<<26)
+#define DISPPLANE_8BPP (0x2<<26)
+#define DISPPLANE_15_16BPP (0x4<<26)
+#define DISPPLANE_16BPP (0x5<<26)
+#define DISPPLANE_32BPP_NO_ALPHA (0x6<<26)
+#define DISPPLANE_32BPP (0x7<<26)
+#define DISPPLANE_BOTTOM (4)
+
/*
* OCMD - Overlay Command Register
*/
@@ -297,7 +310,7 @@ typedef struct _PsbPortPrivRec {
ov_psb_fixed32 saturation;
ov_psb_fixed32 hue;
- void * p_iep_lite_context;
+ unsigned char * p_iep_lite_context;
/* hwoverlay */
uint32_t gamma0;
diff --git a/src/psb_surface.c b/src/psb_surface.c
index 7cd3544..28028cb 100644
--- a/src/psb_surface.c
+++ b/src/psb_surface.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -32,8 +32,6 @@
#include "psb_def.h"
#include "psb_surface.h"
-#include <RAR/rar.h>
-
/*
* Create surface
@@ -43,7 +41,7 @@ VAStatus psb_surface_create(psb_driver_data_p driver_data,
psb_surface_p psb_surface /* out */
)
{
- int ret;
+ int ret = 0;
if (fourcc == VA_FOURCC_NV12) {
if ((width <= 0) || (width > 5120) || (height <= 0) || (height > 5120)) {
@@ -96,8 +94,12 @@ VAStatus psb_surface_create(psb_driver_data_p driver_data,
if (protected == 0)
ret = psb_buffer_create(driver_data, psb_surface->size, psb_bt_surface, &psb_surface->buf);
- else
- ret = psb_buffer_create_rar(driver_data, psb_surface->size, &psb_surface->buf);
+ else {
+ if (IS_MFLD(driver_data)) { /* as normal */
+ ret = psb_buffer_create(driver_data, psb_surface->size, psb_bt_surface, &psb_surface->buf);
+ psb_surface->extra_info[6] = 1; /* set protected flag */
+ }
+ }
return ret ? VA_STATUS_ERROR_ALLOCATION_FAILED : VA_STATUS_SUCCESS;
}
@@ -131,7 +133,41 @@ VAStatus psb_surface_create_for_userptr(
psb_surface->size = size;
psb_surface->extra_info[4] = VA_FOURCC_NV12;
- ret = psb_buffer_create(driver_data, psb_surface->size, psb_bt_surface, &psb_surface->buf);
+ ret = psb_buffer_create(driver_data, psb_surface->size, psb_bt_cpu_vpu_shared, &psb_surface->buf);
+
+ return ret ? VA_STATUS_ERROR_ALLOCATION_FAILED : VA_STATUS_SUCCESS;
+}
+
+VAStatus psb_surface_create_from_kbuf(
+ psb_driver_data_p driver_data,
+ int width, int height,
+ unsigned size, /* total buffer size need to be allocated */
+ unsigned int fourcc, /* expected fourcc */
+ int kbuf_handle,
+ 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, /* UV offset from the beginning of the memory */
+ unsigned int chroma_v_offset,
+ psb_surface_p psb_surface /* out */
+)
+{
+ int ret;
+
+ if ((width <= 0) || (width > 5120) || (height <= 0) || (height > 5120))
+ return VA_STATUS_ERROR_ALLOCATION_FAILED;
+
+ psb_surface->stride_mode = STRIDE_NA;
+ psb_surface->stride = luma_stride;
+
+
+ psb_surface->luma_offset = luma_offset;
+ psb_surface->chroma_offset = chroma_u_offset;
+ psb_surface->size = size;
+ psb_surface->extra_info[4] = VA_FOURCC_NV12;
+
+ ret = psb_kbuffer_reference(driver_data, &psb_surface->buf, kbuf_handle);
return ret ? VA_STATUS_ERROR_ALLOCATION_FAILED : VA_STATUS_SUCCESS;
}
@@ -216,7 +252,7 @@ VAStatus psb_surface_create_camera_from_ub(psb_driver_data_p driver_data,
*/
VAStatus psb_surface_set_chroma(psb_surface_p psb_surface, int chroma)
{
- void *surface_data;
+ unsigned char *surface_data;
int ret = psb_buffer_map(&psb_surface->buf, &surface_data);
if (ret) return VA_STATUS_ERROR_UNKNOWN;
@@ -262,3 +298,40 @@ VAStatus psb_surface_query_status(psb_surface_p psb_surface, VASurfaceStatus *st
return VA_STATUS_SUCCESS;
}
+
+/*
+ * Set current displaying surface info to kernel
+ * so that other component can access it in another process
+ */
+int psb_surface_set_displaying(psb_driver_data_p driver_data,
+ int width, int height,
+ psb_surface_p psb_surface)
+{
+ struct drm_lnc_video_getparam_arg arg;
+ struct drm_video_displaying_frameinfo value;
+ int ret = 0;
+
+ if (psb_surface) {
+ value.buf_handle = (uint32_t)(wsbmKBufHandle(wsbmKBuf(psb_surface->buf.drm_buf)));
+ value.width = width;
+ value.height = height;
+ value.size = psb_surface->size;
+ value.format = psb_surface->extra_info[4];
+ value.luma_stride = psb_surface->stride;
+ value.chroma_u_stride = psb_surface->stride;
+ value.chroma_v_stride = psb_surface->stride;
+ value.luma_offset = psb_surface->luma_offset;
+ value.chroma_u_offset = psb_surface->chroma_offset;
+ value.chroma_v_offset = psb_surface->chroma_offset;
+ } else /* clean kernel displaying surface info */
+ memset(&value, 0, sizeof(value));
+
+ arg.key = IMG_VIDEO_SET_DISPLAYING_FRAME;
+ arg.value = (uint64_t)((unsigned long) & value);
+ ret = drmCommandWriteRead(driver_data->drm_fd, driver_data->getParamIoctlOffset,
+ &arg, sizeof(arg));
+ if (ret != 0)
+ psb__error_message("IMG_VIDEO_SET_DISPLAYING_FRAME failed\n");
+
+ return ret;
+}
diff --git a/src/psb_surface.h b/src/psb_surface.h
index 53c11f8..9274c54 100644
--- a/src/psb_surface.h
+++ b/src/psb_surface.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -60,9 +60,10 @@ struct psb_surface_s {
/* Used to store driver private data, e.g. decoder specific intermediate status data
* extra_info[0-3]: used for decode
* extra_info[4]: surface fourcc
- * extra_info[5]: surface skippeded or not for encode
+ * extra_info[5]: surface skippeded or not for encode, rotate info for decode
+ * extra_info[6]: mfld protected surface
*/
- int extra_info[6];
+ int extra_info[8];
int size;
unsigned int bc_buffer;
};
@@ -89,6 +90,20 @@ VAStatus psb_surface_create_for_userptr(
psb_surface_p psb_surface /* out */
);
+VAStatus psb_surface_create_from_kbuf(
+ psb_driver_data_p driver_data,
+ int width, int height,
+ unsigned size, /* total buffer size need to be allocated */
+ unsigned int fourcc, /* expected fourcc */
+ int kbuf_handle, /*kernel handle */
+ 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, /* UV offset from the beginning of the memory */
+ unsigned int chroma_v_offset,
+ psb_surface_p psb_surface /* out */
+);
VAStatus psb_surface_create_camera(psb_driver_data_p driver_data,
@@ -130,4 +145,11 @@ VAStatus psb_surface_sync(psb_surface_p psb_surface);
*/
VAStatus psb_surface_query_status(psb_surface_p psb_surface, VASurfaceStatus *status);
+/*
+ * Set current displaying surface info to kernel
+ */
+int psb_surface_set_displaying(psb_driver_data_p driver_data,
+ int width, int height,
+ psb_surface_p psb_surface);
+
#endif /* _PSB_SURFACE_H_ */
diff --git a/src/psb_surface_ext.h b/src/psb_surface_ext.h
index fc98f5a..e7e28bc 100644
--- a/src/psb_surface_ext.h
+++ b/src/psb_surface_ext.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/psb_texstreaming.c b/src/psb_texstreaming.c
index 793228d..98c62ae 100644
--- a/src/psb_texstreaming.c
+++ b/src/psb_texstreaming.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -28,6 +28,7 @@
#include <va/va.h>
#include <va/va_backend.h>
+#include <wsbm/wsbm_manager.h>
#ifdef ANDROID
#include "android/psb_android_glue.h"
@@ -40,21 +41,21 @@
#define INIT_DRIVER_DATA psb_driver_data_p driver_data = (psb_driver_data_p) ctx->pDriverData;
#define SURFACE(id) ((object_surface_p) object_heap_lookup( &driver_data->surface_heap, id ))
-VAStatus psb_register_video_bcd(
- VADriverContextP ctx,
- int width,
- int height,
- int stride,
- int num_surfaces,
- VASurfaceID *surface_list
-)
+int psb_register_video_bcd(VADriverContextP ctx)
{
- INIT_DRIVER_DATA
- int i;
- VAStatus vaStatus = VA_STATUS_SUCCESS;
-
+ INIT_DRIVER_DATA;
+ int width, height, stride, num_surfaces;
+ VASurfaceID *surface_list;
BC_Video_ioctl_package ioctl_package;
bc_buf_params_t buf_param;
+ bc_buf_ptr_t buf_pa;
+ int ret, i;
+
+ width = driver_data->bcd_buffer_width;
+ height = driver_data->bcd_buffer_height;
+ stride = driver_data->bcd_buffer_stride;
+ num_surfaces = driver_data->bcd_buffer_num;
+ surface_list = driver_data->bcd_buffer_surfaces;
buf_param.count = num_surfaces;
buf_param.width = width;
@@ -62,39 +63,38 @@ VAStatus psb_register_video_bcd(
buf_param.height = height;
buf_param.fourcc = BC_PIX_FMT_NV12;
buf_param.type = BC_MEMORY_USERPTR;
-#ifdef ANDROID
- driver_data->bcd_ioctrl_num = IS_MFLD(driver_data) ? 0x32 : 0x2c;
-#else
- driver_data->bcd_ioctrl_num = 0x32;
-#endif
-
- psb__information_message("In psb_register_video_bcd, call BC_Video_ioctl_request_buffers to request buffers in BCD driver.\n");
- psb__information_message("buffer count is %d, width is %d, stride is %d, height is %d.\n", num_surfaces, width, stride, height);
+ driver_data->bcd_ioctrl_num = driver_data->getParamIoctlOffset + 1;
+ psb__information_message("BCD: request buffers in BCD driver\n");
+ psb__information_message("BCD: %d buffers, %dx%d, stride %d\n", num_surfaces, width, stride, height);
ioctl_package.ioctl_cmd = BC_Video_ioctl_request_buffers;
ioctl_package.inputparam = (int)(&buf_param);
- if (drmCommandWriteRead(driver_data->drm_fd, driver_data->bcd_ioctrl_num, &ioctl_package, sizeof(ioctl_package)) != 0) {
- psb__error_message("Failed to request buffers from buffer class video driver.\n");
- return VA_STATUS_ERROR_UNKNOWN;
+ if (drmCommandWriteRead(driver_data->drm_fd,
+ driver_data->bcd_ioctrl_num,
+ &ioctl_package,
+ sizeof(ioctl_package)) != 0) {
+ psb__error_message("BCD: failed to request buffers\n");
+ return -1;
}
driver_data->bcd_id = ioctl_package.outputparam;
driver_data->bcd_registered = 1;
- psb__information_message("In psb_register_video_bcd, the allocated bc device id is %d.\n", driver_data->bcd_id);
- psb__information_message("In psb_register_video_bcd, call BC_Video_ioctl_get_buffer_count to get buffer count.\n");
+ psb__information_message("BCD: allocated bc device id is %d\n", driver_data->bcd_id);
+ psb__information_message("BCD: try to get buffer count\n");
ioctl_package.ioctl_cmd = BC_Video_ioctl_get_buffer_count;
ioctl_package.device_id = driver_data->bcd_id;
- if (drmCommandWriteRead(driver_data->drm_fd, driver_data->bcd_ioctrl_num, &ioctl_package, sizeof(ioctl_package)) != 0) {
- psb__error_message("Failed to get buffer count from buffer class video driver.\n");
- return VA_STATUS_ERROR_UNKNOWN;
+ if (drmCommandWriteRead(driver_data->drm_fd,
+ driver_data->bcd_ioctrl_num,
+ &ioctl_package,
+ sizeof(ioctl_package)) != 0) {
+ psb__error_message("BCD: failed to get buffer count\n");
+ return -1;
}
if (ioctl_package.outputparam != num_surfaces) {
- psb__error_message("buffer count is not correct.\n");
- return VA_STATUS_ERROR_UNKNOWN;
+ psb__error_message("BCD: buffer count is not correct (%d expected, actual %d).\n",
+ num_surfaces, ioctl_package.outputparam);
+ return -1;
}
-
- psb__information_message("In psb_register_video_bcd, call BC_Video_ioctl_set_buffer_phyaddr to bind buffer id with physical address.\n");
- bc_buf_ptr_t buf_pa;
-
+ psb__information_message("BCD:set_buffer_phyaddr to bind buffer id with physical address.\n");
for (i = 0; i < num_surfaces; i++) {
psb_surface_p psb_surface;
object_surface_p obj_surface = SURFACE(surface_list[i]);
@@ -108,37 +108,130 @@ VAStatus psb_register_video_bcd(
ioctl_package.device_id = driver_data->bcd_id;
ioctl_package.inputparam = (int)(&buf_pa);
/*bind bcd buffer index with ttm buffer handle and set buffer phyaddr in kernel driver*/
- if (drmCommandWriteRead(driver_data->drm_fd, driver_data->bcd_ioctrl_num, &ioctl_package, sizeof(ioctl_package)) != 0) {
- psb__error_message("Failed to set buffer phyaddr from buffer class video driver.\n");
- return VA_STATUS_ERROR_UNKNOWN;
+ if (drmCommandWriteRead(driver_data->drm_fd,
+ driver_data->bcd_ioctrl_num,
+ &ioctl_package,
+ sizeof(ioctl_package)) != 0) {
+ psb__error_message("BCD: failed to set buffer phyaddr\n");
+ return -1;
}
}
- psb__information_message("num_surface = %d, bcd_id = %d\n", num_surfaces, driver_data->bcd_id);
- return vaStatus;
+ psb__information_message("BCD: num_surface = %d, bcd_id = %d\n", num_surfaces, driver_data->bcd_id);
+ psb__android_message("BCD: register num_surface = %d, %dx%d, bcd_id = %d\n",
+ num_surfaces, width, height, driver_data->bcd_id);
+
+ return 0;
}
-VAStatus psb_release_video_bcd(VADriverContextP ctx)
+int psb_release_video_bcd(VADriverContextP ctx)
{
- INIT_DRIVER_DATA
- VAStatus vaStatus = VA_STATUS_SUCCESS;
+ INIT_DRIVER_DATA;
+ BC_Video_ioctl_package ioctl_package;
/*destroyTextureStreamSource can be called by LayerBuffer::unregisterBuffers automatically
*But h264vld will not that destroyTextureStreamSource, so still keep it here
*otherwise, will get "Erroneous page count" error.
*/
#ifdef ANDROID
- psb__information_message("In psb_release_video_bcd, call psb_android_texture_streaming_destroy to destroy texture streaming source.\n");
- psb_android_texture_streaming_destroy();
+ if (driver_data->ts_source_created) {
+ psb__information_message("BCD:destroy texture streaming source.\n");
+ psb_android_texture_streaming_destroy();
+ driver_data->ts_source_created = 0;
+ }
#endif
- BC_Video_ioctl_package ioctl_package;
- psb__information_message("In psb_release_video_bcd, call BC_Video_ioctl_release_buffer_device to release video buffer device id.\n");
+ psb__information_message("BCD: release video buffer device id.\n");
ioctl_package.ioctl_cmd = BC_Video_ioctl_release_buffer_device;
ioctl_package.device_id = driver_data->bcd_id;
- if (drmCommandWriteRead(driver_data->drm_fd, driver_data->bcd_ioctrl_num, &ioctl_package, sizeof(ioctl_package)) != 0) {
- psb__error_message("Failed to release video buffer class device.\n");
- return VA_STATUS_ERROR_UNKNOWN;
+ if (drmCommandWriteRead(driver_data->drm_fd,
+ driver_data->bcd_ioctrl_num,
+ &ioctl_package,
+ sizeof(ioctl_package)) != 0) {
+ psb__error_message("BCD: failed to release video buffer class device.\n");
+ return -1;
}
driver_data->bcd_registered = 0;
+ driver_data->bcd_buffer_num = 0;
+ if (driver_data->bcd_buffer_surfaces) {
+ free(driver_data->bcd_buffer_surfaces);
+ driver_data->bcd_buffer_surfaces = NULL;
+ }
+
+ return 0;
+}
+
+/*
+ * return the BCD buffer index,
+ * or -1 if the surface is not BCD buffer
+ */
+int psb_get_video_bcd(
+ VADriverContextP ctx,
+ VASurfaceID surface)
+{
+ INIT_DRIVER_DATA;
+ VAStatus vaStatus = VA_STATUS_SUCCESS;
+ VASurfaceID *surface_list;
+ int ret = 0;
+ unsigned int i;
+
+ if (driver_data->bcd_registered == 0) {
+ ret = psb_register_video_bcd(ctx);
+ if (ret != 0)
+ driver_data->bcd_buffer_num = 0;
+
+ driver_data->bcd_registered = 1;
+ }
+
+ surface_list = driver_data->bcd_buffer_surfaces;
+
+ for (i = 0; i < driver_data->bcd_buffer_num; i++) {
+ if (surface == surface_list[i])
+ break;
+ }
+
+ if (i == driver_data->bcd_buffer_num)
+ return -1;
+
+
+ return i;
+}
+
+/* keep BCD info for later registing */
+int psb_add_video_bcd(
+ VADriverContextP ctx,
+ int width,
+ int height,
+ int stride,
+ int num_surfaces,
+ VASurfaceID *surface_list
+)
+{
+ INIT_DRIVER_DATA;
+ int oldbuf_num = driver_data->bcd_buffer_num;
+
+ /* add new buffer, check the resolution with the previous buffers */
+ if ((oldbuf_num != 0) &&
+ ((driver_data->bcd_buffer_width != width ||
+ driver_data->bcd_buffer_height != height ||
+ driver_data->bcd_buffer_stride != stride))) {
+ psb__error_message("BCD only supports one instance, previous (%dx%d,stride %d), new (%dx%d,stride %d)\n",
+ driver_data->bcd_buffer_width,
+ driver_data->bcd_buffer_height,
+ driver_data->bcd_buffer_stride,
+ width, height, stride);
+
+ return -1;
+ } else {
+ driver_data->bcd_buffer_width = width;
+ driver_data->bcd_buffer_height = height;
+ driver_data->bcd_buffer_stride = stride;
+ }
+
+ driver_data->bcd_buffer_num += num_surfaces;
+ driver_data->bcd_buffer_surfaces = realloc(driver_data->bcd_buffer_surfaces,
+ driver_data->bcd_buffer_num * sizeof(VASurfaceID));
+ memcpy(driver_data->bcd_buffer_surfaces + oldbuf_num,
+ &surface_list[0],
+ num_surfaces * sizeof(VASurfaceID));
- return vaStatus;
+ return 0;
}
diff --git a/src/psb_texstreaming.h b/src/psb_texstreaming.h
index d4de665..cba8975 100644
--- a/src/psb_texstreaming.h
+++ b/src/psb_texstreaming.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -82,7 +82,7 @@ typedef struct bc_buf_params {
enum BC_memory type;
} bc_buf_params_t;
-VAStatus psb_register_video_bcd(
+int psb_add_video_bcd(
VADriverContextP ctx,
int width,
int height,
@@ -90,8 +90,12 @@ VAStatus psb_register_video_bcd(
int num_surfaces,
VASurfaceID *surface_list
);
-
-VAStatus psb_release_video_bcd(VADriverContextP ctx);
+int psb_get_video_bcd(
+ VADriverContextP ctx,
+ VASurfaceID surface
+);
+int psb_register_video_bcd(VADriverContextP ctx);
+int psb_release_video_bcd(VADriverContextP ctx);
/*add for texture streaming end*/
#endif /*_PSB_TEXSTREAMING_H*/
diff --git a/src/psb_texture.c b/src/psb_texture.c
index 97729c2..da26005 100644
--- a/src/psb_texture.c
+++ b/src/psb_texture.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -29,6 +29,7 @@
*/
#include <stdio.h>
+#include <unistd.h>
#include <math.h>
#include <psb_drm.h>
@@ -54,6 +55,7 @@
#define INIT_DRIVER_DATA psb_driver_data_p driver_data = (psb_driver_data_p) ctx->pDriverData;
#define INIT_OUTPUT_PRIV psb_x11_output_p output = (psb_x11_output_p)(((psb_driver_data_p)ctx->pDriverData)->ws_priv)
#define SURFACE(id) ((object_surface_p) object_heap_lookup( &driver_data->surface_heap, id ))
+#define SUBPIC(id) ((object_subpic_p) object_heap_lookup( &driver_data->subpic_heap, id ))
#define Degree (2*PI / 360.0)
#define PI 3.1415927
@@ -153,7 +155,7 @@ static unsigned long PVRCalculateStride(unsigned long widthInPixels, unsigned in
return ((ulActiveLinelenInPixels * bitsPerPixel) + 7) >> 3;
}
-static int pvr_context_create(void **pvr_ctx)
+static int pvr_context_create(unsigned char **pvr_ctx)
{
int ret = 0;
int pvr_devices = PVR2DEnumerateDevices(0);
@@ -192,19 +194,23 @@ out:
return ret;
}
-void psb_ctexture_init(VADriverContextP ctx)
+void psb_fix_drmfd_closesequence(psb_driver_data_p driver_data)
+{
+ driver_data->dup_drm_fd = dup(driver_data->drm_fd);
+}
+
+
+int psb_ctexture_init(VADriverContextP ctx)
{
INIT_DRIVER_DATA;
-#ifndef ANDROID
- INIT_OUTPUT_PRIV;
-#endif
struct psb_texture_s *texture_priv = &driver_data->ctexture_priv;
int i, ret;
- ret = pvr_context_create(&texture_priv->hPVR2DContext);
+ ret = pvr_context_create(&driver_data->hPVR2DContext);
if (ret != PVR2D_OK) {
psb__error_message("%s(): null PVR context!!", __func__);
+ return ret;
}
texture_priv->video_transfermatrix = PSB_VideoTransferMatrix_BT709;
@@ -226,7 +232,7 @@ void psb_ctexture_init(VADriverContextP ctx)
texture_priv->gamma2 = 0x202020;
texture_priv->gamma1 = 0x101010;
texture_priv->gamma0 = 0x080808;
-#ifndef ANDROID
+
texture_priv->dri_init_flag = 0;
texture_priv->drawable_update_flag = 0;
texture_priv->extend_dri_init_flag = 0;
@@ -237,14 +243,8 @@ void psb_ctexture_init(VADriverContextP ctx)
texture_priv->desth_save = 0;
texture_priv->local_rotation_save = -1;
texture_priv->extend_rotation_save = -1;
- output->output_drawable = 0;
- output->extend_drawable = 0;
- for (i = 0; i < VIDEO_BUFFER_NUM; i++) {
- texture_priv->videoBuf[i] = NULL;
- texture_priv->subpicBuf[i] = NULL;
- texture_priv->wrapped_surface_id[i] = -1;
- texture_priv->wrapped_subpic_id[i] = -1;
- }
+ texture_priv->dri_drawable = NULL;
+ texture_priv->extend_dri_drawable = NULL;
for (i = 0; i < DRI2_BLIT_BUFFERS_NUM; i++) {
texture_priv->blt_meminfo[i] = NULL;
@@ -255,50 +255,33 @@ void psb_ctexture_init(VADriverContextP ctx)
texture_priv->flip_meminfo[i] = NULL;
texture_priv->blt_meminfo_pixmap = NULL;
-#endif
+
for (i = 0; i < 6; i++)
texture_priv->pal_meminfo[i] = NULL;
psb_setup_coeffs(texture_priv);
+ psb_fix_drmfd_closesequence(driver_data);
+
+ return 0;
}
void psb_ctexture_deinit(VADriverContextP ctx)
{
INIT_DRIVER_DATA;
-#ifndef ANDROID
- INIT_OUTPUT_PRIV;
-#endif
PVR2DERROR ePVR2DStatus;
int i;
struct psb_texture_s *texture_priv = &driver_data->ctexture_priv;
-#ifndef ANDROID
- for (i = 0; i < VIDEO_BUFFER_NUM; i++) {
- if (texture_priv->videoBuf[i]) {
- ePVR2DStatus = PVR2DMemFree(texture_priv->hPVR2DContext, texture_priv->videoBuf[i]);
- if (ePVR2DStatus != PVR2D_OK)
- psb__error_message("%s: PVR2DMemFree error %d\n", __FUNCTION__, ePVR2DStatus);
- }
-
- if (texture_priv->subpicBuf[i]) {
- ePVR2DStatus = PVR2DMemFree(texture_priv->hPVR2DContext, texture_priv->subpicBuf[i]);
- if (ePVR2DStatus != PVR2D_OK)
- psb__error_message("%s: PVR2DMemFree error %d\n", __FUNCTION__, ePVR2DStatus);
- }
-
- texture_priv->wrapped_surface_id[i] = -1;
- texture_priv->wrapped_subpic_id[i] = -1;
- }
if (texture_priv->blt_meminfo_pixmap) {
- ePVR2DStatus = PVR2DMemFree(texture_priv->hPVR2DContext, texture_priv->blt_meminfo_pixmap);
+ ePVR2DStatus = PVR2DMemFree(driver_data->hPVR2DContext, texture_priv->blt_meminfo_pixmap);
if (ePVR2DStatus != PVR2D_OK)
psb__error_message("%s: PVR2DMemFree error %d\n", __FUNCTION__, ePVR2DStatus);
}
for (i = 0; i < DRI2_BLIT_BUFFERS_NUM; i++) {
if (texture_priv->blt_meminfo[i]) {
- ePVR2DStatus = PVR2DMemFree(texture_priv->hPVR2DContext, texture_priv->blt_meminfo[i]);
+ ePVR2DStatus = PVR2DMemFree(driver_data->hPVR2DContext, texture_priv->blt_meminfo[i]);
if (ePVR2DStatus != PVR2D_OK)
psb__error_message("%s: PVR2DMemFree error %d\n", __FUNCTION__, ePVR2DStatus);
texture_priv->blt_meminfo[i] = NULL;
@@ -307,7 +290,7 @@ void psb_ctexture_deinit(VADriverContextP ctx)
for (i = 0; i < DRI2_FLIP_BUFFERS_NUM; i++) {
if (texture_priv->flip_meminfo[i]) {
- ePVR2DStatus = PVR2DMemFree(texture_priv->hPVR2DContext, texture_priv->flip_meminfo[i]);
+ ePVR2DStatus = PVR2DMemFree(driver_data->hPVR2DContext, texture_priv->flip_meminfo[i]);
if (ePVR2DStatus != PVR2D_OK)
psb__error_message("%s: PVR2DMemFree error %d\n", __FUNCTION__, ePVR2DStatus);
texture_priv->flip_meminfo[i] = NULL;
@@ -316,39 +299,32 @@ void psb_ctexture_deinit(VADriverContextP ctx)
for (i = 0; i < DRI2_BLIT_BUFFERS_NUM; i++) {
if (texture_priv->extend_blt_meminfo[i]) {
- ePVR2DStatus = PVR2DMemFree(texture_priv->hPVR2DContext, texture_priv->extend_blt_meminfo[i]);
+ ePVR2DStatus = PVR2DMemFree(driver_data->hPVR2DContext, texture_priv->extend_blt_meminfo[i]);
if (ePVR2DStatus != PVR2D_OK)
psb__error_message("%s: PVR2DMemFree error %d\n", __FUNCTION__, ePVR2DStatus);
texture_priv->extend_blt_meminfo[i] = NULL;
}
}
- if (output->extend_drawable) {
- XDestroyWindow(ctx->native_dpy, output->extend_drawable);
- output->extend_drawable = 0;
- }
-#endif
for (i = 0; i < 6; i++) {
if (texture_priv->pal_meminfo[i]) {
- ePVR2DStatus = PVR2DMemFree(texture_priv->hPVR2DContext, texture_priv->pal_meminfo[i]);
+ ePVR2DStatus = PVR2DMemFree(driver_data->hPVR2DContext, texture_priv->pal_meminfo[i]);
if (ePVR2DStatus != PVR2D_OK)
psb__error_message("%s: PVR2DMemFree error %d\n", __FUNCTION__, ePVR2DStatus);
texture_priv->pal_meminfo[i] = NULL;
}
}
-#ifndef ANDROID
- if (texture_priv->hPVR2DContext) {
- ePVR2DStatus = PVR2DDestroyDeviceContext(texture_priv->hPVR2DContext);
- if (ePVR2DStatus != PVR2D_OK)
- psb__error_message("%s: PVR2DMemFree error %d\n", __FUNCTION__, ePVR2DStatus);
- texture_priv->hPVR2DContext = NULL;
+ if (driver_data->hPVR2DContext) {
+ ePVR2DStatus = PVR2DDestroyDeviceContext(driver_data->hPVR2DContext);
+ if (ePVR2DStatus != PVR2D_OK)
+ psb__error_message("%s: PVR2DMemFree error %d\n", __FUNCTION__, ePVR2DStatus);
+ driver_data->hPVR2DContext = NULL;
}
-#endif
-
- (void)texture_priv;
+ if (driver_data->dup_drm_fd)
+ close(driver_data->dup_drm_fd);
}
/* calculate subpicture size according to the downscale situation of both main and subpicture bitstream */
@@ -383,23 +359,21 @@ static void psb_calculate_subpic_size(int surf_width, int surf_height, int dst_w
static PPVR2DMEMINFO psb_check_subpic_buffer(psb_driver_data_p driver_data, PsbVASurfaceRec* surface_subpic)
{
- int i, j;
+ unsigned int i, j;
unsigned char* tmp_buffer;
unsigned char tmp;
-
- struct psb_texture_s *texture_priv = &driver_data->ctexture_priv;
PVR2DERROR ePVR2DStatus;
/* Find and return the wrapped buffer index */
for (i = 0; i < VIDEO_BUFFER_NUM; i++) {
- if (texture_priv->wrapped_subpic_id[i] == surface_subpic->subpic_id && texture_priv->subpicBuf[i]) {
- return texture_priv->subpicBuf[i];
+ if (driver_data->wrapped_subpic_id[i] == surface_subpic->subpic_id && driver_data->subpicBuf[i]) {
+ return driver_data->subpicBuf[i];
}
}
/* Wrap a un-wrapped buffer and return */
for (i = 0; i < VIDEO_BUFFER_NUM; i++) {
- if (texture_priv->wrapped_subpic_id[i] == -1) {
+ if (driver_data->wrapped_subpic_id[i] == VA_INVALID_ID) {
tmp_buffer = NULL;
tmp_buffer = wsbmBOMap(surface_subpic->bo, WSBM_ACCESS_READ | WSBM_ACCESS_WRITE);
for (j = 0; j < surface_subpic->size; j = j + 4096) {
@@ -408,18 +382,19 @@ static PPVR2DMEMINFO psb_check_subpic_buffer(psb_driver_data_p driver_data, PsbV
*(tmp_buffer + j) = 0;
}
- ePVR2DStatus = PVR2DMemWrap(texture_priv->hPVR2DContext,
+ ePVR2DStatus = PVR2DMemWrap(driver_data->hPVR2DContext,
tmp_buffer,
0,
surface_subpic->size,
NULL,
- &texture_priv->subpicBuf[i]);
+ &driver_data->subpicBuf[i]);
if (ePVR2DStatus != PVR2D_OK) {
psb__error_message("%s: PVR2DMemWrap error %d\n", __FUNCTION__, ePVR2DStatus);
+ return NULL;
}
- texture_priv->wrapped_subpic_id[i] = surface_subpic->subpic_id;
- return texture_priv->subpicBuf[i];
+ driver_data->wrapped_subpic_id[i] = surface_subpic->subpic_id;
+ return driver_data->subpicBuf[i];
}
}
@@ -431,27 +406,65 @@ static PPVR2DMEMINFO psb_check_subpic_buffer(psb_driver_data_p driver_data, PsbV
return NULL;
}
-static PPVR2DMEMINFO psb_check_video_buffer(psb_driver_data_p driver_data, VASurfaceID surface)
+
+void psb_init_surface_pvr2dbuf(psb_driver_data_p driver_data)
+{
+ int i;
+ for (i = 0; i < VIDEO_BUFFER_NUM; i++) {
+ driver_data->videoBuf[i] = NULL;
+ driver_data->subpicBuf[i] = NULL;
+ driver_data->wrapped_surface_id[i] = VA_INVALID_ID;
+ driver_data->wrapped_subpic_id[i] = VA_INVALID_ID;
+ }
+
+}
+
+void psb_free_surface_pvr2dbuf(psb_driver_data_p driver_data)
+{
+ int i;
+ PVR2DERROR ePVR2DStatus;
+
+ for (i = 0; i < VIDEO_BUFFER_NUM; i++) {
+ if ((driver_data->wrapped_surface_id[i] != VA_INVALID_ID) && driver_data->videoBuf[i]) {
+ ePVR2DStatus = PVR2DMemFree(driver_data->hPVR2DContext, driver_data->videoBuf[i]);
+ if (ePVR2DStatus != PVR2D_OK)
+ psb__error_message("%s: PVR2DMemFree error %d\n", __FUNCTION__, ePVR2DStatus);
+ }
+
+ if ((driver_data->wrapped_subpic_id[i] != VA_INVALID_ID) && driver_data->subpicBuf[i]) {
+ ePVR2DStatus = PVR2DMemFree(driver_data->hPVR2DContext, driver_data->subpicBuf[i]);
+ if (ePVR2DStatus != PVR2D_OK)
+ psb__error_message("%s: PVR2DMemFree error %d\n", __FUNCTION__, ePVR2DStatus);
+ }
+
+ driver_data->wrapped_surface_id[i] = VA_INVALID_ID;
+ driver_data->wrapped_subpic_id[i] = -1;
+
+ driver_data->videoBuf[i] = NULL;
+ driver_data->subpicBuf[i] = NULL;
+ }
+}
+
+
+static PPVR2DMEMINFO psb_wrap_surface_pvr2dbuf(psb_driver_data_p driver_data, VASurfaceID surface)
{
int i, j;
unsigned char* tmp_buffer;
unsigned char tmp;
-
- struct psb_texture_s *texture_priv = &driver_data->ctexture_priv;
object_surface_p obj_surface = SURFACE(surface);
psb_surface_p psb_surface = obj_surface->psb_surface;
PVR2DERROR ePVR2DStatus;
/* Find and return the wrapped buffer index */
for (i = 0; i < VIDEO_BUFFER_NUM; i++) {
- if (texture_priv->wrapped_surface_id[i] == surface && texture_priv->videoBuf[i]) {
- return texture_priv->videoBuf[i];
+ if (driver_data->wrapped_surface_id[i] == surface && driver_data->videoBuf[i]) {
+ return driver_data->videoBuf[i];
}
}
/* Wrap a un-wrapped buffer and return */
for (i = 0; i < VIDEO_BUFFER_NUM; i++) {
- if (texture_priv->wrapped_surface_id[i] == -1) {
+ if (driver_data->wrapped_surface_id[i] == VA_INVALID_ID) {
tmp_buffer = NULL;
tmp_buffer = wsbmBOMap(psb_surface->buf.drm_buf, WSBM_ACCESS_READ | WSBM_ACCESS_WRITE);
for (j = 0; j < psb_surface->size; j = j + 4096) {
@@ -460,18 +473,18 @@ static PPVR2DMEMINFO psb_check_video_buffer(psb_driver_data_p driver_data, VASur
*(tmp_buffer + j) = 0;
}
- ePVR2DStatus = PVR2DMemWrap(texture_priv->hPVR2DContext,
+ ePVR2DStatus = PVR2DMemWrap(driver_data->hPVR2DContext,
tmp_buffer,
0,
psb_surface->size,
NULL,
- &texture_priv->videoBuf[i]);
+ &driver_data->videoBuf[i]);
if (ePVR2DStatus != PVR2D_OK) {
psb__error_message("%s: PVR2DMemWrap error %d\n", __FUNCTION__, ePVR2DStatus);
}
- texture_priv->wrapped_surface_id[i] = surface;
- return texture_priv->videoBuf[i];
+ driver_data->wrapped_surface_id[i] = surface;
+ return driver_data->videoBuf[i];
}
}
@@ -483,25 +496,15 @@ static PPVR2DMEMINFO psb_check_video_buffer(psb_driver_data_p driver_data, VASur
return NULL;
}
-#ifndef ANDROID
void psb_putsurface_textureblit(
- VADriverContextP ctx, PPVR2DMEMINFO pDstMeminfo, VASurfaceID surface, int src_x, int src_y, int src_w,
+ VADriverContextP ctx, unsigned char *dst, VASurfaceID surface, int src_x, int src_y, int src_w,
int src_h, int dst_x, int dst_y, int dst_w, int dst_h, unsigned int subtitle,
int width, int height,
int src_pitch, struct _WsbmBufferObject * src_buf,
- unsigned int placement)
-#else
-void psb_putsurface_textureblit(
- VADriverContextP ctx, unsigned char * data, VASurfaceID surface, int src_x, int src_y, int src_w,
- int src_h, int dst_x, int dst_y, int dst_w, int dst_h,
- int width, int height,
- int src_pitch, struct _WsbmBufferObject * src_buf,
- unsigned int placement)
-#endif
+ unsigned int placement, int wrap_dst)
{
-#ifndef ANDROID
INIT_DRIVER_DATA;
- int i;
+ unsigned int i;
unsigned char *tmp_palette;
struct psb_texture_s *texture_priv = &driver_data->ctexture_priv;
object_surface_p obj_surface;
@@ -512,6 +515,7 @@ void psb_putsurface_textureblit(
PVR2DERROR ePVR2DStatus;
PPVR2DMEMINFO pVaVideoSubpicMemInfo;
PPVR2DMEMINFO pVaVideoMemInfo;
+ PPVR2DMEMINFO pDstMeminfo;
src_pitch = (src_pitch + 0x3) & ~0x3;
@@ -540,37 +544,41 @@ void psb_putsurface_textureblit(
sBltVP.bCoeffsGiven = 1;
}
- pVaVideoMemInfo = psb_check_video_buffer(driver_data, surface);
- if (!pVaVideoMemInfo)
+ pVaVideoMemInfo = psb_wrap_surface_pvr2dbuf(driver_data, surface);
+ if (!pVaVideoMemInfo) {
psb__error_message("%s: Failed to get source PVR2DMEMINFO!\n", __func__);
+ return;
+ }
/* wrap the dest source */
/* FIXME: this is wrap for rgb565 */
-#ifdef ANDROID
- PVR2DMEMINFO *pDstMeminfo;
- ePVR2DStatus = PVR2DMemWrap(texture_priv->hPVR2DContext,
- data,
- 0,
- (dst_w * dst_h * 2),
- NULL,
- &pDstMeminfo);
- if (ePVR2DStatus != PVR2D_OK) {
- psb__error_message("%s: PVR2DMemWrap error %d\n", __FUNCTION__, ePVR2DStatus);
+ if (wrap_dst == 0) {
+
+ pDstMeminfo = (PPVR2DMEMINFO)dst;
+ if (IS_MRST(driver_data))
+ sBltVP.sDst.Stride = PVRCalculateStride(((struct dri_drawable*)texture_priv->dri_drawable)->width, 32, 32);
+ if (IS_MFLD(driver_data))
+ sBltVP.sDst.Stride = PVRCalculateStride(((struct dri_drawable*)texture_priv->dri_drawable)->width, 32, 8);
+ sBltVP.sDst.Format = PVR2D_ARGB8888;
+
+ } else {
+ ePVR2DStatus = PVR2DMemWrap(driver_data->hPVR2DContext,
+ dst,
+ 0,
+ (dst_w * dst_h * 2),
+ NULL,
+ &pDstMeminfo);
+ if (ePVR2DStatus != PVR2D_OK) {
+ psb__error_message("%s: PVR2DMemWrap error %d\n", __FUNCTION__, ePVR2DStatus);
+ return;
+ }
+
+ /* FIXME: this wrong, how to get system pitch */
+ sBltVP.sDst.Stride = dst_w * 2;//align_to(dst_w, 64);
+ sBltVP.sDst.Format = PVR2D_RGB565;
}
-#endif
sBltVP.sDst.pSurfMemInfo = pDstMeminfo;
sBltVP.sDst.SurfOffset = 0;
-#ifndef ANDROID
- if (IS_MFLD(driver_data))
- sBltVP.sDst.Stride = PVRCalculateStride(dst_w, 32, 8);
- if (IS_MRST(driver_data))
- sBltVP.sDst.Stride = PVRCalculateStride(dst_w, 32, 32);
- sBltVP.sDst.Format = PVR2D_ARGB8888;
-#else
- /* FIXME: this wrong, how to get system pitch */
- sBltVP.sDst.Stride = dst_w * 2;//align_to(dst_w, 64);
- sBltVP.sDst.Format = PVR2D_RGB565;
-#endif
sBltVP.sDst.SurfWidth = dst_w;
sBltVP.sDst.SurfHeight = dst_h;
@@ -600,20 +608,21 @@ void psb_putsurface_textureblit(
sBltVP.rcSource->top = src_y;
sBltVP.rcSource->bottom = src_y + src_h;
-#ifdef ANDROID
- if (obj_surface->subpic_count) {
-#else
if (subtitle == 1 && obj_surface->subpic_count) {
-#endif
for (i = 0; i < obj_surface->subpic_count; i++) {
-
sBltVP.uiNumLayers += 1;
psb_calculate_subpic_size(obj_surface->width, obj_surface->height, dst_w, dst_h, surface_subpic);
pVaVideoSubpicMemInfo = psb_check_subpic_buffer(driver_data, surface_subpic);
- if (!pVaVideoSubpicMemInfo)
+ if (!pVaVideoSubpicMemInfo) {
psb__error_message("%s: Failed to get subpic PVR2DMEMINFO!\n", __func__);
+ return;
+ }
+
+ object_subpic_p obj_subpic = SUBPIC(surface_subpic->subpic_id);
+ sBltVP.AlphaBlendingFunc = PVR2D_ALPHA_OP_GLOBAL;
+ sBltVP.subpicGlobalAlpha[i] = obj_subpic->global_alpha;
sBltVP.sSrcSubpic[i].pSurfMemInfo = pVaVideoSubpicMemInfo;
sBltVP.sSrcSubpic[i].SurfOffset = 0;
@@ -640,7 +649,7 @@ void psb_putsurface_textureblit(
//only allocate memory once for palette
if (surface_subpic->fourcc == VA_FOURCC_AI44) {
if (!texture_priv->pal_meminfo[i]) {
- ePVR2DStatus = PVR2DMemAlloc(texture_priv->hPVR2DContext, 16 * sizeof(unsigned int), 0, 0, &texture_priv->pal_meminfo[i]);
+ ePVR2DStatus = PVR2DMemAlloc(driver_data->hPVR2DContext, 16 * sizeof(unsigned int), 0, 0, &texture_priv->pal_meminfo[i]);
if (ePVR2DStatus != PVR2D_OK) {
psb__error_message("%s: PVR2DMemAlloc error %d\n", __FUNCTION__, ePVR2DStatus);
return;
@@ -656,19 +665,23 @@ void psb_putsurface_textureblit(
}
}
- ePVR2DStatus = PVR2DBltVideo(texture_priv->hPVR2DContext, &sBltVP);
- if (ePVR2DStatus != PVR2D_OK) {
+//#ifndef ANDROID /* MRST Android not enable this API, uncomment for MRST */
+ ePVR2DStatus = PVR2DBltVideo(driver_data->hPVR2DContext, &sBltVP);
+//#endif
+
+ if (ePVR2DStatus != PVR2D_OK)
psb__error_message("%s: failed to do PVR2DBltVideo with error code %d\n",
__FUNCTION__, ePVR2DStatus);
- }
-#ifdef ANDROID
- ePVR2DStatus = PVR2DMemFree(texture_priv->hPVR2DContext, pDstMeminfo);
- if (ePVR2DStatus != PVR2D_OK) {
- psb__error_message("%s: PVR2DMemFree error %d\n", __FUNCTION__, ePVR2DStatus);
+ if (wrap_dst) {
+ ePVR2DStatus = PVR2DMemFree(driver_data->hPVR2DContext, pDstMeminfo);
+ if (ePVR2DStatus != PVR2D_OK)
+ psb__error_message("%s: PVR2DMemFree error %d\n", __FUNCTION__, ePVR2DStatus);
}
-#endif
-#endif
+
+ driver_data->cur_displaying_surface = VA_INVALID_SURFACE;
+ driver_data->last_displaying_surface = VA_INVALID_SURFACE;
+ obj_surface->display_timestamp = 0;
}
static void
diff --git a/src/psb_texture.h b/src/psb_texture.h
index 76d7b18..be2b0d8 100644
--- a/src/psb_texture.h
+++ b/src/psb_texture.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -43,6 +43,7 @@
#define DRI2_MAX_BUFFERS_NUM MAX( DRI2_FLIP_BUFFERS_NUM, DRI2_BLIT_BUFFERS_NUM )
#define VIDEO_BUFFER_NUM 20
+
typedef struct _psb_coeffs_ {
signed char rY;
signed char rU;
@@ -81,8 +82,6 @@ typedef struct _PVRDRI2BackBuffersExport_ {
} PVRDRI2BackBuffersExport;
struct psb_texture_s {
- void *hPVR2DContext;
-
struct _WsbmBufferObject *vaSrf;
unsigned int video_transfermatrix;
@@ -102,17 +101,16 @@ struct psb_texture_s {
sgx_psb_fixed32 hue;
psb_coeffs_s coeffs;
- PVR2DMEMINFO *pal_meminfo[6];
- uint32_t wrapped_surface_id[VIDEO_BUFFER_NUM];
- uint32_t wrapped_subpic_id[VIDEO_BUFFER_NUM];
- PVR2DMEMINFO *videoBuf[VIDEO_BUFFER_NUM];
- PVR2DMEMINFO *subpicBuf[VIDEO_BUFFER_NUM];
-#ifndef ANDROID
+
uint32_t update_coeffs;
PVRDRI2BackBuffersExport dri2_bb_export;
PVRDRI2BackBuffersExport extend_dri2_bb_export;
- struct dri_drawable *extend_dri_drawable;
- struct dri_drawable *dri_drawable;
+
+ /* struct dri_drawable *extend_dri_drawable; */
+ /* struct dri_drawable *dri_drawable; */
+ unsigned char *extend_dri_drawable;
+ unsigned char *dri_drawable;
+
uint32_t dri_init_flag;
uint32_t extend_dri_init_flag;
uint32_t adjust_window_flag;
@@ -125,14 +123,14 @@ struct psb_texture_s {
uint32_t local_rotation_save;
uint32_t extend_rotation_save;
+ PVR2DMEMINFO *pal_meminfo[6];
PVR2DMEMINFO *blt_meminfo_pixmap;
PVR2DMEMINFO *blt_meminfo[DRI2_BLIT_BUFFERS_NUM];
PVR2DMEMINFO *flip_meminfo[DRI2_FLIP_BUFFERS_NUM];
PVR2DMEMINFO *extend_blt_meminfo[DRI2_BLIT_BUFFERS_NUM];
-#endif
};
-void psb_ctexture_init(VADriverContextP ctx);
+int psb_ctexture_init(VADriverContextP ctx);
void psb_ctexture_deinit(VADriverContextP ctx);
@@ -140,20 +138,12 @@ void blit_texture_to_buf(VADriverContextP ctx, unsigned char * data, int src_x,
int src_h, int dst_x, int dst_y, int dst_w, int dst_h,
int width, int height, int src_pitch, struct _WsbmBufferObject * src_buf,
unsigned int placement);
-#ifndef ANDROID
+
void psb_putsurface_textureblit(
- VADriverContextP ctx, PPVR2DMEMINFO pDstMeminfo, VASurfaceID surface, int src_x, int src_y, int src_w,
+ VADriverContextP ctx, unsigned char *dst, VASurfaceID surface, int src_x, int src_y, int src_w,
int src_h, int dst_x, int dst_y, int dst_w, int dst_h, unsigned int subtitle,
int width, int height,
int src_pitch, struct _WsbmBufferObject * src_buf,
- unsigned int placement);
-#else
-void psb_putsurface_textureblit(
- VADriverContextP ctx, unsigned char * data, VASurfaceID surface, int src_x, int src_y, int src_w,
- int src_h, int dst_x, int dst_y, int dst_w, int dst_h,
- int width, int height,
- int src_pitch, struct _WsbmBufferObject * src_buf,
- unsigned int placement);
-#endif
+ unsigned int placement, int wrap_dst);
#endif /* !PSB_TEXTURE_H_ */
diff --git a/src/psb_ws_driver.c b/src/psb_ws_driver.c
index 0a1ed21..0652d4c 100644
--- a/src/psb_ws_driver.c
+++ b/src/psb_ws_driver.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.
diff --git a/src/psb_ws_driver.h b/src/psb_ws_driver.h
index 343a23f..5240912 100644
--- a/src/psb_ws_driver.h
+++ b/src/psb_ws_driver.h
@@ -9,11 +9,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.
diff --git a/src/pvr2d.h b/src/pvr2d.h
index 5fe95b1..8d0a3f5 100644
--- a/src/pvr2d.h
+++ b/src/pvr2d.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -40,11 +40,12 @@ extern "C" {
#endif
/* PVR2D header revision */
-#define PVR2D_REV_MAJOR 3
-#define PVR2D_REV_MINOR 5
+#define PVR2D_REV_MAJOR 3
+#define PVR2D_REV_MINOR 5
/* Basic types */
- typedef enum {
+ typedef enum
+ {
PVR2D_FALSE = 0,
PVR2D_TRUE
}
@@ -52,14 +53,14 @@ extern "C" {
typedef void* PVR2D_HANDLE;
- typedef char PVR2D_CHAR, *PVR2D_PCHAR;
- typedef unsigned char PVR2D_UCHAR, *PVR2D_PUCHAR;
- typedef int PVR2D_INT, *PVR2D_PINT;
- typedef unsigned int PVR2D_UINT, *PVR2D_PUINT;
- typedef long PVR2D_LONG, *PVR2D_PLONG;
- typedef unsigned long PVR2D_ULONG, *PVR2D_PULONG;
+ typedef char PVR2D_CHAR, *PVR2D_PCHAR;
+ typedef unsigned char PVR2D_UCHAR, *PVR2D_PUCHAR;
+ typedef int PVR2D_INT, *PVR2D_PINT;
+ typedef unsigned int PVR2D_UINT, *PVR2D_PUINT;
+ typedef long PVR2D_LONG, *PVR2D_PLONG;
+ typedef unsigned long PVR2D_ULONG, *PVR2D_PULONG;
- typedef void PVR2D_VOID, *PVR2D_PVOID;
+ typedef void PVR2D_VOID, *PVR2D_PVOID;
/* error codes */
@@ -82,46 +83,46 @@ extern "C" {
typedef unsigned long PVR2DFORMAT;
/* Standard PVR2D pixel formats */
-#define PVR2D_1BPP 0x00UL // 1bpp mask surface or palletized 1 bit source with 2x32 bit CLUT
-#define PVR2D_RGB565 0x01UL // Common rgb 565 format
-#define PVR2D_ARGB4444 0x02UL // Common argb 4444 format
-#define PVR2D_RGB888 0x03UL // Common rgb 888 format (not supported)
-#define PVR2D_ARGB8888 0x04UL // Common argb 8888 format
-#define PVR2D_ARGB1555 0x05UL // Common argb 1555 format
-#define PVR2D_ALPHA8 0x06UL // Alpha-only 8 bit per pixel (used with a constant fill colour)
-#define PVR2D_ALPHA4 0x07UL // Alpha-only 4 bits per pixel (used with a constant fill colour)
-#define PVR2D_PAL2 0x08UL // Palletized 2 bit format (requires 4x32 bit CLUT)
-#define PVR2D_PAL4 0x09UL // Palletized 4 bit format (requires 16x32 bit CLUT)
-#define PVR2D_PAL8 0x0AUL // Palletized 8 bit format (requires 256x32 bit CLUT)
-#define PVR2D_U8 0x10UL // monochrome unsigned 8 bit
-#define PVR2D_U88 0x11UL // monochrome unsigned 16 bit
-#define PVR2D_S8 0x12UL // signed 8 bit
-#define PVR2D_YUV422_YUYV 0x13UL // YUV 422 low-high byte order Y0UY1V
-#define PVR2D_YUV422_UYVY 0x14UL // YUV 422 low-high byte order UY0VY1
-#define PVR2D_YUV422_YVYU 0x15UL // YUV 422 low-high byte order Y0VY1U
-#define PVR2D_YUV422_VYUY 0x16UL // YUV 422 low-high byte order VY0UY1
-#define PVR2D_YUV420_2PLANE 0x17UL // YUV420 2 Plane
-#define PVR2D_YUV420_3PLANE 0x18UL // YUV420 3 Plane
-#define PVR2D_2101010ARGB 0x19UL // 32 bit 2 10 10 10
-#define PVR2D_888RSGSBS 0x1AUL
-#define PVR2D_16BPP_RAW 0x1BUL // 16 bit raw (no format conversion)
-#define PVR2D_32BPP_RAW 0x1CUL // 32 bit raw
-#define PVR2D_64BPP_RAW 0x1DUL // 64 bit raw
-#define PVR2D_128BPP_RAW 0x1EUL // 128 bit raw
-#define PVR2D_RGBA8888 0x1FUL // Common rgba 888 format
-#define PVR2D_NV12_U8V8 0x20UL // NV12 Plane U8V8
-
-#define PVR2D_NO_OF_FORMATS 0x21UL
+#define PVR2D_1BPP 0x00UL // 1bpp mask surface or palletized 1 bit source with 2x32 bit CLUT
+#define PVR2D_RGB565 0x01UL // Common rgb 565 format
+#define PVR2D_ARGB4444 0x02UL // Common argb 4444 format
+#define PVR2D_RGB888 0x03UL // Common rgb 888 format (not supported)
+#define PVR2D_ARGB8888 0x04UL // Common argb 8888 format
+#define PVR2D_ARGB1555 0x05UL // Common argb 1555 format
+#define PVR2D_ALPHA8 0x06UL // Alpha-only 8 bit per pixel (used with a constant fill colour)
+#define PVR2D_ALPHA4 0x07UL // Alpha-only 4 bits per pixel (used with a constant fill colour)
+#define PVR2D_PAL2 0x08UL // Palletized 2 bit format (requires 4x32 bit CLUT)
+#define PVR2D_PAL4 0x09UL // Palletized 4 bit format (requires 16x32 bit CLUT)
+#define PVR2D_PAL8 0x0AUL // Palletized 8 bit format (requires 256x32 bit CLUT)
+#define PVR2D_U8 0x10UL // monochrome unsigned 8 bit
+#define PVR2D_U88 0x11UL // monochrome unsigned 16 bit
+#define PVR2D_S8 0x12UL // signed 8 bit
+#define PVR2D_YUV422_YUYV 0x13UL // YUV 422 low-high byte order Y0UY1V
+#define PVR2D_YUV422_UYVY 0x14UL // YUV 422 low-high byte order UY0VY1
+#define PVR2D_YUV422_YVYU 0x15UL // YUV 422 low-high byte order Y0VY1U
+#define PVR2D_YUV422_VYUY 0x16UL // YUV 422 low-high byte order VY0UY1
+#define PVR2D_YUV420_2PLANE 0x17UL // YUV420 2 Plane
+#define PVR2D_YUV420_3PLANE 0x18UL // YUV420 3 Plane
+#define PVR2D_2101010ARGB 0x19UL // 32 bit 2 10 10 10
+#define PVR2D_888RSGSBS 0x1AUL
+#define PVR2D_16BPP_RAW 0x1BUL // 16 bit raw (no format conversion)
+#define PVR2D_32BPP_RAW 0x1CUL // 32 bit raw
+#define PVR2D_64BPP_RAW 0x1DUL // 64 bit raw
+#define PVR2D_128BPP_RAW 0x1EUL // 128 bit raw
+#define PVR2D_RGBA8888 0x1FUL // Common rgba 888 format
+#define PVR2D_NV12_U8V8 0x20UL // NV12 Plane U8V8
+
+#define PVR2D_NO_OF_FORMATS 0x21UL
/* Format modifier bit field (DstFormat and SrcFormat bits 16..23) */
-#define PVR2D_FORMAT_MASK 0x0000FFFFUL // PVR2D Format bits
-#define PVR2D_FORMAT_LAYOUT_MASK 0x000F0000UL // Format layout (strided / twiddled / tiled)
-#define PVR2D_FORMAT_FLAGS_MASK 0x0FF00000UL // Surface Flags mask
+#define PVR2D_FORMAT_MASK 0x0000FFFFUL // PVR2D Format bits
+#define PVR2D_FORMAT_LAYOUT_MASK 0x000F0000UL // Format layout (strided / twiddled / tiled)
+#define PVR2D_FORMAT_FLAGS_MASK 0x0FF00000UL // Surface Flags mask
/* Layout */
-#define PVR2D_FORMAT_LAYOUT_SHIFT 16
-#define PVR2D_FORMAT_LAYOUT_STRIDED 0x00000000UL
-#define PVR2D_FORMAT_LAYOUT_TILED 0x00010000UL
+#define PVR2D_FORMAT_LAYOUT_SHIFT 16
+#define PVR2D_FORMAT_LAYOUT_STRIDED 0x00000000UL
+#define PVR2D_FORMAT_LAYOUT_TILED 0x00010000UL
#define PVR2D_FORMAT_LAYOUT_TWIDDLED 0x00020000UL
/*
@@ -129,7 +130,7 @@ extern "C" {
This flag requests a surface pdump, to capture the pixel state after host writes.
Not needed if the surface state has resulted from previous SGX 2D/3D core writes.
*/
-#define PVR2D_SURFACE_PDUMP 0x00100000UL // calls PVRSRVPDumpMem to capture the surface (pdump builds only)
+#define PVR2D_SURFACE_PDUMP 0x00100000UL // calls PVRSRVPDumpMem to capture the surface (pdump builds only)
/*
Low level 3D format extension - for blts via the 3D core only.
@@ -137,7 +138,7 @@ extern "C" {
The outcome is hardware dependant.
There is no guarantee that any specific PVRSRV format will be supported.
*/
-#define PVR2D_FORMAT_PVRSRV 0x80000000
+#define PVR2D_FORMAT_PVRSRV 0x80000000
/* wrap surface type */
typedef enum {
@@ -146,37 +147,37 @@ extern "C" {
} PVR2DWRAPFLAGS;
-#define PVR2D_CONTEXT_FLAGS_PRIORITY_MASK 0x00000003
+#define PVR2D_CONTEXT_FLAGS_PRIORITY_MASK 0x00000003
-#define PVR2D_CONTEXT_FLAGS_LOW_PRIORITY_CONTEXT 1
-#define PVR2D_CONTEXT_FLAGS_NORMAL_PRIORITY_CONTEXT 0
-#define PVR2D_CONTEXT_FLAGS_HIGH_PRIORITY_CONTEXT 2
+#define PVR2D_CONTEXT_FLAGS_LOW_PRIORITY_CONTEXT 1
+#define PVR2D_CONTEXT_FLAGS_NORMAL_PRIORITY_CONTEXT 0
+#define PVR2D_CONTEXT_FLAGS_HIGH_PRIORITY_CONTEXT 2
/* flags for control information of additional blits */
typedef enum {
- PVR2D_BLIT_DISABLE_ALL = 0x00000000, /* disable all additional controls */
- PVR2D_BLIT_CK_ENABLE = 0x00000001, /* enable colour key */
- PVR2D_BLIT_GLOBAL_ALPHA_ENABLE = 0x00000002, /* enable standard global alpha */
+ PVR2D_BLIT_DISABLE_ALL = 0x00000000, /* disable all additional controls */
+ PVR2D_BLIT_CK_ENABLE = 0x00000001, /* enable colour key */
+ PVR2D_BLIT_GLOBAL_ALPHA_ENABLE = 0x00000002, /* enable standard global alpha */
PVR2D_BLIT_PERPIXEL_ALPHABLEND_ENABLE = 0x00000004, /* enable per-pixel alpha bleding */
- PVR2D_BLIT_PAT_SURFACE_ENABLE = 0x00000008, /* enable pattern surf (disable fill) */
+ PVR2D_BLIT_PAT_SURFACE_ENABLE = 0x00000008, /* enable pattern surf (disable fill) */
PVR2D_BLIT_FULLY_SPECIFIED_ALPHA_ENABLE = 0x00000010, /* enable fully specified alpha */
- PVR2D_BLIT_ROT_90 = 0x00000020, /* apply 90 degree rotation to the blt */
- PVR2D_BLIT_ROT_180 = 0x00000040, /* apply 180 degree rotation to the blt */
- PVR2D_BLIT_ROT_270 = 0x00000080, /* apply 270 degree rotation to the blt */
- PVR2D_BLIT_COPYORDER_TL2BR = 0x00000100, /* copy order overrides */
- PVR2D_BLIT_COPYORDER_BR2TL = 0x00000200,
- PVR2D_BLIT_COPYORDER_TR2BL = 0x00000400,
- PVR2D_BLIT_COPYORDER_BL2TR = 0x00000800,
- PVR2D_BLIT_COLKEY_SOURCE = 0x00001000, /* Key colour is on the source surface */
- PVR2D_BLIT_COLKEY_DEST = 0x00002000, /* Key colour is on the destination surface */
- PVR2D_BLIT_COLKEY_MASKED = 0x00004000, /* Mask enabled for colour key */
- PVR2D_BLIT_COLKEY_OP_PASS = 0x00008000, /* Colour key op = pass */
- PVR2D_BLIT_COLKEY_OP_REJECT = 0x00010000, /* Colour key op = reject */
- PVR2D_BLIT_PATH_2DCORE = 0x00100000, /* Blt via dedicated 2D Core or PTLA */
- PVR2D_BLIT_PATH_3DCORE = 0x00200000, /* Blt via 3D Core */
- PVR2D_BLIT_PATH_SWBLT = 0x00400000, /* Blt via host software */
- PVR2D_BLIT_NO_SRC_SYNC_INFO = 0x00800000, /* Dont send a source sync info*/
- PVR2D_BLIT_ISSUE_STATUS_UPDATES = 0x01000000, /* Issue status updates */
+ PVR2D_BLIT_ROT_90 = 0x00000020, /* apply 90 degree rotation to the blt */
+ PVR2D_BLIT_ROT_180 = 0x00000040, /* apply 180 degree rotation to the blt */
+ PVR2D_BLIT_ROT_270 = 0x00000080, /* apply 270 degree rotation to the blt */
+ PVR2D_BLIT_COPYORDER_TL2BR = 0x00000100, /* copy order overrides */
+ PVR2D_BLIT_COPYORDER_BR2TL = 0x00000200,
+ PVR2D_BLIT_COPYORDER_TR2BL = 0x00000400,
+ PVR2D_BLIT_COPYORDER_BL2TR = 0x00000800,
+ PVR2D_BLIT_COLKEY_SOURCE = 0x00001000, /* Key colour is on the source surface */
+ PVR2D_BLIT_COLKEY_DEST = 0x00002000, /* Key colour is on the destination surface */
+ PVR2D_BLIT_COLKEY_MASKED = 0x00004000, /* Mask enabled for colour key */
+ PVR2D_BLIT_COLKEY_OP_PASS = 0x00008000, /* Colour key op = pass */
+ PVR2D_BLIT_COLKEY_OP_REJECT = 0x00010000, /* Colour key op = reject */
+ PVR2D_BLIT_PATH_2DCORE = 0x00100000, /* Blt via dedicated 2D Core or PTLA */
+ PVR2D_BLIT_PATH_3DCORE = 0x00200000, /* Blt via 3D Core */
+ PVR2D_BLIT_PATH_SWBLT = 0x00400000, /* Blt via host software */
+ PVR2D_BLIT_NO_SRC_SYNC_INFO = 0x00800000, /* Dont send a source sync info*/
+ PVR2D_BLIT_ISSUE_STATUS_UPDATES = 0x01000000, /* Issue status updates */
PVR2D_BLIT_FORCE_ALPHA_FF = 0x02000000, /* set the alpha channel to 0xFF */
} PVR2DBLITFLAGS;
@@ -184,7 +185,9 @@ extern "C" {
/* standard alpha-blending functions, AlphaBlendingFunc field of PVR2DBLTINFO */
typedef enum {
PVR2D_ALPHA_OP_SRC_DSTINV = 1, /* source alpha : Cdst = Csrc*Asrc + Cdst*(1-Asrc) */
- PVR2D_ALPHA_OP_SRCP_DSTINV = 2 /* premultiplied source alpha : Cdst = Csrc + Cdst*(1-Asrc) */
+ PVR2D_ALPHA_OP_SRCP_DSTINV = 2, /* premultiplied source alpha : Cdst = Csrc + Cdst*(1-Asrc) */
+ PVR2D_ALPHA_OP_GLOBAL = 3, /* global alpha: Cdst = Csrc*Aglob + Cdst*(1-Aglob) */
+ PVR2D_ALPHA_OP_SRCP_GLOBAL = 4 /* premultiplied source with global alpha: Cdst = Csrc*Aglob + Cdst*(1-Asrc)*(1-Aglob) */
} PVR2D_ALPHABLENDFUNC;
/* blend ops for fully specified alpha (SGX 2D Core only) */
@@ -198,44 +201,44 @@ extern "C" {
PVR2D_BLEND_OP_DST_PLUS_GLOBAL = 6
} PVR2D_BLEND_OP;
- /* SGX 2D Core Fully specified alpha blend : pAlpha field of PVR2DBLTINFO structure */
- /* a fully specified Alpha Blend operation is defined as */
- /* DST (ALPHA) = (ALPHA_1 * SRC (ALPHA)) + (ALPHA_3 * DST (ALPHA)) */
- /* DST (RGB) = (ALPHA_2 * SRC (RGB)) + (ALPHA_4 * DST (RGB)) */
- /* if the pre-multiplication stage is enabled then the equations become the following: */
- /* PRE_MUL = ((SRC(A)) * (Global Alpha Value)) */
- /* DST (ALPHA) = (ALPHA_1 * SRC (ALPHA)) + (PRE_MUL * DST (ALPHA)) */
- /* DST (RGB) = (ALPHA_2 * SRC (RGB)) + (PRE_MUL * DST (RGB)) */
+ /* SGX 2D Core Fully specified alpha blend : pAlpha field of PVR2DBLTINFO structure */
+ /* a fully specified Alpha Blend operation is defined as */
+ /* DST (ALPHA) = (ALPHA_1 * SRC (ALPHA)) + (ALPHA_3 * DST (ALPHA)) */
+ /* DST (RGB) = (ALPHA_2 * SRC (RGB)) + (ALPHA_4 * DST (RGB)) */
+ /* if the pre-multiplication stage is enabled then the equations become the following: */
+ /* PRE_MUL = ((SRC(A)) * (Global Alpha Value)) */
+ /* DST (ALPHA) = (ALPHA_1 * SRC (ALPHA)) + (PRE_MUL * DST (ALPHA)) */
+ /* DST (RGB) = (ALPHA_2 * SRC (RGB)) + (PRE_MUL * DST (RGB)) */
/* if the transparent source alpha stage is enabled then a source alpha of zero forces the */
- /* source to be transparent for that pixel regardless of the blend equation being used. */
+ /* source to be transparent for that pixel regardless of the blend equation being used. */
typedef struct _PVR2D_ALPHABLT {
PVR2D_BLEND_OP eAlpha1;
- PVR2D_BOOL bAlpha1Invert;
+ PVR2D_BOOL bAlpha1Invert;
PVR2D_BLEND_OP eAlpha2;
- PVR2D_BOOL bAlpha2Invert;
+ PVR2D_BOOL bAlpha2Invert;
PVR2D_BLEND_OP eAlpha3;
- PVR2D_BOOL bAlpha3Invert;
+ PVR2D_BOOL bAlpha3Invert;
PVR2D_BLEND_OP eAlpha4;
- PVR2D_BOOL bAlpha4Invert;
- PVR2D_BOOL bPremulAlpha; /* enable pre-multiplication stage */
- PVR2D_BOOL bTransAlpha; /* enable transparent source alpha stage */
- PVR2D_BOOL bUpdateAlphaLookup; /* enable and update the 1555-Lookup alpha table */
- PVR2D_UCHAR uAlphaLookup0; /* 8 bit alpha when A=0 in a 1555-Lookup surface */
- PVR2D_UCHAR uAlphaLookup1; /* 8 bit alpha when A=1 in a 1555-Lookup surface */
- PVR2D_UCHAR uGlobalRGB; /* Global Alpha Value for RGB, 0=transparent 255=opaque */
- PVR2D_UCHAR uGlobalA; /* Global Alpha Value for Alpha */
+ PVR2D_BOOL bAlpha4Invert;
+ PVR2D_BOOL bPremulAlpha; /* enable pre-multiplication stage */
+ PVR2D_BOOL bTransAlpha; /* enable transparent source alpha stage */
+ PVR2D_BOOL bUpdateAlphaLookup; /* enable and update the 1555-Lookup alpha table */
+ PVR2D_UCHAR uAlphaLookup0; /* 8 bit alpha when A=0 in a 1555-Lookup surface */
+ PVR2D_UCHAR uAlphaLookup1; /* 8 bit alpha when A=1 in a 1555-Lookup surface */
+ PVR2D_UCHAR uGlobalRGB; /* Global Alpha Value for RGB, 0=transparent 255=opaque */
+ PVR2D_UCHAR uGlobalA; /* Global Alpha Value for Alpha */
} PVR2D_ALPHABLT, *PPVR2D_ALPHABLT;
/* surface memory info structure */
typedef struct _PVR2DMEMINFO {
- PVR2D_VOID *pBase;
- PVR2D_ULONG ui32MemSize;
- PVR2D_ULONG ui32DevAddr;
- PVR2D_ULONG ulFlags;
- PVR2D_VOID *hPrivateData;
- PVR2D_VOID *hPrivateMapData;
+ PVR2D_VOID *pBase;
+ PVR2D_ULONG ui32MemSize;
+ PVR2D_ULONG ui32DevAddr;
+ PVR2D_ULONG ulFlags;
+ PVR2D_VOID *hPrivateData;
+ PVR2D_VOID *hPrivateMapData;
} PVR2DMEMINFO, *PPVR2DMEMINFO;
@@ -243,20 +246,20 @@ extern "C" {
#define PVR2D_MAX_DEVICE_NAME 20
typedef struct _PVR2DDEVICEINFO {
- PVR2D_ULONG ulDevID;
- PVR2D_CHAR szDeviceName[PVR2D_MAX_DEVICE_NAME];
+ PVR2D_ULONG ulDevID;
+ PVR2D_CHAR szDeviceName[PVR2D_MAX_DEVICE_NAME];
} PVR2DDEVICEINFO;
typedef struct _PVR2DISPLAYINFO {
- PVR2D_ULONG ulMaxFlipChains;
- PVR2D_ULONG ulMaxBuffersInChain;
- PVR2DFORMAT eFormat;
- PVR2D_ULONG ulWidth;
- PVR2D_ULONG ulHeight;
- PVR2D_LONG lStride;
- PVR2D_ULONG ulMinFlipInterval;
- PVR2D_ULONG ulMaxFlipInterval;
+ PVR2D_ULONG ulMaxFlipChains;
+ PVR2D_ULONG ulMaxBuffersInChain;
+ PVR2DFORMAT eFormat;
+ PVR2D_ULONG ulWidth;
+ PVR2D_ULONG ulHeight;
+ PVR2D_LONG lStride;
+ PVR2D_ULONG ulMinFlipInterval;
+ PVR2D_ULONG ulMaxFlipInterval;
} PVR2DDISPLAYINFO;
@@ -303,50 +306,50 @@ extern "C" {
} PVR2D_AYUVSample8;
typedef struct _PVR2DBLTINFO {
- PVR2D_ULONG CopyCode; /* rop code */
- PVR2D_ULONG Colour; /* fill colour */
- PVR2D_ULONG ColourKey; /* colour key argb8888 (see CKEY_ defs below) */
- PVR2D_UCHAR GlobalAlphaValue; /* global alpha blending */
- PVR2D_UCHAR AlphaBlendingFunc; /* per-pixel alpha-blending function */
-
- PVR2DBLITFLAGS BlitFlags; /* additional blit control information */
-
- PVR2DMEMINFO *pDstMemInfo; /* destination memory */
- PVR2D_ULONG DstOffset; /* byte offset from start of allocation to destination surface pixel 0,0 */
- PVR2D_LONG DstStride; /* signed stride, the number of bytes from pixel 0,0 to 0,1 */
- PVR2D_LONG DstX, DstY; /* pixel offset from start of dest surface to start of blt rectangle */
- PVR2D_LONG DSizeX, DSizeY; /* blt size */
- PVR2DFORMAT DstFormat; /* dest format */
- PVR2D_ULONG DstSurfWidth; /* size of dest surface in pixels */
- PVR2D_ULONG DstSurfHeight; /* size of dest surface in pixels */
-
- PVR2DMEMINFO *pSrcMemInfo; /* source mem, (source fields are also used for patterns) */
- PVR2D_ULONG SrcOffset; /* byte offset from start of allocation to src/pat surface pixel 0,0 */
- PVR2D_LONG SrcStride; /* signed stride, the number of bytes from pixel 0,0 to 0,1 */
- PVR2D_LONG SrcX, SrcY; /* pixel offset from start of surface to start of source rectangle */
+ PVR2D_ULONG CopyCode; /* rop code */
+ PVR2D_ULONG Colour; /* fill colour */
+ PVR2D_ULONG ColourKey; /* colour key argb8888 (see CKEY_ defs below) */
+ PVR2D_UCHAR GlobalAlphaValue; /* global alpha blending */
+ PVR2D_UCHAR AlphaBlendingFunc; /* per-pixel alpha-blending function */
+
+ PVR2DBLITFLAGS BlitFlags; /* additional blit control information */
+
+ PVR2DMEMINFO *pDstMemInfo; /* destination memory */
+ PVR2D_ULONG DstOffset; /* byte offset from start of allocation to destination surface pixel 0,0 */
+ PVR2D_LONG DstStride; /* signed stride, the number of bytes from pixel 0,0 to 0,1 */
+ PVR2D_LONG DstX, DstY; /* pixel offset from start of dest surface to start of blt rectangle */
+ PVR2D_LONG DSizeX, DSizeY; /* blt size */
+ PVR2DFORMAT DstFormat; /* dest format */
+ PVR2D_ULONG DstSurfWidth; /* size of dest surface in pixels */
+ PVR2D_ULONG DstSurfHeight; /* size of dest surface in pixels */
+
+ PVR2DMEMINFO *pSrcMemInfo; /* source mem, (source fields are also used for patterns) */
+ PVR2D_ULONG SrcOffset; /* byte offset from start of allocation to src/pat surface pixel 0,0 */
+ PVR2D_LONG SrcStride; /* signed stride, the number of bytes from pixel 0,0 to 0,1 */
+ PVR2D_LONG SrcX, SrcY; /* pixel offset from start of surface to start of source rectangle */
/* for patterns this is the start offset within the pattern */
- PVR2D_LONG SizeX, SizeY; /* source rectangle size or pattern size in pixels */
- PVR2DFORMAT SrcFormat; /* source/pattern format */
- PVR2DMEMINFO *pPalMemInfo; /* source/pattern palette memory containing argb8888 colour table */
- PVR2D_ULONG PalOffset; /* byte offset from start of allocation to start of palette */
- PVR2D_ULONG SrcSurfWidth; /* size of source surface in pixels */
- PVR2D_ULONG SrcSurfHeight; /* size of source surface in pixels */
+ PVR2D_LONG SizeX, SizeY; /* source rectangle size or pattern size in pixels */
+ PVR2DFORMAT SrcFormat; /* source/pattern format */
+ PVR2DMEMINFO *pPalMemInfo; /* source/pattern palette memory containing argb8888 colour table */
+ PVR2D_ULONG PalOffset; /* byte offset from start of allocation to start of palette */
+ PVR2D_ULONG SrcSurfWidth; /* size of source surface in pixels */
+ PVR2D_ULONG SrcSurfHeight; /* size of source surface in pixels */
- PVR2DMEMINFO *pMaskMemInfo; /* mask memory, 1bpp format implied */
- PVR2D_ULONG MaskOffset; /* byte offset from start of allocation to mask surface pixel 0,0 */
- PVR2D_LONG MaskStride; /* signed stride, the number of bytes from pixel 0,0 to 0,1 */
- PVR2D_LONG MaskX, MaskY; /* mask rect top left (mask size = blt size) */
- PVR2D_ULONG MaskSurfWidth; /* size of mask surface in pixels */
- PVR2D_ULONG MaskSurfHeight; /* size of mask surface in pixels */
+ PVR2DMEMINFO *pMaskMemInfo; /* mask memory, 1bpp format implied */
+ PVR2D_ULONG MaskOffset; /* byte offset from start of allocation to mask surface pixel 0,0 */
+ PVR2D_LONG MaskStride; /* signed stride, the number of bytes from pixel 0,0 to 0,1 */
+ PVR2D_LONG MaskX, MaskY; /* mask rect top left (mask size = blt size) */
+ PVR2D_ULONG MaskSurfWidth; /* size of mask surface in pixels */
+ PVR2D_ULONG MaskSurfHeight; /* size of mask surface in pixels */
- PPVR2D_ALPHABLT pAlpha; /* fully specified alpha blend (2DCore only) */
+ PPVR2D_ALPHABLT pAlpha; /* fully specified alpha blend (2DCore only) */
- PVR2D_ULONG uSrcChromaPlane1; /* mem offset from start of source alloc to chroma plane 1 */
- PVR2D_ULONG uSrcChromaPlane2; /* mem offset from start of source alloc to chroma plane 2 */
- PVR2D_ULONG uDstChromaPlane1; /* mem offset from start of dest alloc to chroma plane 1 */
- PVR2D_ULONG uDstChromaPlane2; /* mem offset from start of dest alloc to chroma plane 2 */
+ PVR2D_ULONG uSrcChromaPlane1; /* mem offset from start of source alloc to chroma plane 1 */
+ PVR2D_ULONG uSrcChromaPlane2; /* mem offset from start of source alloc to chroma plane 2 */
+ PVR2D_ULONG uDstChromaPlane1; /* mem offset from start of dest alloc to chroma plane 1 */
+ PVR2D_ULONG uDstChromaPlane2; /* mem offset from start of dest alloc to chroma plane 2 */
- PVR2D_ULONG ColourKeyMask; /* 32 bit colour key mask, only valid when PVR2D_BLIT_COLKEY_MASKED is set */
+ PVR2D_ULONG ColourKeyMask; /* 32 bit colour key mask, only valid when PVR2D_BLIT_COLKEY_MASKED is set */
} PVR2DBLTINFO, *PPVR2DBLTINFO;
@@ -356,78 +359,79 @@ extern "C" {
} PVR2DRECT;
typedef struct {
- PVR2DMEMINFO *pSurfMemInfo; /* surface memory */
- PVR2D_ULONG SurfOffset; /* byte offset from start of allocation to destination surface pixel 0,0 */
- PVR2D_LONG Stride; /* signed stride */
- PVR2DFORMAT Format; /* format */
- PVR2D_ULONG SurfWidth; /* surface width in pixels */
- PVR2D_ULONG SurfHeight; /* surface height in pixels */
+ PVR2DMEMINFO *pSurfMemInfo; /* surface memory */
+ PVR2D_ULONG SurfOffset; /* byte offset from start of allocation to destination surface pixel 0,0 */
+ PVR2D_LONG Stride; /* signed stride */
+ PVR2DFORMAT Format; /* format */
+ PVR2D_ULONG SurfWidth; /* surface width in pixels */
+ PVR2D_ULONG SurfHeight; /* surface height in pixels */
} PVR2D_SURFACE, *PPVR2D_SURFACE;
typedef struct {
- PVR2D_ULONG uChromaPlane1; /* YUV multiplane - byte offset from start of alloc to chroma plane 1 */
- PVR2D_ULONG uChromaPlane2; /* YUV multiplane - byte offset from start of alloc to chroma plane 2 */
- PVR2D_LONG Reserved[2]; /* Reserved, must be zero */
+ PVR2D_ULONG uChromaPlane1; /* YUV multiplane - byte offset from start of alloc to chroma plane 1 */
+ PVR2D_ULONG uChromaPlane2; /* YUV multiplane - byte offset from start of alloc to chroma plane 2 */
+ PVR2D_LONG Reserved[2]; /* Reserved, must be zero */
} PVR2D_SURFACE_EXT, *PPVR2D_SURFACE_EXT;
typedef struct {
- PVR2D_ULONG *pUseCode; /* USSE code */
- PVR2D_ULONG UseCodeSize; /* usse code size in bytes */
+ PVR2D_ULONG *pUseCode; /* USSE code */
+ PVR2D_ULONG UseCodeSize; /* usse code size in bytes */
} PVR2D_USECODE, *PPVR2D_USECODE;
typedef struct {
- PVR2D_SURFACE sDst; /* destination surface */
- PVR2D_SURFACE sSrc; /* source surface */
- PVR2DRECT rcDest; /* destination rectangle */
- PVR2DRECT rcSource; /* source rectangle */
- PVR2D_HANDLE hUseCode; /* custom USE code (NULL implies source copy) */
- PVR2D_ULONG UseParams[2]; /* per-blt params for use code */
- PVR2D_UCHAR RotationValue; /* Rotation setting */
+ PVR2D_SURFACE sDst; /* destination surface */
+ PVR2D_SURFACE sSrc; /* source surface */
+ PVR2DRECT rcDest; /* destination rectangle */
+ PVR2DRECT rcSource; /* source rectangle */
+ PVR2D_HANDLE hUseCode; /* custom USE code (NULL implies source copy) */
+ PVR2D_ULONG UseParams[2]; /* per-blt params for use code */
+ PVR2D_UCHAR RotationValue; /* Rotation setting */
} PVR2D_3DBLT, *PPVR2D_3DBLT;
typedef struct {
- PVR2D_SURFACE sDst; /* destination surface */
- PVR2DRECT rcDest; /* destination rectangle; scaling is supported */
- PVR2D_SURFACE sSrc; /* source surface */
- PVR2DRECT rcSource; /* source rectangle; scaling is supported */
- PPVR2D_SURFACE pSrc2; /* optional second source surface (NULL if not required) */
- PVR2DRECT* prcSource2; /* optional pSrc2 rectangle */
- PVR2D_HANDLE hUseCode; /* custom USSE shader code (NULL implies default source copy) */
- PVR2D_ULONG UseParams[2]; /* per-blt params for usse code */
- PVR2D_ULONG uiNumTemporaryRegisters; /* no. of temporary registers used in custom shader code */
- PVR2D_BOOL bDisableDestInput; /* set true if the destination is output only */
- PPVR2D_SURFACE_EXT pDstExt; /* Extended format params for dest */
- PPVR2D_SURFACE_EXT pSrcExt[2]; /* Extended format params for source 1 and 2 */
- PVR2D_LONG Reserved[4]; /* Reserved, must be zero */
+ PVR2D_SURFACE sDst; /* destination surface */
+ PVR2DRECT rcDest; /* destination rectangle; scaling is supported */
+ PVR2D_SURFACE sSrc; /* source surface */
+ PVR2DRECT rcSource; /* source rectangle; scaling is supported */
+ PPVR2D_SURFACE pSrc2; /* optional second source surface (NULL if not required) */
+ PVR2DRECT* prcSource2; /* optional pSrc2 rectangle */
+ PVR2D_HANDLE hUseCode; /* custom USSE shader code (NULL implies default source copy) */
+ PVR2D_ULONG UseParams[2]; /* per-blt params for usse code */
+ PVR2D_ULONG uiNumTemporaryRegisters; /* no. of temporary registers used in custom shader code */
+ PVR2D_BOOL bDisableDestInput; /* set true if the destination is output only */
+ PPVR2D_SURFACE_EXT pDstExt; /* Extended format params for dest */
+ PPVR2D_SURFACE_EXT pSrcExt[2]; /* Extended format params for source 1 and 2 */
+ PVR2D_LONG Reserved[4]; /* Reserved, must be zero */
} PVR2D_3DBLT_EXT, *PPVR2D_3DBLT_EXT;
typedef struct {
- PVR2D_SURFACE sDst; /* destination surface */
- PVR2D_SURFACE sSrc[3]; /* source surface */
- PVR2DRECT rcDest; /* destination rectangle */
- PVR2DRECT rcSource[3]; /* source rectangle */
+ PVR2D_SURFACE sDst; /* destination surface */
+ PVR2D_SURFACE sSrc[3]; /* source surface */
+ PVR2DRECT rcDest; /* destination rectangle */
+ PVR2DRECT rcSource[3]; /* source rectangle */
PVR2D_UCHAR GlobalAlphaValue; /* global alpha blending */
PVR2D_UCHAR AlphaBlendingFunc; /* per-pixel alpha-blending function */
PVR2D_UCHAR bCoeffsGiven; /* passing custom coeffs to VPB */
PPVR2D_YUVCOEFFS psYUVCoeffs; /* YUV Coeffs needed for RGB conversion */
PVR2D_UINT uiNumLayers; /* no. of YUV planes */
PVR2D_UCHAR RotationValue; /* Rotation setting */
- PVR2D_SURFACE sSrcSubpic[6]; /* subpic source surfaces */
+ PVR2D_SURFACE sSrcSubpic[6]; /* subpic source surfaces */
+ PVR2D_UCHAR subpicGlobalAlpha[6]; /* global alpha value for each subpic */
PVR2DRECT rcSubpicSource[6]; /* source rectangle */
- PVR2DRECT rcSubpicDest[6]; /* subpicture destination rectangle */
- PPVR2DMEMINFO pPalMemInfo[6]; /* source/pattern palette memory containing argb8888 color table */
- PVR2D_ULONG PalOffset[6]; /* byte offset from start of allocation to start of palette */
+ PVR2DRECT rcSubpicDest[6]; /* subpicture destination rectangle */
+ PPVR2DMEMINFO pPalMemInfo[6]; /* source/pattern palette memory containing argb8888 color table */
+ PVR2D_ULONG PalOffset[6]; /* byte offset from start of allocation to start of palette */
} PVR2D_VPBLT, *PPVR2D_VPBLT;
typedef struct {
PVR2D_SURFACE sDst; /* destination surface */
PVR2DRECT rcDest; /* destination rectangle */
PVR2DRECT rcSource; /* source rectangle */
- PVR2D_UINT RotationValue; /* rotation angle 0/90/180/270 */
+ PVR2D_UINT RotationValue; /* rotation angle 0/90/180/270 */
} PVR2D_WIDIBLT, *PPVR2D_WIDIBLT;
#define MAKE_COPY_BLIT(src,soff,dest,doff,sx,sy,dx,dy,sz)
@@ -448,93 +452,93 @@ extern "C" {
// CopyCode is taken to be a rop4 when pMaskMemInfo is non zero, otherwise it is assumed to be a rop3
// use the PVR2DMASKROP4 macro below to construct a rop4 from two rop3's
// rop3a is the rop used when mask pixel = 1, and rop3b when mask = 0
-#define PVR2DROP4(rop3b, rop3a) ((rop3b<<8)|rop3a)
+#define PVR2DROP4(rop3b, rop3a) ((rop3b<<8)|rop3a)
/* common rop codes */
-#define PVR2DROPclear 0x00 /* 0 (whiteness) */
-#define PVR2DROPset 0xFF /* 1 (blackness) */
-#define PVR2DROPnoop 0xAA /* dst (used for masked blts) */
+#define PVR2DROPclear 0x00 /* 0 (whiteness) */
+#define PVR2DROPset 0xFF /* 1 (blackness) */
+#define PVR2DROPnoop 0xAA /* dst (used for masked blts) */
/* source and dest rop codes */
-#define PVR2DROPand 0x88 /* src AND dst */
-#define PVR2DROPandReverse 0x44 /* src AND NOT dst */
-#define PVR2DROPcopy 0xCC /* src (used for source copy and alpha blts) */
-#define PVR2DROPandInverted 0x22 /* NOT src AND dst */
-#define PVR2DROPxor 0x66 /* src XOR dst */
-#define PVR2DROPor 0xEE /* src OR dst */
-#define PVR2DROPnor 0x11 /* NOT src AND NOT dst */
-#define PVR2DROPequiv 0x99 /* NOT src XOR dst */
-#define PVR2DROPinvert 0x55 /* NOT dst */
-#define PVR2DROPorReverse 0xDD /* src OR NOT dst */
-#define PVR2DROPcopyInverted 0x33 /* NOT src */
-#define PVR2DROPorInverted 0xBB /* NOT src OR dst */
-#define PVR2DROPnand 0x77 /* NOT src OR NOT dst */
+#define PVR2DROPand 0x88 /* src AND dst */
+#define PVR2DROPandReverse 0x44 /* src AND NOT dst */
+#define PVR2DROPcopy 0xCC /* src (used for source copy and alpha blts) */
+#define PVR2DROPandInverted 0x22 /* NOT src AND dst */
+#define PVR2DROPxor 0x66 /* src XOR dst */
+#define PVR2DROPor 0xEE /* src OR dst */
+#define PVR2DROPnor 0x11 /* NOT src AND NOT dst */
+#define PVR2DROPequiv 0x99 /* NOT src XOR dst */
+#define PVR2DROPinvert 0x55 /* NOT dst */
+#define PVR2DROPorReverse 0xDD /* src OR NOT dst */
+#define PVR2DROPcopyInverted 0x33 /* NOT src */
+#define PVR2DROPorInverted 0xBB /* NOT src OR dst */
+#define PVR2DROPnand 0x77 /* NOT src OR NOT dst */
/* pattern rop codes */
-#define PVR2DPATROPand 0xA0 /* pat AND dst */
-#define PVR2DPATROPandReverse 0x50 /* pat AND NOT dst */
-#define PVR2DPATROPcopy 0xF0 /* pat (used for solid color fills and pattern blts) */
-#define PVR2DPATROPandInverted 0x0A /* NOT pat AND dst */
-#define PVR2DPATROPxor 0x5A /* pat XOR dst */
-#define PVR2DPATROPor 0xFA /* pat OR dst */
-#define PVR2DPATROPnor 0x05 /* NOT pat AND NOT dst */
-#define PVR2DPATROPequiv 0xA5 /* NOT pat XOR dst */
-#define PVR2DPATROPinvert 0x55 /* NOT dst */
-#define PVR2DPATROPorReverse 0xF5 /* pat OR NOT dst */
-#define PVR2DPATROPcopyInverted 0x0F /* NOT pat */
-#define PVR2DPATROPorInverted 0xAF /* NOT pat OR dst */
-#define PVR2DPATROPnand 0x5F /* NOT pat OR NOT dst */
+#define PVR2DPATROPand 0xA0 /* pat AND dst */
+#define PVR2DPATROPandReverse 0x50 /* pat AND NOT dst */
+#define PVR2DPATROPcopy 0xF0 /* pat (used for solid color fills and pattern blts) */
+#define PVR2DPATROPandInverted 0x0A /* NOT pat AND dst */
+#define PVR2DPATROPxor 0x5A /* pat XOR dst */
+#define PVR2DPATROPor 0xFA /* pat OR dst */
+#define PVR2DPATROPnor 0x05 /* NOT pat AND NOT dst */
+#define PVR2DPATROPequiv 0xA5 /* NOT pat XOR dst */
+#define PVR2DPATROPinvert 0x55 /* NOT dst */
+#define PVR2DPATROPorReverse 0xF5 /* pat OR NOT dst */
+#define PVR2DPATROPcopyInverted 0x0F /* NOT pat */
+#define PVR2DPATROPorInverted 0xAF /* NOT pat OR dst */
+#define PVR2DPATROPnand 0x5F /* NOT pat OR NOT dst */
/* common rop4 codes */
-#define PVR2DROP4MaskedCopy PVR2DROP4(PVR2DROPnoop,PVR2DROPcopy) /* masked source copy blt (used for rounded window corners etc) */
-#define PVR2DROP4MaskedFill PVR2DROP4(PVR2DROPnoop,PVR2DPATROPcopy) /* masked colour fill blt (used for text) */
+#define PVR2DROP4MaskedCopy PVR2DROP4(PVR2DROPnoop,PVR2DROPcopy) /* masked source copy blt (used for rounded window corners etc) */
+#define PVR2DROP4MaskedFill PVR2DROP4(PVR2DROPnoop,PVR2DPATROPcopy) /* masked colour fill blt (used for text) */
/* Legacy support */
-#define PVR2DROP3_PATMASK PVR2DPATROPcopy
-#define PVR2DROP3_SRCMASK PVR2DROPcopy
+#define PVR2DROP3_PATMASK PVR2DPATROPcopy
+#define PVR2DROP3_SRCMASK PVR2DROPcopy
/* pixmap memory alignment */
-#define PVR2D_ALIGNMENT_4 4 /* DWORD alignment */
-#define PVR2D_ALIGNMENT_ANY 0 /* no alignment */
-#define PVR2D_ALIGNMENT_PALETTE 16 /* 16 byte alignment is required for palettes */
+#define PVR2D_ALIGNMENT_4 4 /* DWORD alignment */
+#define PVR2D_ALIGNMENT_ANY 0 /* no alignment */
+#define PVR2D_ALIGNMENT_PALETTE 16 /* 16 byte alignment is required for palettes */
/* Heap number for PVR2DGetFrameBuffer */
#define PVR2D_FB_PRIMARY_SURFACE 0
-#define PVR2D_PRESENT_PROPERTY_SRCSTRIDE (1UL << 0)
-#define PVR2D_PRESENT_PROPERTY_DSTSIZE (1UL << 1)
-#define PVR2D_PRESENT_PROPERTY_DSTPOS (1UL << 2)
-#define PVR2D_PRESENT_PROPERTY_CLIPRECTS (1UL << 3)
-#define PVR2D_PRESENT_PROPERTY_INTERVAL (1UL << 4)
+#define PVR2D_PRESENT_PROPERTY_SRCSTRIDE (1UL << 0)
+#define PVR2D_PRESENT_PROPERTY_DSTSIZE (1UL << 1)
+#define PVR2D_PRESENT_PROPERTY_DSTPOS (1UL << 2)
+#define PVR2D_PRESENT_PROPERTY_CLIPRECTS (1UL << 3)
+#define PVR2D_PRESENT_PROPERTY_INTERVAL (1UL << 4)
-#define PVR2D_CREATE_FLIPCHAIN_SHARED (1UL << 0)
-#define PVR2D_CREATE_FLIPCHAIN_QUERY (1UL << 1)
+#define PVR2D_CREATE_FLIPCHAIN_SHARED (1UL << 0)
+#define PVR2D_CREATE_FLIPCHAIN_QUERY (1UL << 1)
#define PVR2D_CREATE_FLIPCHAIN_OEMOVERLAY (1UL << 2)
#define PVR2D_CREATE_FLIPCHAIN_AS_BLITCHAIN (1UL << 3)
/* Colour-key colour must be translated into argb8888 format */
-#define CKEY_8888(P) (P)
-#define CKEY_4444(P) (((P&0xF000UL)<<16) | ((P&0x0F00UL)<<12) | ((P&0x00F0UL)<<8) | ((P&0x000FUL)<<4))
-#define CKEY_1555(P) (((P&0x8000UL)<<16) | ((P&0x7C00UL)<<9) | ((P&0x3E0UL)<<6) | ((P&0x1FUL)<<3))
-#define CKEY_565(P) (((P&0xF800UL)<<8) | ((P&0x7E0UL)<<5) | ((P&0x1FUL)<<3))
-#define CKEY_MASK_8888 0x00FFFFFFUL
-#define CKEY_MASK_4444 0x00F0F0F0UL
-#define CKEY_MASK_1555 0x00F8F8F8UL /* Alpha is not normally included in the key test */
-#define CKEY_MASK_565 0x00F8FCF8UL
+#define CKEY_8888(P) (P)
+#define CKEY_4444(P) (((P&0xF000UL)<<16) | ((P&0x0F00UL)<<12) | ((P&0x00F0UL)<<8) | ((P&0x000FUL)<<4))
+#define CKEY_1555(P) (((P&0x8000UL)<<16) | ((P&0x7C00UL)<<9) | ((P&0x3E0UL)<<6) | ((P&0x1FUL)<<3))
+#define CKEY_565(P) (((P&0xF800UL)<<8) | ((P&0x7E0UL)<<5) | ((P&0x1FUL)<<3))
+#define CKEY_MASK_8888 0x00FFFFFFUL
+#define CKEY_MASK_4444 0x00F0F0F0UL
+#define CKEY_MASK_1555 0x00F8F8F8UL /* Alpha is not normally included in the key test */
+#define CKEY_MASK_565 0x00F8FCF8UL
/* Fill colours must be translated into argb8888 format */
-#define CFILL_4444(P) (((P&0xF000UL)<<16) | ((P&0x0F00UL)<<12) | ((P&0x00F0UL)<<8) | ((P&0x000FUL)<<4))
-#define CFILL_1555(P) (((P&0x8000UL)<<16) | ((P&0x7C00UL)<<9) | ((P&0x3E0UL)<<6) | ((P&0x1FUL)<<3))
-#define CFILL_565(P) (((P&0xF800UL)<<8) | ((P&0x7E0UL)<<5) | ((P&0x1FUL)<<3))
+#define CFILL_4444(P) (((P&0xF000UL)<<16) | ((P&0x0F00UL)<<12) | ((P&0x00F0UL)<<8) | ((P&0x000FUL)<<4))
+#define CFILL_1555(P) (((P&0x8000UL)<<16) | ((P&0x7C00UL)<<9) | ((P&0x3E0UL)<<6) | ((P&0x1FUL)<<3))
+#define CFILL_565(P) (((P&0xF800UL)<<8) | ((P&0x7E0UL)<<5) | ((P&0x1FUL)<<3))
/* PVR2DCreateDeviceContext flags */
-#define PVR2D_XSERVER_PROC 0x00000001UL /*!< Set for the Xserver connection */
+#define PVR2D_XSERVER_PROC 0x00000001UL /*!< Set for the Xserver connection */
/* PVR2DMemAlloc flags */
-#define PVR2D_MEM_UNCACHED 0x00000000UL /* Default */
-#define PVR2D_MEM_CACHED 0x00000001UL /* Caller must flush and sync when necessary */
-#define PVR2D_MEM_WRITECOMBINE 0x00000002UL
-#define PVR2D_MEM_NOUSERVIRTUAL 0x00000004UL
+#define PVR2D_MEM_UNCACHED 0x00000000UL /* Default */
+#define PVR2D_MEM_CACHED 0x00000001UL /* Caller must flush and sync when necessary */
+#define PVR2D_MEM_WRITECOMBINE 0x00000002UL
+#define PVR2D_MEM_NOUSERVIRTUAL 0x00000004UL
/* Functions that the library exports */
@@ -678,7 +682,7 @@ extern "C" {
PVR2DERROR PVR2DGetAPIRev(PVR2D_LONG *lRevMajor, PVR2D_LONG *lRevMinor);
PVR2D_IMPORT
- PVR2DERROR PVR2DLoadUseCode(const PVR2DCONTEXTHANDLE hContext, const PVR2D_UCHAR *pUseCode,
+ PVR2DERROR PVR2DLoadUseCode(const PVR2DCONTEXTHANDLE hContext, const PVR2D_UCHAR *pUseCode,
const PVR2D_ULONG UseCodeSize, PVR2D_HANDLE *pUseCodeHandle);
PVR2D_IMPORT
PVR2DERROR PVR2DFreeUseCode(const PVR2DCONTEXTHANDLE hContext, const PVR2D_HANDLE hUseCodeHandle);
diff --git a/src/vc1_defs.h b/src/vc1_defs.h
index cfe210b..71c4998 100644
--- a/src/vc1_defs.h
+++ b/src/vc1_defs.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/vc1_header.h b/src/vc1_header.h
index cb2213e..67462cc 100644
--- a/src/vc1_header.h
+++ b/src/vc1_header.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -305,6 +305,9 @@ struct context_VC1_s {
uint32_t *p_slice_params; /* pointer to ui32SliceParams in CMD_HEADER_VC1 */
uint32_t *slice_first_pic_last;
uint32_t *alt_output_flags;
+
+ uint32_t forward_ref_fcm;
+ uint32_t backward_ref_fcm;
};
typedef struct context_VC1_s *context_VC1_p;
diff --git a/src/vc1_idx.c b/src/vc1_idx.c
index 6974fc6..9b09f96 100644
--- a/src/vc1_idx.c
+++ b/src/vc1_idx.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/vc1_vlc.c b/src/vc1_vlc.c
index c168a87..1b7ae14 100644
--- a/src/vc1_vlc.c
+++ b/src/vc1_vlc.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
diff --git a/src/x11/psb_coverlay.c b/src/x11/psb_coverlay.c
index 8c01277..7fd1b3e 100644
--- a/src/x11/psb_coverlay.c
+++ b/src/x11/psb_coverlay.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.
diff --git a/src/x11/psb_ctexture.c b/src/x11/psb_ctexture.c
index 718c3fc..a206acb 100644
--- a/src/x11/psb_ctexture.c
+++ b/src/x11/psb_ctexture.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
- * Copyright (c) Imagination Technologies Limited, UK
+ * Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -9,11 +9,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.
@@ -71,6 +71,12 @@ static VAStatus psb_extend_dri_init(VADriverContextP ctx, unsigned int destx, un
if (!output->extend_drawable) {
psb__error_message("%s: Failed to create drawable for extend display # %d\n", __func__, output->extend_drawable);
}
+
+ if (texture_priv->extend_dri_drawable) {
+ free_drawable(ctx, texture_priv->extend_dri_drawable);
+ texture_priv->extend_dri_drawable = NULL;
+ }
+
texture_priv->extend_dri_drawable = dri_get_drawable(ctx, output->extend_drawable);
if (!texture_priv->extend_dri_drawable) {
psb__error_message("%s(): Failed to get extend_dri_drawable\n", __func__);
@@ -83,7 +89,7 @@ static VAStatus psb_extend_dri_init(VADriverContextP ctx, unsigned int destx, un
return VA_STATUS_ERROR_UNKNOWN;
}
- ret = PVR2DMemMap(texture_priv->hPVR2DContext, 0, (PVR2D_HANDLE)extend_dri_buffer->dri2.name, &dri2_bb_export_meminfo);
+ ret = PVR2DMemMap(driver_data->hPVR2DContext, 0, (PVR2D_HANDLE)extend_dri_buffer->dri2.name, &dri2_bb_export_meminfo);
if (ret != PVR2D_OK) {
psb__error_message("%s(): PVR2DMemMap failed, ret = %d\n", __func__, ret);
return VA_STATUS_ERROR_UNKNOWN;
@@ -92,7 +98,7 @@ static VAStatus psb_extend_dri_init(VADriverContextP ctx, unsigned int destx, un
memcpy(&texture_priv->extend_dri2_bb_export, dri2_bb_export_meminfo->pBase, sizeof(PVRDRI2BackBuffersExport));
for (i = 0; i < DRI2_BLIT_BUFFERS_NUM; i++) {
- ret = PVR2DMemMap(texture_priv->hPVR2DContext, 0, texture_priv->extend_dri2_bb_export.hBuffers[i], &texture_priv->extend_blt_meminfo[i]);
+ ret = PVR2DMemMap(driver_data->hPVR2DContext, 0, texture_priv->extend_dri2_bb_export.hBuffers[i], &texture_priv->extend_blt_meminfo[i]);
if (ret != PVR2D_OK) {
psb__error_message("%s(): PVR2DMemMap failed, ret = %d\n", __func__, ret);
return VA_STATUS_ERROR_UNKNOWN;
@@ -104,23 +110,53 @@ static VAStatus psb_extend_dri_init(VADriverContextP ctx, unsigned int destx, un
return VA_STATUS_SUCCESS;
}
-static VAStatus psb_dri_init(VADriverContextP ctx, Drawable draw)
+/* reset buffer to prevent non-video area distorting when rendering into part of a drawable */
+static void psb_dri_reset_mem(VADriverContextP ctx)
{
INIT_DRIVER_DATA;
- INIT_OUTPUT_PRIV;
- int i, ret;
+ unsigned int i, size;
+ struct dri_drawable *tmp_drawable;
+ struct psb_texture_s *texture_priv = &driver_data->ctexture_priv;
- union dri_buffer *dri_buffer;
+ tmp_drawable = (struct dri_drawable *)texture_priv->dri_drawable;
+ size = tmp_drawable->width * tmp_drawable->height * 4;
- PPVR2DMEMINFO dri2_bb_export_meminfo;
+ if (!tmp_drawable->is_window) {
+ memset(texture_priv->blt_meminfo_pixmap->pBase, 0x0, size);
+ return;
+ } else {
+ if (texture_priv->dri2_bb_export.ui32Type == DRI2_BACK_BUFFER_EXPORT_TYPE_BUFFERS)
+ for (i = 0; i < DRI2_BLIT_BUFFERS_NUM; i++)
+ memset(texture_priv->blt_meminfo[i]->pBase, 0x0, size);
+ if (texture_priv->dri2_bb_export.ui32Type == DRI2_BACK_BUFFER_EXPORT_TYPE_SWAPCHAIN)
+ for (i = 0; i < DRI2_FLIP_BUFFERS_NUM; i++)
+ memset(texture_priv->blt_meminfo[i]->pBase, 0x0, size);
+ }
+
+ return;
+}
+static VAStatus psb_dri_init(VADriverContextP ctx, Drawable draw)
+{
+ INIT_DRIVER_DATA;
+ union dri_buffer *dri_buffer;
+ PPVR2DMEMINFO dri2_bb_export_meminfo;
struct psb_texture_s *texture_priv = &driver_data->ctexture_priv;
+ struct dri_drawable *tmp_drawable;
+ int i, ret;
+
+ /* free the previous drawable buffer */
+ if (texture_priv->dri_drawable) {
+ free_drawable(ctx, texture_priv->dri_drawable);
+ texture_priv->dri_drawable = NULL;
+ }
- texture_priv->dri_drawable = dri_get_drawable(ctx, output->output_drawable);
+ texture_priv->dri_drawable = dri_get_drawable(ctx, draw);
if (!texture_priv->dri_drawable) {
psb__error_message("%s(): Failed to get dri_drawable\n", __func__);
return VA_STATUS_ERROR_UNKNOWN;
}
+ tmp_drawable = (struct dri_drawable *)texture_priv->dri_drawable;
dri_buffer = dri_get_rendering_buffer(ctx, texture_priv->dri_drawable);
if (!dri_buffer) {
@@ -129,50 +165,53 @@ static VAStatus psb_dri_init(VADriverContextP ctx, Drawable draw)
}
/* pixmap */
- if (!texture_priv->dri_drawable->is_window) {
- ret = PVR2DMemMap(texture_priv->hPVR2DContext, 0, (PVR2D_HANDLE)(dri_buffer->dri2.name & 0x00FFFFFF), &texture_priv->blt_meminfo_pixmap);
+ if (!tmp_drawable->is_window) {
+ if (texture_priv->blt_meminfo_pixmap)
+ PVR2DMemFree(driver_data->hPVR2DContext, texture_priv->blt_meminfo_pixmap);
+
+ ret = PVR2DMemMap(driver_data->hPVR2DContext, 0, (PVR2D_HANDLE)(dri_buffer->dri2.name & 0x00FFFFFF), &texture_priv->blt_meminfo_pixmap);
+ if (ret != PVR2D_OK) {
+ psb__error_message("%s(): PVR2DMemMap failed, ret = %d\n", __func__, ret);
+ return VA_STATUS_ERROR_UNKNOWN;
+ }
+ /* window */
+ } else {
+ ret = PVR2DMemMap(driver_data->hPVR2DContext, 0, (PVR2D_HANDLE)(dri_buffer->dri2.name & 0x00FFFFFF), &dri2_bb_export_meminfo);
if (ret != PVR2D_OK) {
psb__error_message("%s(): PVR2DMemMap failed, ret = %d\n", __func__, ret);
return VA_STATUS_ERROR_UNKNOWN;
}
- texture_priv->dri_init_flag = 1;
- return VA_STATUS_SUCCESS;
- }
-
- ret = PVR2DMemMap(texture_priv->hPVR2DContext, 0, (PVR2D_HANDLE)(dri_buffer->dri2.name & 0x00FFFFFF), &dri2_bb_export_meminfo);
- if (ret != PVR2D_OK) {
- psb__error_message("%s(): PVR2DMemMap failed, ret = %d\n", __func__, ret);
- return VA_STATUS_ERROR_UNKNOWN;
- }
-
- memcpy(&texture_priv->dri2_bb_export, dri2_bb_export_meminfo->pBase, sizeof(PVRDRI2BackBuffersExport));
+ memcpy(&texture_priv->dri2_bb_export, dri2_bb_export_meminfo->pBase, sizeof(PVRDRI2BackBuffersExport));
- if (texture_priv->dri2_bb_export.ui32Type == DRI2_BACK_BUFFER_EXPORT_TYPE_BUFFERS) {
- psb__information_message("psb_dri_init: Now map buffer, DRI2 back buffer export type: DRI2_BACK_BUFFER_EXPORT_TYPE_BUFFERS\n");
+ if (texture_priv->dri2_bb_export.ui32Type == DRI2_BACK_BUFFER_EXPORT_TYPE_BUFFERS) {
+ psb__information_message("psb_dri_init: Now map buffer, DRI2 back buffer export type: DRI2_BACK_BUFFER_EXPORT_TYPE_BUFFERS\n");
- for (i = 0; i < DRI2_BLIT_BUFFERS_NUM; i++) {
- ret = PVR2DMemMap(texture_priv->hPVR2DContext, 0, texture_priv->dri2_bb_export.hBuffers[i], &texture_priv->blt_meminfo[i]);
- if (ret != PVR2D_OK) {
- psb__error_message("%s(): PVR2DMemMap failed, ret = %d\n", __func__, ret);
- return VA_STATUS_ERROR_UNKNOWN;
+ for (i = 0; i < DRI2_BLIT_BUFFERS_NUM; i++) {
+ ret = PVR2DMemMap(driver_data->hPVR2DContext, 0, texture_priv->dri2_bb_export.hBuffers[i], &texture_priv->blt_meminfo[i]);
+ if (ret != PVR2D_OK) {
+ psb__error_message("%s(): PVR2DMemMap failed, ret = %d\n", __func__, ret);
+ return VA_STATUS_ERROR_UNKNOWN;
+ }
}
- }
- } else if (texture_priv->dri2_bb_export.ui32Type == DRI2_BACK_BUFFER_EXPORT_TYPE_SWAPCHAIN) {
- psb__information_message("psb_dri_init: Now map buffer, DRI2 back buffer export type: DRI2_BACK_BUFFER_EXPORT_TYPE_SWAPCHAIN\n");
-
- for (i = 0; i < DRI2_FLIP_BUFFERS_NUM; i++) {
- ret = PVR2DMemMap(texture_priv->hPVR2DContext, 0, texture_priv->dri2_bb_export.hBuffers[i], &texture_priv->flip_meminfo[i]);
- if (ret != PVR2D_OK) {
- psb__error_message("%s(): PVR2DMemMap failed, ret = %d\n", __func__, ret);
- return VA_STATUS_ERROR_UNKNOWN;
+ } else if (texture_priv->dri2_bb_export.ui32Type == DRI2_BACK_BUFFER_EXPORT_TYPE_SWAPCHAIN) {
+ psb__information_message("psb_dri_init: Now map buffer, DRI2 back buffer export type: DRI2_BACK_BUFFER_EXPORT_TYPE_SWAPCHAIN\n");
+
+ for (i = 0; i < DRI2_FLIP_BUFFERS_NUM; i++) {
+ ret = PVR2DMemMap(driver_data->hPVR2DContext, 0, texture_priv->dri2_bb_export.hBuffers[i], &texture_priv->flip_meminfo[i]);
+ if (ret != PVR2D_OK) {
+ psb__error_message("%s(): PVR2DMemMap failed, ret = %d\n", __func__, ret);
+ return VA_STATUS_ERROR_UNKNOWN;
+ }
}
}
+
+ PVR2DMemFree(driver_data->hPVR2DContext, dri2_bb_export_meminfo);
}
texture_priv->dri_init_flag = 1;
- PVR2DMemFree(texture_priv->hPVR2DContext, dri2_bb_export_meminfo);
+ psb_dri_reset_mem(ctx);
return VA_STATUS_SUCCESS;
}
@@ -205,6 +244,7 @@ VAStatus psb_putsurface_ctexture(
psb_output_device local_device, extend_device;
unsigned short tmp;
struct psb_texture_s *texture_priv = &driver_data->ctexture_priv;
+ struct dri_drawable *tmp_drawable;
obj_surface = SURFACE(surface);
@@ -213,13 +253,13 @@ VAStatus psb_putsurface_ctexture(
return VA_STATUS_ERROR_INVALID_SURFACE;
}
- if (driver_data->video_rotate == VA_ROTATION_NONE) {
+ if (driver_data->va_rotate == VA_ROTATION_NONE) {
psb_surface = obj_surface->psb_surface;
surface_width = obj_surface->width;
surface_height = obj_surface->height;
} else {
psb_surface = obj_surface->psb_surface_rotate;
- if (driver_data->video_rotate != VA_ROTATION_180) {
+ if (driver_data->va_rotate != VA_ROTATION_180) {
tmp = srcw;
srcw = srch;
srch = tmp;
@@ -365,17 +405,17 @@ VAStatus psb_putsurface_ctexture(
srcx, srcy, srcw, srch, xoffset, yoffset, xres, yres, texture_priv->extend_current_blt_buffer);
if (subtitle == BOTH || subtitle == ONLY_HDMI)
- psb_putsurface_textureblit(ctx, texture_priv->extend_blt_meminfo[texture_priv->extend_current_blt_buffer], surface, srcx, srcy, srcw, srch, 0, 0,
+ psb_putsurface_textureblit(ctx, (unsigned char *)texture_priv->extend_blt_meminfo[texture_priv->extend_current_blt_buffer], surface, srcx, srcy, srcw, srch, 0, 0,
xres, yres, 1,
surface_width, surface_height,
psb_surface->stride, psb_surface->buf.drm_buf,
- psb_surface->buf.pl_flags);
+ psb_surface->buf.pl_flags, 0 /* no wrap for dst */);
else
- psb_putsurface_textureblit(ctx, texture_priv->extend_blt_meminfo[texture_priv->extend_current_blt_buffer], surface, srcx, srcy, srcw, srch, 0, 0,
+ psb_putsurface_textureblit(ctx, (unsigned char *)texture_priv->extend_blt_meminfo[texture_priv->extend_current_blt_buffer], surface, srcx, srcy, srcw, srch, 0, 0,
xres, yres, 0,
surface_width, surface_height,
psb_surface->stride, psb_surface->buf.drm_buf,
- psb_surface->buf.pl_flags);
+ psb_surface->buf.pl_flags, 0 /* no wrap for dst */);
dri_swap_buffer(ctx, texture_priv->extend_dri_drawable);
texture_priv->extend_current_blt_buffer = (texture_priv->extend_current_blt_buffer + 1) & 0x01;
@@ -419,19 +459,20 @@ VAStatus psb_putsurface_ctexture(
}
/* Main Video for pixmap*/
- if (!texture_priv->dri_drawable->is_window) {
+ tmp_drawable = (struct dri_drawable *)texture_priv->dri_drawable;
+ if (!tmp_drawable->is_window) {
psb__information_message("psb_putsurface_ctexture: Main video Pixmap, coordinate: srcx= %d, srcy=%d, srcw=%d, srch=%d, destx=%d, desty=%d, destw=%d, desth=%d, cur_buffer=%d\n",
srcx, srcy, srcw, srch, destx, desty, destw, desth, texture_priv->current_blt_buffer);
if (subtitle == BOTH || (subtitle == NOSUBTITLE && obj_surface->subpic_count))
- psb_putsurface_textureblit(ctx, texture_priv->blt_meminfo_pixmap, surface, srcx, srcy, srcw, srch, destx, desty, destw, desth, 1,
+ psb_putsurface_textureblit(ctx, (unsigned char *)texture_priv->blt_meminfo_pixmap, surface, srcx, srcy, srcw, srch, destx, desty, destw, desth, 1,
surface_width, surface_height,
psb_surface->stride, psb_surface->buf.drm_buf,
- psb_surface->buf.pl_flags);
+ psb_surface->buf.pl_flags, 0 /* no wrap for dst */);
else
- psb_putsurface_textureblit(ctx, texture_priv->blt_meminfo_pixmap, surface, srcx, srcy, srcw, srch, destx, desty, destw, desth, 0,
+ psb_putsurface_textureblit(ctx, (unsigned char *)texture_priv->blt_meminfo_pixmap, surface, srcx, srcy, srcw, srch, destx, desty, destw, desth, 0,
surface_width, surface_height,
psb_surface->stride, psb_surface->buf.drm_buf,
- psb_surface->buf.pl_flags);
+ psb_surface->buf.pl_flags, 0 /* no wrap for dst */);
return VA_STATUS_SUCCESS;
}
@@ -442,15 +483,15 @@ VAStatus psb_putsurface_ctexture(
srcx, srcy, srcw, srch, destx, desty, destw, desth, texture_priv->current_blt_buffer);
if (subtitle == BOTH || (subtitle == NOSUBTITLE && obj_surface->subpic_count))
- psb_putsurface_textureblit(ctx, texture_priv->blt_meminfo[texture_priv->current_blt_buffer], surface, srcx, srcy, srcw, srch, destx, desty, destw, desth, 1,
+ psb_putsurface_textureblit(ctx, (unsigned char *)texture_priv->blt_meminfo[texture_priv->current_blt_buffer], surface, srcx, srcy, srcw, srch, destx, desty, destw, desth, 1,
surface_width, surface_height,
psb_surface->stride, psb_surface->buf.drm_buf,
- psb_surface->buf.pl_flags);
+ psb_surface->buf.pl_flags, 0 /* no wrap for dst */);
else
- psb_putsurface_textureblit(ctx, texture_priv->blt_meminfo[texture_priv->current_blt_buffer], surface, srcx, srcy, srcw, srch, destx, desty, destw, desth, 0,
+ psb_putsurface_textureblit(ctx, (unsigned char *)texture_priv->blt_meminfo[texture_priv->current_blt_buffer], surface, srcx, srcy, srcw, srch, destx, desty, destw, desth, 0,
surface_width, surface_height,
psb_surface->stride, psb_surface->buf.drm_buf,
- psb_surface->buf.pl_flags);
+ psb_surface->buf.pl_flags, 0 /* no wrap for dst */);
dri_swap_buffer(ctx, texture_priv->dri_drawable);
texture_priv->current_blt_buffer = (texture_priv->current_blt_buffer + 1) & 0x01;
@@ -460,15 +501,15 @@ VAStatus psb_putsurface_ctexture(
srcx, srcy, srcw, srch, destx, desty, display_width, display_height, texture_priv->current_blt_buffer);
if (subtitle == BOTH || (subtitle == NOSUBTITLE && obj_surface->subpic_count))
- psb_putsurface_textureblit(ctx, texture_priv->flip_meminfo[texture_priv->current_blt_buffer], surface, srcx, srcy, srcw, srch, destx, desty,
+ psb_putsurface_textureblit(ctx, (unsigned char *)texture_priv->flip_meminfo[texture_priv->current_blt_buffer], surface, srcx, srcy, srcw, srch, destx, desty,
display_width, display_height, 1, surface_width, surface_height,
psb_surface->stride, psb_surface->buf.drm_buf,
- psb_surface->buf.pl_flags);
+ psb_surface->buf.pl_flags, 0 /* no wrap for dst */);
else
- psb_putsurface_textureblit(ctx, texture_priv->flip_meminfo[texture_priv->current_blt_buffer], surface, srcx, srcy, srcw, srch, destx, desty,
+ psb_putsurface_textureblit(ctx, (unsigned char *)texture_priv->flip_meminfo[texture_priv->current_blt_buffer], surface, srcx, srcy, srcw, srch, destx, desty,
display_width, display_height, 0, surface_width, surface_height,
psb_surface->stride, psb_surface->buf.drm_buf,
- psb_surface->buf.pl_flags);
+ psb_surface->buf.pl_flags, 0 /* no wrap for dst */);
dri_swap_buffer(ctx, texture_priv->dri_drawable);
texture_priv->current_blt_buffer++;
diff --git a/src/x11/psb_x11.c b/src/x11/psb_x11.c
index 092f75a..ce9a474 100644
--- a/src/x11/psb_x11.c
+++ b/src/x11/psb_x11.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.
@@ -30,6 +30,7 @@
#include <X11/Xutil.h>
#include <X11/extensions/Xrandr.h>
#include <X11/extensions/dpms.h>
+#include <va/va_dricommon.h>
#include <va/va_backend.h>
#include "psb_output.h"
#include "psb_surface.h"
@@ -53,6 +54,9 @@
#define CONTEXT(id) ((object_context_p) object_heap_lookup( &driver_data->context_heap, id ))
+void psb_x11_freeWindowClipBoxList(psb_x11_clip_list_t * pHead);
+
+
//X error trap
static int x11_error_code = 0;
static int (*old_error_handler)(Display *, XErrorEvent *);
@@ -268,6 +272,9 @@ void *psb_x11_output_init(VADriverContextP ctx)
return NULL;
}
+ if (getenv("PSB_VIDEO_EXTEND_FULLSCREEN"))
+ driver_data->extend_fullscreen = 1;
+
if (getenv("PSB_VIDEO_PUTSURFACE_X11")) {
psb__information_message("Putsurface force to SW rendering\n");
driver_data->output_method = PSB_PUTSURFACE_X11;
@@ -277,11 +284,34 @@ void *psb_x11_output_init(VADriverContextP ctx)
psb_init_xvideo(ctx, output);
+ output->output_drawable = 0;
+ output->extend_drawable = 0;
+ output->pClipBoxList = NULL;
+ output->ui32NumClipBoxList = 0;
+ output->frame_count = 0;
+ output->bIsVisible = 0;
+
/* always init CTEXTURE and COVERLAY */
driver_data->coverlay = 1;
driver_data->color_key = 0x11;
driver_data->ctexture = 1;
+ driver_data->xrandr_dirty = 0;
+ driver_data->xrandr_update = 0;
+
+ if (getenv("PSB_VIDEO_EXTEND_FULLSCREEN")) {
+ driver_data->extend_fullscreen = 1;
+ }
+
+ driver_data->xrandr_thread_id = 0;
+ if (getenv("PSB_VIDEO_NOTRD") || IS_MRST(driver_data)) {
+ psb__information_message("Force not to start psb xrandr thread.\n");
+ driver_data->use_xrandr_thread = 0;
+ } else {
+ psb__information_message("By default, use psb xrandr thread.\n");
+ driver_data->use_xrandr_thread = 1;
+ }
+
if (IS_MFLD(driver_data) && /* force MFLD to use COVERLAY */
(driver_data->output_method == PSB_PUTSURFACE_OVERLAY)) {
psb__information_message("Use client overlay mode for post-processing\n");
@@ -323,7 +353,23 @@ error_handler(Display *dpy, XErrorEvent *error)
void psb_x11_output_deinit(VADriverContextP ctx)
{
+ INIT_DRIVER_DATA;
+ INIT_OUTPUT_PRIV;
+ struct dri_state *dri_state = (struct dri_state *)ctx->dri_state;
+
+ psb_x11_freeWindowClipBoxList(output->pClipBoxList);
+ output->pClipBoxList = NULL;
+
+ if (output->extend_drawable) {
+ XDestroyWindow(ctx->native_dpy, output->extend_drawable);
+ output->extend_drawable = 0;
+ }
+
psb_deinit_xvideo(ctx);
+
+ /* close dri fd and release all drawable buffer */
+ if (driver_data->ctexture == 1)
+ (*dri_state->close)(ctx);
}
static void
@@ -363,8 +409,14 @@ static int pnw_check_output_method(VADriverContextP ctx, object_surface_p obj_su
return 0;
}
+ /* Assign default value for MRST */
+ if (IS_MRST(driver_data))
+ driver_data->output_method = PSB_PUTSURFACE_OVERLAY;
+ else if (IS_MFLD(driver_data))
+ driver_data->output_method = PSB_PUTSURFACE_COVERLAY;
+
if (driver_data->overlay_auto_paint_color_key)
- driver_data->output_method = PSB_PUTSURFACE_COVERLAY;
+ driver_data->output_method = PSB_PUTSURFACE_COVERLAY;
/* Avoid call is_window()/XGetWindowAttributes() every frame */
if (output->output_drawable_save != draw) {
@@ -375,14 +427,24 @@ static int pnw_check_output_method(VADriverContextP ctx, object_surface_p obj_su
output->is_pixmap = 0;
}
- if (output->is_pixmap == 1 || (IS_MRST(driver_data) && obj_surface->subpic_count > 0) || width >= 2048 || height >= 2048 ||
- /*FIXME: overlay path can't handle subpicture scaling. when surface size > dest box, fallback to texblit.*/
- (IS_MFLD(driver_data) && obj_surface->subpic_count && ((width > destw) || (height > desth)))) {
+ /*FIXME: overlay path can't handle subpicture scaling. when surface size > dest box, fallback to texblit.*/
+ if ((output->is_pixmap == 1)
+ || (IS_MRST(driver_data) && obj_surface->subpic_count > 0)
+ || (IS_MFLD(driver_data) && obj_surface->subpic_count && ((width > destw) || (height > desth)))
+ || (width >= 2048)
+ || (height >= 2048)
+ ) {
psb__information_message("Putsurface fall back to use Client Texture\n");
driver_data->output_method = PSB_PUTSURFACE_CTEXTURE;
}
+ if (IS_MFLD(driver_data) &&
+ (driver_data->xrandr_dirty & PSB_NEW_ROTATION)) {
+ psb_RecalcRotate(ctx);
+ driver_data->xrandr_dirty &= ~PSB_NEW_ROTATION;
+ }
+
return 0;
}
@@ -449,6 +511,11 @@ VAStatus psb_PutSurface(
psb__information_message("Using client Overlay for PutSurface\n");
srcw = srcw <= 1920 ? srcw : 1920;
+ /* init overlay*/
+ if (!driver_data->coverlay_init) {
+ psb_coverlay_init(ctx);
+ driver_data->coverlay_init = 1;
+ }
psb_putsurface_coverlay(
ctx, surface, draw,
diff --git a/src/x11/psb_x11.h b/src/x11/psb_x11.h
index fff7be0..277a48f 100644
--- a/src/x11/psb_x11.h
+++ b/src/x11/psb_x11.h
@@ -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.
diff --git a/src/x11/psb_xrandr.c b/src/x11/psb_xrandr.c
index 0d7edc6..6b1ffc1 100644
--- a/src/x11/psb_xrandr.c
+++ b/src/x11/psb_xrandr.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.
@@ -27,7 +27,7 @@
*
*/
-
+#include <unistd.h>
#include "psb_xrandr.h"
#include "psb_x11.h"
@@ -165,7 +165,7 @@ static void psb_xrandr_hdmi_property(VADriverContextP ctx)
static void psb_xrandr_mipi_location_init(psb_output_device_mode output_device_mode)
{
- psb_xrandr_crtc_p local_crtc, extend_crtc;
+ psb_xrandr_crtc_p local_crtc = NULL, extend_crtc = NULL;
switch (output_device_mode) {
case SINGLE_MIPI0:
@@ -210,7 +210,7 @@ static void psb_xrandr_mipi_location_init(psb_output_device_mode output_device_m
static void psb_xrandr_hdmi_location_init(psb_output_device_mode output_device_mode)
{
- psb_xrandr_crtc_p local_crtc, extend_crtc;
+ psb_xrandr_crtc_p local_crtc = NULL, extend_crtc = NULL;
switch (output_device_mode) {
case SINGLE_HDMI:
@@ -479,6 +479,8 @@ void psb_xrandr_refresh(VADriverContextP ctx)
}
psb_xrandr_coordinate_init(ctx);
+
+ psb_RecalcRotate(ctx);
pthread_mutex_unlock(&psb_xrandr_info->psb_extvideo_mutex);
}
diff --git a/src/x11/psb_xrandr.h b/src/x11/psb_xrandr.h
index 6f211c4..a2e6b0d 100644
--- a/src/x11/psb_xrandr.h
+++ b/src/x11/psb_xrandr.h
@@ -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.
diff --git a/src/x11/psb_xvva.c b/src/x11/psb_xvva.c
index 2fd2158..d9c1982 100644
--- a/src/x11/psb_xvva.c
+++ b/src/x11/psb_xvva.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.