summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Zanussi <tom.zanussi@intel.com>2010-12-27 22:32:21 (GMT)
committerTom Zanussi <tom.zanussi@intel.com>2010-12-27 22:32:21 (GMT)
commitaf40e14ce335fa689d1a989feba3c02a8c71b7a7 (patch)
tree90ce1d53eb63627d90ec7f081b680a66c92e8705
parentba8b8a99fd1598d0ce2cbaa69e9d16358d1ff5db (diff)
downloadmeta-intel-af40e14ce335fa689d1a989feba3c02a8c71b7a7.tar.gz
meta-emenlow: move to meta-intel repo from poky repo
This is the meta-emenlow layer, moved from the poky repo in order to keep all the meta-intel BSPs together. This version builds against laverne (0.90) - detailed build instruction can be found in the README file. Signed-off-by: Tom Zanussi <tom.zanussi@intel.com>
-rw-r--r--meta-emenlow/COPYING.MIT17
-rw-r--r--meta-emenlow/README86
-rw-r--r--meta-emenlow/binary/.gitignore0
-rw-r--r--meta-emenlow/conf/checksums.ini19
-rw-r--r--meta-emenlow/conf/layer.conf10
-rw-r--r--meta-emenlow/conf/machine/emenlow.conf48
-rw-r--r--meta-emenlow/recipes-bsp/formfactor/formfactor/emenlow/machconfig3
-rw-r--r--meta-emenlow/recipes-bsp/formfactor/formfactor_0.0.bbappend3
-rw-r--r--meta-emenlow/recipes-graphics/libdrm-poulsbo/libdrm-poulsbo-2.3.0/libdrm-poulsbo.patch61
-rw-r--r--meta-emenlow/recipes-graphics/libdrm-poulsbo/libdrm-poulsbo_2.3.0.bb19
-rw-r--r--meta-emenlow/recipes-graphics/libva/libva-0.31.0/033_g45_add_rgba_subpic.patch111
-rw-r--r--meta-emenlow/recipes-graphics/libva/libva-0.31.0/034_g45_fix_return_for_unimpl.patch83
-rw-r--r--meta-emenlow/recipes-graphics/libva/libva-0.31.0/035_g45_add_yv12_image_format.patch102
-rw-r--r--meta-emenlow/recipes-graphics/libva/libva-0.31.0/036_g45_add_vaGetImage.patch71
-rw-r--r--meta-emenlow/recipes-graphics/libva/libva-0.31.0/037_g45_add_vaPutImage.patch111
-rw-r--r--meta-emenlow/recipes-graphics/libva/libva-0.31.0/038_g45_vaPutSurface_cliprects.patch531
-rw-r--r--meta-emenlow/recipes-graphics/libva/libva-0.31.0/102_attribute_visibility.patch47
-rw-r--r--meta-emenlow/recipes-graphics/libva/libva-0.31.0/103_fix_vainfo_deps.patch24
-rw-r--r--meta-emenlow/recipes-graphics/libva/libva-0.31.0/104_fix_libva_pkgconfig_deps.patch18
-rw-r--r--meta-emenlow/recipes-graphics/libva/libva-0.31.0/105_dont_search_LIBGL_DRIVERS_PATH.patch21
-rw-r--r--meta-emenlow/recipes-graphics/libva/libva-0.31.0/108_drivers_path.patch25
-rw-r--r--meta-emenlow/recipes-graphics/libva/libva-0.31.0/203_fix_fglrx_detection.patch542
-rw-r--r--meta-emenlow/recipes-graphics/libva/libva-0.31.0/204_check_ATIFGLEXTENSION.patch312
-rw-r--r--meta-emenlow/recipes-graphics/libva/libva-0.31.0/300_sds_version.patch87
-rw-r--r--meta-emenlow/recipes-graphics/libva/libva-0.31.0/301_vdpau_mpeg4.patch26
-rw-r--r--meta-emenlow/recipes-graphics/libva/libva-0.31.0/320_move_vaPutSurface_flags_def.patch60
-rw-r--r--meta-emenlow/recipes-graphics/libva/libva-0.31.0/321_libva_glx.base.patch212
-rw-r--r--meta-emenlow/recipes-graphics/libva/libva-0.31.0/322_libva_glx.patch2024
-rw-r--r--meta-emenlow/recipes-graphics/libva/libva-0.31.0/390_compat.base.patch135
-rw-r--r--meta-emenlow/recipes-graphics/libva/libva-0.31.0/391_compat.patch3273
-rw-r--r--meta-emenlow/recipes-graphics/libva/libva-0.31.0/392_compat.dso.patch183
-rw-r--r--meta-emenlow/recipes-graphics/libva/libva-0.31.0/libdrm-poulsbo.patch26
-rw-r--r--meta-emenlow/recipes-graphics/libva/libva_0.31.0.bb40
-rw-r--r--meta-emenlow/recipes-graphics/psb-firmware/psb-firmware_0.30.bb15
-rw-r--r--meta-emenlow/recipes-graphics/xorg-xserver/files/crosscompile.patch19
-rw-r--r--meta-emenlow/recipes-graphics/xorg-xserver/files/fix_open_max_preprocessor_error.patch13
-rw-r--r--meta-emenlow/recipes-graphics/xorg-xserver/files/libdrm-poulsbo.patch26
-rw-r--r--meta-emenlow/recipes-graphics/xorg-xserver/files/macro_tweak.patch18
-rw-r--r--meta-emenlow/recipes-graphics/xorg-xserver/files/nodolt.patch12
-rw-r--r--meta-emenlow/recipes-graphics/xorg-xserver/xserver-psb_1.7.99.2.bb21
-rw-r--r--meta-emenlow/recipes-graphics/xorg-xserver/xserver-xf86-config/emenlow/xorg.conf13
-rw-r--r--meta-emenlow/recipes-graphics/xorg-xserver/xserver-xf86-config_0.1.bbappend3
-rw-r--r--meta-emenlow/recipes-graphics/xpsb-glx/xpsb-glx-0.18/cross-compile.patch58
-rw-r--r--meta-emenlow/recipes-graphics/xpsb-glx/xpsb-glx-0.18/libdrmname.patch63
-rw-r--r--meta-emenlow/recipes-graphics/xpsb-glx/xpsb-glx-0.18/native-matypes.patch20
-rw-r--r--meta-emenlow/recipes-graphics/xpsb-glx/xpsb-glx_0.18.bb46
-rw-r--r--meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/01_disable_lid_timer.patch12
-rw-r--r--meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/dri-h.patch20
-rw-r--r--meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/libdrm-poulsbo.patch13
-rw-r--r--meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/psb_mixed.patch35
-rw-r--r--meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/psb_xvtempfix.patch17
-rw-r--r--meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/stubs.patch23
-rw-r--r--meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/visibility.patch12
-rw-r--r--meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/xorg-x11-drv-psb-0.31.0-ignoreacpi.patch11
-rw-r--r--meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/xorg-x11-drv-psb-0.31.0-xserver17.patch85
-rw-r--r--meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/xserver-xorg-video-psb-0.31.0-assert.patch11
-rw-r--r--meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/xserver-xorg-video-psb-0.31.0-comment_unused.patch75
-rw-r--r--meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/xserver-xorg-video-psb-0.31.0-greedy.patch19
-rw-r--r--meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/xserver-xorg-video-psb-0.31.0-loader.patch84
-rw-r--r--meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb_0.32.1.bb34
-rw-r--r--meta-emenlow/recipes-kernel/linux/linux-wrs_git.bbappend3
61 files changed, 9111 insertions, 0 deletions
diff --git a/meta-emenlow/COPYING.MIT b/meta-emenlow/COPYING.MIT
new file mode 100644
index 0000000..fb950dc
--- /dev/null
+++ b/meta-emenlow/COPYING.MIT
@@ -0,0 +1,17 @@
1Permission is hereby granted, free of charge, to any person obtaining a copy
2of this software and associated documentation files (the "Software"), to deal
3in the Software without restriction, including without limitation the rights
4to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5copies of the Software, and to permit persons to whom the Software is
6furnished to do so, subject to the following conditions:
7
8The above copyright notice and this permission notice shall be included in
9all copies or substantial portions of the Software.
10
11THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
17THE SOFTWARE.
diff --git a/meta-emenlow/README b/meta-emenlow/README
new file mode 100644
index 0000000..db9f475
--- /dev/null
+++ b/meta-emenlow/README
@@ -0,0 +1,86 @@
1This README file contains information on building the meta-emenlow
2BSP layer using any of the supported machine configurations, and
3booting the images contained in the /binary directory.
4
5If you're only interested in booting the images in the /binary
6directory of a BSP tarball you've downloaded, there's nothing special
7to do - the appropriate images are already in the /binary directory
8depending on which BSP tarball you downloaded.
9
10Please see the corresponding sections below for details.
11
12
13Table of Contents
14=================
15
16 I. Building the meta-emenlow BSP layer
17II. Booting the images in /binary
18
19
20I. Building the meta-emenlow BSP layer
21=======================================
22
23The 'meta-intel' repository contains multiple branches, one
24corresponding to each major release starting with 'laverne' (0.90), in
25addition to the latest code which tracks the current master.
26
27In order to build an image with BSP support for a given release, you
28need to check out the 'meta-intel' branch corresponding to the release
29you're building against e.g. to build for laverne (0.90), check out
30the 'laverne' branch of both poky and 'meta-intel'.
31
32Having done that, and assuming you cloned the 'meta-intel' repository
33at the top-level of your yocto build tree, you can build an emenlow
34image by adding the location of the meta-emenlow layer to
35bblayers.conf e.g.:
36
37 yocto/meta-intel/meta-emenlow \
38
39To enable the emenlow layer, add the emenlow MACHINE to local.conf:
40
41 MACHINE ?= "emenlow"
42
43You should then be able to build an emenlow image as such:
44
45 $ source poky-init-build-env
46 $ bitbake poky-image-sato-live
47
48At the end of a successful build, you should have a live image that
49you can boot from a USB flash drive (see instructions on how to do
50that below, in the section 'Booting the images from /binary').
51
52
53II. Booting the images in /binary
54=================================
55
56This BSP contains bootable live images, which can be used to directly
57boot Yocto off of a USB flash drive.
58
59Under Linux, insert a USB flash drive. Assuming the USB flash drive
60takes device /dev/sdf, use dd to copy the live image to it. For
61example:
62
63# dd if=poky-image-sato-live-emenlow-20101207053738.hddimg of=/dev/sdf
64# sync
65# eject /dev/sdf
66
67This should give you a bootable USB flash device. Insert the device
68into a bootable USB socket on the target, and power on. This should
69result in a system booted to the Sato graphical desktop.
70
71If you want a terminal, use the arrows at the top of the UI to move to
72different pages of available applications, one of which is named
73'Terminal'. Clicking that should give you a root terminal.
74
75If you want to ssh into the system, you can use the root terminal to
76ifconfig the IP address and use that to ssh in. The root password is
77empty, so to log in type 'root' for the user name and hit 'Enter' at
78the Password prompt: and you should be in.
79
80----
81
82If you find you're getting corrupt images on the USB (it doesn't show
83the syslinux boot: prompt, or the boot: prompt contains strange
84characters), try doing this first:
85
86# dd if=/dev/zero of=/dev/sdf bs=1M count=512
diff --git a/meta-emenlow/binary/.gitignore b/meta-emenlow/binary/.gitignore
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/meta-emenlow/binary/.gitignore
diff --git a/meta-emenlow/conf/checksums.ini b/meta-emenlow/conf/checksums.ini
new file mode 100644
index 0000000..476cfca
--- /dev/null
+++ b/meta-emenlow/conf/checksums.ini
@@ -0,0 +1,19 @@
1[https://launchpad.net/~gma500/+archive/ppa/+files/libdrm-poulsbo_2.3.0-1ubuntu0sarvatt4~1004um1ubuntu1.tar.gz]
2md5=82c00bb9f1239f1d00b18411b89c2380
3sha256=335d4ac6694687475efe07b44a2d77a9a9fadcbc16946d01ea8a02339ae7d9ec
4
5[https://launchpad.net/~gma500/+archive/ppa/+files/libva_0.31.0-1+sds9.1ubuntu1.tar.gz]
6md5=860f13e5a9d09511d7c6807b880e758b
7sha256=306468f87b9e13fdb3b6f0c6e2159b20198b33eed9eda4c31d7381a88911554f
8
9[https://launchpad.net/~gma500/+archive/ppa/+files/psb-firmware_0.30-0ubuntu1netbook1ubuntu1.tar.gz]
10md5=760005739edc64387240e56f6916e825
11sha256=714bc9162409b172caaabdaff5a942bc9d104a9b3a47a165754f7090803ba4b3
12
13[https://launchpad.net/~gma500/+archive/ppa/+files/xpsb-glx_0.18-0ubuntu1netbook2~1004um1ubuntu1.tar.gz]
14md5=50423a9e861ccff5814eb95a32494952
15sha256=03c958defef56ae0ec051c6f67620fa90733649925386824b7bf029f40bd7905
16
17[https://launchpad.net/~gma500/+archive/ppa/+files/xserver-xorg-video-psb_0.36.0-0ubuntu3~1004um9.tar.gz]
18md5=67bd808960db4fe9b3a7ff2582da1608
19sha256=deeaf6e4d059e709d8a4268bd013a172f7fbd70778236d7d1e2712d1951de72c
diff --git a/meta-emenlow/conf/layer.conf b/meta-emenlow/conf/layer.conf
new file mode 100644
index 0000000..563b9c8
--- /dev/null
+++ b/meta-emenlow/conf/layer.conf
@@ -0,0 +1,10 @@
1# We have a conf and classes directory, add to BBPATH
2BBPATH := "${BBPATH}:${LAYERDIR}"
3
4# We have a packages directory, add to BBFILES
5BBFILES := "${BBFILES} ${LAYERDIR}/recipes-*/*/*.bb \
6 ${LAYERDIR}/recipes-*/*/*.bbappend"
7
8BBFILE_COLLECTIONS += "emenlow"
9BBFILE_PATTERN_emenlow := "^${LAYERDIR}/"
10BBFILE_PRIORITY_emenlow = "6"
diff --git a/meta-emenlow/conf/machine/emenlow.conf b/meta-emenlow/conf/machine/emenlow.conf
new file mode 100644
index 0000000..fab3b4c
--- /dev/null
+++ b/meta-emenlow/conf/machine/emenlow.conf
@@ -0,0 +1,48 @@
1#@TYPE: Machine
2#@NAME: emenlow
3
4#@DESCRIPTION: Machine configuration for eMenlow based systems, like the
5# Webs-2120 box.
6
7TARGET_ARCH = "i586"
8PACKAGE_EXTRA_ARCHS = "x86 emen"
9
10include conf/machine/include/tune-atom.inc
11
12BASE_PACKAGE_ARCH="emen"
13
14MACHINE_FEATURES = "kernel26 screen keyboard pci usbhost ext2 ext3 x86 \
15 acpi serial usbgadget"
16
17KERNEL_IMAGETYPE = "bzImage"
18
19PREFERRED_PROVIDER_virtual/kernel = "linux-wrs"
20#PREFERRED_PROVIDER_linux-libc-headers ?= "linux-libc-headers-yocto"
21PREFERRED_PROVIDER_libdrm = "libdrm-poulsbo"
22PREFERRED_PROVIDER_drm = "libdrm-poulsbo"
23PREFERRED_PROVIDER_virtual/libx11 = "libx11-trim"
24PREFERRED_PROVIDER_virtual/libgl = "xpsb-glx"
25PREFERRED_PROVIDER_virtual/xserver = "xserver-psb"
26PREFERRED_PROVIDER_virtual/xserver-xf86 = "xserver-psb"
27PREFERRED_PROVIDER_xserver-xf86-dri-lite = "xserver-psb"
28
29XSERVER ?= "xserver-psb \
30 xf86-input-mouse \
31 xf86-input-keyboard \
32 xf86-input-evdev"
33
34SERIAL_CONSOLE = "115200 ttyS0"
35
36MACHINE_EXTRA_RRECOMMENDS = "kernel-modules eee-acpi-scripts"
37
38GUI_MACHINE_CLASS = "bigscreen"
39
40IMAGE_ROOTFS_SIZE_ext3 = "2000000"
41
42IMAGE_FSTYPES ?= "ext3 cpio.gz"
43
44GLIBC_ADDONS = "nptl"
45GLIBC_EXTRA_OECONF = "--with-tls"
46
47SRCREV_machine_pn-linux-wrs_emenlow ?= "aae69fdf104b0a9d7b3710f808aac6ab303490f7"
48SRCREV_meta_pn-linux-wrs_emenlow ?= "b67e060194a38c6331da1532bd06446087a42b3b"
diff --git a/meta-emenlow/recipes-bsp/formfactor/formfactor/emenlow/machconfig b/meta-emenlow/recipes-bsp/formfactor/formfactor/emenlow/machconfig
new file mode 100644
index 0000000..ffce012
--- /dev/null
+++ b/meta-emenlow/recipes-bsp/formfactor/formfactor/emenlow/machconfig
@@ -0,0 +1,3 @@
1# Assume a USB mouse and keyboard are connected
2HAVE_TOUCHSCREEN=0
3HAVE_KEYBOARD=1
diff --git a/meta-emenlow/recipes-bsp/formfactor/formfactor_0.0.bbappend b/meta-emenlow/recipes-bsp/formfactor/formfactor_0.0.bbappend
new file mode 100644
index 0000000..4a41d48
--- /dev/null
+++ b/meta-emenlow/recipes-bsp/formfactor/formfactor_0.0.bbappend
@@ -0,0 +1,3 @@
1FILESEXTRAPATHS := "${THISDIR}/${PN}"
2
3PRINC = "1"
diff --git a/meta-emenlow/recipes-graphics/libdrm-poulsbo/libdrm-poulsbo-2.3.0/libdrm-poulsbo.patch b/meta-emenlow/recipes-graphics/libdrm-poulsbo/libdrm-poulsbo-2.3.0/libdrm-poulsbo.patch
new file mode 100644
index 0000000..14bde68
--- /dev/null
+++ b/meta-emenlow/recipes-graphics/libdrm-poulsbo/libdrm-poulsbo-2.3.0/libdrm-poulsbo.patch
@@ -0,0 +1,61 @@
1# Make this package produce libdrm-poulsbo instead of libdrm so that the
2# emenlow libdrm can coexist with the normal libdrm.
3# jdike@linux.intel.com
4
5Index: libdrm-poulsbo-2.3.0/configure.ac
6===================================================================
7--- libdrm-poulsbo-2.3.0.orig/configure.ac
8+++ libdrm-poulsbo-2.3.0/configure.ac
9@@ -19,7 +19,7 @@
10 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11
12 AC_PREREQ(2.57)
13-AC_INIT([libdrm], 2.3.1, [dri-devel@lists.sourceforge.net], libdrm)
14+AC_INIT([libdrm_poulsbo], 2.3.1, [dri-devel@lists.sourceforge.net], libdrm_poulsbo)
15 AC_CONFIG_SRCDIR([Makefile.am])
16 AM_INIT_AUTOMAKE([dist-bzip2])
17
18@@ -35,4 +35,4 @@ AC_SYS_LARGEFILE
19 pkgconfigdir=${libdir}/pkgconfig
20 AC_SUBST(pkgconfigdir)
21
22-AC_OUTPUT([Makefile libdrm/Makefile shared-core/Makefile libdrm.pc])
23+AC_OUTPUT([Makefile libdrm/Makefile shared-core/Makefile libdrm_poulsbo.pc])
24Index: libdrm-poulsbo-2.3.0/Makefile.am
25===================================================================
26--- libdrm-poulsbo-2.3.0.orig/Makefile.am
27+++ libdrm-poulsbo-2.3.0/Makefile.am
28@@ -25,6 +25,6 @@ AUTOMAKE_OPTIONS = foreign
29 SUBDIRS = libdrm shared-core
30
31 pkgconfigdir = @pkgconfigdir@
32-pkgconfig_DATA = libdrm.pc
33+pkgconfig_DATA = libdrm_poulsbo.pc
34
35-EXTRA_DIST = libdrm.pc.in
36+EXTRA_DIST = libdrm_poulsbo.pc.in
37Index: libdrm-poulsbo-2.3.0/libdrm/Makefile.am
38===================================================================
39--- libdrm-poulsbo-2.3.0.orig/libdrm/Makefile.am
40+++ libdrm-poulsbo-2.3.0/libdrm/Makefile.am
41@@ -18,14 +18,14 @@
42 # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
43 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
44
45-libdrm_la_LTLIBRARIES = libdrm.la
46-libdrm_ladir = $(libdir)
47-libdrm_la_LDFLAGS = -version-number 2:3:0 -no-undefined
48+libdrm_poulsbo_la_LTLIBRARIES = libdrm_poulsbo.la
49+libdrm_poulsbo_ladir = $(libdir)
50+libdrm_poulsbo_la_LDFLAGS = -version-number 2:3:0 -no-undefined
51
52 AM_CFLAGS = -I$(top_srcdir)/shared-core
53-libdrm_la_SOURCES = xf86drm.c xf86drmHash.c xf86drmRandom.c xf86drmSL.c xf86drmMode.c
54+libdrm_poulsbo_la_SOURCES = xf86drm.c xf86drmHash.c xf86drmRandom.c xf86drmSL.c xf86drmMode.c
55
56-libdrmincludedir = ${includedir}/psb
57-libdrminclude_HEADERS = xf86drm.h xf86mm.h xf86drmMode.h
58+libdrm_poulsboincludedir = ${includedir}/psb
59+libdrm_poulsboinclude_HEADERS = xf86drm.h xf86mm.h xf86drmMode.h
60
61 EXTRA_DIST = ChangeLog TODO
diff --git a/meta-emenlow/recipes-graphics/libdrm-poulsbo/libdrm-poulsbo_2.3.0.bb b/meta-emenlow/recipes-graphics/libdrm-poulsbo/libdrm-poulsbo_2.3.0.bb
new file mode 100644
index 0000000..d0e14a5
--- /dev/null
+++ b/meta-emenlow/recipes-graphics/libdrm-poulsbo/libdrm-poulsbo_2.3.0.bb
@@ -0,0 +1,19 @@
1DESCRIPTION = "Userspace interface to kernel DRM services"
2LICENSE = "MIT"
3LIC_FILES_CHKSUM = "file://MIT_License.txt;md5=732825ecdcf420261531d935fcd914a7"
4PR = "r4"
5
6PROVIDES = "libdrm-poulsbo"
7
8inherit autotools pkgconfig
9
10SRC_URI = "https://launchpad.net/~gma500/+archive/ppa/+files/libdrm-poulsbo_2.3.0-1ubuntu0sarvatt4~1004um1ubuntu1.tar.gz \
11 file://libdrm-poulsbo.patch"
12
13SRC_URI[md5sum] = "82c00bb9f1239f1d00b18411b89c2380"
14SRC_URI[sha256sum] = "335d4ac6694687475efe07b44a2d77a9a9fadcbc16946d01ea8a02339ae7d9ec"
15
16do_configure_prepend() {
17 sed -e 's/-ldrm/-ldrm_poulsbo/' -e 's/libdrm/libdrm_poulsbo/' \
18 < ${S}/libdrm.pc.in > ${S}/libdrm_poulsbo.pc.in
19}
diff --git a/meta-emenlow/recipes-graphics/libva/libva-0.31.0/033_g45_add_rgba_subpic.patch b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/033_g45_add_rgba_subpic.patch
new file mode 100644
index 0000000..1b928b4
--- /dev/null
+++ b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/033_g45_add_rgba_subpic.patch
@@ -0,0 +1,111 @@
1From 6622e8eba85cea476f8ef5b8c3620c4a0f024dcd Mon Sep 17 00:00:00 2001
2From: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
3Date: Wed, 4 Nov 2009 10:56:54 +0000
4Subject: [PATCH] [G45] Add RGBA subpictures.
5
6---
7 i965_drv_video/i965_drv_video.c | 18 ++++++++++++++++++
8 i965_drv_video/i965_drv_video.h | 3 ++-
9 i965_drv_video/i965_render.c | 8 ++++----
10 3 files changed, 24 insertions(+), 5 deletions(-)
11
12diff --git a/i965_drv_video/i965_drv_video.c b/i965_drv_video/i965_drv_video.c
13index 8f4bfc1..92c4785 100644
14--- a/i965_drv_video/i965_drv_video.c
15+++ b/i965_drv_video/i965_drv_video.c
16@@ -70,6 +70,14 @@ i965_subpic_formats_map[I965_MAX_SUBPIC_FORMATS + 1] = {
17 { I965_SURFACETYPE_INDEXED, I965_SURFACEFORMAT_A4P4_UNORM,
18 { VA_FOURCC('A','I','4','4'), VA_MSB_FIRST, 8, },
19 0 },
20+ { I965_SURFACETYPE_RGBA, I965_SURFACEFORMAT_B8G8R8A8_UNORM,
21+ { VA_FOURCC('B','G','R','A'), VA_LSB_FIRST, 32,
22+ 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000 },
23+ 0 },
24+ { I965_SURFACETYPE_RGBA, I965_SURFACEFORMAT_R8G8B8A8_UNORM,
25+ { VA_FOURCC('R','G','B','A'), VA_LSB_FIRST, 32,
26+ 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 },
27+ 0 },
28 };
29
30 static const i965_subpic_format_map_t *
31@@ -467,6 +475,7 @@ i965_CreateSubpicture(VADriverContextP ctx,
32 obj_subpic->format = m->format;
33 obj_subpic->width = obj_image->image.width;
34 obj_subpic->height = obj_image->image.height;
35+ obj_subpic->pitch = obj_image->image.pitches[0];
36 obj_subpic->bo = obj_image->bo;
37 return VA_STATUS_SUCCESS;
38 }
39@@ -1218,6 +1227,15 @@ i965_CreateImage(VADriverContextP ctx,
40 image->component_order[1] = 'G';
41 image->component_order[2] = 'B';
42 break;
43+ case VA_FOURCC('A','R','G','B'):
44+ case VA_FOURCC('A','B','G','R'):
45+ case VA_FOURCC('B','G','R','A'):
46+ case VA_FOURCC('R','G','B','A'):
47+ image->num_planes = 1;
48+ image->pitches[0] = width * 4;
49+ image->offsets[0] = 0;
50+ image->data_size = image->offsets[0] + image->pitches[0] * height;
51+ break;
52 default:
53 goto error;
54 }
55diff --git a/i965_drv_video/i965_drv_video.h b/i965_drv_video/i965_drv_video.h
56index c95c799..4d775da 100644
57--- a/i965_drv_video/i965_drv_video.h
58+++ b/i965_drv_video/i965_drv_video.h
59@@ -42,7 +42,7 @@
60 #define I965_MAX_ENTRYPOINTS 5
61 #define I965_MAX_CONFIG_ATTRIBUTES 10
62 #define I965_MAX_IMAGE_FORMATS 10
63-#define I965_MAX_SUBPIC_FORMATS 2
64+#define I965_MAX_SUBPIC_FORMATS 4
65 #define I965_MAX_DISPLAY_ATTRIBUTES 4
66 #define I965_STR_VENDOR "i965 Driver 0.1"
67
68@@ -124,6 +124,7 @@ struct object_subpic
69 unsigned int format;
70 int width;
71 int height;
72+ int pitch;
73 dri_bo *bo;
74 };
75
76diff --git a/i965_drv_video/i965_render.c b/i965_drv_video/i965_render.c
77index f105e90..0476087 100644
78--- a/i965_drv_video/i965_render.c
79+++ b/i965_drv_video/i965_render.c
80@@ -586,7 +586,7 @@ i965_subpic_render_src_surface_state(VADriverContextP ctx,
81 int index,
82 dri_bo *region,
83 unsigned long offset,
84- int w, int h, int format)
85+ int w, int h, int p, int format)
86 {
87 struct i965_driver_data *i965 = i965_driver_data(ctx);
88 struct i965_render_state *render_state = &i965->render_state;
89@@ -620,7 +620,7 @@ i965_subpic_render_src_surface_state(VADriverContextP ctx,
90 ss->ss2.mip_count = 0;
91 ss->ss2.render_target_rotation = 0;
92
93- ss->ss3.pitch = w - 1;
94+ ss->ss3.pitch = p - 1;
95
96 dri_bo_emit_reloc(ss_bo,
97 I915_GEM_DOMAIN_SAMPLER, 0,
98@@ -678,8 +678,8 @@ i965_subpic_render_src_surfaces_state(VADriverContextP ctx,
99 region = obj_surface->bo;
100 subpic_region = obj_image->bo;
101 /*subpicture surface*/
102- i965_subpic_render_src_surface_state(ctx, 1, subpic_region, 0, obj_subpic->width, obj_subpic->height, obj_subpic->format);
103- i965_subpic_render_src_surface_state(ctx, 2, subpic_region, 0, obj_subpic->width, obj_subpic->height, obj_subpic->format);
104+ i965_subpic_render_src_surface_state(ctx, 1, subpic_region, 0, obj_subpic->width, obj_subpic->height, obj_subpic->pitch, obj_subpic->format);
105+ i965_subpic_render_src_surface_state(ctx, 2, subpic_region, 0, obj_subpic->width, obj_subpic->height, obj_subpic->pitch, obj_subpic->format);
106 }
107
108 static void
109--
1101.5.4.3
111
diff --git a/meta-emenlow/recipes-graphics/libva/libva-0.31.0/034_g45_fix_return_for_unimpl.patch b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/034_g45_fix_return_for_unimpl.patch
new file mode 100644
index 0000000..a461213
--- /dev/null
+++ b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/034_g45_fix_return_for_unimpl.patch
@@ -0,0 +1,83 @@
1From 3935c6a836b8f90947f0af658a76b97a08a03c67 Mon Sep 17 00:00:00 2001
2From: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
3Date: Wed, 4 Nov 2009 13:23:40 +0000
4Subject: [PATCH] [G45] Don't return VA_STATUS_SUCCESS for unimplemented functions.
5
6---
7 i965_drv_video/i965_drv_video.c | 18 +++++++++++-------
8 1 files changed, 11 insertions(+), 7 deletions(-)
9
10diff --git a/i965_drv_video/i965_drv_video.c b/i965_drv_video/i965_drv_video.c
11index 10baffb..d8a7bd1 100644
12--- a/i965_drv_video/i965_drv_video.c
13+++ b/i965_drv_video/i965_drv_video.c
14@@ -534,7 +534,8 @@ i965_SetSubpictureImage(VADriverContextP ctx,
15 VASubpictureID subpicture,
16 VAImageID image)
17 {
18- return VA_STATUS_SUCCESS;
19+ /* TODO */
20+ return VA_STATUS_ERROR_UNIMPLEMENTED;
21 }
22
23 VAStatus
24@@ -544,7 +545,8 @@ i965_SetSubpictureChromakey(VADriverContextP ctx,
25 unsigned int chromakey_max,
26 unsigned int chromakey_mask)
27 {
28- return VA_STATUS_SUCCESS;
29+ /* TODO */
30+ return VA_STATUS_ERROR_UNIMPLEMENTED;
31 }
32
33 VAStatus
34@@ -552,7 +554,8 @@ i965_SetSubpictureGlobalAlpha(VADriverContextP ctx,
35 VASubpictureID subpicture,
36 float global_alpha)
37 {
38- return VA_STATUS_SUCCESS;
39+ /* TODO */
40+ return VA_STATUS_ERROR_UNIMPLEMENTED;
41 }
42
43 VAStatus
44@@ -1141,7 +1144,7 @@ i965_GetDisplayAttributes(VADriverContextP ctx,
45 int num_attributes)
46 {
47 /* TODO */
48- return VA_STATUS_ERROR_UNKNOWN;
49+ return VA_STATUS_ERROR_UNIMPLEMENTED;
50 }
51
52 /*
53@@ -1156,7 +1159,7 @@ i965_SetDisplayAttributes(VADriverContextP ctx,
54 int num_attributes)
55 {
56 /* TODO */
57- return VA_STATUS_ERROR_UNKNOWN;
58+ return VA_STATUS_ERROR_UNIMPLEMENTED;
59 }
60
61 VAStatus
62@@ -1166,7 +1169,7 @@ i965_DbgCopySurfaceToBuffer(VADriverContextP ctx,
63 unsigned int *stride) /* out */
64 {
65 /* TODO */
66- return VA_STATUS_ERROR_UNKNOWN;
67+ return VA_STATUS_ERROR_UNIMPLEMENTED;
68 }
69
70 static VAStatus
71@@ -1318,7 +1321,8 @@ VAStatus i965_DeriveImage(VADriverContextP ctx,
72 VASurfaceID surface,
73 VAImage *image) /* out */
74 {
75- return VA_STATUS_SUCCESS;
76+ /* TODO */
77+ return VA_STATUS_ERROR_OPERATION_FAILED;
78 }
79
80 static void
81--
821.5.4.3
83
diff --git a/meta-emenlow/recipes-graphics/libva/libva-0.31.0/035_g45_add_yv12_image_format.patch b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/035_g45_add_yv12_image_format.patch
new file mode 100644
index 0000000..92d814c
--- /dev/null
+++ b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/035_g45_add_yv12_image_format.patch
@@ -0,0 +1,102 @@
1From 23b23e8d65551779f10aedddee7882c2e71ac162 Mon Sep 17 00:00:00 2001
2From: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
3Date: Wed, 4 Nov 2009 13:01:44 +0000
4Subject: [PATCH] [G45] Add YV12 image format.
5
6---
7 i965_drv_video/i965_drv_video.c | 50 ++++++++++++++++++++++++++++++++++++++-
8 i965_drv_video/i965_drv_video.h | 2 +-
9 2 files changed, 50 insertions(+), 2 deletions(-)
10
11diff --git a/i965_drv_video/i965_drv_video.c b/i965_drv_video/i965_drv_video.c
12index 1f026bc..8558d0e 100644
13--- a/i965_drv_video/i965_drv_video.c
14+++ b/i965_drv_video/i965_drv_video.c
15@@ -54,6 +54,36 @@ enum {
16 I965_SURFACETYPE_INDEXED
17 };
18
19+/* List of supported image formats */
20+typedef struct {
21+ unsigned int type;
22+ VAImageFormat va_format;
23+} i965_image_format_map_t;
24+
25+static const i965_image_format_map_t
26+i965_image_formats_map[I965_MAX_IMAGE_FORMATS + 1] = {
27+ { I965_SURFACETYPE_YUV,
28+ { VA_FOURCC('Y','V','1','2'), VA_LSB_FIRST, 12, } },
29+};
30+
31+static const i965_image_format_map_t *
32+get_image_format(const VAImageFormat *va_format)
33+{
34+ unsigned int i;
35+ for (i = 0; i965_image_formats_map[i].type != 0; i++) {
36+ const i965_image_format_map_t * const m = &i965_image_formats_map[i];
37+ if (m->va_format.fourcc == va_format->fourcc &&
38+ (m->type == I965_SURFACETYPE_RGBA ?
39+ (m->va_format.byte_order == va_format->byte_order &&
40+ m->va_format.red_mask == va_format->red_mask &&
41+ m->va_format.green_mask == va_format->green_mask &&
42+ m->va_format.blue_mask == va_format->blue_mask &&
43+ m->va_format.alpha_mask == va_format->alpha_mask) : 1))
44+ return m;
45+ }
46+ return NULL;
47+}
48+
49 /* List of supported subpicture formats */
50 typedef struct {
51 unsigned int type;
52@@ -398,8 +428,16 @@ i965_QueryImageFormats(VADriverContextP ctx,
53 VAImageFormat *format_list, /* out */
54 int *num_formats) /* out */
55 {
56+ int n;
57+
58+ for (n = 0; i965_image_formats_map[n].va_format.fourcc != 0; n++) {
59+ const i965_image_format_map_t * const m = &i965_image_formats_map[n];
60+ if (format_list)
61+ format_list[n] = m->va_format;
62+ }
63+
64 if (num_formats)
65- *num_formats = 0;
66+ *num_formats = n;
67
68 return VA_STATUS_SUCCESS;
69 }
70@@ -1236,6 +1274,16 @@ i965_CreateImage(VADriverContextP ctx,
71 image->offsets[0] = 0;
72 image->data_size = image->offsets[0] + image->pitches[0] * height;
73 break;
74+ case VA_FOURCC('Y','V','1','2'):
75+ image->num_planes = 3;
76+ image->pitches[0] = width;
77+ image->offsets[0] = 0;
78+ image->pitches[1] = width2;
79+ image->offsets[1] = size;
80+ image->pitches[2] = width2;
81+ image->offsets[2] = size + size2;
82+ image->data_size = size + 2 * size2;
83+ break;
84 default:
85 goto error;
86 }
87diff --git a/i965_drv_video/i965_drv_video.h b/i965_drv_video/i965_drv_video.h
88index 4d775da..f512793 100644
89--- a/i965_drv_video/i965_drv_video.h
90+++ b/i965_drv_video/i965_drv_video.h
91@@ -41,7 +41,7 @@
92 #define I965_MAX_PROFILES 11
93 #define I965_MAX_ENTRYPOINTS 5
94 #define I965_MAX_CONFIG_ATTRIBUTES 10
95-#define I965_MAX_IMAGE_FORMATS 10
96+#define I965_MAX_IMAGE_FORMATS 1
97 #define I965_MAX_SUBPIC_FORMATS 4
98 #define I965_MAX_DISPLAY_ATTRIBUTES 4
99 #define I965_STR_VENDOR "i965 Driver 0.1"
100--
1011.5.4.3
102
diff --git a/meta-emenlow/recipes-graphics/libva/libva-0.31.0/036_g45_add_vaGetImage.patch b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/036_g45_add_vaGetImage.patch
new file mode 100644
index 0000000..dc25d9f
--- /dev/null
+++ b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/036_g45_add_vaGetImage.patch
@@ -0,0 +1,71 @@
1From 37f40c0cdc9667907dfb784874b42fb16c2c9bde Mon Sep 17 00:00:00 2001
2From: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
3Date: Wed, 4 Nov 2009 13:16:34 +0000
4Subject: [PATCH] =?utf-8?q?[G45]=C2=A0Implement=20vaGetImage()=20for=20full-sized=20surface=20readback.?=
5MIME-Version: 1.0
6Content-Type: text/plain; charset=utf-8
7Content-Transfer-Encoding: 8bit
8
9---
10 i965_drv_video/i965_drv_video.c | 45 ++++++++++++++++++++++++++++++++++++++-
11 1 files changed, 44 insertions(+), 1 deletions(-)
12
13diff --git a/i965_drv_video/i965_drv_video.c b/i965_drv_video/i965_drv_video.c
14index 8558d0e..10baffb 100644
15--- a/i965_drv_video/i965_drv_video.c
16+++ b/i965_drv_video/i965_drv_video.c
17@@ -1388,7 +1388,50 @@ i965_GetImage(VADriverContextP ctx,
18 unsigned int height,
19 VAImageID image)
20 {
21- return VA_STATUS_SUCCESS;
22+ struct i965_driver_data *i965 = i965_driver_data(ctx);
23+
24+ struct object_surface *obj_surface = SURFACE(surface);
25+ if (!obj_surface)
26+ return VA_STATUS_ERROR_INVALID_SURFACE;
27+
28+ struct object_image *obj_image = IMAGE(image);
29+ if (!obj_image)
30+ return VA_STATUS_ERROR_INVALID_IMAGE;
31+
32+ /* XXX: we only support full-size surface readback */
33+ if (x != 0 ||
34+ y != 0 ||
35+ width != obj_surface->width ||
36+ height != obj_surface->height)
37+ return VA_STATUS_ERROR_INVALID_PARAMETER;
38+
39+ /* XXX: we only support 1:1 image copies */
40+ if (width != obj_image->image.width ||
41+ height != obj_image->image.height)
42+ return VA_STATUS_ERROR_INVALID_PARAMETER;
43+
44+ VAStatus va_status;
45+ void *image_data = NULL;
46+
47+ va_status = i965_MapBuffer(ctx, obj_image->image.buf, &image_data);
48+ if (va_status != VA_STATUS_SUCCESS)
49+ return va_status;
50+
51+ dri_bo_map(obj_surface->bo, 0);
52+
53+ switch (obj_image->image.format.fourcc) {
54+ case VA_FOURCC('Y','V','1','2'): /* YV12 is native format here */
55+ memcpy(image_data, obj_surface->bo->virtual, obj_surface->bo->size);
56+ break;
57+ default:
58+ va_status = VA_STATUS_ERROR_OPERATION_FAILED;
59+ break;
60+ }
61+
62+ dri_bo_unmap(obj_surface->bo);
63+
64+ i965_UnmapBuffer(ctx, obj_image->image.buf);
65+ return va_status;
66 }
67
68 VAStatus
69--
701.5.4.3
71
diff --git a/meta-emenlow/recipes-graphics/libva/libva-0.31.0/037_g45_add_vaPutImage.patch b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/037_g45_add_vaPutImage.patch
new file mode 100644
index 0000000..ce638cc
--- /dev/null
+++ b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/037_g45_add_vaPutImage.patch
@@ -0,0 +1,111 @@
1From 000807cfbd8bcbc9cd4bf28a066087fee43396b4 Mon Sep 17 00:00:00 2001
2From: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
3Date: Wed, 4 Nov 2009 13:36:39 +0000
4Subject: [PATCH] =?utf-8?q?[G45]=C2=A0Implement=20vaPutImage()=20for=20full-sized=20surface=20uploads.?=
5MIME-Version: 1.0
6Content-Type: text/plain; charset=utf-8
7Content-Transfer-Encoding: 8bit
8
9---
10 i965_drv_video/i965_drv_video.c | 78 +++++++++++++++++++++++++++++++--------
11 1 files changed, 62 insertions(+), 16 deletions(-)
12
13diff --git a/i965_drv_video/i965_drv_video.c b/i965_drv_video/i965_drv_video.c
14index d8a7bd1..e8f638c 100644
15--- a/i965_drv_video/i965_drv_video.c
16+++ b/i965_drv_video/i965_drv_video.c
17@@ -443,22 +443,6 @@ i965_QueryImageFormats(VADriverContextP ctx,
18 }
19
20 VAStatus
21-i965_PutImage(VADriverContextP ctx,
22- VASurfaceID surface,
23- VAImageID image,
24- int src_x,
25- int src_y,
26- unsigned int src_width,
27- unsigned int src_height,
28- int dest_x,
29- int dest_y,
30- unsigned int dest_width,
31- unsigned int dest_height)
32-{
33- return VA_STATUS_SUCCESS;
34-}
35-
36-VAStatus
37 i965_QuerySubpictureFormats(VADriverContextP ctx,
38 VAImageFormat *format_list, /* out */
39 unsigned int *flags, /* out */
40@@ -1439,6 +1423,68 @@ i965_GetImage(VADriverContextP ctx,
41 }
42
43 VAStatus
44+i965_PutImage(VADriverContextP ctx,
45+ VASurfaceID surface,
46+ VAImageID image,
47+ int src_x,
48+ int src_y,
49+ unsigned int src_width,
50+ unsigned int src_height,
51+ int dest_x,
52+ int dest_y,
53+ unsigned int dest_width,
54+ unsigned int dest_height)
55+{
56+ struct i965_driver_data *i965 = i965_driver_data(ctx);
57+
58+ struct object_surface *obj_surface = SURFACE(surface);
59+ if (!obj_surface)
60+ return VA_STATUS_ERROR_INVALID_SURFACE;
61+
62+ struct object_image *obj_image = IMAGE(image);
63+ if (!obj_image)
64+ return VA_STATUS_ERROR_INVALID_IMAGE;
65+
66+ /* XXX: we don't support partial video surface updates */
67+ if (src_x != 0 ||
68+ src_y != 0 ||
69+ src_width != obj_image->image.width ||
70+ src_height != obj_image->image.height)
71+ return VA_STATUS_ERROR_OPERATION_FAILED;
72+ if (dest_x != 0 ||
73+ dest_y != 0 ||
74+ dest_width != obj_surface->width ||
75+ dest_height != obj_surface->height)
76+ return VA_STATUS_ERROR_OPERATION_FAILED;
77+ if (src_width != dest_width ||
78+ src_height != dest_height)
79+ return VA_STATUS_ERROR_OPERATION_FAILED;
80+
81+ VAStatus va_status;
82+ void *image_data = NULL;
83+
84+ va_status = i965_MapBuffer(ctx, obj_image->image.buf, &image_data);
85+ if (va_status != VA_STATUS_SUCCESS)
86+ return va_status;
87+
88+ dri_bo_map(obj_surface->bo, 1);
89+
90+ switch (obj_image->image.format.fourcc) {
91+ case VA_FOURCC('Y','V','1','2'): /* YV12 is native format here */
92+ memcpy(obj_surface->bo->virtual, image_data, obj_surface->bo->size);
93+ break;
94+ default:
95+ va_status = VA_STATUS_ERROR_OPERATION_FAILED;
96+ break;
97+ }
98+
99+ dri_bo_unmap(obj_surface->bo);
100+
101+ i965_UnmapBuffer(ctx, obj_image->image.buf);
102+ return va_status;
103+}
104+
105+VAStatus
106 i965_PutSurface(VADriverContextP ctx,
107 VASurfaceID surface,
108 Drawable draw, /* X Drawable */
109--
1101.5.4.3
111
diff --git a/meta-emenlow/recipes-graphics/libva/libva-0.31.0/038_g45_vaPutSurface_cliprects.patch b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/038_g45_vaPutSurface_cliprects.patch
new file mode 100644
index 0000000..ca2e1bd
--- /dev/null
+++ b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/038_g45_vaPutSurface_cliprects.patch
@@ -0,0 +1,531 @@
1From 90de12a47e26ccc0b4cc8189c76991609481870d Mon Sep 17 00:00:00 2001
2From: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
3Date: Wed, 4 Nov 2009 17:34:53 +0000
4Subject: [PATCH] [G45] Handle cliprects in vaPutSurface().
5
6---
7 i965_drv_video/i965_drv_video.c | 39 ++++--
8 i965_drv_video/i965_render.c | 284 +++++++++++++++++++--------------------
9 i965_drv_video/i965_render.h | 30 ++---
10 3 files changed, 176 insertions(+), 177 deletions(-)
11
12diff --git a/i965_drv_video/i965_drv_video.c b/i965_drv_video/i965_drv_video.c
13index e8f638c..20d6bab 100644
14--- a/i965_drv_video/i965_drv_video.c
15+++ b/i965_drv_video/i965_drv_video.c
16@@ -1507,13 +1507,23 @@ i965_PutSurface(VADriverContextP ctx,
17 union dri_buffer *buffer;
18 struct intel_region *dest_region;
19 struct object_surface *obj_surface;
20- int ret;
21+ int ret;
22 uint32_t name;
23+ VARectangle src_rect, dst_rect;
24 Bool new_region = False;
25+
26 /* Currently don't support DRI1 */
27 if (dri_state->driConnectedFlag != VA_DRI2)
28 return VA_STATUS_ERROR_UNKNOWN;
29
30+ /* XXX: we currently only support up to 64 cliprects */
31+ if (number_cliprects > MAX_CLIP_RECTS)
32+ return VA_STATUS_ERROR_OPERATION_FAILED;
33+
34+ obj_surface = SURFACE(surface);
35+ if (!obj_surface)
36+ return VA_STATUS_ERROR_INVALID_SURFACE;
37+
38 dri_drawable = dri_get_drawable(ctx, draw);
39 assert(dri_drawable);
40
41@@ -1552,17 +1562,24 @@ i965_PutSurface(VADriverContextP ctx,
42 assert(ret == 0);
43 }
44
45- i965_render_put_surface(ctx, surface,
46- srcx, srcy, srcw, srch,
47- destx, desty, destw, desth);
48- obj_surface = SURFACE(surface);
49- if(obj_surface->subpic != VA_INVALID_ID) {
50- i965_render_put_subpic(ctx, surface,
51- srcx, srcy, srcw, srch,
52- destx, desty, destw, desth);
53- }
54- dri_swap_buffer(ctx, dri_drawable);
55+ src_rect.x = srcx;
56+ src_rect.y = srcy;
57+ src_rect.width = srcw;
58+ src_rect.height = srch;
59+
60+ dst_rect.x = destx;
61+ dst_rect.y = desty;
62+ dst_rect.width = destw;
63+ dst_rect.height = desth;
64
65+ i965_render_put_surface(ctx, surface, &src_rect, &dst_rect,
66+ cliprects, number_cliprects);
67+
68+ if (obj_surface->subpic != VA_INVALID_ID)
69+ i965_render_put_subpic(ctx, surface, &src_rect, &dst_rect,
70+ cliprects, number_cliprects);
71+
72+ dri_swap_buffer(ctx, dri_drawable);
73 return VA_STATUS_SUCCESS;
74 }
75
76diff --git a/i965_drv_video/i965_render.c b/i965_drv_video/i965_render.c
77index 0476087..d7cd8fe 100644
78--- a/i965_drv_video/i965_render.c
79+++ b/i965_drv_video/i965_render.c
80@@ -787,13 +787,81 @@ i965_render_binding_table(VADriverContextP ctx)
81 dri_bo_unmap(render_state->wm.binding_table);
82 }
83
84-static void
85+static unsigned int
86+i965_render_do_upload_vertex(VADriverContextP ctx,
87+ unsigned int width,
88+ unsigned int height,
89+ const VARectangle *src_rect,
90+ const VARectangle *dst_rect,
91+ const VARectangle *cliprects,
92+ unsigned int num_cliprects)
93+{
94+ struct i965_driver_data *i965 = i965_driver_data(ctx);
95+ struct i965_render_state *render_state = &i965->render_state;
96+ struct intel_region *dest_region = render_state->draw_region;
97+ float *vb, tx1, tx2, ty1, ty2;
98+ int x1, x2, y1, y2;
99+ unsigned int i, n;
100+
101+ if (!cliprects || num_cliprects == 0) {
102+ cliprects = dst_rect;
103+ num_cliprects = 1;
104+ }
105+
106+ dri_bo_map(render_state->vb.vertex_buffer, 1);
107+ assert(render_state->vb.vertex_buffer->virtual);
108+ vb = render_state->vb.vertex_buffer->virtual;
109+
110+ for (n = 0, i = 0; i < num_cliprects; i++) {
111+ x1 = dest_region->x + cliprects[i].x;
112+ y1 = dest_region->y + cliprects[i].y;
113+ x2 = x1 + cliprects[i].width;
114+ y2 = y1 + cliprects[i].height;
115+ x1 = MAX(x1, dst_rect->x);
116+ y1 = MAX(y1, dst_rect->y);
117+ x2 = MIN(x2, dst_rect->x + dst_rect->width);
118+ y2 = MIN(y2, dst_rect->y + dst_rect->height);
119+
120+ if (x2 <= x1 || y2 <= y1)
121+ continue;
122+
123+ const float sx1 = (float)(x1 - dst_rect->x) / (float)dst_rect->width;
124+ const float sy1 = (float)(y1 - dst_rect->y) / (float)dst_rect->height;
125+ const float sx2 = (float)(x2 - dst_rect->x) / (float)dst_rect->width;
126+ const float sy2 = (float)(y2 - dst_rect->y) / (float)dst_rect->height;
127+ tx1 = ((float)src_rect->x + sx1 * (float)src_rect->width) / width;
128+ ty1 = ((float)src_rect->y + sy1 * (float)src_rect->height) / height;
129+ tx2 = ((float)src_rect->x + sx2 * (float)src_rect->width) / width;
130+ ty2 = ((float)src_rect->y + sy2 * (float)src_rect->height) / height;
131+
132+ vb[n++] = tx2;
133+ vb[n++] = ty2;
134+ vb[n++] = x2;
135+ vb[n++] = y2;
136+
137+ vb[n++] = tx1;
138+ vb[n++] = ty2;
139+ vb[n++] = x1;
140+ vb[n++] = y2;
141+
142+ vb[n++] = tx1;
143+ vb[n++] = ty1;
144+ vb[n++] = x1;
145+ vb[n++] = y1;
146+ }
147+
148+ dri_bo_unmap(render_state->vb.vertex_buffer);
149+ return n / 12;
150+}
151+
152+static unsigned int
153 i965_subpic_render_upload_vertex(VADriverContextP ctx,
154 VASurfaceID surface,
155- const VARectangle *output_rect)
156-{
157+ const VARectangle *output_rect,
158+ const VARectangle *cliprects,
159+ unsigned int num_cliprects)
160+{
161 struct i965_driver_data *i965 = i965_driver_data(ctx);
162- struct i965_render_state *render_state = &i965->render_state;
163 struct object_surface *obj_surface = SURFACE(surface);
164 struct object_subpic *obj_subpic = SUBPIC(obj_surface->subpic);
165
166@@ -803,8 +871,6 @@ i965_subpic_render_upload_vertex(VADriverContextP ctx,
167 const float ssy = (float)output_rect->height / (float)obj_surface->height;
168 const float sx = psx * ssx;
169 const float sy = psy * ssy;
170- float *vb, tx1, tx2, ty1, ty2, x1, x2, y1, y2;
171- int i = 0;
172
173 VARectangle dst_rect;
174 dst_rect.x = output_rect->x + sx * (float)obj_subpic->dst_rect.x;
175@@ -812,106 +878,38 @@ i965_subpic_render_upload_vertex(VADriverContextP ctx,
176 dst_rect.width = sx * (float)obj_subpic->dst_rect.width;
177 dst_rect.height = sy * (float)obj_subpic->dst_rect.height;
178
179- dri_bo_map(render_state->vb.vertex_buffer, 1);
180- assert(render_state->vb.vertex_buffer->virtual);
181- vb = render_state->vb.vertex_buffer->virtual;
182-
183- tx1 = (float)obj_subpic->src_rect.x / (float)obj_subpic->width;
184- ty1 = (float)obj_subpic->src_rect.y / (float)obj_subpic->height;
185- tx2 = (float)(obj_subpic->src_rect.x + obj_subpic->src_rect.width) / (float)obj_subpic->width;
186- ty2 = (float)(obj_subpic->src_rect.y + obj_subpic->src_rect.height) / (float)obj_subpic->height;
187-
188- x1 = (float)dst_rect.x;
189- y1 = (float)dst_rect.y;
190- x2 = (float)(dst_rect.x + dst_rect.width);
191- y2 = (float)(dst_rect.y + dst_rect.height);
192-
193- vb[i++] = tx2;
194- vb[i++] = ty2;
195- vb[i++] = x2;
196- vb[i++] = y2;
197-
198- vb[i++] = tx1;
199- vb[i++] = ty2;
200- vb[i++] = x1;
201- vb[i++] = y2;
202-
203- vb[i++] = tx1;
204- vb[i++] = ty1;
205- vb[i++] = x1;
206- vb[i++] = y1;
207- dri_bo_unmap(render_state->vb.vertex_buffer);
208+ return i965_render_do_upload_vertex(ctx,
209+ obj_subpic->width, obj_subpic->height,
210+ &obj_subpic->src_rect, &dst_rect,
211+ cliprects, num_cliprects);
212 }
213
214-static void
215+static unsigned int
216 i965_render_upload_vertex(VADriverContextP ctx,
217 VASurfaceID surface,
218- short srcx,
219- short srcy,
220- unsigned short srcw,
221- unsigned short srch,
222- short destx,
223- short desty,
224- unsigned short destw,
225- unsigned short desth)
226+ const VARectangle *src_rect,
227+ const VARectangle *dst_rect,
228+ const VARectangle *cliprects,
229+ unsigned int num_cliprects)
230 {
231 struct i965_driver_data *i965 = i965_driver_data(ctx);
232- struct i965_render_state *render_state = &i965->render_state;
233- struct intel_region *dest_region = render_state->draw_region;
234- struct object_surface *obj_surface;
235- float *vb;
236-
237- float u1, v1, u2, v2;
238- int i, width, height;
239- int box_x1 = dest_region->x + destx;
240- int box_y1 = dest_region->y + desty;
241- int box_x2 = box_x1 + destw;
242- int box_y2 = box_y1 + desth;
243-
244- obj_surface = SURFACE(surface);
245- assert(surface);
246- width = obj_surface->width;
247- height = obj_surface->height;
248-
249- u1 = (float)srcx / width;
250- v1 = (float)srcy / height;
251- u2 = (float)(srcx + srcw) / width;
252- v2 = (float)(srcy + srch) / height;
253-
254- dri_bo_map(render_state->vb.vertex_buffer, 1);
255- assert(render_state->vb.vertex_buffer->virtual);
256- vb = render_state->vb.vertex_buffer->virtual;
257-
258- i = 0;
259- vb[i++] = u2;
260- vb[i++] = v2;
261- vb[i++] = (float)box_x2;
262- vb[i++] = (float)box_y2;
263-
264- vb[i++] = u1;
265- vb[i++] = v2;
266- vb[i++] = (float)box_x1;
267- vb[i++] = (float)box_y2;
268-
269- vb[i++] = u1;
270- vb[i++] = v1;
271- vb[i++] = (float)box_x1;
272- vb[i++] = (float)box_y1;
273+ struct object_surface *obj_surface = SURFACE(surface);
274+ assert(obj_surface);
275
276- dri_bo_unmap(render_state->vb.vertex_buffer);
277+ return i965_render_do_upload_vertex(ctx,
278+ obj_surface->width, obj_surface->height,
279+ src_rect,
280+ dst_rect,
281+ cliprects, num_cliprects);
282 }
283
284-static void
285+static unsigned int
286 i965_surface_render_state_setup(VADriverContextP ctx,
287- VASurfaceID surface,
288- short srcx,
289- short srcy,
290- unsigned short srcw,
291- unsigned short srch,
292- short destx,
293- short desty,
294- unsigned short destw,
295- unsigned short desth)
296+ VASurfaceID surface,
297+ const VARectangle *src_rect,
298+ const VARectangle *dst_rect,
299+ const VARectangle *cliprects,
300+ unsigned int num_cliprects)
301 {
302 i965_render_vs_unit(ctx);
303 i965_render_sf_unit(ctx);
304@@ -922,21 +920,17 @@ i965_surface_render_state_setup(VADriverContextP ctx,
305 i965_render_cc_viewport(ctx);
306 i965_render_cc_unit(ctx);
307 i965_render_binding_table(ctx);
308- i965_render_upload_vertex(ctx, surface,
309- srcx, srcy, srcw, srch,
310- destx, desty, destw, desth);
311+ return i965_render_upload_vertex(ctx, surface, src_rect, dst_rect,
312+ cliprects, num_cliprects);
313 }
314-static void
315+
316+static unsigned int
317 i965_subpic_render_state_setup(VADriverContextP ctx,
318- VASurfaceID surface,
319- short srcx,
320- short srcy,
321- unsigned short srcw,
322- unsigned short srch,
323- short destx,
324- short desty,
325- unsigned short destw,
326- unsigned short desth)
327+ VASurfaceID surface,
328+ const VARectangle *src_rect,
329+ const VARectangle *dst_rect,
330+ const VARectangle *cliprects,
331+ unsigned int num_cliprects)
332 {
333 i965_render_vs_unit(ctx);
334 i965_render_sf_unit(ctx);
335@@ -947,16 +941,10 @@ i965_subpic_render_state_setup(VADriverContextP ctx,
336 i965_render_cc_viewport(ctx);
337 i965_subpic_render_cc_unit(ctx);
338 i965_render_binding_table(ctx);
339-
340- VARectangle output_rect;
341- output_rect.x = destx;
342- output_rect.y = desty;
343- output_rect.width = destw;
344- output_rect.height = desth;
345- i965_subpic_render_upload_vertex(ctx, surface, &output_rect);
346+ return i965_subpic_render_upload_vertex(ctx, surface, dst_rect,
347+ cliprects, num_cliprects);
348 }
349
350-
351 static void
352 i965_render_pipeline_select(VADriverContextP ctx)
353 {
354@@ -1192,7 +1180,7 @@ i965_render_upload_image_palette(
355 }
356
357 static void
358-i965_render_startup(VADriverContextP ctx)
359+i965_render_startup(VADriverContextP ctx, unsigned int vb_offset)
360 {
361 struct i965_driver_data *i965 = i965_driver_data(ctx);
362 struct i965_render_state *render_state = &i965->render_state;
363@@ -1203,7 +1191,7 @@ i965_render_startup(VADriverContextP ctx)
364 (0 << VB0_BUFFER_INDEX_SHIFT) |
365 VB0_VERTEXDATA |
366 ((4 * 4) << VB0_BUFFER_PITCH_SHIFT));
367- OUT_RELOC(ctx, render_state->vb.vertex_buffer, I915_GEM_DOMAIN_VERTEX, 0, 0);
368+ OUT_RELOC(ctx, render_state->vb.vertex_buffer, I915_GEM_DOMAIN_VERTEX, 0, vb_offset);
369
370 if (IS_IGDNG(i965->intel.device_id))
371 OUT_RELOC(ctx, render_state->vb.vertex_buffer, I915_GEM_DOMAIN_VERTEX, 0, 12 * 4);
372@@ -1268,8 +1256,10 @@ i965_clear_dest_region(VADriverContextP ctx)
373 }
374
375 static void
376-i965_surface_render_pipeline_setup(VADriverContextP ctx)
377+i965_surface_render_pipeline_setup(VADriverContextP ctx, unsigned int n_rects)
378 {
379+ unsigned int i;
380+
381 intel_batchbuffer_start_atomic(ctx, 0x1000);
382 intel_batchbuffer_emit_mi_flush(ctx);
383 i965_clear_dest_region(ctx);
384@@ -1283,13 +1273,16 @@ i965_surface_render_pipeline_setup(VADriverContextP ctx)
385 i965_render_cs_urb_layout(ctx);
386 i965_render_drawing_rectangle(ctx);
387 i965_render_vertex_elements(ctx);
388- i965_render_startup(ctx);
389+ for (i = 0; i < n_rects; i++)
390+ i965_render_startup(ctx, 48 * i);
391 intel_batchbuffer_end_atomic(ctx);
392 }
393
394 static void
395-i965_subpic_render_pipeline_setup(VADriverContextP ctx)
396+i965_subpic_render_pipeline_setup(VADriverContextP ctx, unsigned int n_rects)
397 {
398+ unsigned int i;
399+
400 intel_batchbuffer_start_atomic(ctx, 0x1000);
401 intel_batchbuffer_emit_mi_flush(ctx);
402 i965_render_pipeline_select(ctx);
403@@ -1302,7 +1295,8 @@ i965_subpic_render_pipeline_setup(VADriverContextP ctx)
404 i965_render_cs_urb_layout(ctx);
405 i965_render_drawing_rectangle(ctx);
406 i965_render_vertex_elements(ctx);
407- i965_render_startup(ctx);
408+ for (i = 0; i < n_rects; i++)
409+ i965_render_startup(ctx, 48 * i);
410 intel_batchbuffer_end_atomic(ctx);
411 }
412
413@@ -1396,45 +1390,39 @@ i965_render_initialize(VADriverContextP ctx)
414 void
415 i965_render_put_surface(VADriverContextP ctx,
416 VASurfaceID surface,
417- short srcx,
418- short srcy,
419- unsigned short srcw,
420- unsigned short srch,
421- short destx,
422- short desty,
423- unsigned short destw,
424- unsigned short desth)
425+ const VARectangle *src_rect,
426+ const VARectangle *dst_rect,
427+ const VARectangle *cliprects,
428+ unsigned int num_cliprects)
429 {
430+ unsigned int n_rects;
431+
432 i965_render_initialize(ctx);
433- i965_surface_render_state_setup(ctx, surface,
434- srcx, srcy, srcw, srch,
435- destx, desty, destw, desth);
436- i965_surface_render_pipeline_setup(ctx);
437+ n_rects = i965_surface_render_state_setup(ctx, surface,
438+ src_rect, dst_rect,
439+ cliprects, num_cliprects);
440+ i965_surface_render_pipeline_setup(ctx, n_rects);
441 intel_batchbuffer_flush(ctx);
442 }
443
444 void
445 i965_render_put_subpic(VADriverContextP ctx,
446- VASurfaceID surface,
447- short srcx,
448- short srcy,
449- unsigned short srcw,
450- unsigned short srch,
451- short destx,
452- short desty,
453- unsigned short destw,
454- unsigned short desth)
455+ VASurfaceID surface,
456+ const VARectangle *src_rect,
457+ const VARectangle *dst_rect,
458+ const VARectangle *cliprects,
459+ unsigned int num_cliprects)
460 {
461 struct i965_driver_data *i965 = i965_driver_data(ctx);
462 struct object_surface *obj_surface = SURFACE(surface);
463 struct object_subpic *obj_subpic = SUBPIC(obj_surface->subpic);
464+ unsigned int n_rects;
465 assert(obj_subpic);
466
467 i965_render_initialize(ctx);
468- i965_subpic_render_state_setup(ctx, surface,
469- srcx, srcy, srcw, srch,
470- destx, desty, destw, desth);
471- i965_subpic_render_pipeline_setup(ctx);
472+ n_rects = i965_subpic_render_state_setup(ctx, surface, src_rect, dst_rect,
473+ cliprects, num_cliprects);
474+ i965_subpic_render_pipeline_setup(ctx, n_rects);
475 i965_render_upload_image_palette(ctx, obj_subpic->image, 0xff);
476 intel_batchbuffer_flush(ctx);
477 }
478diff --git a/i965_drv_video/i965_render.h b/i965_drv_video/i965_render.h
479index e3dce02..d2e23f1 100644
480--- a/i965_drv_video/i965_render.h
481+++ b/i965_drv_video/i965_render.h
482@@ -28,6 +28,7 @@
483 #ifndef _I965_RENDER_H_
484 #define _I965_RENDER_H_
485
486+#define MAX_CLIP_RECTS 80 /* vb_bo:4096 / vb:(3*4*4) */
487 #define MAX_RENDER_SURFACES 16
488 #define MAX_SAMPLERS 16
489
490@@ -65,27 +66,20 @@ struct i965_render_state
491
492 Bool i965_render_init(VADriverContextP ctx);
493 Bool i965_render_terminate(VADriverContextP ctx);
494+
495 void i965_render_put_surface(VADriverContextP ctx,
496 VASurfaceID surface,
497- short srcx,
498- short srcy,
499- unsigned short srcw,
500- unsigned short srch,
501- short destx,
502- short desty,
503- unsigned short destw,
504- unsigned short desth);
505-
506+ const VARectangle *src_rect,
507+ const VARectangle *dst_rect,
508+ const VARectangle *cliprects,
509+ unsigned int num_cliprects);
510
511 void
512 i965_render_put_subpic(VADriverContextP ctx,
513- VASurfaceID surface,
514- short srcx,
515- short srcy,
516- unsigned short srcw,
517- unsigned short srch,
518- short destx,
519- short desty,
520- unsigned short destw,
521- unsigned short desth);
522+ VASurfaceID surface,
523+ const VARectangle *src_rect,
524+ const VARectangle *dst_rect,
525+ const VARectangle *cliprects,
526+ unsigned int num_cliprects);
527+
528 #endif /* _I965_RENDER_H_ */
529--
5301.5.4.3
531
diff --git a/meta-emenlow/recipes-graphics/libva/libva-0.31.0/102_attribute_visibility.patch b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/102_attribute_visibility.patch
new file mode 100644
index 0000000..2885ab7
--- /dev/null
+++ b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/102_attribute_visibility.patch
@@ -0,0 +1,47 @@
1commit 8d0004cbd40305114bbe8019122319b43d25a772
2Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
3Date: Tue Sep 8 12:34:39 2009 +0000
4
5 Fix ATTRIBUTE_HIDDEN definition if __attribute__((visibility("hidden"))) is not supported.
6
7commit 7a8bf489ffd436d853364dd0d3c9a6734b8cc7eb
8Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
9Date: Thu Sep 3 15:46:37 2009 +0000
10
11 Check for __attribute__((visibility("hidden"))).
12
13diff --git a/configure.ac b/configure.ac
14index da96872..abef435 100644
15--- a/configure.ac
16+++ b/configure.ac
17@@ -132,6 +132,30 @@ if test x$enable_i965_driver = xyes && ! $PKG_CONFIG --atleast-version=2.4 libdr
18 fi
19 AM_CONDITIONAL(BUILD_I965_DRIVER, test x$enable_i965_driver = xyes)
20
21+dnl Check for __attribute__((visibility()))
22+AC_CACHE_CHECK([whether __attribute__((visibility())) is supported],
23+ libva_cv_visibility_attribute,
24+ [cat > conftest.c <<EOF
25+int foo __attribute__ ((visibility ("hidden"))) = 1;
26+int bar __attribute__ ((visibility ("protected"))) = 1;
27+EOF
28+ libva_cv_visibility_attribute=no
29+ if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
30+ if grep '\.hidden.*foo' conftest.s >/dev/null; then
31+ if grep '\.protected.*bar' conftest.s >/dev/null; then
32+ libva_cv_visibility_attribute=yes
33+ fi
34+ fi
35+ fi
36+ rm -f conftest.[cs]
37+])
38+ATTRIBUTE_HIDDEN=""
39+if test $libva_cv_visibility_attribute = yes; then
40+ ATTRIBUTE_HIDDEN="__attribute__((visibility(\"hidden\")))"
41+fi
42+AC_DEFINE_UNQUOTED([ATTRIBUTE_HIDDEN], [$ATTRIBUTE_HIDDEN],
43+ [Defined to __attribute__((visibility("hidden"))) when available])
44+
45 # We only need the headers, we don't link against the DRM libraries
46 LIBVA_CFLAGS="$DRM_CFLAGS"
47 AC_SUBST(LIBVA_CFLAGS)
diff --git a/meta-emenlow/recipes-graphics/libva/libva-0.31.0/103_fix_vainfo_deps.patch b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/103_fix_vainfo_deps.patch
new file mode 100644
index 0000000..942c26d
--- /dev/null
+++ b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/103_fix_vainfo_deps.patch
@@ -0,0 +1,24 @@
1commit 11e626a3610daf0fce253ef48ab8736bce6178f9
2Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
3Date: Tue Sep 22 12:29:56 2009 +0000
4
5 Fix vainfo dependencies (Konstantin Pavlov).
6
7diff --git a/test/Makefile.am b/test/Makefile.am
8index 58e1677..ee78d34 100644
9--- a/test/Makefile.am
10+++ b/test/Makefile.am
11@@ -31,10 +31,10 @@ AM_CFLAGS = -I$(top_srcdir)/../../include/external/ -I$(top_srcdir)/src -I$(top_
12
13 TESTS = $(check_PROGRAMS)
14
15-TEST_LIBS = $(top_srcdir)/src/$(libvabackendlib)
16+TEST_LIBS = $(top_srcdir)/src/libva.la $(top_srcdir)/src/$(libvabackendlib)
17
18-vainfo_LDADD = $(top_srcdir)/src/$(libvabackendlib)
19-vainfo_DEPENDENCIES = $(top_srcdir)/src/$(libvabackendlib)
20+vainfo_LDADD = $(top_srcdir)/src/libva.la $(top_srcdir)/src/$(libvabackendlib)
21+vainfo_DEPENDENCIES = $(top_srcdir)/src/libva.la $(top_srcdir)/src/$(libvabackendlib)
22 vainfo_SOURCES = vainfo.c
23
24 test_01_LDADD = $(TEST_LIBS)
diff --git a/meta-emenlow/recipes-graphics/libva/libva-0.31.0/104_fix_libva_pkgconfig_deps.patch b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/104_fix_libva_pkgconfig_deps.patch
new file mode 100644
index 0000000..bd212bf
--- /dev/null
+++ b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/104_fix_libva_pkgconfig_deps.patch
@@ -0,0 +1,18 @@
1commit f0b352251894becfcec50de1430bda12c314a464
2Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
3Date: Tue Sep 22 13:00:34 2009 +0000
4
5 Fix libva-x11 pkgconfig dependencies.
6
7diff --git a/libva-x11.pc.in b/libva-x11.pc.in
8index 75e4f0b..6dde07f 100644
9--- a/libva-x11.pc.in
10+++ b/libva-x11.pc.in
11@@ -6,6 +6,7 @@ display=x11
12
13 Name: libva-${display}
14 Description: Userspace Video Acceleration (VA) ${display} interface
15+Requires: libva
16 Version: @PACKAGE_VERSION@
17 Libs: -L${libdir} -lva-${display}
18 Cflags: -I${includedir}
diff --git a/meta-emenlow/recipes-graphics/libva/libva-0.31.0/105_dont_search_LIBGL_DRIVERS_PATH.patch b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/105_dont_search_LIBGL_DRIVERS_PATH.patch
new file mode 100644
index 0000000..de873d6
--- /dev/null
+++ b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/105_dont_search_LIBGL_DRIVERS_PATH.patch
@@ -0,0 +1,21 @@
1commit 035374378644216fb3a7d3974a8c46b1bd425918
2Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
3Date: Tue Sep 22 13:03:23 2009 +0000
4
5 Don't search LIBGL_DRIVERS_PATH, stick to LIBVA_DRIVERS_PATH only or the default path.
6
7diff --git a/src/va.c b/src/va.c
8index 12662cd..723235e 100644
9--- a/src/va.c
10+++ b/src/va.c
11@@ -134,10 +134,6 @@ static VAStatus va_openDriver(VADisplay dpy, char *driver_name)
12 {
13 /* don't allow setuid apps to use LIBVA_DRIVERS_PATH */
14 search_path = getenv("LIBVA_DRIVERS_PATH");
15- if (!search_path)
16- {
17- search_path = getenv("LIBGL_DRIVERS_PATH");
18- }
19 }
20 if (!search_path)
21 {
diff --git a/meta-emenlow/recipes-graphics/libva/libva-0.31.0/108_drivers_path.patch b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/108_drivers_path.patch
new file mode 100644
index 0000000..073c987
--- /dev/null
+++ b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/108_drivers_path.patch
@@ -0,0 +1,25 @@
1From 332bfec6020b5cfcef5d655f4bf525dab67c0b92 Mon Sep 17 00:00:00 2001
2From: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
3Date: Wed, 24 Jun 2009 08:12:13 +0000
4Subject: [PATCH] Install drivers into pkglibdir/va/.
5
6---
7 configure.ac | 2 +-
8 1 files changed, 1 insertions(+), 1 deletions(-)
9
10diff --git a/configure.ac b/configure.ac
11index 4be2b56..d595ac9 100644
12--- a/configure.ac
13+++ b/configure.ac
14@@ -73,7 +73,7 @@ AC_ARG_ENABLE(i965-driver,
15
16 AC_ARG_WITH(drivers-path,
17 [AC_HELP_STRING([--with-drivers-path=[[path]]], [drivers path])],,
18- [with_drivers_path="$libdir/dri"])
19+ [with_drivers_path="$libdir/va/drivers"])
20
21 LIBVA_DRIVERS_PATH="$with_drivers_path"
22 AC_SUBST(LIBVA_DRIVERS_PATH)
23--
241.5.4.3
25
diff --git a/meta-emenlow/recipes-graphics/libva/libva-0.31.0/203_fix_fglrx_detection.patch b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/203_fix_fglrx_detection.patch
new file mode 100644
index 0000000..ce7f106
--- /dev/null
+++ b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/203_fix_fglrx_detection.patch
@@ -0,0 +1,542 @@
1commit fb6ccda5984eda96bcb394b23255143dcbc21f18
2Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
3Date: Thu Sep 10 12:22:17 2009 +0000
4
5 Don't link against libdrm to workaround XvBA / fglrx >= 8.66-RC1 bugs.
6
7commit ab3c0f65182462b54729d2d82d4d645c8be5b2d1
8Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
9Date: Wed Sep 9 13:24:46 2009 +0000
10
11 Fix DRM device opening with fglrx >= 8.66-RC1.
12
13diff --git a/src/x11/Makefile.am b/src/x11/Makefile.am
14index c70380d..b6916f2 100644
15--- a/src/x11/Makefile.am
16+++ b/src/x11/Makefile.am
17@@ -25,6 +25,6 @@ noinst_LTLIBRARIES = libva_x11.la
18 libva_x11includedir = ${includedir}/va
19 libva_x11include_HEADERS = va_x11.h va_dri.h va_dri2.h va_dricommon.h
20
21-libva_x11_la_SOURCES = va_x11.c va_dri.c va_dri2.c va_dricommon.c dri2_util.c dri1_util.c va_nvctrl.c
22+libva_x11_la_SOURCES = va_x11.c va_dri.c va_dri2.c va_dricommon.c dri2_util.c dri1_util.c va_nvctrl.c libdrm_glue.c
23
24-EXTRA_DIST = va_dristr.h va_dri2str.h va_dri2tokens.h va_nvctrl.h
25+EXTRA_DIST = va_dristr.h va_dri2str.h va_dri2tokens.h va_nvctrl.h libdrm_glue.h
26diff --git a/src/x11/dri1_util.c b/src/x11/dri1_util.c
27index b3db5b4..3bd490f 100644
28--- a/src/x11/dri1_util.c
29+++ b/src/x11/dri1_util.c
30@@ -1,10 +1,12 @@
31+#include "config.h"
32+#include <stdio.h>
33 #include <stdlib.h>
34 #include <fcntl.h>
35 #include <unistd.h>
36 #include <sys/mman.h>
37 #include <assert.h>
38
39-#include <xf86drm.h>
40+#include "libdrm_glue.h"
41
42 #include "X11/Xlib.h"
43 #include "va.h"
44@@ -21,6 +23,75 @@ struct dri1_drawable
45 int height;
46 };
47
48+static int
49+firegl_drmOpenMinor(int minor)
50+{
51+ char buf[64];
52+ int fd;
53+
54+ sprintf(buf, "/dev/ati/card%d", minor);
55+ if ((fd = open(buf, O_RDWR, 0)) >= 0)
56+ return fd;
57+ return -1;
58+}
59+
60+static int
61+firegl_drmOpenByBusID(const char *busid)
62+{
63+ int i, fd;
64+ drmSetVersion sv;
65+ const char *buf;
66+
67+ for (i = 0; i < DRM_MAX_MINOR; i++) {
68+ if ((fd = firegl_drmOpenMinor(i)) < 0)
69+ continue;
70+ sv.drm_di_major = 1;
71+ sv.drm_di_minor = 1;
72+ sv.drm_dd_major = -1;
73+ sv.drm_dd_minor = -1;
74+ libdrm_drmSetInterfaceVersion(fd, &sv);
75+ buf = libdrm_drmGetBusid(fd);
76+ if (buf && strcasecmp(buf, busid) == 0) { /* XXX: drmMatchBusID() */
77+ libdrm_drmFreeBusid(buf);
78+ return fd;
79+ }
80+ if (buf)
81+ libdrm_drmFreeBusid(buf);
82+ close(fd);
83+ }
84+ return -1;
85+}
86+
87+static int
88+drm_open_once(struct dri_state *dri_state, const char *BusID, int *newlyopened)
89+{
90+ dri_state->driConnectedFlag = VA_NONE;
91+ dri_state->fd = libdrm_drmOpenOnce(NULL, BusID, newlyopened);
92+ if (dri_state->fd < 0) {
93+ dri_state->fd = firegl_drmOpenByBusID(BusID);
94+ if (dri_state->fd >= 0) {
95+ *newlyopened = 1;
96+ dri_state->driConnectedFlag |= VA_DRI_AMD;
97+ }
98+ }
99+ return dri_state->fd;
100+}
101+
102+static void
103+drm_close_once(struct dri_state *dri_state)
104+{
105+ /* XXX: dri_state->close() doesn't seem to be called, thus this
106+ function is never called either */
107+ if (dri_state->fd < 0)
108+ return;
109+ if (dri_state->driConnectedFlag & VA_DRI_AMD)
110+ close(dri_state->fd);
111+ else
112+ libdrm_drmCloseOnce(dri_state->fd);
113+ dri_state->fd = -1;
114+ dri_state->driConnectedFlag = VA_NONE;
115+}
116+
117 static struct dri_drawable *
118 dri1CreateDrawable(VADriverContextP ctx, XID x_drawable)
119 {
120@@ -64,9 +135,9 @@ dri1Close(VADriverContextP ctx)
121 free_drawable_hashtable(ctx);
122 VA_DRIDestroyContext(ctx->x11_dpy, ctx->x11_screen, dri_state->hwContextID);
123 assert(dri_state->pSAREA != MAP_FAILED);
124- drmUnmap(dri_state->pSAREA, SAREA_MAX);
125+ libdrm_drmUnmap(dri_state->pSAREA, SAREA_MAX);
126 assert(dri_state->fd >= 0);
127- drmCloseOnce(dri_state->fd);
128+ drm_close_once(dri_state);
129 VA_DRICloseConnection(ctx->x11_dpy, ctx->x11_screen);
130 }
131
132@@ -104,21 +175,20 @@ isDRI1Connected(VADriverContextP ctx, char **driver_name)
133 &dri_state->hSAREA, &BusID))
134 goto err_out0;
135
136-
137- dri_state->fd = drmOpenOnce(NULL, BusID, &newlyopened);
138+ drm_open_once(dri_state, BusID, &newlyopened);
139 XFree(BusID);
140
141 if (dri_state->fd < 0)
142 goto err_out1;
143
144
145- if (drmGetMagic(dri_state->fd, &magic))
146+ if (libdrm_drmGetMagic(dri_state->fd, &magic))
147 goto err_out1;
148
149 if (newlyopened && !VA_DRIAuthConnection(ctx->x11_dpy, ctx->x11_screen, magic))
150 goto err_out1;
151
152- if (drmMap(dri_state->fd, dri_state->hSAREA, SAREA_MAX, &dri_state->pSAREA))
153+ if (libdrm_drmMap(dri_state->fd, dri_state->hSAREA, SAREA_MAX, &dri_state->pSAREA))
154 goto err_out1;
155
156 if (!VA_DRICreateContext(ctx->x11_dpy, ctx->x11_screen,
157@@ -127,7 +196,8 @@ isDRI1Connected(VADriverContextP ctx, char **driver_name)
158 &dri_state->hwContextID, &dri_state->hwContext))
159 goto err_out1;
160
161- dri_state->driConnectedFlag = VA_DRI1;
162+ dri_state->driConnectedFlag &= VA_DRI_AMD; /* clear flags but AMD bit */
163+ dri_state->driConnectedFlag |= VA_DRI1;
164 dri_state->createDrawable = dri1CreateDrawable;
165 dri_state->destroyDrawable = dri1DestroyDrawable;
166 dri_state->swapBuffer = dri1SwapBuffer;
167@@ -138,10 +208,10 @@ isDRI1Connected(VADriverContextP ctx, char **driver_name)
168
169 err_out1:
170 if (dri_state->pSAREA != MAP_FAILED)
171- drmUnmap(dri_state->pSAREA, SAREA_MAX);
172+ libdrm_drmUnmap(dri_state->pSAREA, SAREA_MAX);
173
174 if (dri_state->fd >= 0)
175- drmCloseOnce(dri_state->fd);
176+ drm_close_once(dri_state);
177
178 VA_DRICloseConnection(ctx->x11_dpy, ctx->x11_screen);
179
180diff --git a/src/x11/dri2_util.c b/src/x11/dri2_util.c
181index ebe7a2c..b727e97 100644
182--- a/src/x11/dri2_util.c
183+++ b/src/x11/dri2_util.c
184@@ -3,7 +3,7 @@
185 #include <unistd.h>
186 #include <assert.h>
187
188-#include <xf86drm.h>
189+#include "libdrm_glue.h"
190
191 #include <X11/Xlibint.h>
192 #include <X11/Xlib.h>
193@@ -166,7 +166,7 @@ isDRI2Connected(VADriverContextP ctx, char **driver_name)
194 if (dri_state->fd < 0)
195 goto err_out;
196
197- if (drmGetMagic(dri_state->fd, &magic))
198+ if (libdrm_drmGetMagic(dri_state->fd, &magic))
199 goto err_out;
200
201 if (!VA_DRI2Authenticate(ctx->x11_dpy, RootWindow(ctx->x11_dpy, ctx->x11_screen),
202diff --git a/src/x11/libdrm_glue.c b/src/x11/libdrm_glue.c
203new file mode 100644
204index 0000000..b72a2d1
205--- /dev/null
206+++ b/src/x11/libdrm_glue.c
207@@ -0,0 +1,208 @@
208+/*
209+ * Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved.
210+ *
211+ * Permission is hereby granted, free of charge, to any person obtaining a
212+ * copy of this software and associated documentation files (the
213+ * "Software"), to deal in the Software without restriction, including
214+ * without limitation the rights to use, copy, modify, merge, publish,
215+ * distribute, sub license, and/or sell copies of the Software, and to
216+ * permit persons to whom the Software is furnished to do so, subject to
217+ * the following conditions:
218+ *
219+ * The above copyright notice and this permission notice (including the
220+ * next paragraph) shall be included in all copies or substantial portions
221+ * of the Software.
222+ *
223+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
224+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
225+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
226+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
227+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
228+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
229+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
230+ */
231+
232+#define _GNU_SOURCE 1
233+#include "libdrm_glue.h"
234+#include <stdio.h>
235+#include <string.h>
236+#include <dlfcn.h>
237+#include <assert.h>
238+
239+#define LOAD_FUNC_(NAME, RET, ARGS, FALLBACK) \
240+ static RET (*lib_##NAME) ARGS; \
241+ if (lib_##NAME == NULL) { \
242+ lib_##NAME = libdrm_symbol(#NAME); \
243+ if (!lib_##NAME) \
244+ lib_##NAME = FALLBACK; \
245+ } \
246+ assert(lib_##NAME != NULL)
247+
248+#define LOAD_FUNC(NAME, RET, ARGS) \
249+ LOAD_FUNC_(NAME, RET, ARGS, NULL)
250+
251+static void *libdrm_handle;
252+static int libdrm_handle_ok = -1;
253+
254+static inline void *libdrm_symbol(const char *name)
255+{
256+ if (!libdrm_open())
257+ return NULL;
258+ return dlsym(libdrm_handle, name);
259+}
260+
261+int libdrm_open(void)
262+{
263+ if (libdrm_handle_ok < 0) {
264+ libdrm_handle = dlopen("libdrm.so.2", RTLD_LOCAL|RTLD_LAZY);
265+ libdrm_handle_ok = libdrm_handle != NULL;
266+ }
267+ assert(libdrm_handle);
268+ return libdrm_handle_ok;
269+}
270+
271+void libdrm_close(void)
272+{
273+ if (libdrm_handle)
274+ dlclose(libdrm_handle);
275+}
276+
277+// Default drmOpenOnce() and drmCloseOnce() implementations based on current GIT
278+#define DRM_MAX_FDS 16
279+static struct {
280+ char *BusID;
281+ int fd;
282+ int refcount;
283+} connection[DRM_MAX_FDS];
284+
285+static int nr_fds = 0;
286+
287+// Default implementation for drmOpenOnce() if none exists in the library
288+static int
289+libdrm_default_drmOpenOnce(void *unused, const char *BusID, int *newlyopened)
290+{
291+ int i;
292+ int fd;
293+
294+ for (i = 0; i < nr_fds; i++)
295+ if (strcmp(BusID, connection[i].BusID) == 0) {
296+ connection[i].refcount++;
297+ *newlyopened = 0;
298+ return connection[i].fd;
299+ }
300+
301+ fd = libdrm_drmOpen(unused, BusID);
302+ if (fd <= 0 || nr_fds == DRM_MAX_FDS)
303+ return fd;
304+
305+ connection[nr_fds].BusID = strdup(BusID);
306+ connection[nr_fds].fd = fd;
307+ connection[nr_fds].refcount = 1;
308+ *newlyopened = 1;
309+
310+ if (0)
311+ fprintf(stderr, "saved connection %d for %s %d\n",
312+ nr_fds, connection[nr_fds].BusID,
313+ strcmp(BusID, connection[nr_fds].BusID));
314+ nr_fds++;
315+ return fd;
316+}
317+
318+// Default implementation for drmCloseOnce() if none exists in the library
319+static void libdrm_default_drmCloseOnce(int fd)
320+{
321+ int i;
322+
323+ for (i = 0; i < nr_fds; i++) {
324+ if (fd == connection[i].fd) {
325+ if (--connection[i].refcount == 0) {
326+ libdrm_drmClose(connection[i].fd);
327+ free(connection[i].BusID);
328+ if (i < --nr_fds)
329+ connection[i] = connection[nr_fds];
330+ return;
331+ }
332+ }
333+ }
334+}
335+
336+// Determine whether the DRM kernel driver has been loaded
337+int libdrm_drmAvailable(void)
338+{
339+ LOAD_FUNC(drmAvailable, int, (void));
340+ return lib_drmAvailable();
341+}
342+
343+// Open the DRM device
344+int libdrm_drmOpen(const char *name, const char *busid)
345+{
346+ LOAD_FUNC(drmOpen, int, (const char *, const char *));
347+ return lib_drmOpen(name, busid);
348+}
349+
350+// Close the device
351+int libdrm_drmClose(int fd)
352+{
353+ LOAD_FUNC(drmClose, int, (int));
354+ return lib_drmClose(fd);
355+}
356+
357+// Open the DRM device (re-use an existing connection)
358+int libdrm_drmOpenOnce(void *unused, const char *BusID, int *newlyopened)
359+{
360+ LOAD_FUNC_(drmOpenOnce, int, (void *, const char *, int *),
361+ libdrm_default_drmOpenOnce);
362+ return lib_drmOpenOnce(unused, BusID, newlyopened);
363+}
364+
365+// Close the device (unref an existing connection prior to actually closing it)
366+void libdrm_drmCloseOnce(int fd)
367+{
368+ LOAD_FUNC_(drmCloseOnce, void, (int), libdrm_default_drmCloseOnce);
369+ lib_drmCloseOnce(fd);
370+}
371+
372+// DRM connection cookie
373+int libdrm_drmGetMagic(int fd, drm_magic_t * magic)
374+{
375+ LOAD_FUNC(drmGetMagic, int, (int, drm_magic_t *));
376+ return lib_drmGetMagic(fd, magic);
377+}
378+
379+// Issue a set-version ioctl
380+int libdrm_drmSetInterfaceVersion(int fd, drmSetVersion *version)
381+{
382+ LOAD_FUNC(drmSetInterfaceVersion, int, (int, drmSetVersion *));
383+ return lib_drmSetInterfaceVersion(fd, version);
384+}
385+
386+// Get the bus ID of the device
387+char *libdrm_drmGetBusid(int fd)
388+{
389+ LOAD_FUNC(drmGetBusid, char *, (int));
390+ return lib_drmGetBusid(fd);
391+}
392+
393+// Free the bus ID information
394+void libdrm_drmFreeBusid(const char *busid)
395+{
396+ LOAD_FUNC(drmFreeBusid, void, (const char *));
397+ lib_drmFreeBusid(busid);
398+}
399+
400+// Map a region of memory
401+int libdrm_drmMap(int fd,
402+ drm_handle_t handle,
403+ drmSize size,
404+ drmAddressPtr address)
405+{
406+ LOAD_FUNC(drmMap, int, (int, drm_handle_t, drmSize, drmAddressPtr));
407+ return lib_drmMap(fd, handle, size, address);
408+}
409+
410+// Unmap mappings obtained with drmMap()
411+int libdrm_drmUnmap(drmAddress address, drmSize size)
412+{
413+ LOAD_FUNC(drmUnmap, int, (drmAddress, drmSize));
414+ return lib_drmUnmap(address, size);
415+}
416diff --git a/src/x11/libdrm_glue.h b/src/x11/libdrm_glue.h
417new file mode 100644
418index 0000000..878470b
419--- /dev/null
420+++ b/src/x11/libdrm_glue.h
421@@ -0,0 +1,73 @@
422+/*
423+ * Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved.
424+ *
425+ * Permission is hereby granted, free of charge, to any person obtaining a
426+ * copy of this software and associated documentation files (the
427+ * "Software"), to deal in the Software without restriction, including
428+ * without limitation the rights to use, copy, modify, merge, publish,
429+ * distribute, sub license, and/or sell copies of the Software, and to
430+ * permit persons to whom the Software is furnished to do so, subject to
431+ * the following conditions:
432+ *
433+ * The above copyright notice and this permission notice (including the
434+ * next paragraph) shall be included in all copies or substantial portions
435+ * of the Software.
436+ *
437+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
438+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
439+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
440+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
441+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
442+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
443+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
444+ */
445+
446+#ifndef LIBDRM_GLUE_H
447+#define LIBDRM_GLUE_H
448+
449+#include "config.h"
450+#include <xf86drm.h>
451+
452+int libdrm_open(void)
453+ ATTRIBUTE_HIDDEN;
454+
455+void libdrm_close(void)
456+ ATTRIBUTE_HIDDEN;
457+
458+int libdrm_drmAvailable(void)
459+ ATTRIBUTE_HIDDEN;
460+
461+int libdrm_drmOpen(const char *name, const char *busid)
462+ ATTRIBUTE_HIDDEN;
463+
464+int libdrm_drmClose(int fd)
465+ ATTRIBUTE_HIDDEN;
466+
467+int libdrm_drmOpenOnce(void *unused, const char *BusID, int *newlyopened)
468+ ATTRIBUTE_HIDDEN;
469+
470+void libdrm_drmCloseOnce(int fd)
471+ ATTRIBUTE_HIDDEN;
472+
473+int libdrm_drmGetMagic(int fd, drm_magic_t * magic)
474+ ATTRIBUTE_HIDDEN;
475+
476+int libdrm_drmSetInterfaceVersion(int fd, drmSetVersion *version)
477+ ATTRIBUTE_HIDDEN;
478+
479+char *libdrm_drmGetBusid(int fd)
480+ ATTRIBUTE_HIDDEN;
481+
482+void libdrm_drmFreeBusid(const char *busid)
483+ ATTRIBUTE_HIDDEN;
484+
485+int libdrm_drmMap(int fd,
486+ drm_handle_t handle,
487+ drmSize size,
488+ drmAddressPtr address)
489+ ATTRIBUTE_HIDDEN;
490+
491+int libdrm_drmUnmap(drmAddress address, drmSize size)
492+ ATTRIBUTE_HIDDEN;
493+
494+#endif /* LIBDRM_GLUE_H */
495diff --git a/src/x11/va_dricommon.h b/src/x11/va_dricommon.h
496index a2a51a6..0da35fe 100644
497--- a/src/x11/va_dricommon.h
498+++ b/src/x11/va_dricommon.h
499@@ -13,7 +13,8 @@ enum
500 {
501 VA_NONE = 0,
502 VA_DRI1 = 1,
503- VA_DRI2 = 2
504+ VA_DRI2 = 2,
505+ VA_DRI_AMD = 4 /* AMD DRI implementation */
506 };
507
508 union dri_buffer
509diff --git a/src/x11/va_x11.c b/src/x11/va_x11.c
510index b8c60fa..414c261 100644
511--- a/src/x11/va_x11.c
512+++ b/src/x11/va_x11.c
513@@ -31,6 +31,7 @@
514 #include "va_dri2.h"
515 #include "va_dricommon.h"
516 #include "va_nvctrl.h"
517+#include "libdrm_glue.h"
518 #include <stdio.h>
519 #include <stdarg.h>
520 #include <string.h>
521@@ -94,6 +75,8 @@ static void va_DisplayContextDestroy (
522 }
523 ctx = &((*ctx)->pNext);
524 }
525+
526+ libdrm_close();
527 free(pDisplayContext->pDriverContext->dri_state);
528 free(pDisplayContext->pDriverContext);
529 free(pDisplayContext);
530diff --git a/src/Makefile.am b/src/Makefile.am
531index e50a15f..d1f8f70 100644
532--- a/src/Makefile.am
533+++ b/src/Makefile.am
534@@ -45,7 +45,7 @@ libva_la_LDFLAGS = $(LDADD) -no-undefined
535 libva_la_LIBADD = $(LIBVA_LIBS) -ldl
536
537 libva_x11_la_SOURCES =
538-libva_x11_la_LIBADD = $(libvacorelib) x11/libva_x11.la $(LIBVA_LIBS) $(X11_LIBS) $(XEXT_LIBS) $(DRM_LIBS) $(XFIXES_LIBS)
539+libva_x11_la_LIBADD = $(libvacorelib) x11/libva_x11.la $(LIBVA_LIBS) $(X11_LIBS) $(XEXT_LIBS) $(XFIXES_LIBS) -ldl
540 libva_x11_la_LDFLAGS = $(LDADD)
541 libva_x11_la_DEPENDENCIES = $(libvacorelib) x11/libva_x11.la
542
diff --git a/meta-emenlow/recipes-graphics/libva/libva-0.31.0/204_check_ATIFGLEXTENSION.patch b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/204_check_ATIFGLEXTENSION.patch
new file mode 100644
index 0000000..02920a8
--- /dev/null
+++ b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/204_check_ATIFGLEXTENSION.patch
@@ -0,0 +1,312 @@
1commit d91645f8b37aa43bafa76da3146dcdc9c17963ff
2Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
3Date: Fri Nov 20 15:51:22 2009 +0000
4
5 Fix detection of fglrx.
6
7diff --git a/src/x11/Makefile.am b/src/x11/Makefile.am
8index b6916f2..0b61c33 100644
9--- a/src/x11/Makefile.am
10+++ b/src/x11/Makefile.am
11@@ -25,6 +25,23 @@ noinst_LTLIBRARIES = libva_x11.la
12 libva_x11includedir = ${includedir}/va
13 libva_x11include_HEADERS = va_x11.h va_dri.h va_dri2.h va_dricommon.h
14
15-libva_x11_la_SOURCES = va_x11.c va_dri.c va_dri2.c va_dricommon.c dri2_util.c dri1_util.c va_nvctrl.c libdrm_glue.c
16+libva_x11_la_SOURCES = \
17+ dri1_util.c \
18+ dri2_util.c \
19+ libdrm_glue.c \
20+ va_dri.c \
21+ va_dri2.c \
22+ va_dricommon.c \
23+ va_fglext.c \
24+ va_nvctrl.c \
25+ va_x11.c \
26+ $(NULL)
27
28-EXTRA_DIST = va_dristr.h va_dri2str.h va_dri2tokens.h va_nvctrl.h libdrm_glue.h
29+EXTRA_DIST = \
30+ libdrm_glue.h \
31+ va_dri2str.h \
32+ va_dri2tokens.h \
33+ va_dristr.h \
34+ va_fglext.h \
35+ va_nvctrl.h \
36+ $(NULL)
37diff --git a/src/x11/va_fglext.c b/src/x11/va_fglext.c
38new file mode 100644
39index 0000000..bc58e8b
40--- /dev/null
41+++ b/src/x11/va_fglext.c
42@@ -0,0 +1,175 @@
43+/*
44+ * Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved.
45+ *
46+ * Permission is hereby granted, free of charge, to any person obtaining a
47+ * copy of this software and associated documentation files (the
48+ * "Software"), to deal in the Software without restriction, including
49+ * without limitation the rights to use, copy, modify, merge, publish,
50+ * distribute, sub license, and/or sell copies of the Software, and to
51+ * permit persons to whom the Software is furnished to do so, subject to
52+ * the following conditions:
53+ *
54+ * The above copyright notice and this permission notice (including the
55+ * next paragraph) shall be included in all copies or substantial portions
56+ * of the Software.
57+ *
58+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
59+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
60+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
61+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
62+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
63+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
64+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
65+ */
66+
67+#define _GNU_SOURCE 1
68+#include <string.h>
69+
70+#define NEED_REPLIES
71+#include <stdlib.h>
72+#include <X11/Xlibint.h>
73+#include <X11/Xutil.h>
74+#include <X11/extensions/Xext.h>
75+#include <X11/extensions/extutil.h>
76+#include "va_fglext.h"
77+
78+#define ATIFGL_EXTENSION_NAME "ATIFGLEXTENSION"
79+#define ATIFGL_EXTENSION_EVENTS 0
80+
81+typedef struct _FGLGetDriverData {
82+ CARD8 reqType;
83+ CARD8 fireglReqType;
84+ CARD16 length B16;
85+ CARD32 screen B32;
86+ CARD16 size B16;
87+ CARD16 pad1;
88+} xFGLGetDriverDataReq;
89+#define sz_xFGLGetDriverDataReq sizeof(xFGLGetDriverDataReq)
90+
91+typedef struct {
92+ BYTE type;
93+ BYTE pad1;
94+ CARD16 sequenceNumber B16;
95+ CARD32 length B32;
96+ CARD8 majorVersion;
97+ CARD8 minorVersion;
98+ CARD8 patchlevel B16;
99+ CARD8 BIOSVersionMajor;
100+ CARD8 BIOSVersionMinor;
101+ CARD8 HasSecondary;
102+ CARD16 pad3 B16;
103+ CARD32 pad4 B32;
104+ CARD32 pad5 B32;
105+ CARD32 pad6 B32;
106+ CARD32 pad7 B32;
107+ // ... there are more fields
108+} xFGLGetDriverDataReply;
109+#define sz_xFGLGetDriverDataReply sizeof(xFGLGetDriverDataReply)
110+
111+#define X_FGLGetDriverData 0
112+
113+static XExtensionInfo _fglext_ext_info_data;
114+static XExtensionInfo *fglext_ext_info = &_fglext_ext_info_data;
115+static /* const */ char *fglext_extension_name = ATIFGL_EXTENSION_NAME;
116+
117+#define xFGLCheckExtension(dpy,i,val) \
118+ XextCheckExtension (dpy, i, fglext_extension_name, val)
119+
120+static int close_display();
121+static /* const */ XExtensionHooks fglext_extension_hooks = {
122+ NULL, /* create_gc */
123+ NULL, /* copy_gc */
124+ NULL, /* flush_gc */
125+ NULL, /* free_gc */
126+ NULL, /* create_font */
127+ NULL, /* free_font */
128+ close_display, /* close_display */
129+ NULL, /* wire_to_event */
130+ NULL, /* event_to_wire */
131+ NULL, /* error */
132+ NULL, /* error_string */
133+};
134+
135+static XEXT_GENERATE_FIND_DISPLAY (find_display, fglext_ext_info,
136+ fglext_extension_name,
137+ &fglext_extension_hooks,
138+ ATIFGL_EXTENSION_EVENTS, NULL)
139+
140+static XEXT_GENERATE_CLOSE_DISPLAY (close_display, fglext_ext_info)
141+
142+Bool VA_FGLEXTQueryDirectRenderingCapable( Display *dpy, int screen,
143+ Bool *isCapable )
144+{
145+ char **extensions;
146+ int i, n_extensions, has_fglext = 0, has_fglrxdri = 0;
147+
148+ if (isCapable)
149+ *isCapable = False;
150+
151+ extensions = XListExtensions(dpy, &n_extensions);
152+ if (!extensions)
153+ return False;
154+
155+ for (i = 0; i < n_extensions; i++) {
156+ if (strcmp(extensions[i], ATIFGL_EXTENSION_NAME) == 0)
157+ has_fglext = 1;
158+ if (strcmp(extensions[i], "ATIFGLRXDRI") == 0)
159+ has_fglrxdri = 1;
160+ }
161+ XFreeExtensionList(extensions);
162+
163+ if (!has_fglext)
164+ return False;
165+
166+ if (isCapable)
167+ *isCapable = has_fglrxdri;
168+
169+ return True;
170+}
171+
172+Bool VA_FGLEXTGetClientDriverName( Display *dpy, int screen,
173+ int *ddxDriverMajorVersion, int *ddxDriverMinorVersion,
174+ int *ddxDriverPatchVersion, char **clientDriverName )
175+{
176+ XExtDisplayInfo *info = find_display (dpy);
177+ xFGLGetDriverDataReply rep;
178+ xFGLGetDriverDataReq *req;
179+
180+ if (ddxDriverMajorVersion)
181+ *ddxDriverMajorVersion = 0;
182+ if (ddxDriverMinorVersion)
183+ *ddxDriverMinorVersion = 0;
184+ if (ddxDriverPatchVersion)
185+ *ddxDriverPatchVersion = 0;
186+ if (clientDriverName)
187+ *clientDriverName = NULL;
188+
189+ if(!XextHasExtension(info))
190+ return False;
191+
192+ xFGLCheckExtension (dpy, info, False);
193+
194+ LockDisplay (dpy);
195+ GetReq (FGLGetDriverData, req);
196+ req->reqType = info->codes->major_opcode;
197+ req->fireglReqType = X_FGLGetDriverData;
198+ req->screen = screen;
199+ if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
200+ UnlockDisplay (dpy);
201+ SyncHandle ();
202+ return False;
203+ }
204+ UnlockDisplay (dpy);
205+ SyncHandle ();
206+
207+ if (ddxDriverMajorVersion)
208+ *ddxDriverMajorVersion = rep.majorVersion;
209+ if (ddxDriverMinorVersion)
210+ *ddxDriverMinorVersion = rep.minorVersion;
211+ if (ddxDriverPatchVersion)
212+ *ddxDriverPatchVersion = rep.patchlevel;
213+ if (clientDriverName)
214+ *clientDriverName = strdup("fglrx");
215+
216+ return True;
217+}
218diff --git a/src/x11/va_fglext.h b/src/x11/va_fglext.h
219new file mode 100644
220index 0000000..f2d87c3
221--- /dev/null
222+++ b/src/x11/va_fglext.h
223@@ -0,0 +1,37 @@
224+/*
225+ * Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved.
226+ *
227+ * Permission is hereby granted, free of charge, to any person obtaining a
228+ * copy of this software and associated documentation files (the
229+ * "Software"), to deal in the Software without restriction, including
230+ * without limitation the rights to use, copy, modify, merge, publish,
231+ * distribute, sub license, and/or sell copies of the Software, and to
232+ * permit persons to whom the Software is furnished to do so, subject to
233+ * the following conditions:
234+ *
235+ * The above copyright notice and this permission notice (including the
236+ * next paragraph) shall be included in all copies or substantial portions
237+ * of the Software.
238+ *
239+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
240+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
241+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
242+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
243+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
244+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
245+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
246+ */
247+
248+#ifndef VA_FGLEXTLIB_H
249+#define VA_FGLEXTLIB_H
250+
251+#include <X11/Xlib.h>
252+
253+Bool VA_FGLEXTQueryDirectRenderingCapable( Display *dpy, int screen,
254+ Bool *isCapable );
255+
256+Bool VA_FGLEXTGetClientDriverName( Display *dpy, int screen,
257+ int *ddxDriverMajorVersion, int *ddxDriverMinorVersion,
258+ int *ddxDriverPatchVersion, char **clientDriverName );
259+
260+#endif /* VA_FGLEXTLIB_H */
261diff --git a/src/x11/va_x11.c b/src/x11/va_x11.c
262index 414c261..0510e00 100644
263--- a/src/x11/va_x11.c
264+++ b/src/x11/va_x11.c
265@@ -31,6 +31,7 @@
266 #include "va_dri2.h"
267 #include "va_dricommon.h"
268 #include "va_nvctrl.h"
269+#include "va_fglext.h"
270 #include "libdrm_glue.h"
271 #include <stdio.h>
272 #include <stdarg.h>
273@@ -132,6 +133,29 @@ static VAStatus va_NVCTRL_GetDriverName (
274 return VA_STATUS_SUCCESS;
275 }
276
277+static VAStatus va_FGLEXT_GetDriverName(
278+ VADisplayContextP pDisplayContext,
279+ char **driver_name
280+)
281+{
282+ VADriverContextP ctx = pDisplayContext->pDriverContext;
283+ int direct_capable, driver_major, driver_minor, driver_patch;
284+ Bool result;
285+
286+ result = VA_FGLEXTQueryDirectRenderingCapable(ctx->x11_dpy, ctx->x11_screen,
287+ &direct_capable);
288+ if (!result || !direct_capable)
289+ return VA_STATUS_ERROR_UNKNOWN;
290+
291+ result = VA_FGLEXTGetClientDriverName(ctx->x11_dpy, ctx->x11_screen,
292+ &driver_major, &driver_minor,
293+ &driver_patch, driver_name);
294+ if (!result)
295+ return VA_STATUS_ERROR_UNKNOWN;
296+
297+ return VA_STATUS_SUCCESS;
298+}
299+
300 static VAStatus va_DisplayContextGetDriverName (
301 VADisplayContextP pDisplayContext,
302 char **driver_name
303@@ -156,7 +180,8 @@ static VAStatus va_DisplayContextGetDriverName (
304 vaStatus = va_DRIGetDriverName(pDisplayContext, driver_name);
305 if (vaStatus != VA_STATUS_SUCCESS)
306 vaStatus = va_NVCTRL_GetDriverName(pDisplayContext, driver_name);
307-
308+ if (vaStatus != VA_STATUS_SUCCESS)
309+ vaStatus = va_FGLEXT_GetDriverName(pDisplayContext, driver_name);
310 return vaStatus;
311 }
312
diff --git a/meta-emenlow/recipes-graphics/libva/libva-0.31.0/300_sds_version.patch b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/300_sds_version.patch
new file mode 100644
index 0000000..07531c9
--- /dev/null
+++ b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/300_sds_version.patch
@@ -0,0 +1,87 @@
1commit 890acc1975ed9f6b7173ff6fbf9d689943590913
2Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
3Date: Wed Jun 24 11:32:40 2009 +0000
4
5 Explicit API extensions from SDS.
6
7diff --git a/configure.ac b/configure.ac
8index 3999dc4..17b0403 100644
9--- a/configure.ac
10+++ b/configure.ac
11@@ -28,6 +28,9 @@ m4_define([libva_micro_version], [0])
12 m4_define([libva_version],
13 [libva_major_version.libva_minor_version.libva_micro_version])
14
15+# increase this number for each API change
16+m4_define([libva_sds_version], [4])
17+
18 # if the library source code has changed, increment revision
19 m4_define([libva_lt_revision], [0])
20 # if any interface was added/removed/changed, then inc current, reset revision
21@@ -52,11 +55,14 @@ AC_SUBST(LIBVA_MINOR_VERSION)
22 AC_SUBST(LIBVA_MICRO_VERSION)
23 AC_SUBST(LIBVA_VERSION)
24
25+LIBVA_SDS_VERSION=libva_sds_version
26+AC_SUBST(LIBVA_SDS_VERSION)
27+
28 LIBVA_LT_CURRENT=libva_lt_current
29 LIBVA_LT_REV=libva_lt_revision
30 LIBVA_LT_AGE=libva_lt_age
31 LIBVA_LT_VERSION="$LIBVA_LT_CURRENT:$LIBVA_LT_REV:$LIBVA_LT_AGE"
32-LIBVA_LT_LDFLAGS="-version-info $LIBVA_LT_VERSION"
33+LIBVA_LT_LDFLAGS="-version-info $LIBVA_LT_VERSION -release $LIBVA_VERSION.$LIBVA_SDS_VERSION"
34 AC_SUBST(LIBVA_LT_VERSION)
35 AC_SUBST(LIBVA_LT_LDFLAGS)
36
37diff --git a/src/va.c b/src/va.c
38index f9791f8..b60ac12 100644
39--- a/src/va.c
40+++ b/src/va.c
41@@ -35,6 +35,7 @@
42 #include <linux/videodev2.h>
43
44 #define DRIVER_INIT_FUNC "__vaDriverInit_0_31"
45+#define DRIVER_INIT_FUNC_SDS "__vaDriverInit_0_31_sds"
46
47 #define DRIVER_EXTENSION "_drv_video.so"
48
49@@ -160,6 +161,11 @@ static VAStatus va_openDriver(VADisplay dpy, char *driver_name)
50 init_func = (VADriverInit) dlsym(handle, DRIVER_INIT_FUNC);
51 if (!init_func)
52 {
53+ /* Then try SDS extensions (VDPAU and XvBA backends) */
54+ init_func = (VADriverInit) dlsym(handle, DRIVER_INIT_FUNC_SDS);
55+ }
56+ if (!init_func)
57+ {
58 va_errorMessage("%s has no function %s\n", driver_path, DRIVER_INIT_FUNC);
59 dlclose(handle);
60 }
61diff --git a/src/va_version.h.in b/src/va_version.h.in
62index c9ea97a..197c482 100644
63--- a/src/va_version.h.in
64+++ b/src/va_version.h.in
65@@ -47,6 +47,13 @@
66 #define VA_MICRO_VERSION (@LIBVA_MICRO_VERSION@)
67
68 /**
69+ * VA_SDS_VERSION:
70+ *
71+ * The version of the SDS API extensions to the VA library
72+ */
73+#define VA_SDS_VERSION (@LIBVA_SDS_VERSION@)
74+
75+/**
76 * VA_VERSION:
77 *
78 * The full version of the VA library, like 1.2.3
79@@ -59,7 +66,7 @@
80 * The full version of the VA library, in string form (suited for
81 * string concatenation)
82 */
83-#define VA_VERSION_S "@LIBVA_VERSION@"
84+#define VA_VERSION_S "@LIBVA_VERSION@-sds@LIBVA_SDS_VERSION@"
85
86 /**
87 * VA_VERSION_HEX:
diff --git a/meta-emenlow/recipes-graphics/libva/libva-0.31.0/301_vdpau_mpeg4.patch b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/301_vdpau_mpeg4.patch
new file mode 100644
index 0000000..8618890
--- /dev/null
+++ b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/301_vdpau_mpeg4.patch
@@ -0,0 +1,26 @@
1commit 3c2d45290e1369083a27d53a5f94276c82512974
2Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
3Date: Mon Nov 23 12:21:24 2009 +0000
4
5 Add extra picture info fields for VDPAU/MPEG-4.
6
7diff --git a/src/va.h b/src/va.h
8index fa34850..f89a5cb 100755
9--- a/src/va.h
10+++ b/src/va.h
11@@ -672,6 +672,7 @@ typedef struct _VAPictureParameterBufferMPEG4
12 unsigned int quarter_sample : 1;
13 unsigned int data_partitioned : 1;
14 unsigned int reversible_vlc : 1;
15+ unsigned int resync_marker_disable : 1;
16 } bits;
17 unsigned int value;
18 } vol_fields;
19@@ -692,6 +693,7 @@ typedef struct _VAPictureParameterBufferMPEG4
20 } vop_fields;
21 unsigned char vop_fcode_forward;
22 unsigned char vop_fcode_backward;
23+ unsigned short vop_time_increment_resolution;
24 /* short header related */
25 unsigned char num_gobs_in_vop;
26 unsigned char num_macroblocks_in_gob;
diff --git a/meta-emenlow/recipes-graphics/libva/libva-0.31.0/320_move_vaPutSurface_flags_def.patch b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/320_move_vaPutSurface_flags_def.patch
new file mode 100644
index 0000000..f00c52c
--- /dev/null
+++ b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/320_move_vaPutSurface_flags_def.patch
@@ -0,0 +1,60 @@
1commit c682fb5ebd1964638f90590f66edf49629e7481d
2Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
3Date: Fri Aug 21 11:34:50 2009 +0000
4
5 Move vaPutSurface() flags to <va/va.h> header.
6
7diff --git a/src/va.h b/src/va.h
8index 0519f6f..6b4bbd4 100755
9--- a/src/va.h
10+++ b/src/va.h
11@@ -127,6 +127,22 @@ typedef int VAStatus; /* Return status type from functions */
12 #define VA_STATUS_ERROR_RESOLUTION_NOT_SUPPORTED 0x00000013
13 #define VA_STATUS_ERROR_UNKNOWN 0xFFFFFFFF
14
15+/* De-interlacing flags for vaPutSurface() */
16+#define VA_FRAME_PICTURE 0x00000000
17+#define VA_TOP_FIELD 0x00000001
18+#define VA_BOTTOM_FIELD 0x00000002
19+
20+/*
21+ * Clears the drawable with background color.
22+ * for hardware overlay based implementation this flag
23+ * can be used to turn off the overlay
24+ */
25+#define VA_CLEAR_DRAWABLE 0x00000008
26+
27+/* Color space conversion flags for vaPutSurface() */
28+#define VA_SRC_BT601 0x00000010
29+#define VA_SRC_BT709 0x00000020
30+
31 /*
32 * Returns a short english description of error_status
33 */
34diff --git a/src/x11/va_x11.h b/src/x11/va_x11.h
35index 2171ac6..5ab5200 100644
36--- a/src/x11/va_x11.h
37+++ b/src/x11/va_x11.h
38@@ -27,22 +27,6 @@ VADisplay vaGetDisplay (
39 * color space conversion and scaling to the destination
40 * rectangle
41 */
42-/* de-interlacing flags for vaPutSurface */
43-#define VA_FRAME_PICTURE 0x00000000
44-#define VA_TOP_FIELD 0x00000001
45-#define VA_BOTTOM_FIELD 0x00000002
46-
47-/*
48- * clears the drawable with background color.
49- * for hardware overlay based implementation this flag
50- * can be used to turn off the overlay
51- */
52-#define VA_CLEAR_DRAWABLE 0x00000008
53-
54-/* color space conversion flags for vaPutSurface */
55-#define VA_SRC_BT601 0x00000010
56-#define VA_SRC_BT709 0x00000020
57-
58 VAStatus vaPutSurface (
59 VADisplay dpy,
60 VASurfaceID surface,
diff --git a/meta-emenlow/recipes-graphics/libva/libva-0.31.0/321_libva_glx.base.patch b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/321_libva_glx.base.patch
new file mode 100644
index 0000000..43af6f4
--- /dev/null
+++ b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/321_libva_glx.base.patch
@@ -0,0 +1,212 @@
1commit f0b352251894becfcec50de1430bda12c314a464
2Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
3Date: Tue Sep 22 13:00:34 2009 +0000
4
5 Fix libva-glx pkgconfig dependencies.
6
7commit df0953a951d8a2e5e4b0a28a95ae0f1ac735726e
8Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
9Date: Tue Sep 8 12:25:14 2009 +0000
10
11 Add generic VA/GLX implementation with TFP and FBO.
12
13commit f640b1cf9eab4e5d478239b608ed0d8b68f6c5f6
14Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
15Date: Tue Sep 8 12:15:35 2009 +0000
16
17 Move GLX VTable to a new file.
18
19commit 70d9cb6d1aa2fc2dde6646f3b692433e0d93d431
20Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
21Date: Fri Aug 28 11:15:51 2009 +0000
22
23 Add OpenGL extensions (v3).
24
25diff --git a/Makefile.am b/Makefile.am
26index 07385e6..6fb4cae 100644
27--- a/Makefile.am
28+++ b/Makefile.am
29@@ -32,10 +32,13 @@ endif
30
31 pcfiles = libva.pc
32 pcfiles += libva-x11.pc
33+if USE_GLX
34+pcfiles += libva-glx.pc
35+endif
36
37 pkgconfigdir = @pkgconfigdir@
38 pkgconfig_DATA = $(pcfiles)
39
40-EXTRA_DIST = libva.pc.in libva-x11.pc.in
41+EXTRA_DIST = libva.pc.in libva-x11.pc.in libva-glx.pc.in
42
43 CLEANFILES = $(pcfiles)
44diff --git a/configure.ac b/configure.ac
45index c3aba90..abef435 100644
46--- a/configure.ac
47+++ b/configure.ac
48@@ -52,6 +55,11 @@ AC_SUBST(LIBVA_MINOR_VERSION)
49 AC_SUBST(LIBVA_LT_VERSION)
50 AC_SUBST(LIBVA_LT_LDFLAGS)
51
52+AC_ARG_ENABLE(glx,
53+ [AC_HELP_STRING([--enable-glx],
54+ [build with OpenGL for X11 support])],
55+ [], [enable_glx=yes])
56+
57 AC_ARG_ENABLE(dummy-driver,
58 [AC_HELP_STRING([--enable-dummy-driver],
59 [build dummy video driver])],
60@@ -100,6 +132,23 @@ if test x$enable_i965_driver = xyes && ! $PKG_CONFIG --atleast-version=2.4 libdr
61 AC_DEFINE_UNQUOTED([ATTRIBUTE_HIDDEN], [$ATTRIBUTE_HIDDEN],
62 [Defined to __attribute__((visibility("hidden"))) when available])
63
64+# Check for OpenGL (X11)
65+USE_GLX="no"
66+GL_DEPS_CFLAGS=""
67+GL_DEPS_LIBS=""
68+
69+if test x$enable_glx = xyes; then
70+ AC_CHECK_HEADERS([GL/gl.h])
71+ AC_CHECK_HEADERS([GL/glx.h])
72+ AC_CHECK_LIB(GL, glXCreateContext, [
73+ USE_GLX="yes"
74+ GL_DEPS_LIBS="-lX11 -lGL"
75+ ])
76+fi
77+AC_SUBST(GL_DEPS_CFLAGS)
78+AC_SUBST(GL_DEPS_LIBS)
79+AM_CONDITIONAL(USE_GLX, test "$USE_GLX" = "yes")
80+
81 # We only need the headers, we don't link against the DRM libraries
82 LIBVA_CFLAGS="$DRM_CFLAGS"
83 AC_SUBST(LIBVA_CFLAGS)
84@@ -119,6 +192,7 @@ AC_OUTPUT([
85 src/Makefile
86 src/va_version.h
87 src/x11/Makefile
88+ src/glx/Makefile
89 dummy_drv_video/Makefile
90 i965_drv_video/Makefile
91 i965_drv_video/shaders/Makefile
92@@ -128,5 +202,6 @@ AC_OUTPUT([
93 test/Makefile
94 libva.pc
95 libva-x11.pc
96+ libva-glx.pc
97 ])
98
99diff --git a/libva-glx.pc.in b/libva-glx.pc.in
100new file mode 100644
101index 0000000..20ba20a
102--- /dev/null
103+++ b/libva-glx.pc.in
104@@ -0,0 +1,12 @@
105+prefix=@prefix@
106+exec_prefix=@exec_prefix@
107+libdir=@libdir@
108+includedir=@includedir@
109+display=glx
110+
111+Name: libva-${display}
112+Description: Userspace Video Acceleration (VA) ${display} interface
113+Requires: libva
114+Version: @PACKAGE_VERSION@
115+Libs: -L${libdir} -lva-${display}
116+Cflags: -I${includedir}
117diff --git a/src/Makefile.am b/src/Makefile.am
118index 2f4210a..e50a15f 100644
119--- a/src/Makefile.am
120+++ b/src/Makefile.am
121@@ -28,9 +28,17 @@ INCLUDES = \
122 LDADD = \
123 $(LIBVA_LT_LDFLAGS)
124
125-lib_LTLIBRARIES = \
126- libva.la \
127- libva-x11.la
128+libva_x11_backend = libva-x11.la
129+libva_x11_backenddir = x11
130+if USE_GLX
131+libva_glx_backend = libva-glx.la
132+libva_glx_backenddir = glx
133+else
134+libva_glx_backend =
135+libva_glx_backenddir =
136+endif
137+
138+lib_LTLIBRARIES = libva.la $(libva_x11_backend) $(libva_glx_backend)
139
140 libva_ladir = $(libdir)
141 libva_la_LDFLAGS = $(LDADD) -no-undefined
142@@ -41,7 +49,14 @@ libva_x11_la_LIBADD = $(libvacorelib) x11/libva_x11.la $(LIBVA_LIBS) $(X11_LIBS
143 libva_x11_la_LDFLAGS = $(LDADD)
144 libva_x11_la_DEPENDENCIES = $(libvacorelib) x11/libva_x11.la
145
146-SUBDIRS = x11
147+libva_glx_la_SOURCES =
148+libva_glx_la_LIBADD = $(libvacorelib) glx/libva_glx.la libva-x11.la $(GL_DEPS_LIBS) -ldl
149+libva_glx_la_LDFLAGS = $(LDADD)
150+libva_glx_la_DEPENDENCIES = $(libvacorelib) glx/libva_glx.la libva-x11.la
151+
152+SUBDIRS = $(libva_x11_backenddir) $(libva_glx_backenddir)
153+
154+DIST_SUBDIRS = x11 glx
155
156 libva_la_SOURCES = va.c
157
158diff --git a/src/va_backend.h b/src/va_backend.h
159index 6f858f5..8f722a3 100644
160--- a/src/va_backend.h
161+++ b/src/va_backend.h
162@@ -32,9 +32,11 @@
163 #ifdef IN_LIBVA
164 #include "va.h"
165 #include "x11/va_x11.h"
166+#include "glx/va_backend_glx.h"
167 #else
168 #include <va/va.h>
169 #include <va/va_x11.h>
170+#include <va/va_backend_glx.h>
171 #endif
172
173 #include <stdlib.h>
174@@ -372,6 +374,9 @@ struct VADriverVTable
175 unsigned int *chroma_v_offset,
176 void **buffer
177 );
178+
179+ /* Optional: GLX support hooks */
180+ struct VADriverVTableGLX glx;
181 };
182
183 struct VADriverContext
184@@ -394,6 +399,7 @@ struct VADriverContext
185 void *handle; /* dlopen handle */
186
187 void *dri_state;
188+ void *glx; /* opaque for GLX code */
189 };
190
191 struct VADisplayContext
192@@ -413,6 +420,8 @@ struct VADisplayContext
193 VADisplayContextP ctx,
194 char **driver_name
195 );
196+
197+ void *opaque; /* opaque for display extensions (e.g. GLX) */
198 };
199
200 typedef VAStatus (*VADriverInit) (
201diff --git a/src/x11/va_x11.c b/src/x11/va_x11.c
202index 9de904e..b8c60fa 100644
203--- a/src/x11/va_x11.c
204+++ b/src/x11/va_x11.c
205@@ -243,6 +243,7 @@ VADisplay vaGetDisplay (
206 pDisplayContext->vaIsValid = va_DisplayContextIsValid;
207 pDisplayContext->vaDestroy = va_DisplayContextDestroy;
208 pDisplayContext->vaGetDriverName = va_DisplayContextGetDriverName;
209+ pDisplayContext->opaque = NULL;
210 pDisplayContexts = pDisplayContext;
211 pDriverContext->dri_state = dri_state;
212 dpy = (VADisplay)pDisplayContext;
diff --git a/meta-emenlow/recipes-graphics/libva/libva-0.31.0/322_libva_glx.patch b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/322_libva_glx.patch
new file mode 100644
index 0000000..ccd9ae0
--- /dev/null
+++ b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/322_libva_glx.patch
@@ -0,0 +1,2024 @@
1commit 8e76000abce070da5f1c902a6290f4ccaa3eccc8
2Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
3Date: Fri Sep 18 15:51:08 2009 +0000
4
5 Add C++ guards.
6
7commit bf1ae22ef324fbb347f5369e1ba307e847553fe8
8Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
9Date: Fri Sep 18 15:49:55 2009 +0000
10
11 Fix check for GL extensions.
12
13commit df0953a951d8a2e5e4b0a28a95ae0f1ac735726e
14Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
15Date: Tue Sep 8 12:25:14 2009 +0000
16
17 Add generic VA/GLX implementation with TFP and FBO.
18
19commit f640b1cf9eab4e5d478239b608ed0d8b68f6c5f6
20Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
21Date: Tue Sep 8 12:15:35 2009 +0000
22
23 Move GLX VTable to a new file.
24
25commit 70d9cb6d1aa2fc2dde6646f3b692433e0d93d431
26Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
27Date: Fri Aug 28 11:15:51 2009 +0000
28
29 Add OpenGL extensions (v3).
30
31diff --git a/src/glx/Makefile.am b/src/glx/Makefile.am
32new file mode 100644
33index 0000000..7783d8c
34--- /dev/null
35+++ b/src/glx/Makefile.am
36@@ -0,0 +1,41 @@
37+# Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved.
38+#
39+# Permission is hereby granted, free of charge, to any person obtaining a
40+# copy of this software and associated documentation files (the
41+# "Software"), to deal in the Software without restriction, including
42+# without limitation the rights to use, copy, modify, merge, publish,
43+# distribute, sub license, and/or sell copies of the Software, and to
44+# permit persons to whom the Software is furnished to do so, subject to
45+# the following conditions:
46+#
47+# The above copyright notice and this permission notice (including the
48+# next paragraph) shall be included in all copies or substantial portions
49+# of the Software.
50+#
51+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
52+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
53+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
54+# IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
55+# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
56+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
57+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
58+
59+AM_CFLAGS = -DLINUX -DIN_LIBVA -I$(top_srcdir)/src -I$(top_srcdir)/src/x11
60+
61+source_c = \
62+ va_glx.c \
63+ va_glx_impl.c
64+
65+source_h = \
66+ va_glx.h \
67+ va_backend_glx.h
68+
69+source_h_priv = \
70+ va_glx_impl.h \
71+ va_glx_private.h
72+
73+noinst_LTLIBRARIES = libva_glx.la
74+libva_glxincludedir = ${includedir}/va
75+libva_glxinclude_HEADERS = $(source_h)
76+libva_glx_la_SOURCES = $(source_c)
77+noinst_HEADERS = $(source_h_priv)
78diff --git a/src/glx/va_backend_glx.h b/src/glx/va_backend_glx.h
79new file mode 100644
80index 0000000..3885d30
81--- /dev/null
82+++ b/src/glx/va_backend_glx.h
83@@ -0,0 +1,87 @@
84+/*
85+ * Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved.
86+ *
87+ * Permission is hereby granted, free of charge, to any person obtaining a
88+ * copy of this software and associated documentation files (the
89+ * "Software"), to deal in the Software without restriction, including
90+ * without limitation the rights to use, copy, modify, merge, publish,
91+ * distribute, sub license, and/or sell copies of the Software, and to
92+ * permit persons to whom the Software is furnished to do so, subject to
93+ * the following conditions:
94+ *
95+ * The above copyright notice and this permission notice (including the
96+ * next paragraph) shall be included in all copies or substantial portions
97+ * of the Software.
98+ *
99+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
100+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
101+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
102+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
103+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
104+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
105+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
106+ */
107+
108+#ifndef VA_BACKEND_GLX_H
109+#define VA_BACKEND_GLX_H
110+
111+struct VADriverContext;
112+
113+struct VADriverVTableGLX {
114+ /* Optional: create a surface used for display to OpenGL */
115+ VAStatus (*vaCreateSurfaceGLX)(
116+ struct VADriverContext *ctx,
117+ unsigned int gl_target,
118+ unsigned int gl_texture,
119+ void **gl_surface
120+ );
121+
122+ /* Optional: destroy a VA/GLX surface */
123+ VAStatus (*vaDestroySurfaceGLX)(
124+ struct VADriverContext *ctx,
125+ void *gl_surface
126+ );
127+
128+ /* Optional: associate a VA surface to a VA/GLX surface */
129+ VAStatus (*vaAssociateSurfaceGLX)(
130+ struct VADriverContext *ctx,
131+ void *gl_surface,
132+ VASurfaceID surface,
133+ unsigned int flags
134+ );
135+
136+ /* Optional: deassociate a VA surface from a VA/GLX surface */
137+ VAStatus (*vaDeassociateSurfaceGLX)(
138+ struct VADriverContext *ctx,
139+ void *gl_surface
140+ );
141+
142+ /* Optional: synchronize a VA/GLX surface */
143+ VAStatus (*vaSyncSurfaceGLX)(
144+ struct VADriverContext *ctx,
145+ void *gl_surface
146+ );
147+
148+ /* Optional: prepare VA/GLX surface for rendering */
149+ VAStatus (*vaBeginRenderSurfaceGLX)(
150+ struct VADriverContext *ctx,
151+ void *gl_surface
152+ );
153+
154+ /* Optional: notify the server that the VA/GLX surface is no
155+ longer used for rendering */
156+ VAStatus (*vaEndRenderSurfaceGLX)(
157+ struct VADriverContext *ctx,
158+ void *gl_surface
159+ );
160+
161+ /* Optional: copy a VA surface to a VA/GLX surface */
162+ VAStatus (*vaCopySurfaceGLX)(
163+ struct VADriverContext *ctx,
164+ void *gl_surface,
165+ VASurfaceID surface,
166+ unsigned int flags
167+ );
168+};
169+
170+#endif /* VA_BACKEND_GLX_H */
171diff --git a/src/glx/va_glx.c b/src/glx/va_glx.c
172new file mode 100644
173index 0000000..f6ec2c3
174--- /dev/null
175+++ b/src/glx/va_glx.c
176@@ -0,0 +1,295 @@
177+/*
178+ * Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved.
179+ *
180+ * Permission is hereby granted, free of charge, to any person obtaining a
181+ * copy of this software and associated documentation files (the
182+ * "Software"), to deal in the Software without restriction, including
183+ * without limitation the rights to use, copy, modify, merge, publish,
184+ * distribute, sub license, and/or sell copies of the Software, and to
185+ * permit persons to whom the Software is furnished to do so, subject to
186+ * the following conditions:
187+ *
188+ * The above copyright notice and this permission notice (including the
189+ * next paragraph) shall be included in all copies or substantial portions
190+ * of the Software.
191+ *
192+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
193+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
194+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
195+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
196+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
197+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
198+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
199+ */
200+
201+#include "va_glx_private.h"
202+#include "va_glx_impl.h"
203+
204+#define INIT_CONTEXT(ctx, dpy) do { \
205+ if (!vaDisplayIsValid(dpy)) \
206+ return VA_STATUS_ERROR_INVALID_DISPLAY; \
207+ \
208+ ctx = ((VADisplayContextP)(dpy))->pDriverContext; \
209+ if (!(ctx)) \
210+ return VA_STATUS_ERROR_INVALID_DISPLAY; \
211+ \
212+ VAStatus status = va_glx_init_context(ctx); \
213+ if (status != VA_STATUS_SUCCESS) \
214+ return status; \
215+ } while (0)
216+
217+#define INIT_SURFACE(surface, surface_arg) do { \
218+ surface = (VASurfaceGLXP)(surface_arg); \
219+ if (!vaSurfaceIsValid(surface)) \
220+ return VA_STATUS_ERROR_INVALID_SURFACE; \
221+ } while (0)
222+
223+#define INVOKE(ctx, func, args) do { \
224+ VADriverVTableGLXP vtable; \
225+ vtable = &VA_DRIVER_CONTEXT_GLX(ctx)->vtable; \
226+ if (!vtable->va##func##GLX) \
227+ return VA_STATUS_ERROR_UNIMPLEMENTED; \
228+ status = vtable->va##func##GLX args; \
229+ } while (0)
230+
231+// Check VADisplay is valid
232+static inline int vaDisplayIsValid(VADisplay dpy)
233+{
234+ VADisplayContextP pDisplayContext = (VADisplayContextP)dpy;
235+
236+ return (pDisplayContext &&
237+ pDisplayContext->vaIsValid &&
238+ pDisplayContext->vaIsValid(pDisplayContext));
239+}
240+
241+// Check VASurfaceGLX is valid
242+static inline int vaSurfaceIsValid(VASurfaceGLXP pSurfaceGLX)
243+{
244+ return pSurfaceGLX && pSurfaceGLX->magic == VA_SURFACE_GLX_MAGIC;
245+}
246+
247+// Destroy VA/GLX display context
248+static void va_DisplayContextDestroy(VADisplayContextP pDisplayContext)
249+{
250+ VADisplayContextGLXP pDisplayContextGLX;
251+ VADriverContextP pDriverContext;
252+ VADriverContextGLXP pDriverContextGLX;
253+
254+ if (!pDisplayContext)
255+ return;
256+
257+ pDriverContext = pDisplayContext->pDriverContext;
258+ pDriverContextGLX = pDriverContext->glx;
259+ if (pDriverContextGLX) {
260+ free(pDriverContextGLX);
261+ pDriverContext->glx = NULL;
262+ }
263+
264+ pDisplayContextGLX = pDisplayContext->opaque;
265+ if (pDisplayContextGLX) {
266+ if (pDisplayContextGLX->vaDestroy)
267+ pDisplayContextGLX->vaDestroy(pDisplayContext);
268+ free(pDisplayContextGLX);
269+ pDisplayContext->opaque = NULL;
270+ }
271+}
272+
273+// Return a suitable VADisplay for VA API
274+VADisplay vaGetDisplayGLX(Display *native_dpy)
275+{
276+ VADisplay dpy = NULL;
277+ VADisplayContextP pDisplayContext = NULL;
278+ VADisplayContextGLXP pDisplayContextGLX = NULL;
279+ VADriverContextP pDriverContext;
280+ VADriverContextGLXP pDriverContextGLX = NULL;
281+
282+ dpy = vaGetDisplay(native_dpy);
283+ if (!dpy)
284+ return NULL;
285+ pDisplayContext = (VADisplayContextP)dpy;
286+ pDriverContext = pDisplayContext->pDriverContext;
287+
288+ pDisplayContextGLX = calloc(1, sizeof(*pDisplayContextGLX));
289+ if (!pDisplayContextGLX)
290+ goto error;
291+
292+ pDriverContextGLX = calloc(1, sizeof(*pDriverContextGLX));
293+ if (!pDriverContextGLX)
294+ goto error;
295+
296+ pDisplayContextGLX->vaDestroy = pDisplayContext->vaDestroy;
297+ pDisplayContext->vaDestroy = va_DisplayContextDestroy;
298+ pDisplayContext->opaque = pDisplayContextGLX;
299+ pDriverContext->glx = pDriverContextGLX;
300+ return dpy;
301+
302+error:
303+ free(pDriverContextGLX);
304+ free(pDisplayContextGLX);
305+ pDisplayContext->vaDestroy(pDisplayContext);
306+ return NULL;
307+}
308+
309+// Create a surface used for display to OpenGL
310+VAStatus vaCreateSurfaceGLX(
311+ VADisplay dpy,
312+ GLenum target,
313+ GLuint texture,
314+ void **gl_surface
315+)
316+{
317+ VADriverContextP ctx;
318+ VASurfaceGLXP pSurfaceGLX;
319+ VAStatus status;
320+
321+ /* Make sure it is a valid GL texture object */
322+ if (!glIsTexture(texture))
323+ return VA_STATUS_ERROR_INVALID_PARAMETER;
324+
325+ INIT_CONTEXT(ctx, dpy);
326+
327+ pSurfaceGLX = va_glx_create_surface(ctx, target, texture);
328+ if (!pSurfaceGLX)
329+ return VA_STATUS_ERROR_ALLOCATION_FAILED;
330+
331+ INVOKE(ctx, CreateSurface, (ctx, target, texture, &pSurfaceGLX->priv));
332+
333+ if (status != VA_STATUS_SUCCESS)
334+ va_glx_destroy_surface(ctx, &pSurfaceGLX);
335+
336+ *gl_surface = pSurfaceGLX;
337+ return status;
338+}
339+
340+// Destroy a VA/GLX surface
341+VAStatus vaDestroySurfaceGLX(
342+ VADisplay dpy,
343+ void *gl_surface
344+)
345+{
346+ VADriverContextP ctx;
347+ VASurfaceGLXP pSurfaceGLX;
348+ VAStatus status;
349+
350+ INIT_CONTEXT(ctx, dpy);
351+ INIT_SURFACE(pSurfaceGLX, gl_surface);
352+
353+ INVOKE(ctx, DestroySurface, (ctx, pSurfaceGLX));
354+
355+ free(pSurfaceGLX);
356+ return status;
357+}
358+
359+// Associate a VA surface to a VA/GLX surface
360+VAStatus vaAssociateSurfaceGLX(
361+ VADisplay dpy,
362+ void *gl_surface,
363+ VASurfaceID surface,
364+ unsigned int flags
365+)
366+{
367+ VADriverContextP ctx;
368+ VASurfaceGLXP pSurfaceGLX;
369+ VAStatus status;
370+
371+ INIT_CONTEXT(ctx, dpy);
372+ INIT_SURFACE(pSurfaceGLX, gl_surface);
373+
374+ INVOKE(ctx, AssociateSurface, (ctx, pSurfaceGLX, surface, flags));
375+
376+ if (status == VA_STATUS_SUCCESS)
377+ pSurfaceGLX->surface = surface;
378+
379+ return status;
380+}
381+
382+// Deassociate a VA surface from a VA/GLX surface
383+VAStatus vaDeassociateSurfaceGLX(
384+ VADisplay dpy,
385+ void *gl_surface
386+)
387+{
388+ VADriverContextP ctx;
389+ VASurfaceGLXP pSurfaceGLX;
390+ VAStatus status;
391+
392+ INIT_CONTEXT(ctx, dpy);
393+ INIT_SURFACE(pSurfaceGLX, gl_surface);
394+
395+ INVOKE(ctx, DeassociateSurface, (ctx, pSurfaceGLX));
396+
397+ if (status == VA_STATUS_SUCCESS)
398+ pSurfaceGLX->surface = VA_INVALID_SURFACE;
399+
400+ return status;
401+}
402+
403+// Synchronize a VA/GLX surface
404+VAStatus vaSyncSurfaceGLX(
405+ VADisplay dpy,
406+ void *gl_surface
407+)
408+{
409+ VADriverContextP ctx;
410+ VASurfaceGLXP pSurfaceGLX;
411+ VAStatus status;
412+
413+ INIT_CONTEXT(ctx, dpy);
414+ INIT_SURFACE(pSurfaceGLX, gl_surface);
415+
416+ INVOKE(ctx, SyncSurface, (ctx, pSurfaceGLX));
417+ return status;
418+}
419+
420+// Prepare VA/GLX surface for rendering
421+VAStatus vaBeginRenderSurfaceGLX(