summaryrefslogtreecommitdiff
path: root/va
diff options
context:
space:
mode:
authorAustin Yuan <shengquan.yuan@gmail.com>2013-03-29 14:12:19 +0800
committerbuildbot <buildbot@intel.com>2013-04-03 00:44:22 -0700
commit097f9bb6e21f15a66ada17cdf4846098df744c91 (patch)
tree7c7a101c423b771cdadfa89ddd4f5d1115f63a4c /va
parent149f78740d3a49898617fcb5a0fd106398bddb8c (diff)
downloadlibva-097f9bb6e21f15a66ada17cdf4846098df744c91.tar.gz
Add short format decode support in libva
BZ: 96644 Short format decode support is in freedesktop now,and now rebase MCG PSI libva to the latest version Change-Id: Ic564a9c596b6f665a71c46386f20bdc5fad25d3b Signed-off-by: Austin Yuan <shengquan.yuan@intel.com> Reviewed-on: http://android.intel.com:8080/99103 Reviewed-by: Shi, PingX <pingx.shi@intel.com> Tested-by: Shi, PingX <pingx.shi@intel.com> Reviewed-by: buildbot <buildbot@intel.com> Tested-by: buildbot <buildbot@intel.com>
Diffstat (limited to 'va')
-rw-r--r--va/android/drmtest.c139
-rw-r--r--va/android/drmtest.h40
l---------va/android/va_dummy.c1
l---------va/dummy1
-rw-r--r--va/glx/va_glx_impl.c12
-rwxr-xr-xva/va.c1
-rwxr-xr-xva/va.h51
l---------va/va_dummy.h1
8 files changed, 60 insertions, 186 deletions
diff --git a/va/android/drmtest.c b/va/android/drmtest.c
deleted file mode 100644
index 444ef47..0000000
--- a/va/android/drmtest.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright © 2007 Intel Corporation
- *
- * 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, sublicense,
- * 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 NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS 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:
- * Eric Anholt <eric@anholt.net>
- *
- */
-
-#include <string.h>
-#include <fcntl.h>
-#include <fnmatch.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include "drmtest.h"
-
-#define LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE
-#include <libudev.h>
-
-static int is_master(int fd)
-{
- drm_client_t client;
- int ret;
-
- /* Check that we're the only opener and authed. */
- client.idx = 0;
- ret = ioctl(fd, DRM_IOCTL_GET_CLIENT, &client);
- assert (ret == 0);
- if (!client.auth)
- return 0;
- client.idx = 1;
- ret = ioctl(fd, DRM_IOCTL_GET_CLIENT, &client);
- if (ret != -1 || errno != EINVAL)
- return 0;
-
- return 1;
-}
-
-/** Open the first DRM device matching the criteria */
-int drm_open_matching(const char *pci_glob, int flags, int *vendor_id, int *device_id)
-{
- struct udev *udev;
- struct udev_enumerate *e;
- struct udev_device *device, *parent;
- struct udev_list_entry *entry;
- const char *pci_id, *path;
- char *tmp;
- int fd;
-
- *vendor_id = 0;
- *device_id = 0;
-
- udev = udev_new();
- if (udev == NULL) {
- fprintf(stderr, "failed to initialize udev context\n");
- return -1;
- //abort();
- }
-
- fd = -1;
- e = udev_enumerate_new(udev);
- udev_enumerate_add_match_subsystem(e, "drm");
- udev_enumerate_scan_devices(e);
- udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(e)) {
- path = udev_list_entry_get_name(entry);
- device = udev_device_new_from_syspath(udev, path);
- parent = udev_device_get_parent(device);
- /* Filter out KMS output devices. */
- if (strcmp(udev_device_get_subsystem(parent), "pci") != 0)
- continue;
- pci_id = udev_device_get_property_value(parent, "PCI_ID");
- if (fnmatch(pci_glob, pci_id, 0) != 0)
- continue;
- fd = open(udev_device_get_devnode(device), O_RDWR);
- if (fd < 0)
- continue;
- if ((flags & DRM_TEST_MASTER) && !is_master(fd)) {
- close(fd);
- fd = -1;
- continue;
- }
-
- break;
- }
- udev_enumerate_unref(e);
- udev_unref(udev);
-
- *vendor_id = (int) strtol(pci_id, &tmp, 16);
- *device_id = (int) strtol((tmp+1), NULL, 16);
-
- return fd;
-}
-
-int drm_open_any(int *vendor_id, int *device_id)
-{
- int fd = drm_open_matching("*:*", 0, vendor_id, device_id);
-
- if (fd < 0) {
- fprintf(stderr, "failed to open any drm device\n");
- //abort();
- }
-
- return fd;
-}
-
-/**
- * Open the first DRM device we can find where we end up being the master.
- */
-int drm_open_any_master(void)
-{
- int vendor_id, device_id;
- int fd = drm_open_matching("*:*", DRM_TEST_MASTER, &vendor_id, &device_id);
-
- if (fd < 0) {
- fprintf(stderr, "failed to open any drm device\n");
- abort();
- }
-
- return fd;
-
-}
diff --git a/va/android/drmtest.h b/va/android/drmtest.h
deleted file mode 100644
index 5f10f08..0000000
--- a/va/android/drmtest.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright © 2007 Intel Corporation
- *
- * 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, sublicense,
- * 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 NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS 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:
- * Eric Anholt <eric@anholt.net>
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <assert.h>
-#include <errno.h>
-
-#include "xf86drm.h"
-
-#define DRM_TEST_MASTER 0x01
-
-int drm_open_any(int *vendor_id, int *device_id);
-int drm_open_any_master(void);
-int drm_open_matching(const char *pci_glob, int flags, int *vendor_id, int *device_id);
diff --git a/va/android/va_dummy.c b/va/android/va_dummy.c
deleted file mode 120000
index b47bd16..0000000
--- a/va/android/va_dummy.c
+++ /dev/null
@@ -1 +0,0 @@
-va_android.cpp \ No newline at end of file
diff --git a/va/dummy b/va/dummy
deleted file mode 120000
index 1fd74d1..0000000
--- a/va/dummy
+++ /dev/null
@@ -1 +0,0 @@
-android \ No newline at end of file
diff --git a/va/glx/va_glx_impl.c b/va/glx/va_glx_impl.c
index 049be09..aacefc8 100644
--- a/va/glx/va_glx_impl.c
+++ b/va/glx/va_glx_impl.c
@@ -876,19 +876,25 @@ vaCreateSurfaceGLX_impl_libva(
gl_get_current_context(&old_cs);
new_cs = gl_create_context(ctx, &old_cs);
if (!new_cs)
- return VA_STATUS_ERROR_ALLOCATION_FAILED;
+ goto error;
if (!gl_set_current_context(new_cs, NULL))
- return VA_STATUS_ERROR_OPERATION_FAILED;
+ goto error;
pSurfaceGLX = create_surface(ctx, target, texture);
if (!pSurfaceGLX)
- return VA_STATUS_ERROR_ALLOCATION_FAILED;
+ goto error;
pSurfaceGLX->gl_context = new_cs;
*gl_surface = pSurfaceGLX;
gl_set_current_context(&old_cs, NULL);
return VA_STATUS_SUCCESS;
+
+error:
+ if (new_cs)
+ gl_destroy_context(new_cs);
+
+ return VA_STATUS_ERROR_ALLOCATION_FAILED;
}
static VAStatus
diff --git a/va/va.c b/va/va.c
index deff824..e60a4b4 100755
--- a/va/va.c
+++ b/va/va.c
@@ -218,6 +218,7 @@ static VAStatus va_openDriver(VADisplay dpy, char *driver_name)
if (!driver_path) {
va_errorMessage("%s L%d Out of memory!n",
__FUNCTION__, __LINE__);
+ free(search_path);
return VA_STATUS_ERROR_ALLOCATION_FAILED;
}
diff --git a/va/va.h b/va/va.h
index 2c4587d..dbcc8e1 100755
--- a/va/va.h
+++ b/va/va.h
@@ -321,6 +321,21 @@ typedef enum
VAConfigAttribEncryption = 4,
VAConfigAttribRateControl = 5,
+ /** @name Attributes for decoding */
+ /**@{*/
+ /**
+ * \brief Slice Decoding mode. Read/write.
+ *
+ * This attribute determines what mode the driver supports for slice
+ * decoding, through vaGetConfigAttributes(); and what mode the user
+ * will be providing to the driver, through vaCreateConfig(), if the
+ * driver supports those. If this attribute is not set by the user then
+ * it is assumed that VA_DEC_SLICE_MODE_NORMAL mode is used.
+ *
+ * See \c VA_DEC_SLICE_MODE_xxx for the list of slice decoding modes.
+ */
+ VAConfigAttribDecSliceMode = 6,
+
/** @name Attributes for encoding */
/**@{*/
/**
@@ -425,6 +440,8 @@ typedef struct _VAConfigAttrib {
#define VA_RT_FORMAT_YUV400 0x00000010
#define VA_RT_FORMAT_RGB16 0x00010000
#define VA_RT_FORMAT_RGB32 0x00020000
+/* RGBP covers RGBP and BGRP fourcc */
+#define VA_RT_FORMAT_RGBP 0x00100000
#define VA_RT_FORMAT_PROTECTED 0x80000000
/** @name Attribute values for VAConfigAttribRateControl */
@@ -443,6 +460,14 @@ typedef struct _VAConfigAttrib {
#define VA_RC_VBR_CONSTRAINED 0x00000020
/**@}*/
+/** @name Attribute values for VAConfigAttribDecSliceMode */
+/**@{*/
+/** \brief Driver supports normal mode for slice decoding */
+#define VA_DEC_SLICE_MODE_NORMAL 0x00000001
+/** \brief Driver supports base mode for slice decoding */
+#define VA_DEC_SLICE_MODE_BASE 0x00000002
+/**@}*/
+
/** @name Attribute values for VAConfigAttribEncPackedHeaders */
/**@{*/
/** \brief Driver does not support any packed headers mode. */
@@ -1501,7 +1526,14 @@ This is simplely a buffer containing raw bit-stream bytes
typedef struct _VAPictureH264
{
VASurfaceID picture_id;
+ /*
+ * frame_idx is long_term_frame_idx for long term reference picture,
+ * and frame_num for short term reference picture.
+ */
unsigned int frame_idx;
+ /*
+ * see flags below.
+ */
unsigned int flags;
signed int TopFieldOrderCnt;
signed int BottomFieldOrderCnt;
@@ -1512,6 +1544,7 @@ typedef struct _VAPictureH264
#define VA_PICTURE_H264_BOTTOM_FIELD 0x00000004
#define VA_PICTURE_H264_SHORT_TERM_REFERENCE 0x00000008
#define VA_PICTURE_H264_LONG_TERM_REFERENCE 0x00000010
+#define VA_PICTURE_H264_NON_EXISTING 0x00000020
/* H.264 Picture Parameter Buffer */
/*
@@ -1566,6 +1599,8 @@ typedef struct _VAPictureParameterBufferH264
unsigned int value;
} pic_fields;
unsigned short frame_num;
+ unsigned char num_ref_idx_l0_default_active_minus1;
+ unsigned char num_ref_idx_l1_default_active_minus1;
} VAPictureParameterBufferH264;
/* H.264 Inverse Quantization Matrix Buffer */
@@ -1585,7 +1620,20 @@ typedef struct _VAIQMatrixBufferH264
* in raster scan order
*/
-/* H.264 Slice Parameter Buffer */
+/*
+ * H.264 Slice Parameter Buffer for base mode decoding
+ */
+typedef struct _VASliceParameterBufferBaseH264
+{
+ unsigned int slice_data_size;/* number of bytes in the slice data buffer for this slice */
+ /** \brief Byte offset to the NAL Header Unit for this slice. */
+ unsigned int slice_data_offset;
+ unsigned int slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX defintions */
+} VASliceParameterBufferH264Base;
+
+/*
+ * H.264 Slice Parameter Buffer for normal mode decoding
+ */
typedef struct _VASliceParameterBufferH264
{
unsigned int slice_data_size;/* number of bytes in the slice data buffer for this slice */
@@ -2000,6 +2048,7 @@ VAStatus vaQuerySurfaceError(
#define VA_FOURCC_444P 0x50343434
#define VA_FOURCC_RGBP 0x50424752
#define VA_FOURCC_BGRP 0x50524742
+#define VA_FOURCC_411R 0x52313134 /* rotated 411P */
/* byte order */
#define VA_LSB_FIRST 1
diff --git a/va/va_dummy.h b/va/va_dummy.h
deleted file mode 120000
index 69128f8..0000000
--- a/va/va_dummy.h
+++ /dev/null
@@ -1 +0,0 @@
-va_android.h \ No newline at end of file