diff options
author | Tom Zanussi <tom.zanussi@intel.com> | 2010-12-20 12:24:36 -0600 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-12-23 14:20:50 +0000 |
commit | eca21e63590c165c5aaf14cbd51c7f325b731aba (patch) | |
tree | e04b863b4a355e46a6ce526caf6dcc98713eb620 /meta-emenlow/recipes-graphics | |
parent | ab83f5f266ee7f66d14e3711ec84907750ea7e91 (diff) | |
download | poky-eca21e63590c165c5aaf14cbd51c7f325b731aba.tar.gz |
meta-emenlow: update to the new BSP layout
This modifies the meta-emenlow BSP layer to reflect the new BSP
standard layout as defined in the latestYocto BSP Developer's Guide.
There's no change in functionality here - this simply moves things
around, adds a README, and makes the SRCREVs local.
Signed-off-by: Tom Zanussi <tom.zanussi@intel.com>
Diffstat (limited to 'meta-emenlow/recipes-graphics')
54 files changed, 9121 insertions, 0 deletions
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 0000000000..14bde6887a --- /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 | |||
5 | Index: 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]) | ||
24 | Index: 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 | ||
37 | Index: 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 0000000000..d0e14a5622 --- /dev/null +++ b/meta-emenlow/recipes-graphics/libdrm-poulsbo/libdrm-poulsbo_2.3.0.bb | |||
@@ -0,0 +1,19 @@ | |||
1 | DESCRIPTION = "Userspace interface to kernel DRM services" | ||
2 | LICENSE = "MIT" | ||
3 | LIC_FILES_CHKSUM = "file://MIT_License.txt;md5=732825ecdcf420261531d935fcd914a7" | ||
4 | PR = "r4" | ||
5 | |||
6 | PROVIDES = "libdrm-poulsbo" | ||
7 | |||
8 | inherit autotools pkgconfig | ||
9 | |||
10 | SRC_URI = "https://launchpad.net/~gma500/+archive/ppa/+files/libdrm-poulsbo_2.3.0-1ubuntu0sarvatt4~1004um1ubuntu1.tar.gz \ | ||
11 | file://libdrm-poulsbo.patch" | ||
12 | |||
13 | SRC_URI[md5sum] = "82c00bb9f1239f1d00b18411b89c2380" | ||
14 | SRC_URI[sha256sum] = "335d4ac6694687475efe07b44a2d77a9a9fadcbc16946d01ea8a02339ae7d9ec" | ||
15 | |||
16 | do_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 0000000000..1b928b4c09 --- /dev/null +++ b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/033_g45_add_rgba_subpic.patch | |||
@@ -0,0 +1,111 @@ | |||
1 | From 6622e8eba85cea476f8ef5b8c3620c4a0f024dcd Mon Sep 17 00:00:00 2001 | ||
2 | From: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
3 | Date: Wed, 4 Nov 2009 10:56:54 +0000 | ||
4 | Subject: [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 | |||
12 | diff --git a/i965_drv_video/i965_drv_video.c b/i965_drv_video/i965_drv_video.c | ||
13 | index 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 | } | ||
55 | diff --git a/i965_drv_video/i965_drv_video.h b/i965_drv_video/i965_drv_video.h | ||
56 | index 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 | |||
76 | diff --git a/i965_drv_video/i965_render.c b/i965_drv_video/i965_render.c | ||
77 | index 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 | -- | ||
110 | 1.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 0000000000..a4612133bb --- /dev/null +++ b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/034_g45_fix_return_for_unimpl.patch | |||
@@ -0,0 +1,83 @@ | |||
1 | From 3935c6a836b8f90947f0af658a76b97a08a03c67 Mon Sep 17 00:00:00 2001 | ||
2 | From: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
3 | Date: Wed, 4 Nov 2009 13:23:40 +0000 | ||
4 | Subject: [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 | |||
10 | diff --git a/i965_drv_video/i965_drv_video.c b/i965_drv_video/i965_drv_video.c | ||
11 | index 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 | -- | ||
82 | 1.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 0000000000..92d814c1a8 --- /dev/null +++ b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/035_g45_add_yv12_image_format.patch | |||
@@ -0,0 +1,102 @@ | |||
1 | From 23b23e8d65551779f10aedddee7882c2e71ac162 Mon Sep 17 00:00:00 2001 | ||
2 | From: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
3 | Date: Wed, 4 Nov 2009 13:01:44 +0000 | ||
4 | Subject: [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 | |||
11 | diff --git a/i965_drv_video/i965_drv_video.c b/i965_drv_video/i965_drv_video.c | ||
12 | index 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 | } | ||
87 | diff --git a/i965_drv_video/i965_drv_video.h b/i965_drv_video/i965_drv_video.h | ||
88 | index 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 | -- | ||
101 | 1.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 0000000000..dc25d9f9e9 --- /dev/null +++ b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/036_g45_add_vaGetImage.patch | |||
@@ -0,0 +1,71 @@ | |||
1 | From 37f40c0cdc9667907dfb784874b42fb16c2c9bde Mon Sep 17 00:00:00 2001 | ||
2 | From: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
3 | Date: Wed, 4 Nov 2009 13:16:34 +0000 | ||
4 | Subject: [PATCH] =?utf-8?q?[G45]=C2=A0Implement=20vaGetImage()=20for=20full-sized=20surface=20readback.?= | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=utf-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | --- | ||
10 | i965_drv_video/i965_drv_video.c | 45 ++++++++++++++++++++++++++++++++++++++- | ||
11 | 1 files changed, 44 insertions(+), 1 deletions(-) | ||
12 | |||
13 | diff --git a/i965_drv_video/i965_drv_video.c b/i965_drv_video/i965_drv_video.c | ||
14 | index 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 | -- | ||
70 | 1.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 0000000000..ce638cce52 --- /dev/null +++ b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/037_g45_add_vaPutImage.patch | |||
@@ -0,0 +1,111 @@ | |||
1 | From 000807cfbd8bcbc9cd4bf28a066087fee43396b4 Mon Sep 17 00:00:00 2001 | ||
2 | From: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
3 | Date: Wed, 4 Nov 2009 13:36:39 +0000 | ||
4 | Subject: [PATCH] =?utf-8?q?[G45]=C2=A0Implement=20vaPutImage()=20for=20full-sized=20surface=20uploads.?= | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=utf-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | --- | ||
10 | i965_drv_video/i965_drv_video.c | 78 +++++++++++++++++++++++++++++++-------- | ||
11 | 1 files changed, 62 insertions(+), 16 deletions(-) | ||
12 | |||
13 | diff --git a/i965_drv_video/i965_drv_video.c b/i965_drv_video/i965_drv_video.c | ||
14 | index 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 | -- | ||
110 | 1.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 0000000000..ca2e1bd471 --- /dev/null +++ b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/038_g45_vaPutSurface_cliprects.patch | |||
@@ -0,0 +1,531 @@ | |||
1 | From 90de12a47e26ccc0b4cc8189c76991609481870d Mon Sep 17 00:00:00 2001 | ||
2 | From: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
3 | Date: Wed, 4 Nov 2009 17:34:53 +0000 | ||
4 | Subject: [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 | |||
12 | diff --git a/i965_drv_video/i965_drv_video.c b/i965_drv_video/i965_drv_video.c | ||
13 | index 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 | |||
76 | diff --git a/i965_drv_video/i965_render.c b/i965_drv_video/i965_render.c | ||
77 | index 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 | } | ||
478 | diff --git a/i965_drv_video/i965_render.h b/i965_drv_video/i965_render.h | ||
479 | index 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 | -- | ||
530 | 1.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 0000000000..2885ab7b5b --- /dev/null +++ b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/102_attribute_visibility.patch | |||
@@ -0,0 +1,47 @@ | |||
1 | commit 8d0004cbd40305114bbe8019122319b43d25a772 | ||
2 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
3 | Date: Tue Sep 8 12:34:39 2009 +0000 | ||
4 | |||
5 | Fix ATTRIBUTE_HIDDEN definition if __attribute__((visibility("hidden"))) is not supported. | ||
6 | |||
7 | commit 7a8bf489ffd436d853364dd0d3c9a6734b8cc7eb | ||
8 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
9 | Date: Thu Sep 3 15:46:37 2009 +0000 | ||
10 | |||
11 | Check for __attribute__((visibility("hidden"))). | ||
12 | |||
13 | diff --git a/configure.ac b/configure.ac | ||
14 | index 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 0000000000..942c26d1bd --- /dev/null +++ b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/103_fix_vainfo_deps.patch | |||
@@ -0,0 +1,24 @@ | |||
1 | commit 11e626a3610daf0fce253ef48ab8736bce6178f9 | ||
2 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
3 | Date: Tue Sep 22 12:29:56 2009 +0000 | ||
4 | |||
5 | Fix vainfo dependencies (Konstantin Pavlov). | ||
6 | |||
7 | diff --git a/test/Makefile.am b/test/Makefile.am | ||
8 | index 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 0000000000..bd212bf39c --- /dev/null +++ b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/104_fix_libva_pkgconfig_deps.patch | |||
@@ -0,0 +1,18 @@ | |||
1 | commit f0b352251894becfcec50de1430bda12c314a464 | ||
2 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
3 | Date: Tue Sep 22 13:00:34 2009 +0000 | ||
4 | |||
5 | Fix libva-x11 pkgconfig dependencies. | ||
6 | |||
7 | diff --git a/libva-x11.pc.in b/libva-x11.pc.in | ||
8 | index 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 0000000000..de873d6014 --- /dev/null +++ b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/105_dont_search_LIBGL_DRIVERS_PATH.patch | |||
@@ -0,0 +1,21 @@ | |||
1 | commit 035374378644216fb3a7d3974a8c46b1bd425918 | ||
2 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
3 | Date: 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 | |||
7 | diff --git a/src/va.c b/src/va.c | ||
8 | index 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 0000000000..073c987054 --- /dev/null +++ b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/108_drivers_path.patch | |||
@@ -0,0 +1,25 @@ | |||
1 | From 332bfec6020b5cfcef5d655f4bf525dab67c0b92 Mon Sep 17 00:00:00 2001 | ||
2 | From: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
3 | Date: Wed, 24 Jun 2009 08:12:13 +0000 | ||
4 | Subject: [PATCH] Install drivers into pkglibdir/va/. | ||
5 | |||
6 | --- | ||
7 | configure.ac | 2 +- | ||
8 | 1 files changed, 1 insertions(+), 1 deletions(-) | ||
9 | |||
10 | diff --git a/configure.ac b/configure.ac | ||
11 | index 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 | -- | ||
24 | 1.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 0000000000..ce7f10653c --- /dev/null +++ b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/203_fix_fglrx_detection.patch | |||
@@ -0,0 +1,542 @@ | |||
1 | commit fb6ccda5984eda96bcb394b23255143dcbc21f18 | ||
2 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
3 | Date: Thu Sep 10 12:22:17 2009 +0000 | ||
4 | |||
5 | Don't link against libdrm to workaround XvBA / fglrx >= 8.66-RC1 bugs. | ||
6 | |||
7 | commit ab3c0f65182462b54729d2d82d4d645c8be5b2d1 | ||
8 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
9 | Date: Wed Sep 9 13:24:46 2009 +0000 | ||
10 | |||
11 | Fix DRM device opening with fglrx >= 8.66-RC1. | ||
12 | |||
13 | diff --git a/src/x11/Makefile.am b/src/x11/Makefile.am | ||
14 | index 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 | ||
26 | diff --git a/src/x11/dri1_util.c b/src/x11/dri1_util.c | ||
27 | index 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 | |||
180 | diff --git a/src/x11/dri2_util.c b/src/x11/dri2_util.c | ||
181 | index 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), | ||
202 | diff --git a/src/x11/libdrm_glue.c b/src/x11/libdrm_glue.c | ||
203 | new file mode 100644 | ||
204 | index 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 | +} | ||
416 | diff --git a/src/x11/libdrm_glue.h b/src/x11/libdrm_glue.h | ||
417 | new file mode 100644 | ||
418 | index 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 */ | ||
495 | diff --git a/src/x11/va_dricommon.h b/src/x11/va_dricommon.h | ||
496 | index 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 | ||
509 | diff --git a/src/x11/va_x11.c b/src/x11/va_x11.c | ||
510 | index 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); | ||
530 | diff --git a/src/Makefile.am b/src/Makefile.am | ||
531 | index 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 0000000000..02920a8944 --- /dev/null +++ b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/204_check_ATIFGLEXTENSION.patch | |||
@@ -0,0 +1,312 @@ | |||
1 | commit d91645f8b37aa43bafa76da3146dcdc9c17963ff | ||
2 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
3 | Date: Fri Nov 20 15:51:22 2009 +0000 | ||
4 | |||
5 | Fix detection of fglrx. | ||
6 | |||
7 | diff --git a/src/x11/Makefile.am b/src/x11/Makefile.am | ||
8 | index 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) | ||
37 | diff --git a/src/x11/va_fglext.c b/src/x11/va_fglext.c | ||
38 | new file mode 100644 | ||
39 | index 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 | +} | ||
218 | diff --git a/src/x11/va_fglext.h b/src/x11/va_fglext.h | ||
219 | new file mode 100644 | ||
220 | index 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 */ | ||
261 | diff --git a/src/x11/va_x11.c b/src/x11/va_x11.c | ||
262 | index 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 0000000000..07531c90cb --- /dev/null +++ b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/300_sds_version.patch | |||
@@ -0,0 +1,87 @@ | |||
1 | commit 890acc1975ed9f6b7173ff6fbf9d689943590913 | ||
2 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
3 | Date: Wed Jun 24 11:32:40 2009 +0000 | ||
4 | |||
5 | Explicit API extensions from SDS. | ||
6 | |||
7 | diff --git a/configure.ac b/configure.ac | ||
8 | index 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 | |||
37 | diff --git a/src/va.c b/src/va.c | ||
38 | index 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 | } | ||
61 | diff --git a/src/va_version.h.in b/src/va_version.h.in | ||
62 | index 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 0000000000..86188902ab --- /dev/null +++ b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/301_vdpau_mpeg4.patch | |||
@@ -0,0 +1,26 @@ | |||
1 | commit 3c2d45290e1369083a27d53a5f94276c82512974 | ||
2 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
3 | Date: Mon Nov 23 12:21:24 2009 +0000 | ||
4 | |||
5 | Add extra picture info fields for VDPAU/MPEG-4. | ||
6 | |||
7 | diff --git a/src/va.h b/src/va.h | ||
8 | index 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 0000000000..f00c52ca47 --- /dev/null +++ b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/320_move_vaPutSurface_flags_def.patch | |||
@@ -0,0 +1,60 @@ | |||
1 | commit c682fb5ebd1964638f90590f66edf49629e7481d | ||
2 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
3 | Date: Fri Aug 21 11:34:50 2009 +0000 | ||
4 | |||
5 | Move vaPutSurface() flags to <va/va.h> header. | ||
6 | |||
7 | diff --git a/src/va.h b/src/va.h | ||
8 | index 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 | */ | ||
34 | diff --git a/src/x11/va_x11.h b/src/x11/va_x11.h | ||
35 | index 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 0000000000..43af6f40cc --- /dev/null +++ b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/321_libva_glx.base.patch | |||
@@ -0,0 +1,212 @@ | |||
1 | commit f0b352251894becfcec50de1430bda12c314a464 | ||
2 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
3 | Date: Tue Sep 22 13:00:34 2009 +0000 | ||
4 | |||
5 | Fix libva-glx pkgconfig dependencies. | ||
6 | |||
7 | commit df0953a951d8a2e5e4b0a28a95ae0f1ac735726e | ||
8 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
9 | Date: Tue Sep 8 12:25:14 2009 +0000 | ||
10 | |||
11 | Add generic VA/GLX implementation with TFP and FBO. | ||
12 | |||
13 | commit f640b1cf9eab4e5d478239b608ed0d8b68f6c5f6 | ||
14 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
15 | Date: Tue Sep 8 12:15:35 2009 +0000 | ||
16 | |||
17 | Move GLX VTable to a new file. | ||
18 | |||
19 | commit 70d9cb6d1aa2fc2dde6646f3b692433e0d93d431 | ||
20 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
21 | Date: Fri Aug 28 11:15:51 2009 +0000 | ||
22 | |||
23 | Add OpenGL extensions (v3). | ||
24 | |||
25 | diff --git a/Makefile.am b/Makefile.am | ||
26 | index 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) | ||
44 | diff --git a/configure.ac b/configure.ac | ||
45 | index 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 | |||
99 | diff --git a/libva-glx.pc.in b/libva-glx.pc.in | ||
100 | new file mode 100644 | ||
101 | index 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} | ||
117 | diff --git a/src/Makefile.am b/src/Makefile.am | ||
118 | index 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 | |||
158 | diff --git a/src/va_backend.h b/src/va_backend.h | ||
159 | index 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) ( | ||
201 | diff --git a/src/x11/va_x11.c b/src/x11/va_x11.c | ||
202 | index 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 0000000000..ccd9ae090e --- /dev/null +++ b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/322_libva_glx.patch | |||
@@ -0,0 +1,2024 @@ | |||
1 | commit 8e76000abce070da5f1c902a6290f4ccaa3eccc8 | ||
2 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
3 | Date: Fri Sep 18 15:51:08 2009 +0000 | ||
4 | |||
5 | Add C++ guards. | ||
6 | |||
7 | commit bf1ae22ef324fbb347f5369e1ba307e847553fe8 | ||
8 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
9 | Date: Fri Sep 18 15:49:55 2009 +0000 | ||
10 | |||
11 | Fix check for GL extensions. | ||
12 | |||
13 | commit df0953a951d8a2e5e4b0a28a95ae0f1ac735726e | ||
14 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
15 | Date: Tue Sep 8 12:25:14 2009 +0000 | ||
16 | |||
17 | Add generic VA/GLX implementation with TFP and FBO. | ||
18 | |||
19 | commit f640b1cf9eab4e5d478239b608ed0d8b68f6c5f6 | ||
20 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
21 | Date: Tue Sep 8 12:15:35 2009 +0000 | ||
22 | |||
23 | Move GLX VTable to a new file. | ||
24 | |||
25 | commit 70d9cb6d1aa2fc2dde6646f3b692433e0d93d431 | ||
26 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
27 | Date: Fri Aug 28 11:15:51 2009 +0000 | ||
28 | |||
29 | Add OpenGL extensions (v3). | ||
30 | |||
31 | diff --git a/src/glx/Makefile.am b/src/glx/Makefile.am | ||
32 | new file mode 100644 | ||
33 | index 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) | ||
78 | diff --git a/src/glx/va_backend_glx.h b/src/glx/va_backend_glx.h | ||
79 | new file mode 100644 | ||
80 | index 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 */ | ||
171 | diff --git a/src/glx/va_glx.c b/src/glx/va_glx.c | ||
172 | new file mode 100644 | ||
173 | index 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( | ||
422 | + VADisplay dpy, | ||
423 | + void *gl_surface | ||
424 | +) | ||
425 | +{ | ||
426 | + VADriverContextP ctx; | ||
427 | + VASurfaceGLXP pSurfaceGLX; | ||
428 | + VAStatus status; | ||
429 | + | ||
430 | + INIT_CONTEXT(ctx, dpy); | ||
431 | + INIT_SURFACE(pSurfaceGLX, gl_surface); | ||
432 | + | ||
433 | + INVOKE(ctx, BeginRenderSurface, (ctx, pSurfaceGLX)); | ||
434 | + return status; | ||
435 | +} | ||
436 | + | ||
437 | +// Notify the server that the VA/GLX surface is no longer used for rendering | ||
438 | +VAStatus vaEndRenderSurfaceGLX( | ||
439 | + VADisplay dpy, | ||
440 | + void *gl_surface | ||
441 | +) | ||
442 | +{ | ||
443 | + VADriverContextP ctx; | ||
444 | + VASurfaceGLXP pSurfaceGLX; | ||
445 | + VAStatus status; | ||
446 | + | ||
447 | + INIT_CONTEXT(ctx, dpy); | ||
448 | + INIT_SURFACE(pSurfaceGLX, gl_surface); | ||
449 | + | ||
450 | + INVOKE(ctx, EndRenderSurface, (ctx, pSurfaceGLX)); | ||
451 | + return status; | ||
452 | +} | ||
453 | + | ||
454 | +// Copy a VA surface to a VA/GLX surface | ||
455 | +VAStatus vaCopySurfaceGLX( | ||
456 | + VADisplay dpy, | ||
457 | + void *gl_surface, | ||
458 | + VASurfaceID surface, | ||
459 | + unsigned int flags | ||
460 | +) | ||
461 | +{ | ||
462 | + VADriverContextP ctx; | ||
463 | + VASurfaceGLXP pSurfaceGLX; | ||
464 | + VAStatus status; | ||
465 | + | ||
466 | + INIT_CONTEXT(ctx, dpy); | ||
467 | + INIT_SURFACE(pSurfaceGLX, gl_surface); | ||
468 | + | ||
469 | + INVOKE(ctx, CopySurface, (ctx, pSurfaceGLX, surface, flags)); | ||
470 | + return status; | ||
471 | +} | ||
472 | diff --git a/src/glx/va_glx.h b/src/glx/va_glx.h | ||
473 | new file mode 100644 | ||
474 | index 0000000..183ef3a | ||
475 | --- /dev/null | ||
476 | +++ b/src/glx/va_glx.h | ||
477 | @@ -0,0 +1,217 @@ | ||
478 | +/* | ||
479 | + * Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved. | ||
480 | + * | ||
481 | + * Permission is hereby granted, free of charge, to any person obtaining a | ||
482 | + * copy of this software and associated documentation files (the | ||
483 | + * "Software"), to deal in the Software without restriction, including | ||
484 | + * without limitation the rights to use, copy, modify, merge, publish, | ||
485 | + * distribute, sub license, and/or sell copies of the Software, and to | ||
486 | + * permit persons to whom the Software is furnished to do so, subject to | ||
487 | + * the following conditions: | ||
488 | + * | ||
489 | + * The above copyright notice and this permission notice (including the | ||
490 | + * next paragraph) shall be included in all copies or substantial portions | ||
491 | + * of the Software. | ||
492 | + * | ||
493 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
494 | + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
495 | + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. | ||
496 | + * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR | ||
497 | + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
498 | + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
499 | + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
500 | + */ | ||
501 | + | ||
502 | +#ifndef VA_GLX_H | ||
503 | +#define VA_GLX_H | ||
504 | + | ||
505 | +#ifdef IN_LIBVA | ||
506 | +#include "va.h" | ||
507 | +#else | ||
508 | +#include <va/va.h> | ||
509 | +#endif | ||
510 | +#include <GL/glx.h> | ||
511 | + | ||
512 | +#ifdef __cplusplus | ||
513 | +extern "C" { | ||
514 | +#endif | ||
515 | + | ||
516 | +/** | ||
517 | + * Return a suitable VADisplay for VA API | ||
518 | + * | ||
519 | + * @param[in] dpy the X11 display | ||
520 | + * @return a VADisplay | ||
521 | + */ | ||
522 | +VADisplay vaGetDisplayGLX( | ||
523 | + Display *dpy | ||
524 | +); | ||
525 | + | ||
526 | +/** | ||
527 | + * Create a surface used for display to OpenGL | ||
528 | + * | ||
529 | + * The application shall maintain the live GLX context itself. | ||
530 | + * Implementations are free to use glXGetCurrentContext() and | ||
531 | + * glXGetCurrentDrawable() functions for internal purposes. | ||
532 | + * | ||
533 | + * @param[in] dpy the VA display | ||
534 | + * @param[in] target the GL target to which the texture needs to be bound | ||
535 | + * @param[in] texture the GL texture | ||
536 | + * @param[out] gl_surface the VA/GLX surface | ||
537 | + * @return VA_STATUS_SUCCESS if successful | ||
538 | + */ | ||
539 | +VAStatus vaCreateSurfaceGLX( | ||
540 | + VADisplay dpy, | ||
541 | + GLenum target, | ||
542 | + GLuint texture, | ||
543 | + void **gl_surface | ||
544 | +); | ||
545 | + | ||
546 | +/** | ||
547 | + * Destroy a VA/GLX surface | ||
548 | + * | ||
549 | + * The application shall maintain the live GLX context itself. | ||
550 | + * Implementations are free to use glXGetCurrentContext() and | ||
551 | + * glXGetCurrentDrawable() functions for internal purposes. | ||
552 | + * | ||
553 | + * @param[in] dpy the VA display | ||
554 | + * @param[in] gl_surface the VA surface | ||
555 | + * @return VA_STATUS_SUCCESS if successful | ||
556 | + */ | ||
557 | +VAStatus vaDestroySurfaceGLX( | ||
558 | + VADisplay dpy, | ||
559 | + void *gl_surface | ||
560 | +); | ||
561 | + | ||
562 | +/** | ||
563 | + * Associate a VA surface to a VA/GLX surface | ||
564 | + * | ||
565 | + * The association is live until vaDeassociateSurfaceGLX(), | ||
566 | + * vaCopySurfaceGLX() or the next call to vaBeginPicture() with the | ||
567 | + * specificed VA surface. | ||
568 | + * | ||
569 | + * The application shall maintain the live GLX context itself. | ||
570 | + * Implementations are free to use glXGetCurrentContext() and | ||
571 | + * glXGetCurrentDrawable() functions for internal purposes. | ||
572 | + * | ||
573 | + * @param[in] dpy the VA display | ||
574 | + * @param[in] gl_surface the VA/GLX surface | ||
575 | + * @param[in] surface the VA surface | ||
576 | + * @param[in] flags the PutSurface flags | ||
577 | + * @return VA_STATUS_SUCCESS if successful | ||
578 | + */ | ||
579 | +VAStatus vaAssociateSurfaceGLX( | ||
580 | + VADisplay dpy, | ||
581 | + void *gl_surface, | ||
582 | + VASurfaceID surface, | ||
583 | + unsigned int flags | ||
584 | +); | ||
585 | + | ||
586 | +/** | ||
587 | + * Deassociate a VA surface from a VA/GLX surface | ||
588 | + * | ||
589 | + * The application shall maintain the live GLX context itself. | ||
590 | + * Implementations are free to use glXGetCurrentContext() and | ||
591 | + * glXGetCurrentDrawable() functions for internal purposes. | ||
592 | + * | ||
593 | + * @param[in] dpy the VA display | ||
594 | + * @param[in] gl_surface the VA surface | ||
595 | + * @return VA_STATUS_SUCCESS if successful | ||
596 | + */ | ||
597 | +VAStatus vaDeassociateSurfaceGLX( | ||
598 | + VADisplay dpy, | ||
599 | + void *gl_surface | ||
600 | +); | ||
601 | + | ||
602 | +/** | ||
603 | + * Synchronize a VA/GLX surface | ||
604 | + * | ||
605 | + * This function blocks until all pending operations on the VA/GLX | ||
606 | + * surface have been completed. | ||
607 | + * | ||
608 | + * The application shall maintain the live GLX context itself. | ||
609 | + * Implementations are free to use glXGetCurrentContext() and | ||
610 | + * glXGetCurrentDrawable() functions for internal purposes. | ||
611 | + * | ||
612 | + * @param[in] dpy the VA display | ||
613 | + * @param[in] gl_surface the VA surface | ||
614 | + * @return VA_STATUS_SUCCESS if successful | ||
615 | + */ | ||
616 | +VAStatus vaSyncSurfaceGLX( | ||
617 | + VADisplay dpy, | ||
618 | + void *gl_surface | ||
619 | +); | ||
620 | + | ||
621 | +/** | ||
622 | + * Prepare VA/GLX surface for rendering | ||
623 | + * | ||
624 | + * This function performs an implicit vaSyncSurfaceGLX(). | ||
625 | + * | ||
626 | + * Implementations using the GLX texture-from-pixmap extension will | ||
627 | + * generally call glXBindTexImage() here. | ||
628 | + * | ||
629 | + * The application shall maintain the live GLX context itself. | ||
630 | + * Implementations are free to use glXGetCurrentContext() and | ||
631 | + * glXGetCurrentDrawable() functions for internal purposes. | ||
632 | + * | ||
633 | + * @param[in] dpy the VA display | ||
634 | + * @param[in] gl_surface the VA surface | ||
635 | + * @return VA_STATUS_SUCCESS if successful | ||
636 | + */ | ||
637 | +VAStatus vaBeginRenderSurfaceGLX( | ||
638 | + VADisplay dpy, | ||
639 | + void *gl_surface | ||
640 | +); | ||
641 | + | ||
642 | +/** | ||
643 | + * Notify the server that the VA/GLX surface is no longer used for | ||
644 | + * rendering | ||
645 | + * | ||
646 | + * Implementations using the GLX texture-from-pixmap extension will | ||
647 | + * generally call glXReleaseTexImage() here. | ||
648 | + * | ||
649 | + * The application shall maintain the live GLX context itself. | ||
650 | + * Implementations are free to use glXGetCurrentContext() and | ||
651 | + * glXGetCurrentDrawable() functions for internal purposes. | ||
652 | + * | ||
653 | + * @param[in] dpy the VA display | ||
654 | + * @param[in] gl_surface the VA surface | ||
655 | + * @return VA_STATUS_SUCCESS if successful | ||
656 | + */ | ||
657 | +VAStatus vaEndRenderSurfaceGLX( | ||
658 | + VADisplay dpy, | ||
659 | + void *gl_surface | ||
660 | +); | ||
661 | + | ||
662 | +/** | ||
663 | + * Copy a VA surface to a VA/GLX surface | ||
664 | + * | ||
665 | + * This function kills any association that was previously made with | ||
666 | + * vaAssociateSurfaceGLX() and will not return until the copy is | ||
667 | + * completed. | ||
668 | + * | ||
669 | + * Upon successful return, the underlying GL texture will contain the | ||
670 | + * complete pixels and no call to vaBeginRenderSurfaceGLX() or | ||
671 | + * vaEndRenderSurfaceGLX() is required. | ||
672 | + * | ||
673 | + * The application shall maintain the live GLX context itself. | ||
674 | + * Implementations are free to use glXGetCurrentContext() and | ||
675 | + * glXGetCurrentDrawable() functions for internal purposes. | ||
676 | + * | ||
677 | + * @param[in] dpy the VA display | ||
678 | + * @param[in] gl_surface the VA/GLX destination surface | ||
679 | + * @param[in] surface the VA source surface | ||
680 | + * @param[in] flags the PutSurface flags | ||
681 | + * @return VA_STATUS_SUCCESS if successful | ||
682 | + */ | ||
683 | +VAStatus vaCopySurfaceGLX( | ||
684 | + VADisplay dpy, | ||
685 | + void *gl_surface, | ||
686 | + VASurfaceID surface, | ||
687 | + unsigned int flags | ||
688 | +); | ||
689 | + | ||
690 | +#ifdef __cplusplus | ||
691 | +} | ||
692 | +#endif | ||
693 | + | ||
694 | +#endif /* VA_GLX_H */ | ||
695 | diff --git a/src/glx/va_glx_impl.c b/src/glx/va_glx_impl.c | ||
696 | new file mode 100644 | ||
697 | index 0000000..d4f9c1d | ||
698 | --- /dev/null | ||
699 | +++ b/src/glx/va_glx_impl.c | ||
700 | @@ -0,0 +1,1168 @@ | ||
701 | +/* | ||
702 | + * Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved. | ||
703 | + * | ||
704 | + * Permission is hereby granted, free of charge, to any person obtaining a | ||
705 | + * copy of this software and associated documentation files (the | ||
706 | + * "Software"), to deal in the Software without restriction, including | ||
707 | + * without limitation the rights to use, copy, modify, merge, publish, | ||
708 | + * distribute, sub license, and/or sell copies of the Software, and to | ||
709 | + * permit persons to whom the Software is furnished to do so, subject to | ||
710 | + * the following conditions: | ||
711 | + * | ||
712 | + * The above copyright notice and this permission notice (including the | ||
713 | + * next paragraph) shall be included in all copies or substantial portions | ||
714 | + * of the Software. | ||
715 | + * | ||
716 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
717 | + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
718 | + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. | ||
719 | + * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR | ||
720 | + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
721 | + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
722 | + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
723 | + */ | ||
724 | + | ||
725 | +#define _GNU_SOURCE 1 | ||
726 | +#include "va_glx_private.h" | ||
727 | +#include "va_glx_impl.h" | ||
728 | +#include <stdio.h> | ||
729 | +#include <stdarg.h> | ||
730 | +#include <string.h> | ||
731 | +#include <assert.h> | ||
732 | +#include <dlfcn.h> | ||
733 | + | ||
734 | +static void va_glx_error_message(const char *format, ...) | ||
735 | +{ | ||
736 | + va_list args; | ||
737 | + va_start(args, format); | ||
738 | + fprintf(stderr, "[%s] ", PACKAGE_NAME); | ||
739 | + vfprintf(stderr, format, args); | ||
740 | + va_end(args); | ||
741 | +} | ||
742 | + | ||
743 | +// X error trap | ||
744 | +static int x11_error_code = 0; | ||
745 | +static int (*old_error_handler)(Display *, XErrorEvent *); | ||
746 | + | ||
747 | +static int error_handler(Display *dpy, XErrorEvent *error) | ||
748 | +{ | ||
749 | + x11_error_code = error->error_code; | ||
750 | + return 0; | ||
751 | +} | ||
752 | + | ||
753 | +static void x11_trap_errors(void) | ||
754 | +{ | ||
755 | + x11_error_code = 0; | ||
756 | + old_error_handler = XSetErrorHandler(error_handler); | ||
757 | +} | ||
758 | + | ||
759 | +static int x11_untrap_errors(void) | ||
760 | +{ | ||
761 | + XSetErrorHandler(old_error_handler); | ||
762 | + return x11_error_code; | ||
763 | +} | ||
764 | + | ||
765 | +// Returns a string representation of an OpenGL error | ||
766 | +static const char *gl_get_error_string(GLenum error) | ||
767 | +{ | ||
768 | + static const struct { | ||
769 | + GLenum val; | ||
770 | + const char *str; | ||
771 | + } | ||
772 | + gl_errors[] = { | ||
773 | + { GL_NO_ERROR, "no error" }, | ||
774 | + { GL_INVALID_ENUM, "invalid enumerant" }, | ||
775 | + { GL_INVALID_VALUE, "invalid value" }, | ||
776 | + { GL_INVALID_OPERATION, "invalid operation" }, | ||
777 | + { GL_STACK_OVERFLOW, "stack overflow" }, | ||
778 | + { GL_STACK_UNDERFLOW, "stack underflow" }, | ||
779 | + { GL_OUT_OF_MEMORY, "out of memory" }, | ||
780 | +#ifdef GL_INVALID_FRAMEBUFFER_OPERATION_EXT | ||
781 | + { GL_INVALID_FRAMEBUFFER_OPERATION_EXT, "invalid framebuffer operation" }, | ||
782 | +#endif | ||
783 | + { ~0, NULL } | ||
784 | + }; | ||
785 | + | ||
786 | + int i; | ||
787 | + for (i = 0; gl_errors[i].str; i++) { | ||
788 | + if (gl_errors[i].val == error) | ||
789 | + return gl_errors[i].str; | ||
790 | + } | ||
791 | + return "unknown"; | ||
792 | +} | ||
793 | + | ||
794 | +static inline int gl_do_check_error(int report) | ||
795 | +{ | ||
796 | + GLenum error; | ||
797 | + int is_error = 0; | ||
798 | + while ((error = glGetError()) != GL_NO_ERROR) { | ||
799 | + if (report) | ||
800 | + va_glx_error_message("glError: %s caught\n", | ||
801 | + gl_get_error_string(error)); | ||
802 | + is_error = 1; | ||
803 | + } | ||
804 | + return is_error; | ||
805 | +} | ||
806 | + | ||
807 | +static inline void gl_purge_errors(void) | ||
808 | +{ | ||
809 | + gl_do_check_error(0); | ||
810 | +} | ||
811 | + | ||
812 | +static inline int gl_check_error(void) | ||
813 | +{ | ||
814 | + return gl_do_check_error(1); | ||
815 | +} | ||
816 | + | ||
817 | +// glGetFloatv() wrapper | ||
818 | +static int gl_get_current_color(float color[4]) | ||
819 | +{ | ||
820 | + gl_purge_errors(); | ||
821 | + glGetFloatv(GL_CURRENT_COLOR, color); | ||
822 | + if (gl_check_error()) | ||
823 | + return -1; | ||
824 | + return 0; | ||
825 | +} | ||
826 | + | ||
827 | +// glGetIntegerv() wrapper | ||
828 | +static int gl_get_param(GLenum param, unsigned int *pval) | ||
829 | +{ | ||
830 | + GLint val; | ||
831 | + | ||
832 | + gl_purge_errors(); | ||
833 | + glGetIntegerv(param, &val); | ||
834 | + if (gl_check_error()) | ||
835 | + return -1; | ||
836 | + if (pval) | ||
837 | + *pval = val; | ||
838 | + return 0; | ||
839 | +} | ||
840 | + | ||
841 | +// glGetTexLevelParameteriv() wrapper | ||
842 | +static int gl_get_texture_param(GLenum param, unsigned int *pval) | ||
843 | +{ | ||
844 | + GLint val; | ||
845 | + | ||
846 | + gl_purge_errors(); | ||
847 | + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, param, &val); | ||
848 | + if (gl_check_error()) | ||
849 | + return -1; | ||
850 | + if (pval) | ||
851 | + *pval = val; | ||
852 | + return 0; | ||
853 | +} | ||
854 | + | ||
855 | +// Returns the OpenGL VTable | ||
856 | +static inline VAOpenGLVTableP gl_get_vtable(VADriverContextP ctx) | ||
857 | +{ | ||
858 | + return &VA_DRIVER_CONTEXT_GLX(ctx)->gl_vtable; | ||
859 | +} | ||
860 | + | ||
861 | +// Lookup for a GLX function | ||
862 | +typedef void (*GLFuncPtr)(void); | ||
863 | +typedef GLFuncPtr (*GLXGetProcAddressProc)(const char *); | ||
864 | + | ||
865 | +static GLFuncPtr get_proc_address_default(const char *name) | ||
866 | +{ | ||
867 | + return NULL; | ||
868 | +} | ||
869 | + | ||
870 | +static GLXGetProcAddressProc get_proc_address_func(void) | ||
871 | +{ | ||
872 | + GLXGetProcAddressProc get_proc_func; | ||
873 | + | ||
874 | + dlerror(); | ||
875 | + get_proc_func = (GLXGetProcAddressProc) | ||
876 | + dlsym(RTLD_DEFAULT, "glXGetProcAddress"); | ||
877 | + if (dlerror() == NULL) | ||
878 | + return get_proc_func; | ||
879 | + | ||
880 | + get_proc_func = (GLXGetProcAddressProc) | ||
881 | + dlsym(RTLD_DEFAULT, "glXGetProcAddressARB"); | ||
882 | + if (dlerror() == NULL) | ||
883 | + return get_proc_func; | ||
884 | + | ||
885 | + return get_proc_address_default; | ||
886 | +} | ||
887 | + | ||
888 | +static inline GLFuncPtr get_proc_address(const char *name) | ||
889 | +{ | ||
890 | + static GLXGetProcAddressProc get_proc_func = NULL; | ||
891 | + if (get_proc_func == NULL) | ||
892 | + get_proc_func = get_proc_address_func(); | ||
893 | + return get_proc_func(name); | ||
894 | +} | ||
895 | + | ||
896 | +// Check for GLX extensions (TFP, FBO) | ||
897 | +static int check_extension(const char *name, const char *ext) | ||
898 | +{ | ||
899 | + const char *end; | ||
900 | + int name_len, n; | ||
901 | + | ||
902 | + if (name == NULL || ext == NULL) | ||
903 | + return 0; | ||
904 | + | ||
905 | + end = ext + strlen(ext); | ||
906 | + name_len = strlen(name); | ||
907 | + while (ext < end) { | ||
908 | + n = strcspn(ext, " "); | ||
909 | + if (n == name_len && strncmp(name, ext, n) == 0) | ||
910 | + return 1; | ||
911 | + ext += (n + 1); | ||
912 | + } | ||
913 | + return 0; | ||
914 | +} | ||
915 | + | ||
916 | +static int check_tfp_extensions(VADriverContextP ctx) | ||
917 | +{ | ||
918 | + const char *gl_extensions; | ||
919 | + const char *glx_extensions; | ||
920 | + | ||
921 | + gl_extensions = (const char *)glGetString(GL_EXTENSIONS); | ||
922 | + if (!check_extension("GL_ARB_texture_non_power_of_two", gl_extensions)) | ||
923 | + return 0; | ||
924 | + | ||
925 | + glx_extensions = glXQueryExtensionsString(ctx->x11_dpy, ctx->x11_screen); | ||
926 | + if (!check_extension("GLX_EXT_texture_from_pixmap", glx_extensions)) | ||
927 | + return 0; | ||
928 | + return 1; | ||
929 | +} | ||
930 | + | ||
931 | +static int check_fbo_extensions(VADriverContextP ctx) | ||
932 | +{ | ||
933 | + const char *gl_extensions; | ||
934 | + | ||
935 | + gl_extensions = (const char *)glGetString(GL_EXTENSIONS); | ||
936 | + if (!check_extension("GL_ARB_framebuffer_object", gl_extensions)) | ||
937 | + return 0; | ||
938 | + if (!check_extension("GL_EXT_framebuffer_object", gl_extensions)) | ||
939 | + return 0; | ||
940 | + return 1; | ||
941 | +} | ||
942 | + | ||
943 | +// Load GLX extensions | ||
944 | +static int load_tfp_extensions(VADriverContextP ctx) | ||
945 | +{ | ||
946 | + VAOpenGLVTableP pOpenGLVTable = gl_get_vtable(ctx); | ||
947 | + | ||
948 | + pOpenGLVTable->glx_bind_tex_image = (PFNGLXBINDTEXIMAGEEXTPROC) | ||
949 | + get_proc_address("glXBindTexImageEXT"); | ||
950 | + if (pOpenGLVTable->glx_bind_tex_image == NULL) | ||
951 | + return 0; | ||
952 | + pOpenGLVTable->glx_release_tex_image = (PFNGLXRELEASETEXIMAGEEXTPROC) | ||
953 | + get_proc_address("glXReleaseTexImageEXT"); | ||
954 | + if (pOpenGLVTable->glx_release_tex_image == NULL) | ||
955 | + return 0; | ||
956 | + return 1; | ||
957 | +} | ||
958 | + | ||
959 | +static int load_fbo_extensions(VADriverContextP ctx) | ||
960 | +{ | ||
961 | + VAOpenGLVTableP pOpenGLVTable = gl_get_vtable(ctx); | ||
962 | + | ||
963 | + pOpenGLVTable->gl_gen_framebuffers = (PFNGLGENFRAMEBUFFERSEXTPROC) | ||
964 | + get_proc_address("glGenFramebuffersEXT"); | ||
965 | + if (pOpenGLVTable->gl_gen_framebuffers == NULL) | ||
966 | + return 0; | ||
967 | + pOpenGLVTable->gl_delete_framebuffers = (PFNGLDELETEFRAMEBUFFERSEXTPROC) | ||
968 | + get_proc_address("glDeleteFramebuffersEXT"); | ||
969 | + if (pOpenGLVTable->gl_delete_framebuffers == NULL) | ||
970 | + return 0; | ||
971 | + pOpenGLVTable->gl_bind_framebuffer = (PFNGLBINDFRAMEBUFFEREXTPROC) | ||
972 | + get_proc_address("glBindFramebufferEXT"); | ||
973 | + if (pOpenGLVTable->gl_bind_framebuffer == NULL) | ||
974 | + return 0; | ||
975 | + pOpenGLVTable->gl_gen_renderbuffers = (PFNGLGENRENDERBUFFERSEXTPROC) | ||
976 | + get_proc_address("glGenRenderbuffersEXT"); | ||
977 | + if (pOpenGLVTable->gl_gen_renderbuffers == NULL) | ||
978 | + return 0; | ||
979 | + pOpenGLVTable->gl_delete_renderbuffers = (PFNGLDELETERENDERBUFFERSEXTPROC) | ||
980 | + get_proc_address("glDeleteRenderbuffersEXT"); | ||
981 | + if (pOpenGLVTable->gl_delete_renderbuffers == NULL) | ||
982 | + return 0; | ||
983 | + pOpenGLVTable->gl_bind_renderbuffer = (PFNGLBINDRENDERBUFFEREXTPROC) | ||
984 | + get_proc_address("glBindRenderbufferEXT"); | ||
985 | + if (pOpenGLVTable->gl_bind_renderbuffer == NULL) | ||
986 | + return 0; | ||
987 | + pOpenGLVTable->gl_renderbuffer_storage = (PFNGLRENDERBUFFERSTORAGEEXTPROC) | ||
988 | + get_proc_address("glRenderbufferStorageEXT"); | ||
989 | + if (pOpenGLVTable->gl_renderbuffer_storage == NULL) | ||
990 | + return 0; | ||
991 | + pOpenGLVTable->gl_framebuffer_renderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) | ||
992 | + get_proc_address("glFramebufferRenderbufferEXT"); | ||
993 | + if (pOpenGLVTable->gl_framebuffer_renderbuffer == NULL) | ||
994 | + return 0; | ||
995 | + pOpenGLVTable->gl_framebuffer_texture_2d = (PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) | ||
996 | + get_proc_address("glFramebufferTexture2DEXT"); | ||
997 | + if (pOpenGLVTable->gl_framebuffer_texture_2d == NULL) | ||
998 | + return 0; | ||
999 | + pOpenGLVTable->gl_check_framebuffer_status = (PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) | ||
1000 | + get_proc_address("glCheckFramebufferStatusEXT"); | ||
1001 | + if (pOpenGLVTable->gl_check_framebuffer_status == NULL) | ||
1002 | + return 0; | ||
1003 | + return 1; | ||
1004 | +} | ||
1005 | + | ||
1006 | + | ||
1007 | +/* ========================================================================= */ | ||
1008 | +/* === VA/GLX helpers === */ | ||
1009 | +/* ========================================================================= */ | ||
1010 | + | ||
1011 | +// OpenGL texture state | ||
1012 | +typedef struct OpenGLTextureState *OpenGLTextureStateP; | ||
1013 | + | ||
1014 | +struct OpenGLTextureState { | ||
1015 | + int was_enabled; | ||
1016 | + int was_bound; | ||
1017 | + GLenum target; | ||
1018 | + GLuint old_texture; | ||
1019 | +}; | ||
1020 | + | ||
1021 | +// Bind texture, preserve previous texture state | ||
1022 | +static int bind_texture(OpenGLTextureStateP ts, GLenum target, GLuint texture) | ||
1023 | +{ | ||
1024 | + ts->target = target; | ||
1025 | + ts->old_texture = 0; | ||
1026 | + ts->was_bound = 0; | ||
1027 | + ts->was_enabled = glIsEnabled(target); | ||
1028 | + if (!ts->was_enabled) | ||
1029 | + glEnable(target); | ||
1030 | + | ||
1031 | + GLenum texture_binding; | ||
1032 | + switch (target) { | ||
1033 | + case GL_TEXTURE_1D: | ||
1034 | + texture_binding = GL_TEXTURE_BINDING_1D; | ||
1035 | + break; | ||
1036 | + case GL_TEXTURE_2D: | ||
1037 | + texture_binding = GL_TEXTURE_BINDING_2D; | ||
1038 | + break; | ||
1039 | + case GL_TEXTURE_3D: | ||
1040 | + texture_binding = GL_TEXTURE_BINDING_3D; | ||
1041 | + break; | ||
1042 | + case GL_TEXTURE_RECTANGLE_ARB: | ||
1043 | + texture_binding = GL_TEXTURE_BINDING_RECTANGLE_ARB; | ||
1044 | + break; | ||
1045 | + default: | ||
1046 | + assert(!target); | ||
1047 | + return -1; | ||
1048 | + } | ||
1049 | + | ||
1050 | + if (ts->was_enabled && gl_get_param(texture_binding, &ts->old_texture) < 0) | ||
1051 | + return -1; | ||
1052 | + | ||
1053 | + ts->was_bound = texture == ts->old_texture; | ||
1054 | + if (!ts->was_bound) { | ||
1055 | + gl_purge_errors(); | ||
1056 | + glBindTexture(target, texture); | ||
1057 | + if (gl_check_error()) | ||
1058 | + return -1; | ||
1059 | + } | ||
1060 | + return 0; | ||
1061 | +} | ||
1062 | + | ||
1063 | +// Unbind texture, restore previous texture state | ||
1064 | +static void unbind_texture(OpenGLTextureStateP ts) | ||
1065 | +{ | ||
1066 | + if (!ts->was_bound && ts->old_texture) | ||
1067 | + glBindTexture(ts->target, ts->old_texture); | ||
1068 | + if (!ts->was_enabled) | ||
1069 | + glDisable(ts->target); | ||
1070 | +} | ||
1071 | + | ||
1072 | +// Create Pixmaps for GLX texture-from-pixmap extension | ||
1073 | +static int create_tfp_surface(VADriverContextP ctx, VASurfaceGLXP pSurfaceGLX) | ||
1074 | +{ | ||
1075 | + const unsigned int width = pSurfaceGLX->width; | ||
1076 | + const unsigned int height = pSurfaceGLX->height; | ||
1077 | + Pixmap pixmap = None; | ||
1078 | + GLXFBConfig *fbconfig = NULL; | ||
1079 | + GLXPixmap glx_pixmap = None; | ||
1080 | + Window root_window; | ||
1081 | + XWindowAttributes wattr; | ||
1082 | + int *attrib; | ||
1083 | + int n_fbconfig_attribs, x, y, status; | ||
1084 | + unsigned int border_width, depth, dummy; | ||
1085 | + | ||
1086 | + root_window = RootWindow(ctx->x11_dpy, ctx->x11_screen); | ||
1087 | + XGetWindowAttributes(ctx->x11_dpy, root_window, &wattr); | ||
1088 | + pixmap = XCreatePixmap(ctx->x11_dpy, root_window, | ||
1089 | + width, height, wattr.depth); | ||
1090 | + if (!pixmap) | ||
1091 | + return -1; | ||
1092 | + pSurfaceGLX->pixmap = pixmap; | ||
1093 | + | ||
1094 | + x11_trap_errors(); | ||
1095 | + status = XGetGeometry(ctx->x11_dpy, | ||
1096 | + (Drawable)pixmap, | ||
1097 | + &root_window, | ||
1098 | + &x, | ||
1099 | + &y, | ||
1100 | + &dummy, | ||
1101 | + &dummy, | ||
1102 | + &border_width, | ||
1103 | + &depth); | ||
1104 | + if (x11_untrap_errors() != 0 || status == 0) | ||
1105 | + return -1; | ||
1106 | + if (depth != 24 && depth != 32) | ||
1107 | + return -1; | ||
1108 | + | ||
1109 | + int fbconfig_attribs[32] = { | ||
1110 | + GLX_DRAWABLE_TYPE, GLX_PIXMAP_BIT, | ||
1111 | + GLX_DOUBLEBUFFER, GL_TRUE, | ||
1112 | + GLX_RENDER_TYPE, GLX_RGBA_BIT, | ||
1113 | + GLX_X_RENDERABLE, GL_TRUE, | ||
1114 | + GLX_Y_INVERTED_EXT, GL_TRUE, | ||
1115 | + GLX_RED_SIZE, 8, | ||
1116 | + GLX_GREEN_SIZE, 8, | ||
1117 | + GLX_BLUE_SIZE, 8, | ||
1118 | + GL_NONE, | ||
1119 | + }; | ||
1120 | + for (attrib = fbconfig_attribs; *attrib != GL_NONE; attrib += 2) | ||
1121 | + ; | ||
1122 | + *attrib++ = GLX_DEPTH_SIZE; *attrib++ = depth; | ||
1123 | + if (depth == 32) { | ||
1124 | + *attrib++ = GLX_ALPHA_SIZE; *attrib++ = 8; | ||
1125 | + *attrib++ = GLX_BIND_TO_TEXTURE_RGBA_EXT; *attrib++ = GL_TRUE; | ||
1126 | + } | ||
1127 | + else { | ||
1128 | + *attrib++ = GLX_BIND_TO_TEXTURE_RGB_EXT; *attrib++ = GL_TRUE; | ||
1129 | + } | ||
1130 | + *attrib++ = GL_NONE; | ||
1131 | + | ||
1132 | + fbconfig = glXChooseFBConfig(ctx->x11_dpy, ctx->x11_screen, fbconfig_attribs, &n_fbconfig_attribs); | ||
1133 | + if (fbconfig == NULL) | ||
1134 | + return -1; | ||
1135 | + | ||
1136 | + int pixmap_attribs[10] = { | ||
1137 | + GLX_TEXTURE_TARGET_EXT, GLX_TEXTURE_2D_EXT, | ||
1138 | + GLX_MIPMAP_TEXTURE_EXT, GL_FALSE, | ||
1139 | + GL_NONE, | ||
1140 | + }; | ||
1141 | + for (attrib = pixmap_attribs; *attrib != GL_NONE; attrib += 2) | ||
1142 | + ; | ||
1143 | + *attrib++ = GLX_TEXTURE_FORMAT_EXT; | ||
1144 | + if (depth == 32) | ||
1145 | + *attrib++ = GLX_TEXTURE_FORMAT_RGBA_EXT; | ||
1146 | + else | ||
1147 | + *attrib++ = GLX_TEXTURE_FORMAT_RGB_EXT; | ||
1148 | + *attrib++ = GL_NONE; | ||
1149 | + | ||
1150 | + x11_trap_errors(); | ||
1151 | + glx_pixmap = glXCreatePixmap(ctx->x11_dpy, | ||
1152 | + fbconfig[0], | ||
1153 | + pixmap, | ||
1154 | + pixmap_attribs); | ||
1155 | + free(fbconfig); | ||
1156 | + if (x11_untrap_errors() != 0) | ||
1157 | + return -1; | ||
1158 | + pSurfaceGLX->glx_pixmap = glx_pixmap; | ||
1159 | + return 0; | ||
1160 | +} | ||
1161 | + | ||
1162 | +// Destroy Pixmaps used for TFP | ||
1163 | +static void destroy_tfp_surface(VADriverContextP ctx, VASurfaceGLXP pSurfaceGLX) | ||
1164 | +{ | ||
1165 | + if (pSurfaceGLX->glx_pixmap) { | ||
1166 | + glXDestroyPixmap(ctx->x11_dpy, pSurfaceGLX->glx_pixmap); | ||
1167 | + pSurfaceGLX->glx_pixmap = None; | ||
1168 | + } | ||
1169 | + | ||
1170 | + if (pSurfaceGLX->pixmap) { | ||
1171 | + XFreePixmap(ctx->x11_dpy, pSurfaceGLX->pixmap); | ||
1172 | + pSurfaceGLX->pixmap = None; | ||
1173 | + } | ||
1174 | +} | ||
1175 | + | ||
1176 | +// Bind GLX Pixmap to texture | ||
1177 | +static int bind_pixmap(VADriverContextP ctx, VASurfaceGLXP pSurfaceGLX) | ||
1178 | +{ | ||
1179 | + VAOpenGLVTableP pOpenGLVTable = gl_get_vtable(ctx); | ||
1180 | + | ||
1181 | + if (pSurfaceGLX->is_bound) | ||
1182 | + return 0; | ||
1183 | + | ||
1184 | + x11_trap_errors(); | ||
1185 | + pOpenGLVTable->glx_bind_tex_image(ctx->x11_dpy, pSurfaceGLX->glx_pixmap, | ||
1186 | + GLX_FRONT_LEFT_EXT, NULL); | ||
1187 | + XSync(ctx->x11_dpy, False); | ||
1188 | + if (x11_untrap_errors() != 0) { | ||
1189 | + va_glx_error_message("failed to bind pixmap\n"); | ||
1190 | + return -1; | ||
1191 | + } | ||
1192 | + | ||
1193 | + pSurfaceGLX->is_bound = 1; | ||
1194 | + return 0; | ||
1195 | +} | ||
1196 | + | ||
1197 | +// Release GLX Pixmap from texture | ||
1198 | +static int unbind_pixmap(VADriverContextP ctx, VASurfaceGLXP pSurfaceGLX) | ||
1199 | +{ | ||
1200 | + VAOpenGLVTableP pOpenGLVTable = gl_get_vtable(ctx); | ||
1201 | + | ||
1202 | + if (!pSurfaceGLX->is_bound) | ||
1203 | + return 0; | ||
1204 | + | ||
1205 | + x11_trap_errors(); | ||
1206 | + pOpenGLVTable->glx_release_tex_image(ctx->x11_dpy, pSurfaceGLX->glx_pixmap, | ||
1207 | + GLX_FRONT_LEFT_EXT); | ||
1208 | + XSync(ctx->x11_dpy, False); | ||
1209 | + if (x11_untrap_errors() != 0) { | ||
1210 | + va_glx_error_message("failed to release pixmap\n"); | ||
1211 | + return -1; | ||
1212 | + } | ||
1213 | + | ||
1214 | + pSurfaceGLX->is_bound = 0; | ||
1215 | + return 0; | ||
1216 | +} | ||
1217 | + | ||
1218 | +// Render GLX Pixmap to texture | ||
1219 | +static void render_pixmap(VADriverContextP ctx, VASurfaceGLXP pSurfaceGLX) | ||
1220 | +{ | ||
1221 | + const unsigned int w = pSurfaceGLX->width; | ||
1222 | + const unsigned int h = pSurfaceGLX->height; | ||
1223 | + float old_color[4]; | ||
1224 | + | ||
1225 | + gl_get_current_color(old_color); | ||
1226 | + glColor4f(1.0f, 1.0f, 1.0f, 1.0f); | ||
1227 | + glBegin(GL_QUADS); | ||
1228 | + { | ||
1229 | + glTexCoord2f(0.0f, 0.0f); glVertex2i(0, 0); | ||
1230 | + glTexCoord2f(0.0f, 1.0f); glVertex2i(0, h); | ||
1231 | + glTexCoord2f(1.0f, 1.0f); glVertex2i(w, h); | ||
1232 | + glTexCoord2f(1.0f, 0.0f); glVertex2i(w, 0); | ||
1233 | + } | ||
1234 | + glEnd(); | ||
1235 | + glColor4fv(old_color); | ||
1236 | +} | ||
1237 | + | ||
1238 | +// Create offscreen surface | ||
1239 | +static int create_fbo_surface(VADriverContextP ctx, VASurfaceGLXP pSurfaceGLX) | ||
1240 | +{ | ||
1241 | + VAOpenGLVTableP pOpenGLVTable = gl_get_vtable(ctx); | ||
1242 | + const GLenum texture = pSurfaceGLX->texture; | ||
1243 | + const unsigned int texture_width = pSurfaceGLX->width; | ||
1244 | + const unsigned int texture_height = pSurfaceGLX->height; | ||
1245 | + GLuint fbo, fbo_buffer, fbo_texture; | ||
1246 | + GLenum status; | ||
1247 | + | ||
1248 | + glGenTextures(1, &fbo_texture); | ||
1249 | + glBindTexture(GL_TEXTURE_2D, fbo_texture); | ||
1250 | + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | ||
1251 | + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | ||
1252 | + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | ||
1253 | + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | ||
1254 | + glPixelStorei(GL_UNPACK_ALIGNMENT, 4); | ||
1255 | + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture_width, texture_height, 0, | ||
1256 | + GL_BGRA, GL_UNSIGNED_BYTE, NULL); | ||
1257 | + | ||
1258 | + pOpenGLVTable->gl_gen_framebuffers(1, &fbo); | ||
1259 | + pOpenGLVTable->gl_bind_framebuffer(GL_FRAMEBUFFER_EXT, fbo); | ||
1260 | + pOpenGLVTable->gl_gen_renderbuffers(1, &fbo_buffer); | ||
1261 | + pOpenGLVTable->gl_bind_renderbuffer(GL_RENDERBUFFER_EXT, fbo_buffer); | ||
1262 | + | ||
1263 | + glBindTexture(GL_TEXTURE_2D, texture); | ||
1264 | + pOpenGLVTable->gl_framebuffer_texture_2d(GL_FRAMEBUFFER_EXT, | ||
1265 | + GL_COLOR_ATTACHMENT0_EXT, | ||
1266 | + GL_TEXTURE_2D, texture, 0); | ||
1267 | + | ||
1268 | + status = pOpenGLVTable->gl_check_framebuffer_status(GL_DRAW_FRAMEBUFFER_EXT); | ||
1269 | + pOpenGLVTable->gl_bind_framebuffer(GL_FRAMEBUFFER_EXT, 0); | ||
1270 | + if (status != GL_FRAMEBUFFER_COMPLETE_EXT) | ||
1271 | + return -1; | ||
1272 | + | ||
1273 | + pSurfaceGLX->fbo = fbo; | ||
1274 | + pSurfaceGLX->fbo_buffer = fbo_buffer; | ||
1275 | + pSurfaceGLX->fbo_texture = fbo_texture; | ||
1276 | + return 0; | ||
1277 | +} | ||
1278 | + | ||
1279 | +// Destroy offscreen surface | ||
1280 | +static void destroy_fbo_surface(VADriverContextP ctx, VASurfaceGLXP pSurfaceGLX) | ||
1281 | +{ | ||
1282 | + VAOpenGLVTableP pOpenGLVTable = gl_get_vtable(ctx); | ||
1283 | + | ||
1284 | + if (pSurfaceGLX->fbo_texture) { | ||
1285 | + glDeleteTextures(1, &pSurfaceGLX->fbo_texture); | ||
1286 | + pSurfaceGLX->fbo_texture = 0; | ||
1287 | + } | ||
1288 | + | ||
1289 | + if (pSurfaceGLX->fbo_buffer) { | ||
1290 | + pOpenGLVTable->gl_delete_renderbuffers(1, &pSurfaceGLX->fbo_buffer); | ||
1291 | + pSurfaceGLX->fbo_buffer = 0; | ||
1292 | + } | ||
1293 | + | ||
1294 | + if (pSurfaceGLX->fbo) { | ||
1295 | + pOpenGLVTable->gl_delete_framebuffers(1, &pSurfaceGLX->fbo); | ||
1296 | + pSurfaceGLX->fbo = 0; | ||
1297 | + } | ||
1298 | +} | ||
1299 | + | ||
1300 | +// Setup matrices to match the FBO texture dimensions | ||
1301 | +static void fbo_enter(VADriverContextP ctx, VASurfaceGLXP pSurfaceGLX) | ||
1302 | +{ | ||
1303 | + VAOpenGLVTableP pOpenGLVTable = gl_get_vtable(ctx); | ||
1304 | + const unsigned int width = pSurfaceGLX->width; | ||
1305 | + const unsigned int height = pSurfaceGLX->height; | ||
1306 | + | ||
1307 | + pOpenGLVTable->gl_bind_framebuffer(GL_FRAMEBUFFER_EXT, pSurfaceGLX->fbo); | ||
1308 | + glPushAttrib(GL_VIEWPORT_BIT); | ||
1309 | + glMatrixMode(GL_PROJECTION); | ||
1310 | + glPushMatrix(); | ||
1311 | + glLoadIdentity(); | ||
1312 | + glMatrixMode(GL_MODELVIEW); | ||
1313 | + glPushMatrix(); | ||
1314 | + glLoadIdentity(); | ||
1315 | + glViewport(0, 0, width, height); | ||
1316 | + glTranslatef(-1.0f, -1.0f, 0.0f); | ||
1317 | + glScalef(2.0f / width, 2.0f / height, 1.0f); | ||
1318 | + | ||
1319 | + glBindTexture(GL_TEXTURE_2D, pSurfaceGLX->fbo_texture); | ||
1320 | +} | ||
1321 | + | ||
1322 | +// Restore original OpenGL matrices | ||
1323 | +static void fbo_leave(VADriverContextP ctx) | ||
1324 | +{ | ||
1325 | + VAOpenGLVTableP pOpenGLVTable = gl_get_vtable(ctx); | ||
1326 | + | ||
1327 | + glPopAttrib(); | ||
1328 | + glMatrixMode(GL_PROJECTION); | ||
1329 | + glPopMatrix(); | ||
1330 | + glMatrixMode(GL_MODELVIEW); | ||
1331 | + glPopMatrix(); | ||
1332 | + pOpenGLVTable->gl_bind_framebuffer(GL_FRAMEBUFFER_EXT, 0); | ||
1333 | +} | ||
1334 | + | ||
1335 | +// Create VA/GLX surface | ||
1336 | +VASurfaceGLXP | ||
1337 | +va_glx_create_surface(VADriverContextP ctx, GLenum target, GLuint texture) | ||
1338 | +{ | ||
1339 | + VADriverContextGLXP pDriverContextGLX = VA_DRIVER_CONTEXT_GLX(ctx); | ||
1340 | + VASurfaceGLXP pSurfaceGLX; | ||
1341 | + unsigned int internal_format, border_width, width, height; | ||
1342 | + int is_error = 1; | ||
1343 | + | ||
1344 | + /* Make sure binding succeeds, if texture was not already bound */ | ||
1345 | + struct OpenGLTextureState ts; | ||
1346 | + if (bind_texture(&ts, target, texture) < 0) | ||
1347 | + goto end; | ||
1348 | + | ||
1349 | + pSurfaceGLX = malloc(sizeof(*pSurfaceGLX)); | ||
1350 | + if (!pSurfaceGLX) | ||
1351 | + goto end; | ||
1352 | + | ||
1353 | + pSurfaceGLX->magic = VA_SURFACE_GLX_MAGIC; | ||
1354 | + pSurfaceGLX->target = target; | ||
1355 | + pSurfaceGLX->texture = texture; | ||
1356 | + pSurfaceGLX->surface = VA_INVALID_SURFACE; | ||
1357 | + pSurfaceGLX->is_bound = 0; | ||
1358 | + pSurfaceGLX->pixmap = None; | ||
1359 | + pSurfaceGLX->glx_pixmap = None; | ||
1360 | + pSurfaceGLX->fbo = 0; | ||
1361 | + pSurfaceGLX->fbo_buffer = 0; | ||
1362 | + pSurfaceGLX->fbo_texture = 0; | ||
1363 | + pSurfaceGLX->priv = NULL; | ||
1364 | + | ||
1365 | + /* XXX: we don't support other textures than RGBA */ | ||
1366 | + if (gl_get_texture_param(GL_TEXTURE_INTERNAL_FORMAT, &internal_format) < 0) | ||
1367 | + goto end; | ||
1368 | + if (internal_format != GL_RGBA) | ||
1369 | + goto end; | ||
1370 | + | ||
1371 | + /* Check texture dimensions */ | ||
1372 | + if (gl_get_texture_param(GL_TEXTURE_BORDER, &border_width) < 0) | ||
1373 | + goto end; | ||
1374 | + if (gl_get_texture_param(GL_TEXTURE_WIDTH, &width) < 0) | ||
1375 | + goto end; | ||
1376 | + if (gl_get_texture_param(GL_TEXTURE_HEIGHT, &height) < 0) | ||
1377 | + goto end; | ||
1378 | + | ||
1379 | + width -= 2 * border_width; | ||
1380 | + height -= 2 * border_width; | ||
1381 | + if (width == 0 || height == 0) | ||
1382 | + goto end; | ||
1383 | + | ||
1384 | + pSurfaceGLX->width = width; | ||
1385 | + pSurfaceGLX->height = height; | ||
1386 | + | ||
1387 | + /* Create Pixmaps for TFP */ | ||
1388 | + if (pDriverContextGLX->use_tfp) { | ||
1389 | + if (create_tfp_surface(ctx, pSurfaceGLX) < 0) | ||
1390 | + goto end; | ||
1391 | + } | ||
1392 | + | ||
1393 | + /* Create Pixmaps for FBO */ | ||
1394 | + if (pDriverContextGLX->use_fbo) { | ||
1395 | + if (create_fbo_surface(ctx, pSurfaceGLX) < 0) | ||
1396 | + goto end; | ||
1397 | + } | ||
1398 | + | ||
1399 | + is_error = 0; | ||
1400 | +end: | ||
1401 | + if (is_error && pSurfaceGLX) | ||
1402 | + va_glx_destroy_surface(ctx, &pSurfaceGLX); | ||
1403 | + | ||
1404 | + unbind_texture(&ts); | ||
1405 | + return pSurfaceGLX; | ||
1406 | +} | ||
1407 | + | ||
1408 | +// Destroy VA/GLX surface | ||
1409 | +void va_glx_destroy_surface(VADriverContextP ctx, VASurfaceGLXP *ppSurfaceGLX) | ||
1410 | +{ | ||
1411 | + VASurfaceGLXP pSurfaceGLX = *ppSurfaceGLX; | ||
1412 | + | ||
1413 | + unbind_pixmap(ctx, pSurfaceGLX); | ||
1414 | + destroy_fbo_surface(ctx, pSurfaceGLX); | ||
1415 | + destroy_tfp_surface(ctx, pSurfaceGLX); | ||
1416 | + | ||
1417 | + free(pSurfaceGLX); | ||
1418 | + *ppSurfaceGLX = NULL; | ||
1419 | +} | ||
1420 | + | ||
1421 | + | ||
1422 | +/* ========================================================================= */ | ||
1423 | +/* === VA/GLX implementation from the driver (fordward calls) === */ | ||
1424 | +/* ========================================================================= */ | ||
1425 | + | ||
1426 | +#define INVOKE(ctx, func, args) do { \ | ||
1427 | + VADriverVTableGLXP vtable = &(ctx)->vtable.glx; \ | ||
1428 | + if (!vtable->va##func##GLX) \ | ||
1429 | + return VA_STATUS_ERROR_UNIMPLEMENTED; \ | ||
1430 | + \ | ||
1431 | + VAStatus status = vtable->va##func##GLX args; \ | ||
1432 | + if (status != VA_STATUS_SUCCESS) \ | ||
1433 | + return status; \ | ||
1434 | + } while (0) | ||
1435 | + | ||
1436 | +static VAStatus | ||
1437 | +vaCreateSurfaceGLX_impl_driver( | ||
1438 | + VADriverContextP ctx, | ||
1439 | + GLenum target, | ||
1440 | + GLuint texture, | ||
1441 | + void **gl_surface | ||
1442 | +) | ||
1443 | +{ | ||
1444 | + INVOKE(ctx, CreateSurface, (ctx, target, texture, gl_surface)); | ||
1445 | + return VA_STATUS_SUCCESS; | ||
1446 | +} | ||
1447 | + | ||
1448 | +static VAStatus | ||
1449 | +vaDestroySurfaceGLX_impl_driver(VADriverContextP ctx, void *gl_surface) | ||
1450 | +{ | ||
1451 | + VASurfaceGLXP pSurfaceGLX = gl_surface; | ||
1452 | + | ||
1453 | + INVOKE(ctx, DestroySurface, (ctx, pSurfaceGLX->priv)); | ||
1454 | + return VA_STATUS_SUCCESS; | ||
1455 | +} | ||
1456 | + | ||
1457 | +static VAStatus | ||
1458 | +vaAssociateSurfaceGLX_impl_driver( | ||
1459 | + VADriverContextP ctx, | ||
1460 | + void *gl_surface, | ||
1461 | + VASurfaceID surface, | ||
1462 | + unsigned int flags | ||
1463 | +) | ||
1464 | +{ | ||
1465 | + VASurfaceGLXP pSurfaceGLX = gl_surface; | ||
1466 | + | ||
1467 | + INVOKE(ctx, AssociateSurface, (ctx, pSurfaceGLX->priv, surface, flags)); | ||
1468 | + return VA_STATUS_SUCCESS; | ||
1469 | +} | ||
1470 | + | ||
1471 | +static VAStatus | ||
1472 | +vaDeassociateSurfaceGLX_impl_driver(VADriverContextP ctx, void *gl_surface) | ||
1473 | +{ | ||
1474 | + VASurfaceGLXP pSurfaceGLX = gl_surface; | ||
1475 | + | ||
1476 | + INVOKE(ctx, DeassociateSurface, (ctx, pSurfaceGLX->priv)); | ||
1477 | + return VA_STATUS_SUCCESS; | ||
1478 | +} | ||
1479 | + | ||
1480 | +static VAStatus | ||
1481 | +vaSyncSurfaceGLX_impl_driver(VADriverContextP ctx, void *gl_surface) | ||
1482 | +{ | ||
1483 | + VASurfaceGLXP pSurfaceGLX = gl_surface; | ||
1484 | + | ||
1485 | + INVOKE(ctx, SyncSurface, (ctx, pSurfaceGLX->priv)); | ||
1486 | + return VA_STATUS_SUCCESS; | ||
1487 | +} | ||
1488 | + | ||
1489 | +static VAStatus | ||
1490 | +vaBeginRenderSurfaceGLX_impl_driver(VADriverContextP ctx, void *gl_surface) | ||
1491 | +{ | ||
1492 | + VASurfaceGLXP pSurfaceGLX = gl_surface; | ||
1493 | + | ||
1494 | + INVOKE(ctx, BeginRenderSurface, (ctx, pSurfaceGLX->priv)); | ||
1495 | + return VA_STATUS_SUCCESS; | ||
1496 | +} | ||
1497 | + | ||
1498 | +static VAStatus | ||
1499 | +vaEndRenderSurfaceGLX_impl_driver(VADriverContextP ctx, void *gl_surface) | ||
1500 | +{ | ||
1501 | + VASurfaceGLXP pSurfaceGLX = gl_surface; | ||
1502 | + | ||
1503 | + INVOKE(ctx, EndRenderSurface, (ctx, pSurfaceGLX->priv)); | ||
1504 | + return VA_STATUS_SUCCESS; | ||
1505 | +} | ||
1506 | + | ||
1507 | +static VAStatus | ||
1508 | +vaCopySurfaceGLX_impl_driver( | ||
1509 | + VADriverContextP ctx, | ||
1510 | + void *gl_surface, | ||
1511 | + VASurfaceID surface, | ||
1512 | + unsigned int flags | ||
1513 | +) | ||
1514 | +{ | ||
1515 | + VASurfaceGLXP pSurfaceGLX = gl_surface; | ||
1516 | + | ||
1517 | + INVOKE(ctx, CopySurface, (ctx, pSurfaceGLX->priv, surface, flags)); | ||
1518 | + return VA_STATUS_SUCCESS; | ||
1519 | +} | ||
1520 | + | ||
1521 | +#undef INVOKE | ||
1522 | + | ||
1523 | + | ||
1524 | +/* ========================================================================= */ | ||
1525 | +/* === VA/GLX implementation from libVA (generic and suboptimal path) === */ | ||
1526 | +/* ========================================================================= */ | ||
1527 | + | ||
1528 | +static VAStatus | ||
1529 | +vaCreateSurfaceGLX_impl_libva( | ||
1530 | + VADriverContextP ctx, | ||
1531 | + GLenum target, | ||
1532 | + GLuint texture, | ||
1533 | + void **gl_surface | ||
1534 | +) | ||
1535 | +{ | ||
1536 | + VADriverContextGLXP pDriverContextGLX = VA_DRIVER_CONTEXT_GLX(ctx); | ||
1537 | + | ||
1538 | + if (!pDriverContextGLX->use_tfp) | ||
1539 | + return VA_STATUS_ERROR_UNIMPLEMENTED; | ||
1540 | + | ||
1541 | + *gl_surface = NULL; | ||
1542 | + return VA_STATUS_SUCCESS; | ||
1543 | +} | ||
1544 | + | ||
1545 | +static VAStatus | ||
1546 | +vaDestroySurfaceGLX_impl_libva(VADriverContextP ctx, void *gl_surface) | ||
1547 | +{ | ||
1548 | + VADriverContextGLXP pDriverContextGLX = VA_DRIVER_CONTEXT_GLX(ctx); | ||
1549 | + | ||
1550 | + if (!pDriverContextGLX->use_tfp) | ||
1551 | + return VA_STATUS_ERROR_UNIMPLEMENTED; | ||
1552 | + | ||
1553 | + return VA_STATUS_SUCCESS; | ||
1554 | +} | ||
1555 | + | ||
1556 | +static VAStatus | ||
1557 | +vaAssociateSurfaceGLX_impl_libva( | ||
1558 | + VADriverContextP ctx, | ||
1559 | + void *gl_surface, | ||
1560 | + VASurfaceID surface, | ||
1561 | + unsigned int flags | ||
1562 | +) | ||
1563 | +{ | ||
1564 | + VADriverContextGLXP pDriverContextGLX = VA_DRIVER_CONTEXT_GLX(ctx); | ||
1565 | + VADriverVTableGLXP vtable = &pDriverContextGLX->vtable; | ||
1566 | + VASurfaceGLXP pSurfaceGLX = gl_surface; | ||
1567 | + VAStatus status; | ||
1568 | + | ||
1569 | + if (!pDriverContextGLX->use_tfp) | ||
1570 | + return VA_STATUS_ERROR_UNIMPLEMENTED; | ||
1571 | + | ||
1572 | + /* XXX: only support VA_FRAME_PICTURE */ | ||
1573 | + if (flags != VA_FRAME_PICTURE) | ||
1574 | + return VA_STATUS_ERROR_FLAG_NOT_SUPPORTED; | ||
1575 | + | ||
1576 | + /* XXX: optimise case where we are associating the same VA surface | ||
1577 | + as before an no changed occurred to it */ | ||
1578 | + status = vtable->vaDeassociateSurfaceGLX(ctx, gl_surface); | ||
1579 | + if (status != VA_STATUS_SUCCESS) | ||
1580 | + return status; | ||
1581 | + | ||
1582 | + x11_trap_errors(); | ||
1583 | + status = ctx->vtable.vaPutSurface(ctx, | ||
1584 | + surface, | ||
1585 | + pSurfaceGLX->pixmap, | ||
1586 | + 0, 0, | ||
1587 | + pSurfaceGLX->width, | ||
1588 | + pSurfaceGLX->height, | ||
1589 | + 0, 0, | ||
1590 | + pSurfaceGLX->width, | ||
1591 | + pSurfaceGLX->height, | ||
1592 | + NULL, 0, | ||
1593 | + flags); | ||
1594 | + XSync(ctx->x11_dpy, False); | ||
1595 | + if (x11_untrap_errors() != 0) | ||
1596 | + return VA_STATUS_ERROR_OPERATION_FAILED; | ||
1597 | + if (status != VA_STATUS_SUCCESS) | ||
1598 | + return status; | ||
1599 | + | ||
1600 | + pSurfaceGLX->surface = surface; | ||
1601 | + return VA_STATUS_SUCCESS; | ||
1602 | +} | ||
1603 | + | ||
1604 | +static VAStatus | ||
1605 | +vaDeassociateSurfaceGLX_impl_libva(VADriverContextP ctx, void *gl_surface) | ||
1606 | +{ | ||
1607 | + VADriverContextGLXP pDriverContextGLX = VA_DRIVER_CONTEXT_GLX(ctx); | ||
1608 | + VASurfaceGLXP pSurfaceGLX = gl_surface; | ||
1609 | + | ||
1610 | + if (!pDriverContextGLX->use_tfp) | ||
1611 | + return VA_STATUS_ERROR_UNIMPLEMENTED; | ||
1612 | + | ||
1613 | + if (unbind_pixmap(ctx, pSurfaceGLX) < 0) | ||
1614 | + return VA_STATUS_ERROR_OPERATION_FAILED; | ||
1615 | + | ||
1616 | + pSurfaceGLX->surface = VA_INVALID_SURFACE; | ||
1617 | + return VA_STATUS_SUCCESS; | ||
1618 | +} | ||
1619 | + | ||
1620 | +static VAStatus | ||
1621 | +vaSyncSurfaceGLX_impl_libva(VADriverContextP ctx, void *gl_surface) | ||
1622 | +{ | ||
1623 | + VADriverContextGLXP pDriverContextGLX = VA_DRIVER_CONTEXT_GLX(ctx); | ||
1624 | + VASurfaceGLXP pSurfaceGLX = gl_surface; | ||
1625 | + | ||
1626 | + if (!pDriverContextGLX->use_tfp) | ||
1627 | + return VA_STATUS_ERROR_UNIMPLEMENTED; | ||
1628 | + | ||
1629 | + if (pSurfaceGLX->surface == VA_INVALID_SURFACE) | ||
1630 | + return VA_STATUS_ERROR_INVALID_SURFACE; | ||
1631 | + | ||
1632 | + return ctx->vtable.vaSyncSurface(ctx, pSurfaceGLX->surface); | ||
1633 | +} | ||
1634 | + | ||
1635 | +static VAStatus | ||
1636 | +vaBeginRenderSurfaceGLX_impl_libva(VADriverContextP ctx, void *gl_surface) | ||
1637 | +{ | ||
1638 | + VADriverContextGLXP pDriverContextGLX = VA_DRIVER_CONTEXT_GLX(ctx); | ||
1639 | + VASurfaceGLXP pSurfaceGLX = gl_surface; | ||
1640 | + VAStatus status; | ||
1641 | + | ||
1642 | + if (!pDriverContextGLX->use_tfp) | ||
1643 | + return VA_STATUS_ERROR_UNIMPLEMENTED; | ||
1644 | + | ||
1645 | + status = vaSyncSurfaceGLX_impl_libva(ctx, gl_surface); | ||
1646 | + if (status != VA_STATUS_SUCCESS) | ||
1647 | + return status; | ||
1648 | + | ||
1649 | + if (bind_pixmap(ctx, pSurfaceGLX) < 0) | ||
1650 | + return VA_STATUS_ERROR_OPERATION_FAILED; | ||
1651 | + | ||
1652 | + return VA_STATUS_SUCCESS; | ||
1653 | +} | ||
1654 | + | ||
1655 | +static VAStatus | ||
1656 | +vaEndRenderSurfaceGLX_impl_libva(VADriverContextP ctx, void *gl_surface) | ||
1657 | +{ | ||
1658 | + VADriverContextGLXP pDriverContextGLX = VA_DRIVER_CONTEXT_GLX(ctx); | ||
1659 | + VASurfaceGLXP pSurfaceGLX = gl_surface; | ||
1660 | + VAStatus status; | ||
1661 | + | ||
1662 | + if (!pDriverContextGLX->use_tfp) | ||
1663 | + return VA_STATUS_ERROR_UNIMPLEMENTED; | ||
1664 | + | ||
1665 | + if (unbind_pixmap(ctx, pSurfaceGLX) < 0) | ||
1666 | + return VA_STATUS_ERROR_OPERATION_FAILED; | ||
1667 | + | ||
1668 | + return VA_STATUS_SUCCESS; | ||
1669 | +} | ||
1670 | + | ||
1671 | +static VAStatus | ||
1672 | +vaCopySurfaceGLX_impl_libva( | ||
1673 | + VADriverContextP ctx, | ||
1674 | + void *gl_surface, | ||
1675 | + VASurfaceID surface, | ||
1676 | + unsigned int flags | ||
1677 | +) | ||
1678 | +{ | ||
1679 | + VADriverContextGLXP pDriverContextGLX = VA_DRIVER_CONTEXT_GLX(ctx); | ||
1680 | + VADriverVTableGLXP vtable = &pDriverContextGLX->vtable; | ||
1681 | + VASurfaceGLXP pSurfaceGLX = gl_surface; | ||
1682 | + VAStatus status; | ||
1683 | + | ||
1684 | + if (!pDriverContextGLX->use_fbo) | ||
1685 | + return VA_STATUS_ERROR_UNIMPLEMENTED; | ||
1686 | + | ||
1687 | + /* XXX: only support VA_FRAME_PICTURE */ | ||
1688 | + if (flags != VA_FRAME_PICTURE) | ||
1689 | + return VA_STATUS_ERROR_FLAG_NOT_SUPPORTED; | ||
1690 | + | ||
1691 | + /* Associate VA surface */ | ||
1692 | + status = vtable->vaAssociateSurfaceGLX(ctx, gl_surface, surface, flags); | ||
1693 | + if (status != VA_STATUS_SUCCESS) | ||
1694 | + return status; | ||
1695 | + | ||
1696 | + /* Make sure binding succeeds, if texture was not already bound */ | ||
1697 | + struct OpenGLTextureState ts; | ||
1698 | + if (bind_texture(&ts, pSurfaceGLX->target, pSurfaceGLX->texture) < 0) | ||
1699 | + return VA_STATUS_ERROR_OPERATION_FAILED; | ||
1700 | + | ||
1701 | + /* Render to FBO */ | ||
1702 | + fbo_enter(ctx, pSurfaceGLX); | ||
1703 | + status = vtable->vaBeginRenderSurfaceGLX(ctx, gl_surface); | ||
1704 | + if (status == VA_STATUS_SUCCESS) { | ||
1705 | + render_pixmap(ctx, pSurfaceGLX); | ||
1706 | + status = vtable->vaEndRenderSurfaceGLX(ctx, gl_surface); | ||
1707 | + } | ||
1708 | + fbo_leave(ctx); | ||
1709 | + unbind_texture(&ts); | ||
1710 | + if (status != VA_STATUS_SUCCESS) | ||
1711 | + return status; | ||
1712 | + | ||
1713 | + return vtable->vaDeassociateSurfaceGLX(ctx, gl_surface); | ||
1714 | +} | ||
1715 | + | ||
1716 | + | ||
1717 | +/* ========================================================================= */ | ||
1718 | +/* === VA/GLX bind functions implementation with vaCopySurfaceGLX() === */ | ||
1719 | +/* ========================================================================= */ | ||
1720 | + | ||
1721 | +static VAStatus | ||
1722 | +vaAssociateSurfaceGLX_impl_bind( | ||
1723 | + VADriverContextP ctx, | ||
1724 | + void *gl_surface, | ||
1725 | + VASurfaceID surface, | ||
1726 | + unsigned int flags | ||
1727 | +) | ||
1728 | +{ | ||
1729 | + VADriverContextGLXP pDriverContextGLX = VA_DRIVER_CONTEXT_GLX(ctx); | ||
1730 | + VADriverVTableGLXP vtable = &pDriverContextGLX->vtable; | ||
1731 | + VASurfaceGLXP pSurfaceGLX = gl_surface; | ||
1732 | + VAStatus status; | ||
1733 | + | ||
1734 | + if (!pDriverContextGLX->has_copy) | ||
1735 | + return VA_STATUS_ERROR_UNIMPLEMENTED; | ||
1736 | + | ||
1737 | + status = vtable->vaCopySurfaceGLX(ctx, gl_surface, surface, flags); | ||
1738 | + if (status != VA_STATUS_SUCCESS) | ||
1739 | + return status; | ||
1740 | + | ||
1741 | + pSurfaceGLX->surface = surface; | ||
1742 | + return VA_STATUS_SUCCESS; | ||
1743 | +} | ||
1744 | + | ||
1745 | +static VAStatus | ||
1746 | +vaDeassociateSurfaceGLX_impl_bind(VADriverContextP ctx, void *gl_surface) | ||
1747 | +{ | ||
1748 | + VADriverContextGLXP pDriverContextGLX = VA_DRIVER_CONTEXT_GLX(ctx); | ||
1749 | + VASurfaceGLXP pSurfaceGLX = gl_surface; | ||
1750 | + | ||
1751 | + if (!pDriverContextGLX->has_copy) | ||
1752 | + return VA_STATUS_ERROR_UNIMPLEMENTED; | ||
1753 | + | ||
1754 | + pSurfaceGLX->surface = VA_INVALID_SURFACE; | ||
1755 | + return VA_STATUS_SUCCESS; | ||
1756 | +} | ||
1757 | + | ||
1758 | +static VAStatus | ||
1759 | +vaBeginRenderSurfaceGLX_impl_bind(VADriverContextP ctx, void *gl_surface) | ||
1760 | +{ | ||
1761 | + /* Surface is already copied into the texture, in vaAssociateSurfaceGLX() */ | ||
1762 | + return VA_STATUS_SUCCESS; | ||
1763 | +} | ||
1764 | + | ||
1765 | +static VAStatus | ||
1766 | +vaEndRenderSurfaceGLX_impl_bind(VADriverContextP ctx, void *gl_surface) | ||
1767 | +{ | ||
1768 | + return VA_STATUS_SUCCESS; | ||
1769 | +} | ||
1770 | + | ||
1771 | + | ||
1772 | +/* ========================================================================= */ | ||
1773 | +/* === Private VA/GLX vtable initialization === */ | ||
1774 | +/* ========================================================================= */ | ||
1775 | + | ||
1776 | +// Initialize GLX driver context | ||
1777 | +VAStatus va_glx_init_context(VADriverContextP ctx) | ||
1778 | +{ | ||
1779 | + VADriverContextGLXP glx_ctx = VA_DRIVER_CONTEXT_GLX(ctx); | ||
1780 | + VADriverVTableGLXP vtable = &glx_ctx->vtable; | ||
1781 | + int needs_tfp = 0, needs_fbo = 0; | ||
1782 | + | ||
1783 | + if (glx_ctx->is_initialized) | ||
1784 | + return VA_STATUS_SUCCESS; | ||
1785 | + | ||
1786 | + glx_ctx->has_copy = ctx->vtable.glx.vaCopySurfaceGLX != NULL; | ||
1787 | + glx_ctx->has_bind = (ctx->vtable.glx.vaAssociateSurfaceGLX != NULL && | ||
1788 | + ctx->vtable.glx.vaBeginRenderSurfaceGLX != NULL && | ||
1789 | + ctx->vtable.glx.vaEndRenderSurfaceGLX != NULL && | ||
1790 | + ctx->vtable.glx.vaDeassociateSurfaceGLX != NULL); | ||
1791 | + | ||
1792 | + switch ((((unsigned int)glx_ctx->has_bind) << 1) | glx_ctx->has_copy) { | ||
1793 | + case 0: | ||
1794 | + /* Full implementation in libVA */ | ||
1795 | + needs_tfp = 1; | ||
1796 | + needs_fbo = 1; | ||
1797 | + vtable->vaCreateSurfaceGLX = vaCreateSurfaceGLX_impl_libva; | ||
1798 | + vtable->vaDestroySurfaceGLX = vaDestroySurfaceGLX_impl_libva; | ||
1799 | + vtable->vaAssociateSurfaceGLX = vaAssociateSurfaceGLX_impl_libva; | ||
1800 | + vtable->vaDeassociateSurfaceGLX = vaDeassociateSurfaceGLX_impl_libva; | ||
1801 | + vtable->vaBeginRenderSurfaceGLX = vaBeginRenderSurfaceGLX_impl_libva; | ||
1802 | + vtable->vaEndRenderSurfaceGLX = vaEndRenderSurfaceGLX_impl_libva; | ||
1803 | + vtable->vaSyncSurfaceGLX = vaSyncSurfaceGLX_impl_libva; | ||
1804 | + vtable->vaCopySurfaceGLX = vaCopySurfaceGLX_impl_libva; | ||
1805 | + break; | ||
1806 | + case 1: | ||
1807 | + /* Add bind functions based on vaCopySurfaceGLX() */ | ||
1808 | + /* XXX: override vaSyncSurfaceGLX()? */ | ||
1809 | + vtable->vaCreateSurfaceGLX = vaCreateSurfaceGLX_impl_driver; | ||
1810 | + vtable->vaDestroySurfaceGLX = vaDestroySurfaceGLX_impl_driver; | ||
1811 | + vtable->vaAssociateSurfaceGLX = vaAssociateSurfaceGLX_impl_bind; | ||
1812 | + vtable->vaDeassociateSurfaceGLX = vaDeassociateSurfaceGLX_impl_bind; | ||
1813 | + vtable->vaBeginRenderSurfaceGLX = vaBeginRenderSurfaceGLX_impl_bind; | ||
1814 | + vtable->vaEndRenderSurfaceGLX = vaEndRenderSurfaceGLX_impl_bind; | ||
1815 | + vtable->vaSyncSurfaceGLX = vaSyncSurfaceGLX_impl_driver; | ||
1816 | + vtable->vaCopySurfaceGLX = vaCopySurfaceGLX_impl_driver; | ||
1817 | + break; | ||
1818 | + case 2: | ||
1819 | + /* Add copy function based on vaBeginRenderSurfaceGLX() et al. */ | ||
1820 | + needs_fbo = 1; | ||
1821 | + vtable->vaCreateSurfaceGLX = vaCreateSurfaceGLX_impl_driver; | ||
1822 | + vtable->vaDestroySurfaceGLX = vaDestroySurfaceGLX_impl_driver; | ||
1823 | + vtable->vaAssociateSurfaceGLX = vaAssociateSurfaceGLX_impl_driver; | ||
1824 | + vtable->vaDeassociateSurfaceGLX = vaDeassociateSurfaceGLX_impl_driver; | ||
1825 | + vtable->vaBeginRenderSurfaceGLX = vaBeginRenderSurfaceGLX_impl_driver; | ||
1826 | + vtable->vaEndRenderSurfaceGLX = vaEndRenderSurfaceGLX_impl_driver; | ||
1827 | + vtable->vaSyncSurfaceGLX = vaSyncSurfaceGLX_impl_driver; | ||
1828 | + vtable->vaCopySurfaceGLX = vaCopySurfaceGLX_impl_libva; | ||
1829 | + break; | ||
1830 | + case 3: | ||
1831 | + /* Keep driver bind & copy functions */ | ||
1832 | + vtable->vaCreateSurfaceGLX = vaCreateSurfaceGLX_impl_driver; | ||
1833 | + vtable->vaDestroySurfaceGLX = vaDestroySurfaceGLX_impl_driver; | ||
1834 | + vtable->vaAssociateSurfaceGLX = vaAssociateSurfaceGLX_impl_driver; | ||
1835 | + vtable->vaDeassociateSurfaceGLX = vaDeassociateSurfaceGLX_impl_driver; | ||
1836 | + vtable->vaBeginRenderSurfaceGLX = vaBeginRenderSurfaceGLX_impl_driver; | ||
1837 | + vtable->vaEndRenderSurfaceGLX = vaEndRenderSurfaceGLX_impl_driver; | ||
1838 | + vtable->vaSyncSurfaceGLX = vaSyncSurfaceGLX_impl_driver; | ||
1839 | + vtable->vaCopySurfaceGLX = vaCopySurfaceGLX_impl_driver; | ||
1840 | + break; | ||
1841 | + default: | ||
1842 | + /* Fatal error: this cannot happen */ | ||
1843 | + assert(0); | ||
1844 | + return VA_STATUS_ERROR_UNKNOWN; | ||
1845 | + } | ||
1846 | + | ||
1847 | + glx_ctx->has_tfp = 0; | ||
1848 | + glx_ctx->use_tfp = 0; | ||
1849 | + glx_ctx->has_fbo = 0; | ||
1850 | + glx_ctx->use_fbo = 0; | ||
1851 | + | ||
1852 | + if (needs_tfp) { | ||
1853 | + glx_ctx->has_tfp = check_tfp_extensions(ctx); | ||
1854 | + if (!glx_ctx->has_tfp || !load_tfp_extensions(ctx)) | ||
1855 | + return VA_STATUS_ERROR_UNIMPLEMENTED; | ||
1856 | + glx_ctx->use_tfp = 1; | ||
1857 | + } | ||
1858 | + | ||
1859 | + if (needs_fbo) { | ||
1860 | + glx_ctx->has_fbo = check_fbo_extensions(ctx); | ||
1861 | + if (!glx_ctx->has_fbo || !load_fbo_extensions(ctx)) | ||
1862 | + return VA_STATUS_ERROR_UNIMPLEMENTED; | ||
1863 | + glx_ctx->use_fbo = 1; | ||
1864 | + } | ||
1865 | + | ||
1866 | + glx_ctx->is_initialized = 1; | ||
1867 | + return VA_STATUS_SUCCESS; | ||
1868 | +} | ||
1869 | diff --git a/src/glx/va_glx_impl.h b/src/glx/va_glx_impl.h | ||
1870 | new file mode 100644 | ||
1871 | index 0000000..977bfcc | ||
1872 | --- /dev/null | ||
1873 | +++ b/src/glx/va_glx_impl.h | ||
1874 | @@ -0,0 +1,46 @@ | ||
1875 | +/* | ||
1876 | + * Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved. | ||
1877 | + * | ||
1878 | + * Permission is hereby granted, free of charge, to any person obtaining a | ||
1879 | + * copy of this software and associated documentation files (the | ||
1880 | + * "Software"), to deal in the Software without restriction, including | ||
1881 | + * without limitation the rights to use, copy, modify, merge, publish, | ||
1882 | + * distribute, sub license, and/or sell copies of the Software, and to | ||
1883 | + * permit persons to whom the Software is furnished to do so, subject to | ||
1884 | + * the following conditions: | ||
1885 | + * | ||
1886 | + * The above copyright notice and this permission notice (including the | ||
1887 | + * next paragraph) shall be included in all copies or substantial portions | ||
1888 | + * of the Software. | ||
1889 | + * | ||
1890 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
1891 | + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
1892 | + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. | ||
1893 | + * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR | ||
1894 | + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
1895 | + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
1896 | + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
1897 | + */ | ||
1898 | + | ||
1899 | +#ifndef VA_GLX_IMPL_H | ||
1900 | +#define VA_GLX_IMPL_H | ||
1901 | + | ||
1902 | +/** | ||
1903 | + * Initialize GLX driver context | ||
1904 | + * | ||
1905 | + * @param[in] ctx the VA driver context | ||
1906 | + * @return VA_STATUS_SUCCESS if successful | ||
1907 | + */ | ||
1908 | +VAStatus va_glx_init_context(VADriverContextP ctx) | ||
1909 | + ATTRIBUTE_HIDDEN; | ||
1910 | + | ||
1911 | +/** Create VA/GLX surface */ | ||
1912 | +VASurfaceGLXP | ||
1913 | +va_glx_create_surface(VADriverContextP ctx, GLenum target, GLuint texture) | ||
1914 | + ATTRIBUTE_HIDDEN; | ||
1915 | + | ||
1916 | +/** Destroy VA/GLX surface */ | ||
1917 | +void va_glx_destroy_surface(VADriverContextP ctx, VASurfaceGLXP *pSurfaceGLX) | ||
1918 | + ATTRIBUTE_HIDDEN; | ||
1919 | + | ||
1920 | +#endif /* VA_GLX_IMPL_H */ | ||
1921 | diff --git a/src/glx/va_glx_private.h b/src/glx/va_glx_private.h | ||
1922 | new file mode 100644 | ||
1923 | index 0000000..8658ad3 | ||
1924 | --- /dev/null | ||
1925 | +++ b/src/glx/va_glx_private.h | ||
1926 | @@ -0,0 +1,98 @@ | ||
1927 | +/* | ||
1928 | + * Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved. | ||
1929 | + * | ||
1930 | + * Permission is hereby granted, free of charge, to any person obtaining a | ||
1931 | + * copy of this software and associated documentation files (the | ||
1932 | + * "Software"), to deal in the Software without restriction, including | ||
1933 | + * without limitation the rights to use, copy, modify, merge, publish, | ||
1934 | + * distribute, sub license, and/or sell copies of the Software, and to | ||
1935 | + * permit persons to whom the Software is furnished to do so, subject to | ||
1936 | + * the following conditions: | ||
1937 | + * | ||
1938 | + * The above copyright notice and this permission notice (including the | ||
1939 | + * next paragraph) shall be included in all copies or substantial portions | ||
1940 | + * of the Software. | ||
1941 | + * | ||
1942 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
1943 | + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
1944 | + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. | ||
1945 | + * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR | ||
1946 | + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
1947 | + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
1948 | + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
1949 | + */ | ||
1950 | + | ||
1951 | +#ifndef VA_GLX_PRIVATE_H | ||
1952 | +#define VA_GLX_PRIVATE_H | ||
1953 | + | ||
1954 | +#include "config.h" | ||
1955 | +#include "va.h" | ||
1956 | +#include "va_backend.h" | ||
1957 | +#include "va_x11.h" | ||
1958 | +#include "va_glx.h" | ||
1959 | + | ||
1960 | +#if GLX_GLXEXT_VERSION < 18 | ||
1961 | +typedef void (*PFNGLXBINDTEXIMAGEEXTPROC)(Display *, GLXDrawable, int, const int *); | ||
1962 | +typedef void (*PFNGLXRELEASETEXIMAGEEXTPROC)(Display *, GLXDrawable, int); | ||
1963 | +#endif | ||
1964 | + | ||
1965 | +typedef struct VAOpenGLVTable *VAOpenGLVTableP; | ||
1966 | + | ||
1967 | +struct VAOpenGLVTable { | ||
1968 | + PFNGLXBINDTEXIMAGEEXTPROC glx_bind_tex_image; | ||
1969 | + PFNGLXRELEASETEXIMAGEEXTPROC glx_release_tex_image; | ||
1970 | + PFNGLGENFRAMEBUFFERSEXTPROC gl_gen_framebuffers; | ||
1971 | + PFNGLDELETEFRAMEBUFFERSEXTPROC gl_delete_framebuffers; | ||
1972 | + PFNGLBINDFRAMEBUFFEREXTPROC gl_bind_framebuffer; | ||
1973 | + PFNGLGENRENDERBUFFERSEXTPROC gl_gen_renderbuffers; | ||
1974 | + PFNGLDELETERENDERBUFFERSEXTPROC gl_delete_renderbuffers; | ||
1975 | + PFNGLBINDRENDERBUFFEREXTPROC gl_bind_renderbuffer; | ||
1976 | + PFNGLRENDERBUFFERSTORAGEEXTPROC gl_renderbuffer_storage; | ||
1977 | + PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC gl_framebuffer_renderbuffer; | ||
1978 | + PFNGLFRAMEBUFFERTEXTURE2DEXTPROC gl_framebuffer_texture_2d; | ||
1979 | + PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC gl_check_framebuffer_status; | ||
1980 | +}; | ||
1981 | + | ||
1982 | +typedef struct VADisplayContextGLX *VADisplayContextGLXP; | ||
1983 | +typedef struct VADriverContextGLX *VADriverContextGLXP; | ||
1984 | +typedef struct VASurfaceGLX *VASurfaceGLXP; | ||
1985 | +typedef struct VADriverVTableGLX *VADriverVTableGLXP; | ||
1986 | + | ||
1987 | +struct VADisplayContextGLX { | ||
1988 | + void (*vaDestroy)(VADisplayContextP ctx); | ||
1989 | +}; | ||
1990 | + | ||
1991 | +#define VA_DRIVER_CONTEXT_GLX(ctx) ((VADriverContextGLXP)((ctx)->glx)) | ||
1992 | + | ||
1993 | +struct VADriverContextGLX { | ||
1994 | + struct VADriverVTableGLX vtable; | ||
1995 | + struct VAOpenGLVTable gl_vtable; | ||
1996 | + unsigned int is_initialized : 1; | ||
1997 | + unsigned int has_copy : 1; | ||
1998 | + unsigned int has_bind : 1; | ||
1999 | + unsigned int has_tfp : 1; | ||
2000 | + unsigned int has_fbo : 1; | ||
2001 | + unsigned int use_tfp : 1; | ||
2002 | + unsigned int use_fbo : 1; | ||
2003 | +}; | ||
2004 | + | ||
2005 | +/** Unique VASurfaceGLX identifier */ | ||
2006 | +#define VA_SURFACE_GLX_MAGIC VA_FOURCC('V','A','G','L') | ||
2007 | + | ||
2008 | +struct VASurfaceGLX { | ||
2009 | + uint32_t magic; ///< Magic number identifying a VASurfaceGLX | ||
2010 | + GLenum target; ///< GL target to which the texture is bound | ||
2011 | + GLuint texture; ///< GL texture | ||
2012 | + VASurfaceID surface; ///< Associated VA surface | ||
2013 | + unsigned int width; | ||
2014 | + unsigned int height; | ||
2015 | + int is_bound; | ||
2016 | + Pixmap pixmap; | ||
2017 | + GLXPixmap glx_pixmap; | ||
2018 | + GLuint fbo; | ||
2019 | + GLuint fbo_buffer; | ||
2020 | + GLuint fbo_texture; | ||
2021 | + void *priv; ///< Private VA/GLX surface data from driver | ||
2022 | +}; | ||
2023 | + | ||
2024 | +#endif /* VA_GLX_PRIVATE_H */ | ||
diff --git a/meta-emenlow/recipes-graphics/libva/libva-0.31.0/390_compat.base.patch b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/390_compat.base.patch new file mode 100644 index 0000000000..f2e0d61b0d --- /dev/null +++ b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/390_compat.base.patch | |||
@@ -0,0 +1,135 @@ | |||
1 | commit 483bc9e67afa9bcd8f99f08a74a78e7dfad4651f | ||
2 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
3 | Date: Thu Jul 2 09:24:04 2009 +0000 | ||
4 | |||
5 | Fix make dist (va_compat_template.h). | ||
6 | |||
7 | commit 0e0da9ea861f14e8129767dbf6f11be5c051d85f | ||
8 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
9 | Date: Wed Jun 24 11:40:56 2009 +0000 | ||
10 | |||
11 | Add compatibility layer with original libva 0.29. | ||
12 | |||
13 | --- a/src/Makefile.am | ||
14 | +++ b/src/Makefile.am | ||
15 | @@ -44,7 +44,7 @@ libva_x11_la_DEPENDENCIES = $(libvacorelib) | ||
16 | libva_x11_la_DEPENDENCIES = $(libvacorelib) | ||
17 | |||
18 | |||
19 | -libva_la_SOURCES = va.c | ||
20 | +libva_la_SOURCES = va.c va_compat.c | ||
21 | |||
22 | libvaincludedir = ${includedir}/va | ||
23 | libvainclude_HEADERS = va.h va_backend.h va_version.h | ||
24 | @@ -53,4 +53,8 @@ DISTCLEANFILES = \ | ||
25 | va_version.h | ||
26 | |||
27 | EXTRA_DIST = \ | ||
28 | - va_version.h.in | ||
29 | + va_version.h.in \ | ||
30 | + va_compat.h \ | ||
31 | + va_compat_template.h | ||
32 | + | ||
33 | +va_compat.c: va_compat_template.h | ||
34 | --- a/src/va.c | ||
35 | +++ b/src/va.c | ||
36 | @@ -25,6 +25,7 @@ | ||
37 | #define _GNU_SOURCE 1 | ||
38 | #include "va.h" | ||
39 | #include "va_backend.h" | ||
40 | +#include "va_compat.h" | ||
41 | |||
42 | #include <assert.h> | ||
43 | #include <stdarg.h> | ||
44 | @@ -41,6 +42,8 @@ | ||
45 | |||
46 | #define DRIVER_INIT_FUNC "__vaDriverInit_0_31" | ||
47 | #define DRIVER_INIT_FUNC_SDS "__vaDriverInit_0_31_sds" | ||
48 | +#define DRIVER_INIT_FUNC_0_29 "__vaDriverInit_0_29" | ||
49 | +#define DRIVER_INIT_FUNC_0_30 "__vaDriverInit_0_30" | ||
50 | |||
51 | #define DRIVER_EXTENSION "_drv_video.so" | ||
52 | |||
53 | @@ -168,11 +171,22 @@ static VAStatus va_openDriver(VADisplay dpy, char *driver_name) | ||
54 | else | ||
55 | { | ||
56 | VADriverInit init_func; | ||
57 | - init_func = (VADriverInit) dlsym(handle, DRIVER_INIT_FUNC); | ||
58 | + int compat_version = 0; | ||
59 | + /* First, try SDS extensions (VDPAU and XvBA backends) */ | ||
60 | + init_func = (VADriverInit) dlsym(handle, DRIVER_INIT_FUNC_SDS); | ||
61 | if (!init_func) | ||
62 | { | ||
63 | - /* Then try SDS extensions (VDPAU and XvBA backends) */ | ||
64 | - init_func = (VADriverInit) dlsym(handle, DRIVER_INIT_FUNC_SDS); | ||
65 | + /* Otherwise, we need the compatibility layer for some buffers */ | ||
66 | + init_func = (VADriverInit) dlsym(handle, DRIVER_INIT_FUNC); | ||
67 | + compat_version = VA_MINOR_VERSION; | ||
68 | + if (!init_func) { | ||
69 | + init_func = (VADriverInit) dlsym(handle, DRIVER_INIT_FUNC_0_29); | ||
70 | + compat_version = 29; | ||
71 | + } | ||
72 | + if (!init_func) { | ||
73 | + init_func = (VADriverInit) dlsym(handle, DRIVER_INIT_FUNC_0_30); | ||
74 | + compat_version = 30; | ||
75 | + } | ||
76 | } | ||
77 | if (!init_func) | ||
78 | { | ||
79 | @@ -181,7 +195,36 @@ static VAStatus va_openDriver(VADisplay dpy, char *driver_name) | ||
80 | } | ||
81 | else | ||
82 | { | ||
83 | - vaStatus = (*init_func)(ctx); | ||
84 | + struct VADriverContext_0_29 ctx_0_29; | ||
85 | + struct VADriverContext_0_30 ctx_0_30; | ||
86 | + void *compat_ctx = NULL; | ||
87 | + | ||
88 | + switch (compat_version) { | ||
89 | + case 29: | ||
90 | + compat_ctx = &ctx_0_29; | ||
91 | + ctx_0_29.pDriverData = NULL; | ||
92 | + ctx_0_29.x11_dpy = ctx->x11_dpy; | ||
93 | + ctx_0_29.x11_screen = ctx->x11_screen; | ||
94 | + break; | ||
95 | + case 30: | ||
96 | + compat_ctx = &ctx_0_30; | ||
97 | + ctx_0_30.pDriverData = NULL; | ||
98 | + ctx_0_30.x11_dpy = ctx->x11_dpy; | ||
99 | + ctx_0_30.x11_screen = ctx->x11_screen; | ||
100 | + break; | ||
101 | + case VA_MINOR_VERSION: | ||
102 | + compat_ctx = ctx; | ||
103 | + break; | ||
104 | + default: | ||
105 | + ASSERT(compat_version == 0); | ||
106 | + vaStatus = VA_STATUS_ERROR_UNKNOWN; | ||
107 | + break; | ||
108 | + } | ||
109 | + | ||
110 | + vaStatus = (*init_func)(compat_ctx ? compat_ctx : ctx); | ||
111 | + | ||
112 | + if (VA_STATUS_SUCCESS == vaStatus) | ||
113 | + vaStatus = va_compat_init(dpy, compat_version, compat_ctx); | ||
114 | |||
115 | if (VA_STATUS_SUCCESS == vaStatus) | ||
116 | { | ||
117 | @@ -377,6 +422,8 @@ VAStatus vaTerminate ( | ||
118 | old_ctx->handle = NULL; | ||
119 | } | ||
120 | |||
121 | + va_compat_fini(dpy); | ||
122 | + | ||
123 | if (VA_STATUS_SUCCESS == vaStatus) | ||
124 | pDisplayContext->vaDestroy(pDisplayContext); | ||
125 | return vaStatus; | ||
126 | --- a/src/va_backend.h | ||
127 | +++ b/src/va_backend.h | ||
128 | @@ -426,6 +426,7 @@ struct VADriverContext | ||
129 | |||
130 | void *dri_state; | ||
131 | void *glx; /* opaque for GLX code */ | ||
132 | + void *compat; /* opaque for compat code */ | ||
133 | }; | ||
134 | |||
135 | struct VADisplayContext | ||
diff --git a/meta-emenlow/recipes-graphics/libva/libva-0.31.0/391_compat.patch b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/391_compat.patch new file mode 100644 index 0000000000..5e09d22b82 --- /dev/null +++ b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/391_compat.patch | |||
@@ -0,0 +1,3273 @@ | |||
1 | commit 2e7aa803a8547dfcde6e97ae2bb4a8bbdbb2634e | ||
2 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
3 | Date: Mon Nov 23 12:22:09 2009 +0000 | ||
4 | |||
5 | Update compat code for VDPAU/MPEG-4 additions. | ||
6 | |||
7 | commit 30808b39d82cbf0c185052a2d2d5ed8a5fc065d1 | ||
8 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
9 | Date: Thu Sep 10 14:01:57 2009 +0000 | ||
10 | |||
11 | Update compatibility glue for VASliceParameterBufferMPEG2.slice_horizontal_position addition. | ||
12 | |||
13 | commit 27faf49366602637da223f3dc5f30ce4d6d72070 | ||
14 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
15 | Date: Wed Sep 2 15:06:20 2009 +0000 | ||
16 | |||
17 | Fix vaSyncSurface() compat code for VA API < 0.31 drivers. | ||
18 | |||
19 | commit dc33a3e28b38b7d579ab768899963cf9b0d38677 | ||
20 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
21 | Date: Wed Sep 2 12:28:43 2009 +0000 | ||
22 | |||
23 | Fix check for 0.30 modules. | ||
24 | |||
25 | commit bd913971bd9e7460b454513b006e16c18136625e | ||
26 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
27 | Date: Wed Sep 2 11:58:08 2009 +0000 | ||
28 | |||
29 | Update for VA API 0.31. | ||
30 | |||
31 | commit 9cc7f89d3cc0238ab5b3a47c316e261e06a16634 | ||
32 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
33 | Date: Thu Jul 2 15:55:48 2009 +0000 | ||
34 | |||
35 | Fix VAEncSliceParameterBuffer thunk. | ||
36 | |||
37 | commit 483bc9e67afa9bcd8f99f08a74a78e7dfad4651f | ||
38 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
39 | Date: Thu Jul 2 09:24:04 2009 +0000 | ||
40 | |||
41 | Fix make dist (va_compat_template.h). | ||
42 | |||
43 | commit 7f41b22366142c4e476fbae929ad343dc33af3a4 | ||
44 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
45 | Date: Thu Jun 25 14:05:57 2009 +0000 | ||
46 | |||
47 | Drop superfluous semi-colon. | ||
48 | |||
49 | commit dcc75aae23fc8f653179b6a331f4021acd6775fd | ||
50 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
51 | Date: Thu Jun 25 13:53:26 2009 +0000 | ||
52 | |||
53 | Fix check for 0.30 modules. | ||
54 | |||
55 | commit b34512e74ac4150a3f8ee4abe4fa5b17907f8869 | ||
56 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
57 | Date: Thu Jun 25 13:17:48 2009 +0000 | ||
58 | |||
59 | Fix vaTerminate() thunk. | ||
60 | |||
61 | commit 3b006d1ac66429f6b8ffff00ce60e1e47a32c02c | ||
62 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
63 | Date: Thu Jun 25 12:48:22 2009 +0000 | ||
64 | |||
65 | Cosmetics. | ||
66 | |||
67 | commit 452295d5ac34643f8a316491888c3900f12c5bff | ||
68 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
69 | Date: Thu Jun 25 12:18:48 2009 +0000 | ||
70 | |||
71 | Fix compatibility with 0.29 modules. | ||
72 | |||
73 | commit 0e0da9ea861f14e8129767dbf6f11be5c051d85f | ||
74 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
75 | Date: Wed Jun 24 11:40:56 2009 +0000 | ||
76 | |||
77 | Add compatibility layer with original libva 0.29. | ||
78 | |||
79 | diff --git a/src/va_compat.c b/src/va_compat.c | ||
80 | new file mode 100644 | ||
81 | index 0000000..0bd7385 | ||
82 | --- /dev/null | ||
83 | +++ b/src/va_compat.c | ||
84 | @@ -0,0 +1,1171 @@ | ||
85 | +/* | ||
86 | + * Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved. | ||
87 | + * | ||
88 | + * Permission is hereby granted, free of charge, to any person obtaining a | ||
89 | + * copy of this software and associated documentation files (the | ||
90 | + * "Software"), to deal in the Software without restriction, including | ||
91 | + * without limitation the rights to use, copy, modify, merge, publish, | ||
92 | + * distribute, sub license, and/or sell copies of the Software, and to | ||
93 | + * permit persons to whom the Software is furnished to do so, subject to | ||
94 | + * the following conditions: | ||
95 | + * | ||
96 | + * The above copyright notice and this permission notice (including the | ||
97 | + * next paragraph) shall be included in all copies or substantial portions | ||
98 | + * of the Software. | ||
99 | + * | ||
100 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
101 | + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
102 | + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. | ||
103 | + * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR | ||
104 | + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
105 | + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
106 | + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
107 | + */ | ||
108 | + | ||
109 | +#include "config.h" | ||
110 | +#include "va.h" | ||
111 | +#include "va_compat.h" | ||
112 | +#include "va_backend.h" | ||
113 | +#include <string.h> | ||
114 | +#include <alloca.h> | ||
115 | +#include <assert.h> | ||
116 | + | ||
117 | +#define CTX(dpy) (((VADisplayContextP)dpy)->pDriverContext) | ||
118 | +#define COMPAT_CTX(ctx) ((VACompatContextP)(ctx)->compat) | ||
119 | +#define ASSERT assert | ||
120 | + | ||
121 | +/* Invoke the normal VA API entry-point. This one can be replaced with | ||
122 | + one of the va_compat_*() functions */ | ||
123 | +#define VA_INVOKE(FUNC, CTX, ...) \ | ||
124 | + (CTX)->vtable.FUNC(CTX, __VA_ARGS__) | ||
125 | + | ||
126 | +/* Invoke the real VA API entry-point. That is, the driver's function */ | ||
127 | +#define VA_INVOKE_COMPAT_ARGS(CTX, ...) \ | ||
128 | + (COMPAT_CTX(CTX)->compat_ctx, __VA_ARGS__) | ||
129 | +#define VA_INVOKE_COMPAT(FUNC, CTX, ...) \ | ||
130 | + COMPAT_CTX(CTX)->vtable.FUNC VA_INVOKE_COMPAT_ARGS(CTX, __VA_ARGS__) | ||
131 | + | ||
132 | +typedef struct VACompatContext *VACompatContextP; | ||
133 | + | ||
134 | +typedef VAStatus (*VABufferTranslateFunc)(VACompatContextP ctx, void *dest, const void *src); | ||
135 | + | ||
136 | +typedef enum { | ||
137 | + VA_DRIVER_ID_UNKNOWN, | ||
138 | + VA_DRIVER_ID_POULSBO, | ||
139 | + VA_DRIVER_ID_IEGD | ||
140 | +} VADriverID; | ||
141 | + | ||
142 | +typedef struct { | ||
143 | + VABufferID id; | ||
144 | + VABufferType type; | ||
145 | + unsigned int size; | ||
146 | + unsigned int num_elements; | ||
147 | + unsigned char *data; | ||
148 | + VABufferTranslateFunc translate; | ||
149 | + VABufferID compat_id; | ||
150 | + unsigned int compat_size; | ||
151 | + unsigned char *compat_data; | ||
152 | + unsigned int map_count; | ||
153 | +} VABufferCompat; | ||
154 | + | ||
155 | +typedef struct VAContextMap *VAContextMapP; | ||
156 | +typedef struct VAContextMap { | ||
157 | + VASurfaceID surface; | ||
158 | + VAContextID context; | ||
159 | + VAContextMapP next; | ||
160 | +} VAContextMap; | ||
161 | + | ||
162 | +typedef struct { | ||
163 | + VAStatus (*vaTerminate)(void *); | ||
164 | + VAStatus (*vaQueryConfigProfiles)(void *, VAProfile *, int *); | ||
165 | + VAStatus (*vaQueryConfigEntrypoints)(void *, VAProfile, VAEntrypoint *, int *); | ||
166 | + VAStatus (*vaGetConfigAttributes)(void *, VAProfile, VAEntrypoint, VAConfigAttrib *, int); | ||
167 | + VAStatus (*vaCreateConfig)(void *, VAProfile, VAEntrypoint, VAConfigAttrib *, int, VAConfigID *); | ||
168 | + VAStatus (*vaDestroyConfig)(void *, VAConfigID); | ||
169 | + VAStatus (*vaQueryConfigAttributes)(void *, VAConfigID, VAProfile *, VAEntrypoint *, VAConfigAttrib *, int *); | ||
170 | + VAStatus (*vaCreateSurfaces)(void *, int, int, int, int, VASurfaceID *); | ||
171 | + VAStatus (*vaDestroySurfaces)(void *, VASurfaceID *, int); | ||
172 | + VAStatus (*vaCreateContext)(void *, VAConfigID, int, int, int, VASurfaceID *, int, VAContextID *); | ||
173 | + VAStatus (*vaDestroyContext)(void *, VAContextID); | ||
174 | + VAStatus (*vaCreateBuffer)(void *, VAContextID, VABufferType, unsigned int, unsigned int, void *, VABufferID *); | ||
175 | + VAStatus (*vaBufferSetNumElements)(void *, VABufferID, unsigned int); | ||
176 | + VAStatus (*vaMapBuffer)(void *, VABufferID, void **); | ||
177 | + VAStatus (*vaUnmapBuffer)(void *, VABufferID); | ||
178 | + VAStatus (*vaDestroyBuffer)(void *, VABufferID); | ||
179 | + VAStatus (*vaBeginPicture)(void *, VAContextID, VASurfaceID); | ||
180 | + VAStatus (*vaRenderPicture)(void *, VAContextID, VABufferID *, int); | ||
181 | + VAStatus (*vaEndPicture)(void *, VAContextID); | ||
182 | + VAStatus (*vaSyncSurface_pre31)(void *, VAContextID, VASurfaceID); | ||
183 | + VAStatus (*vaQuerySurfaceStatus)(void *, VASurfaceID, VASurfaceStatus *); | ||
184 | + VAStatus (*vaPutSurface)(void *, VASurfaceID, unsigned long, short, short, unsigned short, unsigned short, short, short, unsigned short, unsigned short, VARectangle *, unsigned int, unsigned int); | ||
185 | + VAStatus (*vaQueryImageFormats)(void *, VAImageFormat *, int *); | ||
186 | + VAStatus (*vaCreateImage)(void *, VAImageFormat *, int, int, VAImage *); | ||
187 | + VAStatus (*vaDeriveImage)(void *, VASurfaceID, VAImage *); | ||
188 | + VAStatus (*vaDestroyImage)(void *, VAImageID); | ||
189 | + VAStatus (*vaSetImagePalette)(void *, VAImageID, unsigned char *); | ||
190 | + VAStatus (*vaGetImage)(void *, VASurfaceID, int, int, unsigned int, unsigned int, VAImageID); | ||
191 | + VAStatus (*vaPutImage_pre31)(void *, VASurfaceID, VAImageID, int, int, unsigned int, unsigned int, int, int); | ||
192 | + VAStatus (*vaPutImage2_pre31)(void *, VASurfaceID, VAImageID, int, int, unsigned int, unsigned int, int, int, unsigned int, unsigned int); | ||
193 | + VAStatus (*vaQuerySubpictureFormats)(void *, VAImageFormat *, unsigned int *, unsigned int *); | ||
194 | + VAStatus (*vaCreateSubpicture)(void *, VAImageID, VASubpictureID *); | ||
195 | + VAStatus (*vaDestroySubpicture)(void *, VASubpictureID); | ||
196 | + VAStatus (*vaSetSubpictureImage)(void *, VASubpictureID, VAImageID); | ||
197 | + VAStatus (*vaSetSubpictureChromakey)(void *, VASubpictureID, unsigned int, unsigned int, unsigned int); | ||
198 | + VAStatus (*vaSetSubpictureGlobalAlpha)(void *, VASubpictureID, float); | ||
199 | + VAStatus (*vaAssociateSubpicture_pre31)(void *, VASubpictureID, VASurfaceID *, int, short, short, short, short, unsigned short, unsigned short, unsigned int); | ||
200 | + VAStatus (*vaAssociateSubpicture2_pre31)(void *, VASubpictureID, VASurfaceID *, int, short, short, unsigned short, unsigned short, short, short, unsigned short, unsigned short, unsigned int); | ||
201 | + VAStatus (*vaDeassociateSubpicture)(void *, VASubpictureID, VASurfaceID *, int); | ||
202 | + VAStatus (*vaQueryDisplayAttributes)(void *, VADisplayAttribute *, int *); | ||
203 | + VAStatus (*vaGetDisplayAttributes)(void *, VADisplayAttribute *, int); | ||
204 | + VAStatus (*vaSetDisplayAttributes)(void *, VADisplayAttribute *, int); | ||
205 | + | ||
206 | + /* 0.29 hooks */ | ||
207 | + VAStatus (*vaSetSubpicturePalette)(void *, VASubpictureID, unsigned char *); | ||
208 | + VAStatus (*vaDbgCopySurfaceToBuffer)(void *, VASurfaceID, void **, unsigned int *); | ||
209 | + | ||
210 | + /* 0.30 hooks */ | ||
211 | + VAStatus (*vaCreateSurfaceFromCIFrame)(void *, unsigned long, VASurfaceID *); | ||
212 | + VAStatus (*vaCreateSurfaceFromV4L2Buf)(void *, int, struct v4l2_format *, struct v4l2_buffer *, VASurfaceID *); | ||
213 | + VAStatus (*vaCopySurfaceToBuffer)(void *, VASurfaceID, unsigned int *, unsigned int *, unsigned int *, unsigned int *, unsigned int *, unsigned int *, unsigned int *, void **); | ||
214 | + | ||
215 | + /* 0.31 hooks */ | ||
216 | + VAStatus (*vaPutImage)(void *, VASurfaceID, VAImageID, int, int, unsigned int, unsigned int, int, int, unsigned int, unsigned int); | ||
217 | + VAStatus (*vaAssociateSubpicture)(void *, VASubpictureID, VASurfaceID *, int, short, short, unsigned short, unsigned short, short, short, unsigned short, unsigned short, unsigned int); | ||
218 | + VAStatus (*vaSyncSurface)(void *, VASurfaceID); | ||
219 | +} VACompatDriverVTable; | ||
220 | + | ||
221 | +typedef struct VACompatContext { | ||
222 | + VABufferCompat *buffers; | ||
223 | + unsigned int buffers_count_max; | ||
224 | + unsigned int compat_version; | ||
225 | + void *compat_ctx; | ||
226 | + VACompatDriverVTable vtable; /* original vtable */ | ||
227 | + VADriverID driver_id; | ||
228 | + char *driver_name; | ||
229 | + VAContextMapP context_map; | ||
230 | + VAContextMapP last_context_map_match; | ||
231 | + unsigned int skip_frame : 1; | ||
232 | +} VACompatContext; | ||
233 | + | ||
234 | +#define COMPAT_MAJOR 0 | ||
235 | +#define COMPAT_MINOR 29 | ||
236 | +#include "va_compat_template.h" | ||
237 | + | ||
238 | +#define COMPAT_MAJOR 0 | ||
239 | +#define COMPAT_MINOR 30 | ||
240 | +#include "va_compat_template.h" | ||
241 | + | ||
242 | +#define COMPAT_MAJOR 0 | ||
243 | +#define COMPAT_MINOR 31 | ||
244 | +#include "va_compat_template.h" | ||
245 | + | ||
246 | +static inline int va_IsIntelBuffer(VADriverContextP ctx, VABufferID id) | ||
247 | +{ | ||
248 | + VACompatContextP compat = ctx->compat; | ||
249 | + | ||
250 | + if (compat->driver_id == VA_DRIVER_ID_POULSBO) { | ||
251 | + /* There were only Intel implementations for VA API. Besides, the | ||
252 | + returned buffer IDs had the following format [ 0 BASE ID ] where | ||
253 | + BASE is the 7-bit value 0x04 and ID an index into the heap of | ||
254 | + objects */ | ||
255 | + return (id & 0x7f000000) == 0x04000000; | ||
256 | + } | ||
257 | + | ||
258 | + if (compat->driver_id == VA_DRIVER_ID_IEGD) { | ||
259 | + /* XXX: there is no means to differentiate the buffers, they | ||
260 | + are linearly generated (IEGD 10.0 build 1335) */ | ||
261 | + return 1; | ||
262 | + } | ||
263 | + | ||
264 | + return 0; | ||
265 | +} | ||
266 | + | ||
267 | +static VAContextMapP va_context_map_lookup_p( | ||
268 | + VACompatContextP ctx, | ||
269 | + VASurfaceID surface | ||
270 | +) | ||
271 | +{ | ||
272 | + VAContextMapP m = ctx->context_map; | ||
273 | + | ||
274 | + while (m) { | ||
275 | + if (m->surface == surface) | ||
276 | + return m; | ||
277 | + m = m->next; | ||
278 | + } | ||
279 | + return NULL; | ||
280 | +} | ||
281 | + | ||
282 | +static VAContextID va_context_map_lookup( | ||
283 | + VACompatContextP ctx, | ||
284 | + VASurfaceID surface | ||
285 | +) | ||
286 | +{ | ||
287 | + VAContextMapP m; | ||
288 | + | ||
289 | + /* Lookup in cached */ | ||
290 | + m = ctx->last_context_map_match; | ||
291 | + if (m && m->surface == surface) | ||
292 | + return m->context; | ||
293 | + | ||
294 | + /* Full (slow) lookup */ | ||
295 | + m = va_context_map_lookup_p(ctx, surface); | ||
296 | + if (m) { | ||
297 | + ctx->last_context_map_match = m; | ||
298 | + return m->context; | ||
299 | + } | ||
300 | + return VA_INVALID_ID; | ||
301 | +} | ||
302 | + | ||
303 | +static void va_context_map_add( | ||
304 | + VACompatContextP ctx, | ||
305 | + VAContextID context, | ||
306 | + VASurfaceID surface | ||
307 | +) | ||
308 | +{ | ||
309 | + VAContextMapP m; | ||
310 | + | ||
311 | + /* Update existing entry */ | ||
312 | + m = va_context_map_lookup_p(ctx, surface); | ||
313 | + if (m) { | ||
314 | + m->context = context; | ||
315 | + return; | ||
316 | + } | ||
317 | + | ||
318 | + /* Create new mapping */ | ||
319 | + m = malloc(sizeof(*m)); | ||
320 | + ASSERT(m); | ||
321 | + if (m) { | ||
322 | + m->surface = surface; | ||
323 | + m->context = context; | ||
324 | + m->next = ctx->context_map; | ||
325 | + ctx->context_map = m; | ||
326 | + } | ||
327 | +} | ||
328 | + | ||
329 | +static void va_context_map_remove( | ||
330 | + VACompatContextP ctx, | ||
331 | + VAContextID context | ||
332 | +) | ||
333 | +{ | ||
334 | + VAContextMapP p = NULL; | ||
335 | + VAContextMapP m = ctx->context_map; | ||
336 | + VAContextMapP d; | ||
337 | + | ||
338 | + while (m) { | ||
339 | + if (m->context == context) { | ||
340 | + d = m; | ||
341 | + | ||
342 | + /* Unlink current node */ | ||
343 | + if (p) | ||
344 | + p->next = m->next; | ||
345 | + else | ||
346 | + ctx->context_map = m->next; | ||
347 | + m = m->next; | ||
348 | + | ||
349 | + /* Reset cache */ | ||
350 | + if (ctx->last_context_map_match == d) | ||
351 | + ctx->last_context_map_match = NULL; | ||
352 | + | ||
353 | + free(d); | ||
354 | + } | ||
355 | + else { | ||
356 | + p = m; | ||
357 | + m = m->next; | ||
358 | + } | ||
359 | + } | ||
360 | +} | ||
361 | + | ||
362 | +static VABufferCompat *va_GetBufferCompat ( | ||
363 | + VADriverContextP ctx, | ||
364 | + VABufferID id | ||
365 | +) | ||
366 | +{ | ||
367 | + VACompatContextP compat = ctx->compat; | ||
368 | + int index; | ||
369 | + | ||
370 | + if (!va_IsIntelBuffer(ctx, id)) | ||
371 | + return NULL; | ||
372 | + | ||
373 | + index = id & 0x00ffffff; | ||
374 | + if (index >= compat->buffers_count_max) | ||
375 | + return NULL; | ||
376 | + | ||
377 | + if (compat->buffers[index].id != id) | ||
378 | + return NULL; | ||
379 | + | ||
380 | + return &compat->buffers[index]; | ||
381 | +} | ||
382 | + | ||
383 | +static VAStatus va_TranslateBufferCompat ( | ||
384 | + VADriverContextP ctx, | ||
385 | + VABufferCompat *compat_buffer | ||
386 | +) | ||
387 | +{ | ||
388 | + VAStatus status; | ||
389 | + unsigned char *src, *dest; | ||
390 | + int i; | ||
391 | + | ||
392 | + status = VA_INVOKE(vaMapBuffer, ctx, compat_buffer->id, (void **)&src); | ||
393 | + if (status != VA_STATUS_SUCCESS) | ||
394 | + return status; | ||
395 | + | ||
396 | + ASSERT(compat_buffer->data); | ||
397 | + ASSERT(src == compat_buffer->data); | ||
398 | + ASSERT(compat_buffer->compat_data); | ||
399 | + dest = compat_buffer->compat_data; | ||
400 | + for (i = 0; i < compat_buffer->num_elements; i++) | ||
401 | + { | ||
402 | + /* XXX: check errors */ | ||
403 | + status = compat_buffer->translate(ctx->compat, dest, src); | ||
404 | + | ||
405 | + src += compat_buffer->size; | ||
406 | + dest += compat_buffer->compat_size; | ||
407 | + } | ||
408 | + | ||
409 | + return VA_INVOKE(vaUnmapBuffer, ctx, compat_buffer->id); | ||
410 | +} | ||
411 | + | ||
412 | +static VAStatus va_CreateBufferCompat ( | ||
413 | + VADriverContextP ctx, | ||
414 | + VAContextID context, | ||
415 | + VABufferID id, | ||
416 | + VABufferType type, | ||
417 | + unsigned int size, | ||
418 | + unsigned int num_elements, | ||
419 | + unsigned int compat_size, | ||
420 | + VABufferTranslateFunc translate_func | ||
421 | +) | ||
422 | +{ | ||
423 | + VACompatContextP compat = ctx->compat; | ||
424 | + VABufferCompat *compat_buffer; | ||
425 | + int index; | ||
426 | + | ||
427 | + if (!va_IsIntelBuffer(ctx, id)) | ||
428 | + return VA_STATUS_ERROR_INVALID_BUFFER; | ||
429 | + index = id & 0x00ffffff; | ||
430 | + | ||
431 | + /* XXX: this allocation strategy is not really space efficient... */ | ||
432 | + if (index >= compat->buffers_count_max) | ||
433 | + { | ||
434 | + compat->buffers_count_max = index + 1; | ||
435 | + compat->buffers = realloc(compat->buffers, | ||
436 | + (compat->buffers_count_max * | ||
437 | + sizeof(VABufferCompat))); | ||
438 | + if (compat->buffers == NULL) | ||
439 | + return VA_STATUS_ERROR_ALLOCATION_FAILED; | ||
440 | + } | ||
441 | + | ||
442 | + compat_buffer = &compat->buffers[index]; | ||
443 | + compat_buffer->id = id; | ||
444 | + compat_buffer->type = type; | ||
445 | + compat_buffer->size = size; | ||
446 | + compat_buffer->num_elements = num_elements; | ||
447 | + compat_buffer->data = NULL; | ||
448 | + compat_buffer->translate = translate_func; | ||
449 | + compat_buffer->compat_size = compat_size; | ||
450 | + compat_buffer->compat_data = NULL; | ||
451 | + compat_buffer->map_count = 0; | ||
452 | + | ||
453 | + return VA_INVOKE_COMPAT(vaCreateBuffer, | ||
454 | + ctx, | ||
455 | + context, | ||
456 | + type, | ||
457 | + compat_size, | ||
458 | + num_elements, | ||
459 | + NULL, | ||
460 | + &compat_buffer->compat_id); | ||
461 | +} | ||
462 | + | ||
463 | +static VAStatus va_DestroyBufferCompat ( | ||
464 | + VADriverContextP ctx, | ||
465 | + VABufferID id | ||
466 | +) | ||
467 | +{ | ||
468 | + VABufferCompat *compat_buffer; | ||
469 | + VAStatus status; | ||
470 | + | ||
471 | + if ((compat_buffer = va_GetBufferCompat(ctx, id)) == NULL) | ||
472 | + return VA_STATUS_SUCCESS; | ||
473 | + | ||
474 | + /* Force unmap if there were more maps than unmaps */ | ||
475 | + if (compat_buffer->map_count > 1) | ||
476 | + compat_buffer->map_count = 1; | ||
477 | + if (compat_buffer->map_count > 1) | ||
478 | + { | ||
479 | + if ((status = VA_INVOKE(vaUnmapBuffer, ctx, id)) != VA_STATUS_SUCCESS) | ||
480 | + return status; | ||
481 | + } | ||
482 | + | ||
483 | + compat_buffer->id = 0; | ||
484 | + return VA_INVOKE_COMPAT(vaDestroyBuffer, ctx, compat_buffer->compat_id); | ||
485 | +} | ||
486 | + | ||
487 | +static VAStatus va_compat_CreateBuffer ( | ||
488 | + VADriverContextP ctx, | ||
489 | + VAContextID context, /* in */ | ||
490 | + VABufferType type, /* in */ | ||
491 | + unsigned int size, /* in */ | ||
492 | + unsigned int num_elements, /* in */ | ||
493 | + void *data, /* in */ | ||
494 | + VABufferID *buf_id /* out */ | ||
495 | +) | ||
496 | +{ | ||
497 | + VABufferTranslateFunc translate_func = NULL; | ||
498 | + unsigned int compat_size = 0; | ||
499 | + VAStatus status; | ||
500 | + | ||
501 | + status = VA_INVOKE_COMPAT(vaCreateBuffer, | ||
502 | + ctx, | ||
503 | + context, | ||
504 | + type, | ||
505 | + size, | ||
506 | + num_elements, | ||
507 | + data, | ||
508 | + buf_id); | ||
509 | + | ||
510 | + if (status != VA_STATUS_SUCCESS) | ||
511 | + return status; | ||
512 | + | ||
513 | +#define INIT_TRANSLATE_FUNC_(STRUCT, MAJOR, MINOR) do { \ | ||
514 | + translate_func = va_compat_translate_VA##STRUCT##_##MAJOR##_##MINOR; \ | ||
515 | + compat_size = sizeof(VA##STRUCT##_##MAJOR##_##MINOR); \ | ||
516 | +} while (0) | ||
517 | +#define INIT_TRANSLATE_FUNC(BUFFER, CODEC, MAJOR, MINOR) \ | ||
518 | + INIT_TRANSLATE_FUNC_(BUFFER##Buffer##CODEC, MAJOR, MINOR) | ||
519 | + | ||
520 | + /* XXX: this assumes all structures have different sizes from each other */ | ||
521 | + switch (size) { | ||
522 | + case sizeof(VAPictureParameterBufferH264): | ||
523 | + if (type == VAPictureParameterBufferType && ctx->version_major == 0) | ||
524 | + { | ||
525 | + switch (ctx->version_minor) { | ||
526 | + case 29: INIT_TRANSLATE_FUNC(PictureParameter,H264, 0,29); break; | ||
527 | + case 30: INIT_TRANSLATE_FUNC(PictureParameter,H264, 0,30); break; | ||
528 | + } | ||
529 | + } | ||
530 | + break; | ||
531 | + case sizeof(VASliceParameterBufferH264): | ||
532 | + if (type == VASliceParameterBufferType && ctx->version_major == 0) | ||
533 | + { | ||
534 | + switch (ctx->version_minor) { | ||
535 | + case 29: INIT_TRANSLATE_FUNC(SliceParameter,H264, 0,29); break; | ||
536 | + case 30: INIT_TRANSLATE_FUNC(SliceParameter,H264, 0,30); break; | ||
537 | + } | ||
538 | + } | ||
539 | + break; | ||
540 | + case sizeof(VAPictureParameterBufferVC1): | ||
541 | + if (type == VAPictureParameterBufferType && ctx->version_major == 0) | ||
542 | + { | ||
543 | + switch (ctx->version_minor) { | ||
544 | + case 29: INIT_TRANSLATE_FUNC(PictureParameter,VC1, 0,29); break; | ||
545 | + case 30: INIT_TRANSLATE_FUNC(PictureParameter,VC1, 0,30); break; | ||
546 | + } | ||
547 | + } | ||
548 | + break; | ||
549 | + case sizeof(VAPictureParameterBufferMPEG2): | ||
550 | + if (type == VAPictureParameterBufferType && ctx->version_major == 0) | ||
551 | + { | ||
552 | + switch (ctx->version_minor) { | ||
553 | + case 29: INIT_TRANSLATE_FUNC(PictureParameter,MPEG2, 0,29); break; | ||
554 | + case 30: INIT_TRANSLATE_FUNC(PictureParameter,MPEG2, 0,30); break; | ||
555 | + } | ||
556 | + } | ||
557 | + break; | ||
558 | + case sizeof(VASliceParameterBufferMPEG2): | ||
559 | + if (type == VASliceParameterBufferType && ctx->version_major == 0) | ||
560 | + { | ||
561 | + switch (ctx->version_minor) { | ||
562 | + case 29: INIT_TRANSLATE_FUNC(SliceParameter,MPEG2, 0,29); break; | ||
563 | + case 30: INIT_TRANSLATE_FUNC(SliceParameter,MPEG2, 0,30); break; | ||
564 | + } | ||
565 | + } | ||
566 | + break; | ||
567 | + case sizeof(VAPictureParameterBufferMPEG4): | ||
568 | + if (type == VAPictureParameterBufferType && ctx->version_major == 0) | ||
569 | + { | ||
570 | + switch (ctx->version_minor) { | ||
571 | + case 29: INIT_TRANSLATE_FUNC(PictureParameter,MPEG4, 0,29); break; | ||
572 | + case 30: INIT_TRANSLATE_FUNC(PictureParameter,MPEG4, 0,30); break; | ||
573 | + case 31: INIT_TRANSLATE_FUNC(PictureParameter,MPEG4, 0,31); break; | ||
574 | + } | ||
575 | + } | ||
576 | + break; | ||
577 | + case sizeof(VAEncSliceParameterBuffer): | ||
578 | + if (type == VAEncSliceParameterBufferType && ctx->version_major == 0) | ||
579 | + { | ||
580 | + switch (ctx->version_minor) { | ||
581 | + case 30: INIT_TRANSLATE_FUNC_(EncSliceParameterBuffer, 0,30); break; | ||
582 | + } | ||
583 | + } | ||
584 | + break; | ||
585 | + } | ||
586 | + | ||
587 | +#undef INIT_TRANSLATE_FUNC | ||
588 | + | ||
589 | + /* Create thunk */ | ||
590 | + if (buf_id && translate_func) | ||
591 | + { | ||
592 | + ASSERT(compat_size > 0); | ||
593 | + | ||
594 | + status = va_CreateBufferCompat(ctx, | ||
595 | + context, | ||
596 | + *buf_id, | ||
597 | + type, | ||
598 | + size, | ||
599 | + num_elements, | ||
600 | + compat_size, | ||
601 | + translate_func); | ||
602 | + } | ||
603 | + | ||
604 | + return status; | ||
605 | +} | ||
606 | + | ||
607 | +static VAStatus va_compat_BufferSetNumElements ( | ||
608 | + VADriverContextP ctx, | ||
609 | + VABufferID buf_id, /* in */ | ||
610 | + unsigned int num_elements /* in */ | ||
611 | +) | ||
612 | +{ | ||
613 | + VABufferCompat *compat_buffer; | ||
614 | + VAStatus status; | ||
615 | + | ||
616 | + status = VA_INVOKE_COMPAT(vaBufferSetNumElements, ctx, buf_id, num_elements); | ||
617 | + if (status != VA_STATUS_SUCCESS) | ||
618 | + return status; | ||
619 | + | ||
620 | + if ((compat_buffer = va_GetBufferCompat(ctx, buf_id)) != NULL) | ||
621 | + { | ||
622 | + compat_buffer->num_elements = num_elements; | ||
623 | + status = VA_INVOKE_COMPAT(vaBufferSetNumElements, | ||
624 | + ctx, | ||
625 | + compat_buffer->compat_id, | ||
626 | + num_elements); | ||
627 | + } | ||
628 | + | ||
629 | + return status; | ||
630 | +} | ||
631 | + | ||
632 | +static VAStatus va_compat_DestroyBuffer ( | ||
633 | + VADriverContextP ctx, | ||
634 | + VABufferID buffer_id | ||
635 | +) | ||
636 | +{ | ||
637 | + VAStatus status; | ||
638 | + if ((status = va_DestroyBufferCompat(ctx, buffer_id)) != VA_STATUS_SUCCESS) | ||
639 | + return status; | ||
640 | + | ||
641 | + return VA_INVOKE_COMPAT(vaDestroyBuffer, ctx, buffer_id); | ||
642 | +} | ||
643 | + | ||
644 | +static VAStatus va_compat_MapBuffer ( | ||
645 | + VADriverContextP ctx, | ||
646 | + VABufferID buf_id, /* in */ | ||
647 | + void **pbuf /* out */ | ||
648 | +) | ||
649 | +{ | ||
650 | + VABufferCompat *compat_buffer; | ||
651 | + VAStatus status; | ||
652 | + | ||
653 | + if ((compat_buffer = va_GetBufferCompat(ctx, buf_id)) == NULL) | ||
654 | + return VA_INVOKE_COMPAT(vaMapBuffer, ctx, buf_id, pbuf); | ||
655 | + | ||
656 | + if (compat_buffer->map_count++ == 0) | ||
657 | + { | ||
658 | + status = VA_INVOKE_COMPAT(vaMapBuffer, ctx, buf_id, (void **)&compat_buffer->data); | ||
659 | + if (status != VA_STATUS_SUCCESS) | ||
660 | + return status; | ||
661 | + | ||
662 | + status = VA_INVOKE_COMPAT(vaMapBuffer, ctx, compat_buffer->compat_id, (void **)&compat_buffer->compat_data); | ||
663 | + if (status != VA_STATUS_SUCCESS) | ||
664 | + return status; | ||
665 | + } | ||
666 | + | ||
667 | + if (pbuf) | ||
668 | + *pbuf = compat_buffer->data; | ||
669 | + | ||
670 | + return VA_STATUS_SUCCESS; | ||
671 | +} | ||
672 | + | ||
673 | +static VAStatus va_compat_UnmapBuffer ( | ||
674 | + VADriverContextP ctx, | ||
675 | + VABufferID buf_id /* in */ | ||
676 | +) | ||
677 | +{ | ||
678 | + VABufferCompat *compat_buffer; | ||
679 | + VAStatus status; | ||
680 | + | ||
681 | + if ((compat_buffer = va_GetBufferCompat(ctx, buf_id)) == NULL) | ||
682 | + return VA_INVOKE_COMPAT(vaUnmapBuffer, ctx, buf_id); | ||
683 | + | ||
684 | + if (--compat_buffer->map_count == 0) | ||
685 | + { | ||
686 | + status = VA_INVOKE_COMPAT(vaUnmapBuffer, ctx, compat_buffer->compat_id); | ||
687 | + if (status != VA_STATUS_SUCCESS) | ||
688 | + return status; | ||
689 | + compat_buffer->compat_data = NULL; | ||
690 | + | ||
691 | + status = VA_INVOKE_COMPAT(vaUnmapBuffer, ctx, compat_buffer->id); | ||
692 | + if (status != VA_STATUS_SUCCESS) | ||
693 | + return status; | ||
694 | + compat_buffer->data = NULL; | ||
695 | + } | ||
696 | + | ||
697 | + return VA_STATUS_SUCCESS; | ||
698 | +} | ||
699 | + | ||
700 | +static VAStatus va_compat_BeginPicture ( | ||
701 | + VADriverContextP ctx, | ||
702 | + VAContextID context, | ||
703 | + VASurfaceID render_target | ||
704 | +) | ||
705 | +{ | ||
706 | + VACompatContextP compat = ctx->compat; | ||
707 | + compat->skip_frame = 0; | ||
708 | + return VA_INVOKE_COMPAT(vaBeginPicture, ctx, context, render_target); | ||
709 | +} | ||
710 | + | ||
711 | +static VAStatus va_compat_EndPicture ( | ||
712 | + VADriverContextP ctx, | ||
713 | + VAContextID context | ||
714 | +) | ||
715 | +{ | ||
716 | + VACompatContextP compat = ctx->compat; | ||
717 | + VAStatus status = VA_INVOKE_COMPAT(vaEndPicture, ctx, context); | ||
718 | + | ||
719 | + /* Ignore errors if the HW decoder did not handle VC-1 skipped P-frames */ | ||
720 | + if (compat->skip_frame && status == VA_STATUS_ERROR_UNKNOWN) | ||
721 | + status = VA_STATUS_SUCCESS; | ||
722 | + | ||
723 | + return status; | ||
724 | +} | ||
725 | + | ||
726 | +static VAStatus va_compat_RenderPicture ( | ||
727 | + VADriverContextP ctx, | ||
728 | + VAContextID context, | ||
729 | + VABufferID *buffers, | ||
730 | + int num_buffers | ||
731 | +) | ||
732 | +{ | ||
733 | + VACompatContextP compat = ctx->compat; | ||
734 | + VABufferCompat *compat_buffer; | ||
735 | + VABufferID *compat_buffer_ids; | ||
736 | + VAStatus status; | ||
737 | + int i, n; | ||
738 | + | ||
739 | + if ((n = num_buffers) < 1) | ||
740 | + n = 1; | ||
741 | + compat_buffer_ids = alloca(n * sizeof(compat_buffer_ids[0])); | ||
742 | + | ||
743 | + for (i = 0; i < num_buffers; i++) | ||
744 | + { | ||
745 | + if ((compat_buffer = va_GetBufferCompat(ctx, buffers[i])) == NULL) | ||
746 | + compat_buffer_ids[i] = buffers[i]; | ||
747 | + else | ||
748 | + { | ||
749 | + status = va_TranslateBufferCompat(ctx, compat_buffer); | ||
750 | + if (status != VA_STATUS_SUCCESS) | ||
751 | + return status; | ||
752 | + compat_buffer_ids[i] = compat_buffer->compat_id; | ||
753 | + } | ||
754 | + } | ||
755 | + | ||
756 | + if (!compat->skip_frame) | ||
757 | + { | ||
758 | + status = VA_INVOKE_COMPAT(vaRenderPicture, ctx, context, compat_buffer_ids, num_buffers); | ||
759 | + if (status != VA_STATUS_SUCCESS) | ||
760 | + return status; | ||
761 | + } | ||
762 | + | ||
763 | + /* Buffers are automatically destroyed afterwards */ | ||
764 | + for (i = 0; i < num_buffers; i++) | ||
765 | + { | ||
766 | + if ((compat_buffer = va_GetBufferCompat(ctx, buffers[i])) != NULL) | ||
767 | + { | ||
768 | + status = VA_INVOKE_COMPAT(vaDestroyBuffer, ctx, compat_buffer->id); | ||
769 | + if (status != VA_STATUS_SUCCESS) | ||
770 | + return status; | ||
771 | + } | ||
772 | + } | ||
773 | + | ||
774 | + return VA_STATUS_SUCCESS; | ||
775 | +} | ||
776 | + | ||
777 | +#define DEFINE_VTABLE_ENTRY_(RETVAL, PROC, ARGS, COMPAT_PROC, COMPAT_ARGS, COMPAT_PRE, COMPAT_POST) \ | ||
778 | +static RETVAL va_compat_##PROC ARGS \ | ||
779 | +{ \ | ||
780 | + if (COMPAT_CTX(ctx)->vtable.va##COMPAT_PROC == NULL) \ | ||
781 | + return VA_STATUS_ERROR_OPERATION_FAILED; \ | ||
782 | + COMPAT_PRE; \ | ||
783 | + RETVAL ret = COMPAT_CTX(ctx)->vtable.va##COMPAT_PROC VA_INVOKE_COMPAT_ARGS COMPAT_ARGS; \ | ||
784 | + COMPAT_POST; \ | ||
785 | + return ret; \ | ||
786 | +} | ||
787 | + | ||
788 | +#define DEFINE_VTABLE_ENTRY(RETVAL, PROC, DECL_ARGS, CALL_ARGS) \ | ||
789 | +DEFINE_VTABLE_ENTRY_(RETVAL, PROC, DECL_ARGS, PROC, CALL_ARGS, {}, {}) | ||
790 | + | ||
791 | +static VAStatus va_compat_Terminate(VADriverContextP ctx) | ||
792 | +{ | ||
793 | + if (COMPAT_CTX(ctx)->vtable.vaTerminate == NULL) | ||
794 | + return VA_STATUS_ERROR_OPERATION_FAILED; | ||
795 | + return COMPAT_CTX(ctx)->vtable.vaTerminate(COMPAT_CTX(ctx)->compat_ctx); | ||
796 | +} | ||
797 | + | ||
798 | +DEFINE_VTABLE_ENTRY( | ||
799 | + VAStatus, QueryConfigProfiles, | ||
800 | + (VADriverContextP ctx, VAProfile *profile_list, int *num_profiles), | ||
801 | + (ctx, profile_list, num_profiles)) | ||
802 | + | ||
803 | +DEFINE_VTABLE_ENTRY( | ||
804 | + VAStatus, QueryConfigEntrypoints, | ||
805 | + (VADriverContextP ctx, VAProfile profile, | ||
806 | + VAEntrypoint *entrypoint_list, int *num_entrypoints), | ||
807 | + (ctx, profile, entrypoint_list, num_entrypoints)) | ||
808 | + | ||
809 | +DEFINE_VTABLE_ENTRY( | ||
810 | + VAStatus, GetConfigAttributes, | ||
811 | + (VADriverContextP ctx, VAProfile profile, VAEntrypoint entrypoint, | ||
812 | + VAConfigAttrib *attrib_list, int num_attribs), | ||
813 | + (ctx, profile, entrypoint, attrib_list, num_attribs)) | ||
814 | + | ||
815 | +DEFINE_VTABLE_ENTRY( | ||
816 | + VAStatus, CreateConfig, | ||
817 | + (VADriverContextP ctx, VAProfile profile, VAEntrypoint entrypoint, | ||
818 | + VAConfigAttrib *attrib_list, int num_attribs, VAConfigID *config_id), | ||
819 | + (ctx, profile, entrypoint, attrib_list, num_attribs, config_id)) | ||
820 | + | ||
821 | +DEFINE_VTABLE_ENTRY( | ||
822 | + VAStatus, DestroyConfig, | ||
823 | + (VADriverContextP ctx, VAConfigID config_id), | ||
824 | + (ctx, config_id)) | ||
825 | + | ||
826 | +DEFINE_VTABLE_ENTRY( | ||
827 | + VAStatus, QueryConfigAttributes, | ||
828 | + (VADriverContextP ctx, VAConfigID config_id, VAProfile *profile, | ||
829 | + VAEntrypoint *entrypoint, VAConfigAttrib *attrib_list, int *num_attribs), | ||
830 | + (ctx, config_id, profile, entrypoint, attrib_list, num_attribs)) | ||
831 | + | ||
832 | +DEFINE_VTABLE_ENTRY( | ||
833 | + VAStatus, CreateSurfaces, | ||
834 | + (VADriverContextP ctx, int width, int height, int format, | ||
835 | + int num_surfaces, VASurfaceID *surfaces), | ||
836 | + (ctx, width, height, format, num_surfaces, surfaces)) | ||
837 | + | ||
838 | +DEFINE_VTABLE_ENTRY( | ||
839 | + VAStatus, DestroySurfaces, | ||
840 | + (VADriverContextP ctx, VASurfaceID *surface_list, int num_surfaces), | ||
841 | + (ctx, surface_list, num_surfaces)) | ||
842 | + | ||
843 | +DEFINE_VTABLE_ENTRY( | ||
844 | + VAStatus, CreateContext, | ||
845 | + (VADriverContextP ctx, VAConfigID config_id, | ||
846 | + int picture_width, int picture_height, int flag, | ||
847 | + VASurfaceID *render_targets, int num_render_targets, VAContextID *context), | ||
848 | + (ctx, config_id, picture_width, picture_height, flag, | ||
849 | + render_targets, num_render_targets, context)) | ||
850 | + | ||
851 | +DEFINE_VTABLE_ENTRY( | ||
852 | + VAStatus, DestroyContext, | ||
853 | + (VADriverContextP ctx, VAContextID context), | ||
854 | + (ctx, context)) | ||
855 | + | ||
856 | +DEFINE_VTABLE_ENTRY( | ||
857 | + VAStatus, SyncSurface, | ||
858 | + (VADriverContextP ctx, VASurfaceID render_target), | ||
859 | + (ctx, render_target)) | ||
860 | + | ||
861 | +DEFINE_VTABLE_ENTRY( | ||
862 | + VAStatus, QuerySurfaceStatus, | ||
863 | + (VADriverContextP ctx, VASurfaceID render_target, VASurfaceStatus *status), | ||
864 | + (ctx, render_target, status)) | ||
865 | + | ||
866 | +DEFINE_VTABLE_ENTRY( | ||
867 | + VAStatus, PutSurface, | ||
868 | + (VADriverContextP ctx, VASurfaceID surface, Drawable draw, | ||
869 | + short srcx, short srcy, unsigned short srcw, unsigned short srch, | ||
870 | + short destx, short desty, unsigned short destw, unsigned short desth, | ||
871 | + VARectangle *cliprects, unsigned int number_cliprects, unsigned int flags), | ||
872 | + (ctx, surface, draw, srcx, srcy, srcw, srch, destx, desty, destw, desth, | ||
873 | + cliprects, number_cliprects, flags)) | ||
874 | + | ||
875 | +DEFINE_VTABLE_ENTRY( | ||
876 | + VAStatus, QueryImageFormats, | ||
877 | + (VADriverContextP ctx, VAImageFormat *format_list, int *num_formats), | ||
878 | + (ctx, format_list, num_formats)) | ||
879 | + | ||
880 | +DEFINE_VTABLE_ENTRY( | ||
881 | + VAStatus, CreateImage, | ||
882 | + (VADriverContextP ctx, VAImageFormat *format, | ||
883 | + int width, int height, VAImage *image), | ||
884 | + (ctx, format, width, height, image)) | ||
885 | + | ||
886 | +DEFINE_VTABLE_ENTRY( | ||
887 | + VAStatus, DeriveImage, | ||
888 | + (VADriverContextP ctx, VASurfaceID surface, VAImage *image), | ||
889 | + (ctx, surface, image)) | ||
890 | + | ||
891 | +DEFINE_VTABLE_ENTRY( | ||
892 | + VAStatus, DestroyImage, | ||
893 | + (VADriverContextP ctx, VAImageID image), | ||
894 | + (ctx, image)) | ||
895 | + | ||
896 | +DEFINE_VTABLE_ENTRY( | ||
897 | + VAStatus, SetImagePalette, | ||
898 | + (VADriverContextP ctx, VAImageID image, unsigned char *palette), | ||
899 | + (ctx, image, palette)) | ||
900 | + | ||
901 | +DEFINE_VTABLE_ENTRY( | ||
902 | + VAStatus, GetImage, | ||
903 | + (VADriverContextP ctx, VASurfaceID surface, | ||
904 | + int x, int y, unsigned int width, unsigned int height, VAImageID image), | ||
905 | + (ctx, surface, x, y, width, height, image)) | ||
906 | + | ||
907 | +DEFINE_VTABLE_ENTRY( | ||
908 | + VAStatus, PutImage, | ||
909 | + (VADriverContextP ctx, VASurfaceID surface, VAImageID image, | ||
910 | + int srcx, int srcy, unsigned int srcw, unsigned int srch, | ||
911 | + int destx, int desty, unsigned int destw, unsigned int desth), | ||
912 | + (ctx, surface, image, srcx, srcy, srcw, srch, destx, desty, destw, desth)) | ||
913 | + | ||
914 | +DEFINE_VTABLE_ENTRY( | ||
915 | + VAStatus, QuerySubpictureFormats, | ||
916 | + (VADriverContextP ctx, VAImageFormat *format_list, | ||
917 | + unsigned int *flags, unsigned int *num_formats), | ||
918 | + (ctx, format_list, flags, num_formats)) | ||
919 | + | ||
920 | +DEFINE_VTABLE_ENTRY( | ||
921 | + VAStatus, CreateSubpicture, | ||
922 | + (VADriverContextP ctx, VAImageID image, VASubpictureID *subpicture), | ||
923 | + (ctx, image, subpicture)) | ||
924 | + | ||
925 | +DEFINE_VTABLE_ENTRY( | ||
926 | + VAStatus, DestroySubpicture, | ||
927 | + (VADriverContextP ctx, VASubpictureID subpicture), | ||
928 | + (ctx, subpicture)) | ||
929 | + | ||
930 | +DEFINE_VTABLE_ENTRY( | ||
931 | + VAStatus, SetSubpictureImage, | ||
932 | + (VADriverContextP ctx, VASubpictureID subpicture, VAImageID image), | ||
933 | + (ctx, subpicture, image)) | ||
934 | + | ||
935 | +DEFINE_VTABLE_ENTRY( | ||
936 | + VAStatus, SetSubpictureChromakey, | ||
937 | + (VADriverContextP ctx, VASubpictureID subpicture, | ||
938 | + unsigned int chromakey_min, | ||
939 | + unsigned int chromakey_max, | ||
940 | + unsigned int chromakey_mask), | ||
941 | + (ctx, subpicture, chromakey_min, chromakey_max, chromakey_mask)) | ||
942 | + | ||
943 | +DEFINE_VTABLE_ENTRY( | ||
944 | + VAStatus, SetSubpictureGlobalAlpha, | ||
945 | + (VADriverContextP ctx, VASubpictureID subpicture, float global_alpha), | ||
946 | + (ctx, subpicture, global_alpha)) | ||
947 | + | ||
948 | +DEFINE_VTABLE_ENTRY( | ||
949 | + VAStatus, AssociateSubpicture, | ||
950 | + (VADriverContextP ctx, VASubpictureID subpicture, | ||
951 | + VASurfaceID *target_surfaces, int num_surfaces, | ||
952 | + short srcx, short srcy, unsigned short srcw, unsigned short srch, | ||
953 | + short destx, short desty, unsigned short destw, unsigned short desth, | ||
954 | + unsigned int flags), | ||
955 | + (ctx, subpicture, target_surfaces, num_surfaces, | ||
956 | + srcx, srcy, srcw, srch, destx, desty, destw, desth, flags)) | ||
957 | + | ||
958 | +DEFINE_VTABLE_ENTRY( | ||
959 | + VAStatus, DeassociateSubpicture, | ||
960 | + (VADriverContextP ctx, VASubpictureID subpicture, | ||
961 | + VASurfaceID *target_surfaces, int num_surfaces), | ||
962 | + (ctx, subpicture, target_surfaces, num_surfaces)) | ||
963 | + | ||
964 | +DEFINE_VTABLE_ENTRY( | ||
965 | + VAStatus, QueryDisplayAttributes, | ||
966 | + (VADriverContextP ctx, VADisplayAttribute *attr_list, int *num_attributes), | ||
967 | + (ctx, attr_list, num_attributes)) | ||
968 | + | ||
969 | +DEFINE_VTABLE_ENTRY( | ||
970 | + VAStatus, GetDisplayAttributes, | ||
971 | + (VADriverContextP ctx, VADisplayAttribute *attr_list, int num_attributes), | ||
972 | + (ctx, attr_list, num_attributes)) | ||
973 | + | ||
974 | +DEFINE_VTABLE_ENTRY( | ||
975 | + VAStatus, SetDisplayAttributes, | ||
976 | + (VADriverContextP ctx, VADisplayAttribute *attr_list, int num_attributes), | ||
977 | + (ctx, attr_list, num_attributes)) | ||
978 | + | ||
979 | +DEFINE_VTABLE_ENTRY( | ||
980 | + VAStatus, CreateSurfaceFromCIFrame, | ||
981 | + (VADriverContextP ctx, unsigned long frame_id, VASurfaceID *surface), | ||
982 | + (ctx, frame_id, surface)) | ||
983 | + | ||
984 | +DEFINE_VTABLE_ENTRY( | ||
985 | + VAStatus, CreateSurfaceFromV4L2Buf, | ||
986 | + (VADriverContextP ctx, int v4l2_fd, | ||
987 | + struct v4l2_format *v4l2_fmt, struct v4l2_buffer *v4l2_buf, | ||
988 | + VASurfaceID *surface), | ||
989 | + (ctx, v4l2_fd, v4l2_fmt, v4l2_buf, surface)) | ||
990 | + | ||
991 | +DEFINE_VTABLE_ENTRY( | ||
992 | + VAStatus, CopySurfaceToBuffer, | ||
993 | + (VADriverContextP ctx, VASurfaceID surface, unsigned int *fourcc, | ||
994 | + unsigned int *luma_stride, | ||
995 | + unsigned int *chroma_u_stride, unsigned int *chroma_v_stride, | ||
996 | + unsigned int *luma_offset, | ||
997 | + unsigned int *chroma_u_offset, unsigned int *chroma_v_offset, | ||
998 | + void **buffer), | ||
999 | + (ctx, surface, fourcc, | ||
1000 | + luma_stride, chroma_u_stride, chroma_v_stride, | ||
1001 | + luma_offset, chroma_u_offset, chroma_v_offset, | ||
1002 | + buffer)) | ||
1003 | + | ||
1004 | +DEFINE_VTABLE_ENTRY_( | ||
1005 | + VAStatus, SyncSurface_pre31, | ||
1006 | + (VADriverContextP ctx, VASurfaceID render_target), | ||
1007 | + SyncSurface_pre31, | ||
1008 | + (ctx, va_context_map_lookup(COMPAT_CTX(ctx), render_target), render_target), | ||
1009 | + {}, {}) | ||
1010 | + | ||
1011 | +DEFINE_VTABLE_ENTRY_( | ||
1012 | + VAStatus, PutImage_pre31, | ||
1013 | + (VADriverContextP ctx, VASurfaceID surface, VAImageID image, | ||
1014 | + int srcx, int srcy, unsigned int srcw, unsigned int srch, | ||
1015 | + int destx, int desty, unsigned int destw, unsigned int desth), | ||
1016 | + PutImage2_pre31, | ||
1017 | + (ctx, surface, image, srcx, srcy, srcw, srch, destx, desty, destw, desth), | ||
1018 | + {}, {}) | ||
1019 | + | ||
1020 | +DEFINE_VTABLE_ENTRY_( | ||
1021 | + VAStatus, AssociateSubpicture_pre31, | ||
1022 | + (VADriverContextP ctx, VASubpictureID subpicture, | ||
1023 | + VASurfaceID *target_surfaces, int num_surfaces, | ||
1024 | + short srcx, short srcy, unsigned short srcw, unsigned short srch, | ||
1025 | + short destx, short desty, unsigned short destw, unsigned short desth, | ||
1026 | + unsigned int flags), | ||
1027 | + AssociateSubpicture2_pre31, | ||
1028 | + (ctx, subpicture, target_surfaces, num_surfaces, | ||
1029 | + srcx, srcy, srcw, srch, destx, desty, destw, desth, flags), | ||
1030 | + {}, {}) | ||
1031 | + | ||
1032 | +DEFINE_VTABLE_ENTRY_( | ||
1033 | + VAStatus, CreateContext_pre31, | ||
1034 | + (VADriverContextP ctx, VAConfigID config_id, | ||
1035 | + int picture_width, int picture_height, int flag, | ||
1036 | + VASurfaceID *render_targets, int num_render_targets, VAContextID *context), | ||
1037 | + CreateContext, | ||
1038 | + (ctx, config_id, picture_width, picture_height, flag, | ||
1039 | + render_targets, num_render_targets, context), | ||
1040 | + {}, { | ||
1041 | + VACompatContextP const compat_ctx = COMPAT_CTX(ctx); | ||
1042 | + int i; | ||
1043 | + for (i = 0; i < num_render_targets; i++) | ||
1044 | + va_context_map_add(compat_ctx, *context, render_targets[i]); | ||
1045 | + }) | ||
1046 | + | ||
1047 | +DEFINE_VTABLE_ENTRY_( | ||
1048 | + VAStatus, DestroyContext_pre31, | ||
1049 | + (VADriverContextP ctx, VAContextID context), | ||
1050 | + DestroyContext, | ||
1051 | + (ctx, context), | ||
1052 | + {}, { va_context_map_remove(COMPAT_CTX(ctx), context); }) | ||
1053 | + | ||
1054 | +#undef DEFINE_VTABLE_ENTRY | ||
1055 | +#undef DEFINE_VTABLE_ENTRY_ | ||
1056 | + | ||
1057 | +static void va_compat_init_VADriverVTable(VADriverContextP ctx, int compat_version) | ||
1058 | +{ | ||
1059 | +#define INIT_VTABLE_(CTX, DST_PROC, SRC_PROC) \ | ||
1060 | + (CTX)->vtable.va##DST_PROC = va_compat_##SRC_PROC | ||
1061 | +#define INIT_VTABLE(CTX, PROC) \ | ||
1062 | + INIT_VTABLE_(CTX, PROC, PROC) | ||
1063 | + | ||
1064 | + INIT_VTABLE(ctx, Terminate); | ||
1065 | + INIT_VTABLE(ctx, QueryConfigProfiles); | ||
1066 | + INIT_VTABLE(ctx, QueryConfigEntrypoints); | ||
1067 | + INIT_VTABLE(ctx, GetConfigAttributes); | ||
1068 | + INIT_VTABLE(ctx, CreateConfig); | ||
1069 | + INIT_VTABLE(ctx, DestroyConfig); | ||
1070 | + INIT_VTABLE(ctx, QueryConfigAttributes); | ||
1071 | + INIT_VTABLE(ctx, CreateSurfaces); | ||
1072 | + INIT_VTABLE(ctx, DestroySurfaces); | ||
1073 | + INIT_VTABLE(ctx, CreateContext); | ||
1074 | + INIT_VTABLE(ctx, DestroyContext); | ||
1075 | + INIT_VTABLE(ctx, CreateBuffer); | ||
1076 | + INIT_VTABLE(ctx, BufferSetNumElements); | ||
1077 | + INIT_VTABLE(ctx, MapBuffer); | ||
1078 | + INIT_VTABLE(ctx, UnmapBuffer); | ||
1079 | + INIT_VTABLE(ctx, DestroyBuffer); | ||
1080 | + INIT_VTABLE(ctx, BeginPicture); | ||
1081 | + INIT_VTABLE(ctx, RenderPicture); | ||
1082 | + INIT_VTABLE(ctx, EndPicture); | ||
1083 | + INIT_VTABLE(ctx, SyncSurface); | ||
1084 | + INIT_VTABLE(ctx, QuerySurfaceStatus); | ||
1085 | + INIT_VTABLE(ctx, PutSurface); | ||
1086 | + INIT_VTABLE(ctx, QueryImageFormats); | ||
1087 | + INIT_VTABLE(ctx, CreateImage); | ||
1088 | + INIT_VTABLE(ctx, DeriveImage); | ||
1089 | + INIT_VTABLE(ctx, DestroyImage); | ||
1090 | + INIT_VTABLE(ctx, SetImagePalette); | ||
1091 | + INIT_VTABLE(ctx, GetImage); | ||
1092 | + INIT_VTABLE(ctx, PutImage); | ||
1093 | + INIT_VTABLE(ctx, QuerySubpictureFormats); | ||
1094 | + INIT_VTABLE(ctx, CreateSubpicture); | ||
1095 | + INIT_VTABLE(ctx, DestroySubpicture); | ||
1096 | + INIT_VTABLE(ctx, SetSubpictureImage); | ||
1097 | + INIT_VTABLE(ctx, SetSubpictureChromakey); | ||
1098 | + INIT_VTABLE(ctx, SetSubpictureGlobalAlpha); | ||
1099 | + INIT_VTABLE(ctx, AssociateSubpicture); | ||
1100 | + INIT_VTABLE(ctx, DeassociateSubpicture); | ||
1101 | + INIT_VTABLE(ctx, QueryDisplayAttributes); | ||
1102 | + INIT_VTABLE(ctx, GetDisplayAttributes); | ||
1103 | + INIT_VTABLE(ctx, SetDisplayAttributes); | ||
1104 | + INIT_VTABLE(ctx, CreateSurfaceFromCIFrame); | ||
1105 | + INIT_VTABLE(ctx, CreateSurfaceFromV4L2Buf); | ||
1106 | + INIT_VTABLE(ctx, CopySurfaceToBuffer); | ||
1107 | + | ||
1108 | + if (compat_version && compat_version < 31) { | ||
1109 | + INIT_VTABLE_(ctx, CreateContext, CreateContext_pre31); | ||
1110 | + INIT_VTABLE_(ctx, DestroyContext, DestroyContext_pre31); | ||
1111 | + INIT_VTABLE_(ctx, SyncSurface, SyncSurface_pre31); | ||
1112 | + INIT_VTABLE_(ctx, PutImage, PutImage_pre31); | ||
1113 | + INIT_VTABLE_(ctx, AssociateSubpicture, AssociateSubpicture_pre31); | ||
1114 | + } | ||
1115 | + | ||
1116 | +#undef INIT_VTABLE | ||
1117 | +#undef INIT_VTABLE__ | ||
1118 | +} | ||
1119 | + | ||
1120 | +VAStatus va_compat_init(VADisplay dpy, int compat_version, void *compat_ctx) | ||
1121 | +{ | ||
1122 | + VADisplayContextP pDisplayContext = (VADisplayContextP)dpy; | ||
1123 | + VADriverContextP ctx = CTX(dpy); | ||
1124 | + VADriverContextP_0_29 ctx_0_29; | ||
1125 | + VADriverContextP_0_30 ctx_0_30; | ||
1126 | + VACompatContextP compat; | ||
1127 | + VAStatus status; | ||
1128 | + char *driver_name; | ||
1129 | + | ||
1130 | + ctx->compat = NULL; | ||
1131 | + | ||
1132 | + if (compat_version == 0) | ||
1133 | + return VA_STATUS_SUCCESS; | ||
1134 | + | ||
1135 | + ASSERT(compat_ctx); | ||
1136 | + if (compat_ctx == NULL) | ||
1137 | + return VA_STATUS_ERROR_UNKNOWN; | ||
1138 | + | ||
1139 | + driver_name = NULL; | ||
1140 | + status = pDisplayContext->vaGetDriverName(pDisplayContext, &driver_name); | ||
1141 | + ASSERT(status == VA_STATUS_SUCCESS); | ||
1142 | + if (status != VA_STATUS_SUCCESS) | ||
1143 | + return status; | ||
1144 | + | ||
1145 | + if ((compat = malloc(sizeof(*compat))) == NULL) | ||
1146 | + return VA_STATUS_ERROR_ALLOCATION_FAILED; | ||
1147 | + compat->buffers = NULL; | ||
1148 | + compat->buffers_count_max = 0; | ||
1149 | + compat->compat_version = compat_version; | ||
1150 | + compat->compat_ctx = NULL; | ||
1151 | + compat->driver_name = driver_name; | ||
1152 | + compat->context_map = NULL; | ||
1153 | + compat->last_context_map_match = NULL; | ||
1154 | + ctx->compat = compat; | ||
1155 | + | ||
1156 | + if (strcmp(driver_name, "psb") == 0) | ||
1157 | + compat->driver_id = VA_DRIVER_ID_POULSBO; | ||
1158 | + else if (strcmp(driver_name, "iegd") == 0) | ||
1159 | + compat->driver_id = VA_DRIVER_ID_IEGD; | ||
1160 | + else | ||
1161 | + compat->driver_id = VA_DRIVER_ID_UNKNOWN; | ||
1162 | + | ||
1163 | + switch (compat_version) { | ||
1164 | + case 29: | ||
1165 | + if ((ctx_0_29 = malloc(sizeof(*ctx_0_29))) == NULL) | ||
1166 | + return VA_STATUS_ERROR_ALLOCATION_FAILED; | ||
1167 | + memcpy(ctx_0_29, compat_ctx, sizeof(*ctx_0_29)); | ||
1168 | + va_compat_translate_VADriverContext_0_29(compat, ctx_0_29); | ||
1169 | + compat->compat_ctx = ctx_0_29; | ||
1170 | + COPY_FIELD(ctx, ctx_0_29, version_major); | ||
1171 | + COPY_FIELD(ctx, ctx_0_29, version_minor); | ||
1172 | + COPY_FIELD(ctx, ctx_0_29, max_profiles); | ||
1173 | + COPY_FIELD(ctx, ctx_0_29, max_entrypoints); | ||
1174 | + COPY_FIELD(ctx, ctx_0_29, max_attributes); | ||
1175 | + COPY_FIELD(ctx, ctx_0_29, max_image_formats); | ||
1176 | + COPY_FIELD(ctx, ctx_0_29, max_subpic_formats); | ||
1177 | + COPY_FIELD(ctx, ctx_0_29, max_display_attributes); | ||
1178 | + COPY_FIELD(ctx, ctx_0_29, str_vendor); | ||
1179 | + break; | ||
1180 | + case 30: | ||
1181 | + if ((ctx_0_30 = malloc(sizeof(*ctx_0_30))) == NULL) | ||
1182 | + return VA_STATUS_ERROR_ALLOCATION_FAILED; | ||
1183 | + memcpy(ctx_0_30, compat_ctx, sizeof(*ctx_0_30)); | ||
1184 | + va_compat_translate_VADriverContext_0_30(compat, ctx_0_30); | ||
1185 | + compat->compat_ctx = ctx_0_30; | ||
1186 | + COPY_FIELD(ctx, ctx_0_30, version_major); | ||
1187 | + COPY_FIELD(ctx, ctx_0_30, version_minor); | ||
1188 | + COPY_FIELD(ctx, ctx_0_30, max_profiles); | ||
1189 | + COPY_FIELD(ctx, ctx_0_30, max_entrypoints); | ||
1190 | + COPY_FIELD(ctx, ctx_0_30, max_attributes); | ||
1191 | + COPY_FIELD(ctx, ctx_0_30, max_image_formats); | ||
1192 | + COPY_FIELD(ctx, ctx_0_30, max_subpic_formats); | ||
1193 | + COPY_FIELD(ctx, ctx_0_30, max_display_attributes); | ||
1194 | + COPY_FIELD(ctx, ctx_0_30, str_vendor); | ||
1195 | + break; | ||
1196 | + case VA_MINOR_VERSION: | ||
1197 | + va_compat_translate_VADriverContext(compat, compat_ctx); | ||
1198 | + compat->compat_ctx = compat_ctx; | ||
1199 | + break; | ||
1200 | + default: | ||
1201 | + ASSERT(compat_version == 0); | ||
1202 | + return VA_STATUS_ERROR_UNKNOWN; | ||
1203 | + } | ||
1204 | + | ||
1205 | + va_compat_init_VADriverVTable(ctx, compat_version); | ||
1206 | + return VA_STATUS_SUCCESS; | ||
1207 | +} | ||
1208 | + | ||
1209 | +VAStatus va_compat_fini(VADisplay dpy) | ||
1210 | +{ | ||
1211 | + VADriverContextP ctx = CTX(dpy); | ||
1212 | + VACompatContextP compat = ctx->compat; | ||
1213 | + int i; | ||
1214 | + | ||
1215 | + if (compat == NULL) | ||
1216 | + return VA_STATUS_SUCCESS; | ||
1217 | + | ||
1218 | + if (compat->driver_name) | ||
1219 | + { | ||
1220 | + free(compat->driver_name); | ||
1221 | + compat->driver_name = NULL; | ||
1222 | + } | ||
1223 | + | ||
1224 | + if (compat->buffers) | ||
1225 | + { | ||
1226 | + for (i = 0; i < compat->buffers_count_max; i++) | ||
1227 | + { | ||
1228 | + if (compat->buffers[i].id) | ||
1229 | + va_DestroyBufferCompat(ctx, compat->buffers[i].id); | ||
1230 | + } | ||
1231 | + free(compat->buffers); | ||
1232 | + compat->buffers = NULL; | ||
1233 | + } | ||
1234 | + | ||
1235 | + if (compat->compat_ctx && compat->compat_version != VA_MINOR_VERSION) | ||
1236 | + { | ||
1237 | + free(compat->compat_ctx); | ||
1238 | + compat->compat_ctx = NULL; | ||
1239 | + } | ||
1240 | + | ||
1241 | + if (compat->context_map) | ||
1242 | + { | ||
1243 | + VAContextMapP d, m = compat->context_map; | ||
1244 | + while (m) { | ||
1245 | + d = m; | ||
1246 | + m = m->next; | ||
1247 | + free(d); | ||
1248 | + } | ||
1249 | + } | ||
1250 | + compat->last_context_map_match = NULL; | ||
1251 | + | ||
1252 | + free(compat); | ||
1253 | + ctx->compat = NULL; | ||
1254 | + return VA_STATUS_SUCCESS; | ||
1255 | +} | ||
1256 | diff --git a/src/va_compat.h b/src/va_compat.h | ||
1257 | new file mode 100644 | ||
1258 | index 0000000..2c9d801 | ||
1259 | --- /dev/null | ||
1260 | +++ b/src/va_compat.h | ||
1261 | @@ -0,0 +1,1467 @@ | ||
1262 | +/* | ||
1263 | + * Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved. | ||
1264 | + * | ||
1265 | + * Permission is hereby granted, free of charge, to any person obtaining a | ||
1266 | + * copy of this software and associated documentation files (the | ||
1267 | + * "Software"), to deal in the Software without restriction, including | ||
1268 | + * without limitation the rights to use, copy, modify, merge, publish, | ||
1269 | + * distribute, sub license, and/or sell copies of the Software, and to | ||
1270 | + * permit persons to whom the Software is furnished to do so, subject to | ||
1271 | + * the following conditions: | ||
1272 | + * | ||
1273 | + * The above copyright notice and this permission notice (including the | ||
1274 | + * next paragraph) shall be included in all copies or substantial portions | ||
1275 | + * of the Software. | ||
1276 | + * | ||
1277 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
1278 | + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
1279 | + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. | ||
1280 | + * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR | ||
1281 | + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
1282 | + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
1283 | + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
1284 | + */ | ||
1285 | + | ||
1286 | +#ifndef VA_COMPAT_H | ||
1287 | +#define VA_COMPAT_H | ||
1288 | + | ||
1289 | +VAStatus va_compat_init(VADisplay dpy, int compat_version, void *compat_ctx); | ||
1290 | +VAStatus va_compat_fini(VADisplay dpy); | ||
1291 | + | ||
1292 | +/* H.264 Picture (0.29) */ | ||
1293 | +typedef struct _VAPictureH264_0_29 | ||
1294 | +{ | ||
1295 | + VASurfaceID picture_id; | ||
1296 | + unsigned int flags; | ||
1297 | + unsigned int TopFieldOrderCnt; | ||
1298 | + unsigned int BottomFieldOrderCnt; | ||
1299 | +} VAPictureH264_0_29; | ||
1300 | + | ||
1301 | +/* H.264 Picture Parameter Buffer (0.29) */ | ||
1302 | +typedef struct _VAPictureParameterBufferH264_0_29 | ||
1303 | +{ | ||
1304 | + VAPictureH264_0_29 CurrPic; | ||
1305 | + VAPictureH264_0_29 ReferenceFrames[16]; /* in DPB */ | ||
1306 | + unsigned short picture_width_in_mbs_minus1; | ||
1307 | + unsigned short picture_height_in_mbs_minus1; | ||
1308 | + unsigned char bit_depth_luma_minus8; | ||
1309 | + unsigned char bit_depth_chroma_minus8; | ||
1310 | + unsigned char num_ref_frames; | ||
1311 | + union { | ||
1312 | + struct { | ||
1313 | + unsigned char chroma_format_idc : 2; | ||
1314 | + unsigned char residual_colour_transform_flag : 1; | ||
1315 | + unsigned char frame_mbs_only_flag : 1; | ||
1316 | + unsigned char mb_adaptive_frame_field_flag : 1; | ||
1317 | + unsigned char direct_8x8_inference_flag : 1; | ||
1318 | + unsigned char MinLumaBiPredSize8x8 : 1; /* see A.3.3.2 */ | ||
1319 | + }; | ||
1320 | + unsigned char seq_fields; | ||
1321 | + }; | ||
1322 | + unsigned char num_slice_groups_minus1; | ||
1323 | + unsigned char slice_group_map_type; | ||
1324 | + signed char pic_init_qp_minus26; | ||
1325 | + signed char chroma_qp_index_offset; | ||
1326 | + signed char second_chroma_qp_index_offset; | ||
1327 | + union { | ||
1328 | + struct { | ||
1329 | + unsigned char entropy_coding_mode_flag : 1; | ||
1330 | + unsigned char weighted_pred_flag : 1; | ||
1331 | + unsigned char weighted_bipred_idc : 2; | ||
1332 | + unsigned char transform_8x8_mode_flag : 1; | ||
1333 | + unsigned char field_pic_flag : 1; | ||
1334 | + unsigned char constrained_intra_pred_flag : 1; | ||
1335 | + }; | ||
1336 | + unsigned char pic_fields; | ||
1337 | + }; | ||
1338 | + unsigned short frame_num; | ||
1339 | +} VAPictureParameterBufferH264_0_29; | ||
1340 | + | ||
1341 | +/* H.264 Slice Parameter Buffer (0.29) */ | ||
1342 | +typedef struct _VASliceParameterBufferH264_0_29 | ||
1343 | +{ | ||
1344 | + unsigned int slice_data_size;/* number of bytes in the slice data buffer for this slice */ | ||
1345 | + unsigned int slice_data_offset;/* the offset to the NAL start code for this slice */ | ||
1346 | + unsigned int slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX defintions */ | ||
1347 | + unsigned short slice_data_bit_offset; /* bit offset from NAL start code to the beginning of slice data */ | ||
1348 | + unsigned short first_mb_in_slice; | ||
1349 | + unsigned char slice_type; | ||
1350 | + unsigned char direct_spatial_mv_pred_flag; | ||
1351 | + unsigned char num_ref_idx_l0_active_minus1; | ||
1352 | + unsigned char num_ref_idx_l1_active_minus1; | ||
1353 | + unsigned char cabac_init_idc; | ||
1354 | + char slice_qp_delta; | ||
1355 | + unsigned char disable_deblocking_filter_idc; | ||
1356 | + char slice_alpha_c0_offset_div2; | ||
1357 | + char slice_beta_offset_div2; | ||
1358 | + VAPictureH264_0_29 RefPicList0[32]; /* See 8.2.4.2 */ | ||
1359 | + VAPictureH264_0_29 RefPicList1[32]; /* See 8.2.4.2 */ | ||
1360 | + unsigned char luma_log2_weight_denom; | ||
1361 | + unsigned char chroma_log2_weight_denom; | ||
1362 | + unsigned char luma_weight_l0_flag; | ||
1363 | + short luma_weight_l0[32]; | ||
1364 | + short luma_offset_l0[32]; | ||
1365 | + unsigned char chroma_weight_l0_flag; | ||
1366 | + short chroma_weight_l0[32][2]; | ||
1367 | + short chroma_offset_l0[32][2]; | ||
1368 | + unsigned char luma_weight_l1_flag; | ||
1369 | + short luma_weight_l1[32]; | ||
1370 | + short luma_offset_l1[32]; | ||
1371 | + unsigned char chroma_weight_l1_flag; | ||
1372 | + short chroma_weight_l1[32][2]; | ||
1373 | + short chroma_offset_l1[32][2]; | ||
1374 | +} VASliceParameterBufferH264_0_29; | ||
1375 | + | ||
1376 | +/* VC-1 Picture Parameter Buffer (0.29) */ | ||
1377 | +typedef struct _VAPictureParameterBufferVC1_0_29 | ||
1378 | +{ | ||
1379 | + VASurfaceID forward_reference_picture; | ||
1380 | + VASurfaceID backward_reference_picture; | ||
1381 | + /* if out-of-loop post-processing is done on the render | ||
1382 | + target, then we need to keep the in-loop decoded | ||
1383 | + picture as a reference picture */ | ||
1384 | + VASurfaceID inloop_decoded_picture; | ||
1385 | + | ||
1386 | + /* sequence layer for AP or meta data for SP and MP */ | ||
1387 | + union { | ||
1388 | + struct { | ||
1389 | + unsigned char interlace : 1; /* SEQUENCE_LAYER::INTERLACE */ | ||
1390 | + unsigned char syncmarker : 1;/* METADATA::SYNCMARKER */ | ||
1391 | + unsigned char overlap : 1;/* METADATA::OVERLAP */ | ||
1392 | + }; | ||
1393 | + unsigned char sequence_fields; | ||
1394 | + }; | ||
1395 | + | ||
1396 | + unsigned short coded_width; /* ENTRY_POINT_LAYER::CODED_WIDTH */ | ||
1397 | + unsigned short coded_height; /* ENTRY_POINT_LAYER::CODED_HEIGHT */ | ||
1398 | + unsigned char closed_entry; /* ENTRY_POINT_LAYER::CLOSED_ENTRY */ | ||
1399 | + unsigned char broken_link; /* ENTRY_POINT_LAYER::BROKEN_LINK */ | ||
1400 | + unsigned char loopfilter; /* ENTRY_POINT_LAYER::LOOPFILTER */ | ||
1401 | + unsigned char conditional_overlap_flag; /* ENTRY_POINT_LAYER::CONDOVER */ | ||
1402 | + unsigned char fast_uvmc_flag; /* ENTRY_POINT_LAYER::FASTUVMC */ | ||
1403 | + union { | ||
1404 | + struct { | ||
1405 | + unsigned char range_mapping_luma_flag: 1; /* ENTRY_POINT_LAYER::RANGE_MAPY_FLAG */ | ||
1406 | + unsigned char range_mapping_luma: 3; /* ENTRY_POINT_LAYER::RANGE_MAPY */ | ||
1407 | + unsigned char range_mapping_chroma_flag: 1; /* ENTRY_POINT_LAYER::RANGE_MAPUV_FLAG */ | ||
1408 | + unsigned char range_mapping_chroma: 3; /* ENTRY_POINT_LAYER::RANGE_MAPUV */ | ||
1409 | + }; | ||
1410 | + unsigned char range_mapping_fields; | ||
1411 | + }; | ||
1412 | + | ||
1413 | + unsigned char b_picture_fraction; /* PICTURE_LAYER::BFRACTION */ | ||
1414 | + unsigned char cbp_table; /* PICTURE_LAYER::CBPTAB/ICBPTAB */ | ||
1415 | + unsigned char mb_mode_table; /* PICTURE_LAYER::MBMODETAB */ | ||
1416 | + unsigned char range_reduction_frame;/* PICTURE_LAYER::RANGEREDFRM */ | ||
1417 | + unsigned char rounding_control; /* PICTURE_LAYER::RNDCTRL */ | ||
1418 | + unsigned char post_processing; /* PICTURE_LAYER::POSTPROC */ | ||
1419 | + unsigned char picture_resolution_index; /* PICTURE_LAYER::RESPIC */ | ||
1420 | + unsigned char luma_scale; /* PICTURE_LAYER::LUMSCALE */ | ||
1421 | + unsigned char luma_shift; /* PICTURE_LAYER::LUMSHIFT */ | ||
1422 | + union { | ||
1423 | + struct { | ||
1424 | + unsigned char picture_type : 2; /* PICTURE_LAYER::PTYPE */ | ||
1425 | + unsigned char frame_coding_mode : 3;/* PICTURE_LAYER::FCM */ | ||
1426 | + unsigned char top_field_first : 1;/* PICTURE_LAYER::TFF */ | ||
1427 | + unsigned char is_first_field : 1; /* set to 1 if it is the first field */ | ||
1428 | + unsigned char intensity_compensation: 1;/* PICTURE_LAYER::INTCOMP */ | ||
1429 | + }; | ||
1430 | + unsigned char picture_fields; | ||
1431 | + }; | ||
1432 | + union { | ||
1433 | + struct { | ||
1434 | + unsigned char mv_type_mb : 1; /* PICTURE::MVTYPEMB */ | ||
1435 | + unsigned char direct_mb : 1; /* PICTURE::DIRECTMB */ | ||
1436 | + unsigned char skip_mb : 1; /* PICTURE::SKIPMB */ | ||
1437 | + unsigned char field_tx : 1; /* PICTURE::FIELDTX */ | ||
1438 | + unsigned char forward_mb : 1; /* PICTURE::FORWARDMB */ | ||
1439 | + unsigned char ac_pred : 1; /* PICTURE::ACPRED */ | ||
1440 | + unsigned char overflags : 1; /* PICTURE::OVERFLAGS */ | ||
1441 | + }; | ||
1442 | + unsigned char raw_coding_flag; | ||
1443 | + }; | ||
1444 | + union { | ||
1445 | + struct { | ||
1446 | + unsigned char bp_mv_type_mb : 1; /* PICTURE::MVTYPEMB */ | ||
1447 | + unsigned char bp_direct_mb : 1; /* PICTURE::DIRECTMB */ | ||
1448 | + unsigned char bp_skip_mb : 1; /* PICTURE::SKIPMB */ | ||
1449 | + unsigned char bp_field_tx : 1; /* PICTURE::FIELDTX */ | ||
1450 | + unsigned char bp_forward_mb : 1; /* PICTURE::FORWARDMB */ | ||
1451 | + unsigned char bp_ac_pred : 1; /* PICTURE::ACPRED */ | ||
1452 | + unsigned char bp_overflags : 1; /* PICTURE::OVERFLAGS */ | ||
1453 | + }; | ||
1454 | + unsigned char bitplane_present_flag; /* signal what bitplane is being passed via the bitplane buffer */ | ||
1455 | + }; | ||
1456 | + union { | ||
1457 | + struct { | ||
1458 | + unsigned char reference_distance_flag : 1;/* PICTURE_LAYER::REFDIST_FLAG */ | ||
1459 | + unsigned char reference_distance : 5;/* PICTURE_LAYER::REFDIST */ | ||
1460 | + unsigned char num_reference_pictures: 1;/* PICTURE_LAYER::NUMREF */ | ||
1461 | + unsigned char reference_field_pic_indicator : 1;/* PICTURE_LAYER::REFFIELD */ | ||
1462 | + }; | ||
1463 | + unsigned short reference_fields; | ||
1464 | + }; | ||
1465 | + union { | ||
1466 | + struct { | ||
1467 | + VAMvModeVC1 mv_mode : 3; /* PICTURE_LAYER::MVMODE */ | ||
1468 | + VAMvModeVC1 mv_mode2 : 3; /* PICTURE_LAYER::MVMODE2 */ | ||
1469 | + unsigned char mv_table : 3; /* PICTURE_LAYER::MVTAB/IMVTAB */ | ||
1470 | + unsigned char two_mv_block_pattern_table: 2; /* PICTURE_LAYER::2MVBPTAB */ | ||
1471 | + unsigned char four_mv_switch : 1; /* PICTURE_LAYER::4MVSWITCH */ | ||
1472 | + unsigned char four_mv_block_pattern_table : 2; /* PICTURE_LAYER::4MVBPTAB */ | ||
1473 | + unsigned char extended_mv_flag : 1; /* ENTRY_POINT_LAYER::EXTENDED_MV */ | ||
1474 | + unsigned char extended_mv_range : 2; /* PICTURE_LAYER::MVRANGE */ | ||
1475 | + unsigned char extended_dmv_flag : 1; /* ENTRY_POINT_LAYER::EXTENDED_DMV */ | ||
1476 | + unsigned char extended_dmv_range : 2; /* PICTURE_LAYER::DMVRANGE */ | ||
1477 | + }; | ||
1478 | + unsigned int mv_fields; | ||
1479 | + }; | ||
1480 | + union { | ||
1481 | + struct { | ||
1482 | + unsigned char dquant : 2; /* ENTRY_POINT_LAYER::DQUANT */ | ||
1483 | + unsigned char quantizer : 2; /* ENTRY_POINT_LAYER::QUANTIZER */ | ||
1484 | + unsigned char half_qp : 1; /* PICTURE_LAYER::HALFQP */ | ||
1485 | + unsigned char pic_quantizer_scale : 5;/* PICTURE_LAYER::PQUANT */ | ||
1486 | + unsigned char pic_quantizer_type : 1;/* PICTURE_LAYER::PQUANTIZER */ | ||
1487 | + unsigned char dq_frame : 1; /* VOPDQUANT::DQUANTFRM */ | ||
1488 | + unsigned char dq_profile : 2; /* VOPDQUANT::DQPROFILE */ | ||
1489 | + unsigned char dq_sb_edge : 2; /* VOPDQUANT::DQSBEDGE */ | ||
1490 | + unsigned char dq_db_edge : 2; /* VOPDQUANT::DQDBEDGE */ | ||
1491 | + unsigned char dq_binary_level : 1; /* VOPDQUANT::DQBILEVEL */ | ||
1492 | + unsigned char alt_pic_quantizer : 5;/* VOPDQUANT::ALTPQUANT */ | ||
1493 | + }; | ||
1494 | + unsigned long pic_quantizer_fields; | ||
1495 | + }; | ||
1496 | + union { | ||
1497 | + struct { | ||
1498 | + unsigned char variable_sized_transform_flag : 1;/* ENTRY_POINT_LAYER::VSTRANSFORM */ | ||
1499 | + unsigned char mb_level_transform_type_flag : 1;/* PICTURE_LAYER::TTMBF */ | ||
1500 | + unsigned char frame_level_transform_type : 2;/* PICTURE_LAYER::TTFRM */ | ||
1501 | + unsigned char transform_ac_codingset_idx1 : 2;/* PICTURE_LAYER::TRANSACFRM */ | ||
1502 | + unsigned char transform_ac_codingset_idx2 : 2;/* PICTURE_LAYER::TRANSACFRM2 */ | ||
1503 | + unsigned char intra_transform_dc_table : 1;/* PICTURE_LAYER::TRANSDCTAB */ | ||
1504 | + }; | ||
1505 | + unsigned short transform_fields; | ||
1506 | + }; | ||
1507 | +} VAPictureParameterBufferVC1_0_29; | ||
1508 | + | ||
1509 | +/* MPEG-2 Picture Parameter Buffer (0.29) */ | ||
1510 | +typedef struct _VAPictureParameterBufferMPEG2_0_29 | ||
1511 | +{ | ||
1512 | + unsigned short horizontal_size; | ||
1513 | + unsigned short vertical_size; | ||
1514 | + VASurfaceID forward_reference_picture; | ||
1515 | + VASurfaceID backward_reference_picture; | ||
1516 | + /* meanings of the following fields are the same as in the standard */ | ||
1517 | + int picture_coding_type; | ||
1518 | + int f_code; /* pack all four fcode into this */ | ||
1519 | + union { | ||
1520 | + struct { | ||
1521 | + unsigned char intra_dc_precision : 2; | ||
1522 | + unsigned char picture_structure : 2; | ||
1523 | + unsigned char top_field_first : 1; | ||
1524 | + unsigned char frame_pred_frame_dct : 1; | ||
1525 | + unsigned char concealment_motion_vectors : 1; | ||
1526 | + unsigned char q_scale_type : 1; | ||
1527 | + unsigned char intra_vlc_format : 1; | ||
1528 | + unsigned char alternate_scan : 1; | ||
1529 | + unsigned char repeat_first_field : 1; | ||
1530 | + unsigned char progressive_frame : 1; | ||
1531 | + unsigned char is_first_field : 1; /* indicate whether the current field | ||
1532 | + * is the first field for field picture | ||
1533 | + */ | ||
1534 | + }; | ||
1535 | + unsigned int picture_coding_extension; | ||
1536 | + }; | ||
1537 | +} VAPictureParameterBufferMPEG2_0_29; | ||
1538 | + | ||
1539 | +/* MPEG-2 Slice Parameter Buffer (0.29) */ | ||
1540 | +typedef struct _VASliceParameterBufferMPEG2_0_29 | ||
1541 | +{ | ||
1542 | + unsigned int slice_data_size;/* number of bytes in the slice data buffer for this slice */ | ||
1543 | + unsigned int slice_data_offset;/* the offset to the first byte of slice data */ | ||
1544 | + unsigned int slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX defintions */ | ||
1545 | + unsigned int macroblock_offset;/* the offset to the first bit of MB from the first byte of slice data */ | ||
1546 | + unsigned int slice_vertical_position; | ||
1547 | + int quantiser_scale_code; | ||
1548 | + int intra_slice_flag; | ||
1549 | +} VASliceParameterBufferMPEG2_0_29; | ||
1550 | + | ||
1551 | +/* MPEG-4 Picture Parameter Buffer (0.29) */ | ||
1552 | +typedef struct _VAPictureParameterBufferMPEG4_0_29 | ||
1553 | +{ | ||
1554 | + unsigned short vop_width; | ||
1555 | + unsigned short vop_height; | ||
1556 | + VASurfaceID forward_reference_picture; | ||
1557 | + VASurfaceID backward_reference_picture; | ||
1558 | + union { | ||
1559 | + struct { | ||
1560 | + unsigned char short_video_header : 1; | ||
1561 | + unsigned char chroma_format : 2; | ||
1562 | + unsigned char interlaced : 1; | ||
1563 | + unsigned char obmc_disable : 1; | ||
1564 | + unsigned char sprite_enable : 2; | ||
1565 | + unsigned char sprite_warping_accuracy : 2; | ||
1566 | + unsigned char quant_type : 1; | ||
1567 | + unsigned char quarter_sample : 1; | ||
1568 | + unsigned char data_partitioned : 1; | ||
1569 | + unsigned char reversible_vlc : 1; | ||
1570 | + }; | ||
1571 | + unsigned short vol_fields; | ||
1572 | + }; | ||
1573 | + unsigned char no_of_sprite_warping_points; | ||
1574 | + short sprite_trajectory_du[3]; | ||
1575 | + short sprite_trajectory_dv[3]; | ||
1576 | + unsigned char quant_precision; | ||
1577 | + union { | ||
1578 | + struct { | ||
1579 | + unsigned char vop_coding_type : 2; | ||
1580 | + unsigned char backward_reference_vop_coding_type : 2; | ||
1581 | + unsigned char vop_rounding_type : 1; | ||
1582 | + unsigned char intra_dc_vlc_thr : 3; | ||
1583 | + unsigned char top_field_first : 1; | ||
1584 | + unsigned char alternate_vertical_scan_flag : 1; | ||
1585 | + }; | ||
1586 | + unsigned short vop_fields; | ||
1587 | + }; | ||
1588 | + unsigned char vop_fcode_forward; | ||
1589 | + unsigned char vop_fcode_backward; | ||
1590 | + /* short header related */ | ||
1591 | + unsigned char num_gobs_in_vop; | ||
1592 | + unsigned char num_macroblocks_in_gob; | ||
1593 | + /* for direct mode prediction */ | ||
1594 | + short TRB; | ||
1595 | + short TRD; | ||
1596 | +} VAPictureParameterBufferMPEG4_0_29; | ||
1597 | + | ||
1598 | +/* H.264 Picture (0.30) */ | ||
1599 | +typedef struct _VAPictureH264_0_30 | ||
1600 | +{ | ||
1601 | + VASurfaceID picture_id; | ||
1602 | + unsigned int flags; | ||
1603 | + unsigned int TopFieldOrderCnt; | ||
1604 | + unsigned int BottomFieldOrderCnt; | ||
1605 | +} VAPictureH264_0_30; | ||
1606 | + | ||
1607 | +/* H.264 Picture Parameter Buffer (0.30) */ | ||
1608 | +typedef struct _VAPictureParameterBufferH264_0_30 | ||
1609 | +{ | ||
1610 | + VAPictureH264 CurrPic; | ||
1611 | + VAPictureH264 ReferenceFrames[16]; /* in DPB */ | ||
1612 | + unsigned short picture_width_in_mbs_minus1; | ||
1613 | + unsigned short picture_height_in_mbs_minus1; | ||
1614 | + unsigned char bit_depth_luma_minus8; | ||
1615 | + unsigned char bit_depth_chroma_minus8; | ||
1616 | + unsigned char num_ref_frames; | ||
1617 | + union { | ||
1618 | + struct { | ||
1619 | + unsigned char chroma_format_idc : 2; | ||
1620 | + unsigned char residual_colour_transform_flag : 1; | ||
1621 | + unsigned char frame_mbs_only_flag : 1; | ||
1622 | + unsigned char mb_adaptive_frame_field_flag : 1; | ||
1623 | + unsigned char direct_8x8_inference_flag : 1; | ||
1624 | + unsigned char MinLumaBiPredSize8x8 : 1; /* see A.3.3.2 */ | ||
1625 | + } bits; | ||
1626 | + unsigned char value; | ||
1627 | + } seq_fields; | ||
1628 | + unsigned char num_slice_groups_minus1; | ||
1629 | + unsigned char slice_group_map_type; | ||
1630 | + signed char pic_init_qp_minus26; | ||
1631 | + signed char chroma_qp_index_offset; | ||
1632 | + signed char second_chroma_qp_index_offset; | ||
1633 | + union { | ||
1634 | + struct { | ||
1635 | + unsigned char entropy_coding_mode_flag : 1; | ||
1636 | + unsigned char weighted_pred_flag : 1; | ||
1637 | + unsigned char weighted_bipred_idc : 2; | ||
1638 | + unsigned char transform_8x8_mode_flag : 1; | ||
1639 | + unsigned char field_pic_flag : 1; | ||
1640 | + unsigned char constrained_intra_pred_flag : 1; | ||
1641 | + } bits; | ||
1642 | + unsigned char value; | ||
1643 | + } pic_fields; | ||
1644 | + unsigned short frame_num; | ||
1645 | +} VAPictureParameterBufferH264_0_30; | ||
1646 | + | ||
1647 | +/* H.264 Slice Parameter Buffer (0.30) */ | ||
1648 | +typedef struct _VASliceParameterBufferH264_0_30 | ||
1649 | +{ | ||
1650 | + unsigned int slice_data_size;/* number of bytes in the slice data buffer for this slice */ | ||
1651 | + unsigned int slice_data_offset;/* the offset to the NAL start code for this slice */ | ||
1652 | + unsigned int slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX defintions */ | ||
1653 | + unsigned short slice_data_bit_offset; /* bit offset from NAL start code to the beginning of slice data */ | ||
1654 | + unsigned short first_mb_in_slice; | ||
1655 | + unsigned char slice_type; | ||
1656 | + unsigned char direct_spatial_mv_pred_flag; | ||
1657 | + unsigned char num_ref_idx_l0_active_minus1; | ||
1658 | + unsigned char num_ref_idx_l1_active_minus1; | ||
1659 | + unsigned char cabac_init_idc; | ||
1660 | + char slice_qp_delta; | ||
1661 | + unsigned char disable_deblocking_filter_idc; | ||
1662 | + char slice_alpha_c0_offset_div2; | ||
1663 | + char slice_beta_offset_div2; | ||
1664 | + VAPictureH264 RefPicList0[32]; /* See 8.2.4.2 */ | ||
1665 | + VAPictureH264 RefPicList1[32]; /* See 8.2.4.2 */ | ||
1666 | + unsigned char luma_log2_weight_denom; | ||
1667 | + unsigned char chroma_log2_weight_denom; | ||
1668 | + unsigned char luma_weight_l0_flag; | ||
1669 | + short luma_weight_l0[32]; | ||
1670 | + short luma_offset_l0[32]; | ||
1671 | + unsigned char chroma_weight_l0_flag; | ||
1672 | + short chroma_weight_l0[32][2]; | ||
1673 | + short chroma_offset_l0[32][2]; | ||
1674 | + unsigned char luma_weight_l1_flag; | ||
1675 | + short luma_weight_l1[32]; | ||
1676 | + short luma_offset_l1[32]; | ||
1677 | + unsigned char chroma_weight_l1_flag; | ||
1678 | + short chroma_weight_l1[32][2]; | ||
1679 | + short chroma_offset_l1[32][2]; | ||
1680 | +} VASliceParameterBufferH264_0_30; | ||
1681 | + | ||
1682 | +/* VC-1 Picture Parameter Buffer (0.30) */ | ||
1683 | +typedef struct _VAPictureParameterBufferVC1_0_30 | ||
1684 | +{ | ||
1685 | + VASurfaceID forward_reference_picture; | ||
1686 | + VASurfaceID backward_reference_picture; | ||
1687 | + /* if out-of-loop post-processing is done on the render | ||
1688 | + target, then we need to keep the in-loop decoded | ||
1689 | + picture as a reference picture */ | ||
1690 | + VASurfaceID inloop_decoded_picture; | ||
1691 | + | ||
1692 | + /* sequence layer for AP or meta data for SP and MP */ | ||
1693 | + union { | ||
1694 | + struct { | ||
1695 | + unsigned char interlace : 1; /* SEQUENCE_LAYER::INTERLACE */ | ||
1696 | + unsigned char syncmarker : 1;/* METADATA::SYNCMARKER */ | ||
1697 | + unsigned char overlap : 1;/* METADATA::OVERLAP */ | ||
1698 | + } bits; | ||
1699 | + unsigned char value; | ||
1700 | + } sequence_fields; | ||
1701 | + | ||
1702 | + unsigned short coded_width; /* ENTRY_POINT_LAYER::CODED_WIDTH */ | ||
1703 | + unsigned short coded_height; /* ENTRY_POINT_LAYER::CODED_HEIGHT */ | ||
1704 | + unsigned char closed_entry; /* ENTRY_POINT_LAYER::CLOSED_ENTRY */ | ||
1705 | + unsigned char broken_link; /* ENTRY_POINT_LAYER::BROKEN_LINK */ | ||
1706 | + unsigned char loopfilter; /* ENTRY_POINT_LAYER::LOOPFILTER */ | ||
1707 | + unsigned char conditional_overlap_flag; /* ENTRY_POINT_LAYER::CONDOVER */ | ||
1708 | + unsigned char fast_uvmc_flag; /* ENTRY_POINT_LAYER::FASTUVMC */ | ||
1709 | + union { | ||
1710 | + struct { | ||
1711 | + unsigned char luma_flag : 1; /* ENTRY_POINT_LAYER::RANGE_MAPY_FLAG */ | ||
1712 | + unsigned char luma : 3; /* ENTRY_POINT_LAYER::RANGE_MAPY */ | ||
1713 | + unsigned char chroma_flag : 1; /* ENTRY_POINT_LAYER::RANGE_MAPUV_FLAG */ | ||
1714 | + unsigned char chroma : 3; /* ENTRY_POINT_LAYER::RANGE_MAPUV */ | ||
1715 | + } bits; | ||
1716 | + unsigned char value; | ||
1717 | + } range_mapping_fields; | ||
1718 | + | ||
1719 | + unsigned char b_picture_fraction; /* PICTURE_LAYER::BFRACTION */ | ||
1720 | + unsigned char cbp_table; /* PICTURE_LAYER::CBPTAB/ICBPTAB */ | ||
1721 | + unsigned char mb_mode_table; /* PICTURE_LAYER::MBMODETAB */ | ||
1722 | + unsigned char range_reduction_frame;/* PICTURE_LAYER::RANGEREDFRM */ | ||
1723 | + unsigned char rounding_control; /* PICTURE_LAYER::RNDCTRL */ | ||
1724 | + unsigned char post_processing; /* PICTURE_LAYER::POSTPROC */ | ||
1725 | + unsigned char picture_resolution_index; /* PICTURE_LAYER::RESPIC */ | ||
1726 | + unsigned char luma_scale; /* PICTURE_LAYER::LUMSCALE */ | ||
1727 | + unsigned char luma_shift; /* PICTURE_LAYER::LUMSHIFT */ | ||
1728 | + union { | ||
1729 | + struct { | ||
1730 | + unsigned char picture_type : 2; /* PICTURE_LAYER::PTYPE */ | ||
1731 | + unsigned char frame_coding_mode : 3; /* PICTURE_LAYER::FCM */ | ||
1732 | + unsigned char top_field_first : 1; /* PICTURE_LAYER::TFF */ | ||
1733 | + unsigned char is_first_field : 1; /* set to 1 if it is the first field */ | ||
1734 | + unsigned char intensity_compensation : 1; /* PICTURE_LAYER::INTCOMP */ | ||
1735 | + } bits; | ||
1736 | + unsigned char value; | ||
1737 | + } picture_fields; | ||
1738 | + union { | ||
1739 | + struct { | ||
1740 | + unsigned char mv_type_mb : 1; /* PICTURE::MVTYPEMB */ | ||
1741 | + unsigned char direct_mb : 1; /* PICTURE::DIRECTMB */ | ||
1742 | + unsigned char skip_mb : 1; /* PICTURE::SKIPMB */ | ||
1743 | + unsigned char field_tx : 1; /* PICTURE::FIELDTX */ | ||
1744 | + unsigned char forward_mb : 1; /* PICTURE::FORWARDMB */ | ||
1745 | + unsigned char ac_pred : 1; /* PICTURE::ACPRED */ | ||
1746 | + unsigned char overflags : 1; /* PICTURE::OVERFLAGS */ | ||
1747 | + } flags; | ||
1748 | + unsigned char value; | ||
1749 | + } raw_coding; | ||
1750 | + union { | ||
1751 | + struct { | ||
1752 | + unsigned char bp_mv_type_mb : 1; /* PICTURE::MVTYPEMB */ | ||
1753 | + unsigned char bp_direct_mb : 1; /* PICTURE::DIRECTMB */ | ||
1754 | + unsigned char bp_skip_mb : 1; /* PICTURE::SKIPMB */ | ||
1755 | + unsigned char bp_field_tx : 1; /* PICTURE::FIELDTX */ | ||
1756 | + unsigned char bp_forward_mb : 1; /* PICTURE::FORWARDMB */ | ||
1757 | + unsigned char bp_ac_pred : 1; /* PICTURE::ACPRED */ | ||
1758 | + unsigned char bp_overflags : 1; /* PICTURE::OVERFLAGS */ | ||
1759 | + } flags; | ||
1760 | + unsigned char value; | ||
1761 | + } bitplane_present; /* signal what bitplane is being passed via the bitplane buffer */ | ||
1762 | + union { | ||
1763 | + struct { | ||
1764 | + unsigned char reference_distance_flag : 1;/* PICTURE_LAYER::REFDIST_FLAG */ | ||
1765 | + unsigned char reference_distance : 5;/* PICTURE_LAYER::REFDIST */ | ||
1766 | + unsigned char num_reference_pictures: 1;/* PICTURE_LAYER::NUMREF */ | ||
1767 | + unsigned char reference_field_pic_indicator : 1;/* PICTURE_LAYER::REFFIELD */ | ||
1768 | + } bits; | ||
1769 | + unsigned short value; | ||
1770 | + } reference_fields; | ||
1771 | + union { | ||
1772 | + struct { | ||
1773 | + unsigned char mv_mode : 3; /* PICTURE_LAYER::MVMODE */ | ||
1774 | + unsigned char mv_mode2 : 3; /* PICTURE_LAYER::MVMODE2 */ | ||
1775 | + unsigned char mv_table : 3; /* PICTURE_LAYER::MVTAB/IMVTAB */ | ||
1776 | + unsigned char two_mv_block_pattern_table: 2; /* PICTURE_LAYER::2MVBPTAB */ | ||
1777 | + unsigned char four_mv_switch : 1; /* PICTURE_LAYER::4MVSWITCH */ | ||
1778 | + unsigned char four_mv_block_pattern_table : 2; /* PICTURE_LAYER::4MVBPTAB */ | ||
1779 | + unsigned char extended_mv_flag : 1; /* ENTRY_POINT_LAYER::EXTENDED_MV */ | ||
1780 | + unsigned char extended_mv_range : 2; /* PICTURE_LAYER::MVRANGE */ | ||
1781 | + unsigned char extended_dmv_flag : 1; /* ENTRY_POCHAR_LAYER::EXTENDED_DMV */ | ||
1782 | + unsigned char extended_dmv_range : 2; /* PICTURE_LAYER::DMVRANGE */ | ||
1783 | + } bits; | ||
1784 | + unsigned int value; | ||
1785 | + } mv_fields; | ||
1786 | + union { | ||
1787 | + struct { | ||
1788 | + unsigned char dquant : 2; /* ENTRY_POINT_LAYER::DQUANT */ | ||
1789 | + unsigned char quantizer : 2; /* ENTRY_POINT_LAYER::QUANTIZER */ | ||
1790 | + unsigned char half_qp : 1; /* PICTURE_LAYER::HALFQP */ | ||
1791 | + unsigned char pic_quantizer_scale : 5;/* PICTURE_LAYER::PQUANT */ | ||
1792 | + unsigned char pic_quantizer_type : 1;/* PICTURE_LAYER::PQUANTIZER */ | ||
1793 | + unsigned char dq_frame : 1; /* VOPDQUANT::DQUANTFRM */ | ||
1794 | + unsigned char dq_profile : 2; /* VOPDQUANT::DQPROFILE */ | ||
1795 | + unsigned char dq_sb_edge : 2; /* VOPDQUANT::DQSBEDGE */ | ||
1796 | + unsigned char dq_db_edge : 2; /* VOPDQUANT::DQDBEDGE */ | ||
1797 | + unsigned char dq_binary_level : 1; /* VOPDQUANT::DQBILEVEL */ | ||
1798 | + unsigned char alt_pic_quantizer : 5;/* VOPDQUANT::ALTPQUANT */ | ||
1799 | + } bits; | ||
1800 | + unsigned long value; | ||
1801 | + } pic_quantizer_fields; | ||
1802 | + union { | ||
1803 | + struct { | ||
1804 | + unsigned char variable_sized_transform_flag : 1;/* ENTRY_POINT_LAYER::VSTRANSFORM */ | ||
1805 | + unsigned char mb_level_transform_type_flag : 1;/* PICTURE_LAYER::TTMBF */ | ||
1806 | + unsigned char frame_level_transform_type : 2;/* PICTURE_LAYER::TTFRM */ | ||
1807 | + unsigned char transform_ac_codingset_idx1 : 2;/* PICTURE_LAYER::TRANSACFRM */ | ||
1808 | + unsigned char transform_ac_codingset_idx2 : 2;/* PICTURE_LAYER::TRANSACFRM2 */ | ||
1809 | + unsigned char intra_transform_dc_table : 1;/* PICTURE_LAYER::TRANSDCTAB */ | ||
1810 | + } bits; | ||
1811 | + unsigned short value; | ||
1812 | + } transform_fields; | ||
1813 | +} VAPictureParameterBufferVC1_0_30; | ||
1814 | + | ||
1815 | +/* MPEG-2 Picture Parameter Buffer (0.30) */ | ||
1816 | +typedef struct _VAPictureParameterBufferMPEG2_0_30 | ||
1817 | +{ | ||
1818 | + unsigned short horizontal_size; | ||
1819 | + unsigned short vertical_size; | ||
1820 | + VASurfaceID forward_reference_picture; | ||
1821 | + VASurfaceID backward_reference_picture; | ||
1822 | + /* meanings of the following fields are the same as in the standard */ | ||
1823 | + int picture_coding_type; | ||
1824 | + int f_code; /* pack all four fcode into this */ | ||
1825 | + union { | ||
1826 | + struct { | ||
1827 | + unsigned int intra_dc_precision : 2; | ||
1828 | + unsigned int picture_structure : 2; | ||
1829 | + unsigned int top_field_first : 1; | ||
1830 | + unsigned int frame_pred_frame_dct : 1; | ||
1831 | + unsigned int concealment_motion_vectors : 1; | ||
1832 | + unsigned int q_scale_type : 1; | ||
1833 | + unsigned int intra_vlc_format : 1; | ||
1834 | + unsigned int alternate_scan : 1; | ||
1835 | + unsigned int repeat_first_field : 1; | ||
1836 | + unsigned int progressive_frame : 1; | ||
1837 | + unsigned int is_first_field : 1; /* indicate whether the current field | ||
1838 | + * is the first field for field picture | ||
1839 | + */ | ||
1840 | + } bits; | ||
1841 | + unsigned int value; | ||
1842 | + } picture_coding_extension; | ||
1843 | +} VAPictureParameterBufferMPEG2_0_30; | ||
1844 | + | ||
1845 | +/* MPEG-2 Slice Parameter Buffer (0.29) */ | ||
1846 | +typedef VASliceParameterBufferMPEG2_0_29 VASliceParameterBufferMPEG2_0_30; | ||
1847 | + | ||
1848 | +/* MPEG-4 Picture Parameter Buffer (0.30) */ | ||
1849 | +typedef struct _VAPictureParameterBufferMPEG4_0_30 | ||
1850 | +{ | ||
1851 | + unsigned short vop_width; | ||
1852 | + unsigned short vop_height; | ||
1853 | + VASurfaceID forward_reference_picture; | ||
1854 | + VASurfaceID backward_reference_picture; | ||
1855 | + union { | ||
1856 | + struct { | ||
1857 | + unsigned char short_video_header : 1; | ||
1858 | + unsigned char chroma_format : 2; | ||
1859 | + unsigned char interlaced : 1; | ||
1860 | + unsigned char obmc_disable : 1; | ||
1861 | + unsigned char sprite_enable : 2; | ||
1862 | + unsigned char sprite_warping_accuracy : 2; | ||
1863 | + unsigned char quant_type : 1; | ||
1864 | + unsigned char quarter_sample : 1; | ||
1865 | + unsigned char data_partitioned : 1; | ||
1866 | + unsigned char reversible_vlc : 1; | ||
1867 | + } bits; | ||
1868 | + unsigned short value; | ||
1869 | + } vol_fields; | ||
1870 | + unsigned char no_of_sprite_warping_points; | ||
1871 | + short sprite_trajectory_du[3]; | ||
1872 | + short sprite_trajectory_dv[3]; | ||
1873 | + unsigned char quant_precision; | ||
1874 | + union { | ||
1875 | + struct { | ||
1876 | + unsigned char vop_coding_type : 2; | ||
1877 | + unsigned char backward_reference_vop_coding_type : 2; | ||
1878 | + unsigned char vop_rounding_type : 1; | ||
1879 | + unsigned char intra_dc_vlc_thr : 3; | ||
1880 | + unsigned char top_field_first : 1; | ||
1881 | + unsigned char alternate_vertical_scan_flag : 1; | ||
1882 | + } bits; | ||
1883 | + unsigned short value; | ||
1884 | + } vop_fields; | ||
1885 | + unsigned char vop_fcode_forward; | ||
1886 | + unsigned char vop_fcode_backward; | ||
1887 | + /* short header related */ | ||
1888 | + unsigned char num_gobs_in_vop; | ||
1889 | + unsigned char num_macroblocks_in_gob; | ||
1890 | + /* for direct mode prediction */ | ||
1891 | + short TRB; | ||
1892 | + short TRD; | ||
1893 | +} VAPictureParameterBufferMPEG4_0_30; | ||
1894 | + | ||
1895 | +/* Encode Slice Parameter Buffer (0.30) */ | ||
1896 | +typedef struct _VAEncSliceParameterBuffer_0_30 | ||
1897 | +{ | ||
1898 | + unsigned int start_row_number; /* starting MB row number for this slice */ | ||
1899 | + unsigned int slice_height; /* slice height measured in MB */ | ||
1900 | + union { | ||
1901 | + struct { | ||
1902 | + unsigned char is_intra : 1; | ||
1903 | + unsigned char disable_deblocking_filter_idc : 2; | ||
1904 | + } bits; | ||
1905 | + unsigned char value; | ||
1906 | + } slice_flags; | ||
1907 | +} VAEncSliceParameterBuffer_0_30; | ||
1908 | + | ||
1909 | +/* MPEG-4 Picture Parameter Buffer (0.31) */ | ||
1910 | +typedef struct _VAPictureParameterBufferMPEG4_0_31 | ||
1911 | +{ | ||
1912 | + unsigned short vop_width; | ||
1913 | + unsigned short vop_height; | ||
1914 | + VASurfaceID forward_reference_picture; | ||
1915 | + VASurfaceID backward_reference_picture; | ||
1916 | + union { | ||
1917 | + struct { | ||
1918 | + unsigned int short_video_header : 1; | ||
1919 | + unsigned int chroma_format : 2; | ||
1920 | + unsigned int interlaced : 1; | ||
1921 | + unsigned int obmc_disable : 1; | ||
1922 | + unsigned int sprite_enable : 2; | ||
1923 | + unsigned int sprite_warping_accuracy : 2; | ||
1924 | + unsigned int quant_type : 1; | ||
1925 | + unsigned int quarter_sample : 1; | ||
1926 | + unsigned int data_partitioned : 1; | ||
1927 | + unsigned int reversible_vlc : 1; | ||
1928 | + } bits; | ||
1929 | + unsigned int value; | ||
1930 | + } vol_fields; | ||
1931 | + unsigned char no_of_sprite_warping_points; | ||
1932 | + short sprite_trajectory_du[3]; | ||
1933 | + short sprite_trajectory_dv[3]; | ||
1934 | + unsigned char quant_precision; | ||
1935 | + union { | ||
1936 | + struct { | ||
1937 | + unsigned int vop_coding_type : 2; | ||
1938 | + unsigned int backward_reference_vop_coding_type : 2; | ||
1939 | + unsigned int vop_rounding_type : 1; | ||
1940 | + unsigned int intra_dc_vlc_thr : 3; | ||
1941 | + unsigned int top_field_first : 1; | ||
1942 | + unsigned int alternate_vertical_scan_flag : 1; | ||
1943 | + } bits; | ||
1944 | + unsigned int value; | ||
1945 | + } vop_fields; | ||
1946 | + unsigned char vop_fcode_forward; | ||
1947 | + unsigned char vop_fcode_backward; | ||
1948 | + /* short header related */ | ||
1949 | + unsigned char num_gobs_in_vop; | ||
1950 | + unsigned char num_macroblocks_in_gob; | ||
1951 | + /* for direct mode prediction */ | ||
1952 | + short TRB; | ||
1953 | + short TRD; | ||
1954 | +} VAPictureParameterBufferMPEG4_0_31; | ||
1955 | + | ||
1956 | +typedef struct VADriverContext_0_29 *VADriverContextP_0_29; | ||
1957 | + | ||
1958 | +/* Driver VTable (0.29) */ | ||
1959 | +struct VADriverVTable_0_29 | ||
1960 | +{ | ||
1961 | + VAStatus (*vaTerminate) ( VADriverContextP_0_29 ctx ); | ||
1962 | + | ||
1963 | + VAStatus (*vaQueryConfigProfiles) ( | ||
1964 | + VADriverContextP_0_29 ctx, | ||
1965 | + VAProfile *profile_list, /* out */ | ||
1966 | + int *num_profiles /* out */ | ||
1967 | + ); | ||
1968 | + | ||
1969 | + VAStatus (*vaQueryConfigEntrypoints) ( | ||
1970 | + VADriverContextP_0_29 ctx, | ||
1971 | + VAProfile profile, | ||
1972 | + VAEntrypoint *entrypoint_list, /* out */ | ||
1973 | + int *num_entrypoints /* out */ | ||
1974 | + ); | ||
1975 | + | ||
1976 | + VAStatus (*vaGetConfigAttributes) ( | ||
1977 | + VADriverContextP_0_29 ctx, | ||
1978 | + VAProfile profile, | ||
1979 | + VAEntrypoint entrypoint, | ||
1980 | + VAConfigAttrib *attrib_list, /* in/out */ | ||
1981 | + int num_attribs | ||
1982 | + ); | ||
1983 | + | ||
1984 | + VAStatus (*vaCreateConfig) ( | ||
1985 | + VADriverContextP_0_29 ctx, | ||
1986 | + VAProfile profile, | ||
1987 | + VAEntrypoint entrypoint, | ||
1988 | + VAConfigAttrib *attrib_list, | ||
1989 | + int num_attribs, | ||
1990 | + VAConfigID *config_id /* out */ | ||
1991 | + ); | ||
1992 | + | ||
1993 | + VAStatus (*vaDestroyConfig) ( | ||
1994 | + VADriverContextP_0_29 ctx, | ||
1995 | + VAConfigID config_id | ||
1996 | + ); | ||
1997 | + | ||
1998 | + VAStatus (*vaQueryConfigAttributes) ( | ||
1999 | + VADriverContextP_0_29 ctx, | ||
2000 | + VAConfigID config_id, | ||
2001 | + VAProfile *profile, /* out */ | ||
2002 | + VAEntrypoint *entrypoint, /* out */ | ||
2003 | + VAConfigAttrib *attrib_list, /* out */ | ||
2004 | + int *num_attribs /* out */ | ||
2005 | + ); | ||
2006 | + | ||
2007 | + VAStatus (*vaCreateSurfaces) ( | ||
2008 | + VADriverContextP_0_29 ctx, | ||
2009 | + int width, | ||
2010 | + int height, | ||
2011 | + int format, | ||
2012 | + int num_surfaces, | ||
2013 | + VASurfaceID *surfaces /* out */ | ||
2014 | + ); | ||
2015 | + | ||
2016 | + VAStatus (*vaDestroySurfaces) ( | ||
2017 | + VADriverContextP_0_29 ctx, | ||
2018 | + VASurfaceID *surface_list, | ||
2019 | + int num_surfaces | ||
2020 | + ); | ||
2021 | + | ||
2022 | + VAStatus (*vaCreateContext) ( | ||
2023 | + VADriverContextP_0_29 ctx, | ||
2024 | + VAConfigID config_id, | ||
2025 | + int picture_width, | ||
2026 | + int picture_height, | ||
2027 | + int flag, | ||
2028 | + VASurfaceID *render_targets, | ||
2029 | + int num_render_targets, | ||
2030 | + VAContextID *context /* out */ | ||
2031 | + ); | ||
2032 | + | ||
2033 | + VAStatus (*vaDestroyContext) ( | ||
2034 | + VADriverContextP_0_29 ctx, | ||
2035 | + VAContextID context | ||
2036 | + ); | ||
2037 | + | ||
2038 | + VAStatus (*vaCreateBuffer) ( | ||
2039 | + VADriverContextP_0_29 ctx, | ||
2040 | + VAContextID context, /* in */ | ||
2041 | + VABufferType type, /* in */ | ||
2042 | + unsigned int size, /* in */ | ||
2043 | + unsigned int num_elements, /* in */ | ||
2044 | + void *data, /* in */ | ||
2045 | + VABufferID *buf_id /* out */ | ||
2046 | + ); | ||
2047 | + | ||
2048 | + VAStatus (*vaBufferSetNumElements) ( | ||
2049 | + VADriverContextP_0_29 ctx, | ||
2050 | + VABufferID buf_id, /* in */ | ||
2051 | + unsigned int num_elements /* in */ | ||
2052 | + ); | ||
2053 | + | ||
2054 | + VAStatus (*vaMapBuffer) ( | ||
2055 | + VADriverContextP_0_29 ctx, | ||
2056 | + VABufferID buf_id, /* in */ | ||
2057 | + void **pbuf /* out */ | ||
2058 | + ); | ||
2059 | + | ||
2060 | + VAStatus (*vaUnmapBuffer) ( | ||
2061 | + VADriverContextP_0_29 ctx, | ||
2062 | + VABufferID buf_id /* in */ | ||
2063 | + ); | ||
2064 | + | ||
2065 | + VAStatus (*vaDestroyBuffer) ( | ||
2066 | + VADriverContextP_0_29 ctx, | ||
2067 | + VABufferID buffer_id | ||
2068 | + ); | ||
2069 | + | ||
2070 | + VAStatus (*vaBeginPicture) ( | ||
2071 | + VADriverContextP_0_29 ctx, | ||
2072 | + VAContextID context, | ||
2073 | + VASurfaceID render_target | ||
2074 | + ); | ||
2075 | + | ||
2076 | + VAStatus (*vaRenderPicture) ( | ||
2077 | + VADriverContextP_0_29 ctx, | ||
2078 | + VAContextID context, | ||
2079 | + VABufferID *buffers, | ||
2080 | + int num_buffers | ||
2081 | + ); | ||
2082 | + | ||
2083 | + VAStatus (*vaEndPicture) ( | ||
2084 | + VADriverContextP_0_29 ctx, | ||
2085 | + VAContextID context | ||
2086 | + ); | ||
2087 | + | ||
2088 | + VAStatus (*vaSyncSurface) ( | ||
2089 | + VADriverContextP_0_29 ctx, | ||
2090 | + VAContextID context, | ||
2091 | + VASurfaceID render_target | ||
2092 | + ); | ||
2093 | + | ||
2094 | + VAStatus (*vaQuerySurfaceStatus) ( | ||
2095 | + VADriverContextP_0_29 ctx, | ||
2096 | + VASurfaceID render_target, | ||
2097 | + VASurfaceStatus *status /* out */ | ||
2098 | + ); | ||
2099 | + | ||
2100 | + VAStatus (*vaPutSurface) ( | ||
2101 | + VADriverContextP_0_29 ctx, | ||
2102 | + VASurfaceID surface, | ||
2103 | + unsigned long draw, /* X Drawable */ | ||
2104 | + short srcx, | ||
2105 | + short srcy, | ||
2106 | + unsigned short srcw, | ||
2107 | + unsigned short srch, | ||
2108 | + short destx, | ||
2109 | + short desty, | ||
2110 | + unsigned short destw, | ||
2111 | + unsigned short desth, | ||
2112 | + VARectangle *cliprects, /* client supplied clip list */ | ||
2113 | + unsigned int number_cliprects, /* number of clip rects in the clip list */ | ||
2114 | + unsigned int flags /* de-interlacing flags */ | ||
2115 | + ); | ||
2116 | + | ||
2117 | + VAStatus (*vaQueryImageFormats) ( | ||
2118 | + VADriverContextP_0_29 ctx, | ||
2119 | + VAImageFormat *format_list, /* out */ | ||
2120 | + int *num_formats /* out */ | ||
2121 | + ); | ||
2122 | + | ||
2123 | + VAStatus (*vaCreateImage) ( | ||
2124 | + VADriverContextP_0_29 ctx, | ||
2125 | + VAImageFormat *format, | ||
2126 | + int width, | ||
2127 | + int height, | ||
2128 | + VAImage *image /* out */ | ||
2129 | + ); | ||
2130 | + | ||
2131 | + VAStatus (*vaDeriveImage) ( | ||
2132 | + VADriverContextP_0_29 ctx, | ||
2133 | + VASurfaceID surface, | ||
2134 | + VAImage *image /* out */ | ||
2135 | + ); | ||
2136 | + | ||
2137 | + VAStatus (*vaDestroyImage) ( | ||
2138 | + VADriverContextP_0_29 ctx, | ||
2139 | + VAImageID image | ||
2140 | + ); | ||
2141 | + | ||
2142 | + VAStatus (*vaSetImagePalette) ( | ||
2143 | + VADriverContextP_0_29 ctx, | ||
2144 | + VAImageID image, | ||
2145 | + /* | ||
2146 | + * pointer to an array holding the palette data. The size of the array is | ||
2147 | + * num_palette_entries * entry_bytes in size. The order of the components | ||
2148 | + * in the palette is described by the component_order in VAImage struct | ||
2149 | + */ | ||
2150 | + unsigned char *palette | ||
2151 | + ); | ||
2152 | + | ||
2153 | + VAStatus (*vaGetImage) ( | ||
2154 | + VADriverContextP_0_29 ctx, | ||
2155 | + VASurfaceID surface, | ||
2156 | + int x, /* coordinates of the upper left source pixel */ | ||
2157 | + int y, | ||
2158 | + unsigned int width, /* width and height of the region */ | ||
2159 | + unsigned int height, | ||
2160 | + VAImageID image | ||
2161 | + ); | ||
2162 | + | ||
2163 | + VAStatus (*vaPutImage) ( | ||
2164 | + VADriverContextP_0_29 ctx, | ||
2165 | + VASurfaceID surface, | ||
2166 | + VAImageID image, | ||
2167 | + int src_x, | ||
2168 | + int src_y, | ||
2169 | + unsigned int width, | ||
2170 | + unsigned int height, | ||
2171 | + int dest_x, | ||
2172 | + int dest_y | ||
2173 | + ); | ||
2174 | + | ||
2175 | + VAStatus (*vaPutImage2) ( | ||
2176 | + VADriverContextP_0_29 ctx, | ||
2177 | + VASurfaceID surface, | ||
2178 | + VAImageID image, | ||
2179 | + int src_x, | ||
2180 | + int src_y, | ||
2181 | + unsigned int src_width, | ||
2182 | + unsigned int src_height, | ||
2183 | + int dest_x, | ||
2184 | + int dest_y, | ||
2185 | + unsigned int dest_width, | ||
2186 | + unsigned int dest_height | ||
2187 | + ); | ||
2188 | + | ||
2189 | + VAStatus (*vaQuerySubpictureFormats) ( | ||
2190 | + VADriverContextP_0_29 ctx, | ||
2191 | + VAImageFormat *format_list, /* out */ | ||
2192 | + unsigned int *flags, /* out */ | ||
2193 | + unsigned int *num_formats /* out */ | ||
2194 | + ); | ||
2195 | + | ||
2196 | + VAStatus (*vaCreateSubpicture) ( | ||
2197 | + VADriverContextP_0_29 ctx, | ||
2198 | + VAImageID image, | ||
2199 | + VASubpictureID *subpicture /* out */ | ||
2200 | + ); | ||
2201 | + | ||
2202 | + VAStatus (*vaDestroySubpicture) ( | ||
2203 | + VADriverContextP_0_29 ctx, | ||
2204 | + VASubpictureID subpicture | ||
2205 | + ); | ||
2206 | + | ||
2207 | + VAStatus (*vaSetSubpictureImage) ( | ||
2208 | + VADriverContextP_0_29 ctx, | ||
2209 | + VASubpictureID subpicture, | ||
2210 | + VAImageID image | ||
2211 | + ); | ||
2212 | + | ||
2213 | + VAStatus (*vaSetSubpicturePalette) ( | ||
2214 | + VADriverContextP_0_29 ctx, | ||
2215 | + VASubpictureID subpicture, | ||
2216 | + /* | ||
2217 | + * pointer to an array holding the palette data. The size of the array is | ||
2218 | + * num_palette_entries * entry_bytes in size. The order of the components | ||
2219 | + * in the palette is described by the component_order in VASubpicture struct | ||
2220 | + */ | ||
2221 | + unsigned char *palette | ||
2222 | + ); | ||
2223 | + | ||
2224 | + VAStatus (*vaSetSubpictureChromakey) ( | ||
2225 | + VADriverContextP_0_29 ctx, | ||
2226 | + VASubpictureID subpicture, | ||
2227 | + unsigned int chromakey_min, | ||
2228 | + unsigned int chromakey_max, | ||
2229 | + unsigned int chromakey_mask | ||
2230 | + ); | ||
2231 | + | ||
2232 | + VAStatus (*vaSetSubpictureGlobalAlpha) ( | ||
2233 | + VADriverContextP_0_29 ctx, | ||
2234 | + VASubpictureID subpicture, | ||
2235 | + float global_alpha | ||
2236 | + ); | ||
2237 | + | ||
2238 | + VAStatus (*vaAssociateSubpicture) ( | ||
2239 | + VADriverContextP_0_29 ctx, | ||
2240 | + VASubpictureID subpicture, | ||
2241 | + VASurfaceID *target_surfaces, | ||
2242 | + int num_surfaces, | ||
2243 | + short src_x, /* upper left offset in subpicture */ | ||
2244 | + short src_y, | ||
2245 | + short dest_x, /* upper left offset in surface */ | ||
2246 | + short dest_y, | ||
2247 | + unsigned short width, | ||
2248 | + unsigned short height, | ||
2249 | + /* | ||
2250 | + * whether to enable chroma-keying or global-alpha | ||
2251 | + * see VA_SUBPICTURE_XXX values | ||
2252 | + */ | ||
2253 | + unsigned int flags | ||
2254 | + ); | ||
2255 | + | ||
2256 | + VAStatus (*vaAssociateSubpicture2) ( | ||
2257 | + VADriverContextP_0_29 ctx, | ||
2258 | + VASubpictureID subpicture, | ||
2259 | + VASurfaceID *target_surfaces, | ||
2260 | + int num_surfaces, | ||
2261 | + short src_x, /* upper left offset in subpicture */ | ||
2262 | + short src_y, | ||
2263 | + unsigned short src_width, | ||
2264 | + unsigned short src_height, | ||
2265 | + short dest_x, /* upper left offset in surface */ | ||
2266 | + short dest_y, | ||
2267 | + unsigned short dest_width, | ||
2268 | + unsigned short dest_height, | ||
2269 | + /* | ||
2270 | + * whether to enable chroma-keying or global-alpha | ||
2271 | + * see VA_SUBPICTURE_XXX values | ||
2272 | + */ | ||
2273 | + unsigned int flags | ||
2274 | + ); | ||
2275 | + | ||
2276 | + VAStatus (*vaDeassociateSubpicture) ( | ||
2277 | + VADriverContextP_0_29 ctx, | ||
2278 | + VASubpictureID subpicture, | ||
2279 | + VASurfaceID *target_surfaces, | ||
2280 | + int num_surfaces | ||
2281 | + ); | ||
2282 | + | ||
2283 | + VAStatus (*vaQueryDisplayAttributes) ( | ||
2284 | + VADriverContextP_0_29 ctx, | ||
2285 | + VADisplayAttribute *attr_list, /* out */ | ||
2286 | + int *num_attributes /* out */ | ||
2287 | + ); | ||
2288 | + | ||
2289 | + VAStatus (*vaGetDisplayAttributes) ( | ||
2290 | + VADriverContextP_0_29 ctx, | ||
2291 | + VADisplayAttribute *attr_list, /* in/out */ | ||
2292 | + int num_attributes | ||
2293 | + ); | ||
2294 | + | ||
2295 | + VAStatus (*vaSetDisplayAttributes) ( | ||
2296 | + VADriverContextP_0_29 ctx, | ||
2297 | + VADisplayAttribute *attr_list, | ||
2298 | + int num_attributes | ||
2299 | + ); | ||
2300 | + | ||
2301 | + | ||
2302 | + VAStatus (*vaDbgCopySurfaceToBuffer) ( | ||
2303 | + VADriverContextP_0_29 ctx, | ||
2304 | + VASurfaceID surface, | ||
2305 | + void **buffer, /* out */ | ||
2306 | + unsigned int *stride /* out */ | ||
2307 | + ); | ||
2308 | +}; | ||
2309 | + | ||
2310 | +/* Driver context (0.29) */ | ||
2311 | +struct VADriverContext_0_29 | ||
2312 | +{ | ||
2313 | + void *old_pNext; /* preserved for binary compatibility */ | ||
2314 | + | ||
2315 | + void *pDriverData; | ||
2316 | + struct VADriverVTable_0_29 vtable; | ||
2317 | + | ||
2318 | + void *x11_dpy; | ||
2319 | + int x11_screen; | ||
2320 | + | ||
2321 | + int version_major; | ||
2322 | + int version_minor; | ||
2323 | + int max_profiles; | ||
2324 | + int max_entrypoints; | ||
2325 | + int max_attributes; | ||
2326 | + int max_image_formats; | ||
2327 | + int max_subpic_formats; | ||
2328 | + int max_display_attributes; | ||
2329 | + const char *str_vendor; | ||
2330 | + | ||
2331 | + void *handle; /* dlopen handle */ | ||
2332 | +}; | ||
2333 | + | ||
2334 | +/* Forward declarations for VA API 0.30 */ | ||
2335 | +struct v4l2_format; | ||
2336 | +struct v4l2_buffer; | ||
2337 | +typedef struct VADriverContext_0_30 *VADriverContextP_0_30; | ||
2338 | + | ||
2339 | +/* Driver VTable (0.30) */ | ||
2340 | +struct VADriverVTable_0_30 | ||
2341 | +{ | ||
2342 | + VAStatus (*vaTerminate) ( VADriverContextP_0_30 ctx ); | ||
2343 | + | ||
2344 | + VAStatus (*vaQueryConfigProfiles) ( | ||
2345 | + VADriverContextP_0_30 ctx, | ||
2346 | + VAProfile *profile_list, /* out */ | ||
2347 | + int *num_profiles /* out */ | ||
2348 | + ); | ||
2349 | + | ||
2350 | + VAStatus (*vaQueryConfigEntrypoints) ( | ||
2351 | + VADriverContextP_0_30 ctx, | ||
2352 | + VAProfile profile, | ||
2353 | + VAEntrypoint *entrypoint_list, /* out */ | ||
2354 | + int *num_entrypoints /* out */ | ||
2355 | + ); | ||
2356 | + | ||
2357 | + VAStatus (*vaGetConfigAttributes) ( | ||
2358 | + VADriverContextP_0_30 ctx, | ||
2359 | + VAProfile profile, | ||
2360 | + VAEntrypoint entrypoint, | ||
2361 | + VAConfigAttrib *attrib_list, /* in/out */ | ||
2362 | + int num_attribs | ||
2363 | + ); | ||
2364 | + | ||
2365 | + VAStatus (*vaCreateConfig) ( | ||
2366 | + VADriverContextP_0_30 ctx, | ||
2367 | + VAProfile profile, | ||
2368 | + VAEntrypoint entrypoint, | ||
2369 | + VAConfigAttrib *attrib_list, | ||
2370 | + int num_attribs, | ||
2371 | + VAConfigID *config_id /* out */ | ||
2372 | + ); | ||
2373 | + | ||
2374 | + VAStatus (*vaDestroyConfig) ( | ||
2375 | + VADriverContextP_0_30 ctx, | ||
2376 | + VAConfigID config_id | ||
2377 | + ); | ||
2378 | + | ||
2379 | + VAStatus (*vaQueryConfigAttributes) ( | ||
2380 | + VADriverContextP_0_30 ctx, | ||
2381 | + VAConfigID config_id, | ||
2382 | + VAProfile *profile, /* out */ | ||
2383 | + VAEntrypoint *entrypoint, /* out */ | ||
2384 | + VAConfigAttrib *attrib_list, /* out */ | ||
2385 | + int *num_attribs /* out */ | ||
2386 | + ); | ||
2387 | + | ||
2388 | + VAStatus (*vaCreateSurfaces) ( | ||
2389 | + VADriverContextP_0_30 ctx, | ||
2390 | + int width, | ||
2391 | + int height, | ||
2392 | + int format, | ||
2393 | + int num_surfaces, | ||
2394 | + VASurfaceID *surfaces /* out */ | ||
2395 | + ); | ||
2396 | + | ||
2397 | + VAStatus (*vaDestroySurfaces) ( | ||
2398 | + VADriverContextP_0_30 ctx, | ||
2399 | + VASurfaceID *surface_list, | ||
2400 | + int num_surfaces | ||
2401 | + ); | ||
2402 | + | ||
2403 | + VAStatus (*vaCreateContext) ( | ||
2404 | + VADriverContextP_0_30 ctx, | ||
2405 | + VAConfigID config_id, | ||
2406 | + int picture_width, | ||
2407 | + int picture_height, | ||
2408 | + int flag, | ||
2409 | + VASurfaceID *render_targets, | ||
2410 | + int num_render_targets, | ||
2411 | + VAContextID *context /* out */ | ||
2412 | + ); | ||
2413 | + | ||
2414 | + VAStatus (*vaDestroyContext) ( | ||
2415 | + VADriverContextP_0_30 ctx, | ||
2416 | + VAContextID context | ||
2417 | + ); | ||
2418 | + | ||
2419 | + VAStatus (*vaCreateBuffer) ( | ||
2420 | + VADriverContextP_0_30 ctx, | ||
2421 | + VAContextID context, /* in */ | ||
2422 | + VABufferType type, /* in */ | ||
2423 | + unsigned int size, /* in */ | ||
2424 | + unsigned int num_elements, /* in */ | ||
2425 | + void *data, /* in */ | ||
2426 | + VABufferID *buf_id /* out */ | ||
2427 | + ); | ||
2428 | + | ||
2429 | + VAStatus (*vaBufferSetNumElements) ( | ||
2430 | + VADriverContextP_0_30 ctx, | ||
2431 | + VABufferID buf_id, /* in */ | ||
2432 | + unsigned int num_elements /* in */ | ||
2433 | + ); | ||
2434 | + | ||
2435 | + VAStatus (*vaMapBuffer) ( | ||
2436 | + VADriverContextP_0_30 ctx, | ||
2437 | + VABufferID buf_id, /* in */ | ||
2438 | + void **pbuf /* out */ | ||
2439 | + ); | ||
2440 | + | ||
2441 | + VAStatus (*vaUnmapBuffer) ( | ||
2442 | + VADriverContextP_0_30 ctx, | ||
2443 | + VABufferID buf_id /* in */ | ||
2444 | + ); | ||
2445 | + | ||
2446 | + VAStatus (*vaDestroyBuffer) ( | ||
2447 | + VADriverContextP_0_30 ctx, | ||
2448 | + VABufferID buffer_id | ||
2449 | + ); | ||
2450 | + | ||
2451 | + VAStatus (*vaBeginPicture) ( | ||
2452 | + VADriverContextP_0_30 ctx, | ||
2453 | + VAContextID context, | ||
2454 | + VASurfaceID render_target | ||
2455 | + ); | ||
2456 | + | ||
2457 | + VAStatus (*vaRenderPicture) ( | ||
2458 | + VADriverContextP_0_30 ctx, | ||
2459 | + VAContextID context, | ||
2460 | + VABufferID *buffers, | ||
2461 | + int num_buffers | ||
2462 | + ); | ||
2463 | + | ||
2464 | + VAStatus (*vaEndPicture) ( | ||
2465 | + VADriverContextP_0_30 ctx, | ||
2466 | + VAContextID context | ||
2467 | + ); | ||
2468 | + | ||
2469 | + VAStatus (*vaSyncSurface) ( | ||
2470 | + VADriverContextP_0_30 ctx, | ||
2471 | + VAContextID context, | ||
2472 | + VASurfaceID render_target | ||
2473 | + ); | ||
2474 | + | ||
2475 | + VAStatus (*vaQuerySurfaceStatus) ( | ||
2476 | + VADriverContextP_0_30 ctx, | ||
2477 | + VASurfaceID render_target, | ||
2478 | + VASurfaceStatus *status /* out */ | ||
2479 | + ); | ||
2480 | + | ||
2481 | + VAStatus (*vaPutSurface) ( | ||
2482 | + VADriverContextP_0_30 ctx, | ||
2483 | + VASurfaceID surface, | ||
2484 | + unsigned long draw, /* X Drawable */ | ||
2485 | + short srcx, | ||
2486 | + short srcy, | ||
2487 | + unsigned short srcw, | ||
2488 | + unsigned short srch, | ||
2489 | + short destx, | ||
2490 | + short desty, | ||
2491 | + unsigned short destw, | ||
2492 | + unsigned short desth, | ||
2493 | + VARectangle *cliprects, /* client supplied clip list */ | ||
2494 | + unsigned int number_cliprects, /* number of clip rects in the clip list */ | ||
2495 | + unsigned int flags /* de-interlacing flags */ | ||
2496 | + ); | ||
2497 | + | ||
2498 | + VAStatus (*vaQueryImageFormats) ( | ||
2499 | + VADriverContextP_0_30 ctx, | ||
2500 | + VAImageFormat *format_list, /* out */ | ||
2501 | + int *num_formats /* out */ | ||
2502 | + ); | ||
2503 | + | ||
2504 | + VAStatus (*vaCreateImage) ( | ||
2505 | + VADriverContextP_0_30 ctx, | ||
2506 | + VAImageFormat *format, | ||
2507 | + int width, | ||
2508 | + int height, | ||
2509 | + VAImage *image /* out */ | ||
2510 | + ); | ||
2511 | + | ||
2512 | + VAStatus (*vaDeriveImage) ( | ||
2513 | + VADriverContextP_0_30 ctx, | ||
2514 | + VASurfaceID surface, | ||
2515 | + VAImage *image /* out */ | ||
2516 | + ); | ||
2517 | + | ||
2518 | + VAStatus (*vaDestroyImage) ( | ||
2519 | + VADriverContextP_0_30 ctx, | ||
2520 | + VAImageID image | ||
2521 | + ); | ||
2522 | + | ||
2523 | + VAStatus (*vaSetImagePalette) ( | ||
2524 | + VADriverContextP_0_30 ctx, | ||
2525 | + VAImageID image, | ||
2526 | + /* | ||
2527 | + * pointer to an array holding the palette data. The size of the array is | ||
2528 | + * num_palette_entries * entry_bytes in size. The order of the components | ||
2529 | + * in the palette is described by the component_order in VAImage struct | ||
2530 | + */ | ||
2531 | + unsigned char *palette | ||
2532 | + ); | ||
2533 | + | ||
2534 | + VAStatus (*vaGetImage) ( | ||
2535 | + VADriverContextP_0_30 ctx, | ||
2536 | + VASurfaceID surface, | ||
2537 | + int x, /* coordinates of the upper left source pixel */ | ||
2538 | + int y, | ||
2539 | + unsigned int width, /* width and height of the region */ | ||
2540 | + unsigned int height, | ||
2541 | + VAImageID image | ||
2542 | + ); | ||
2543 | + | ||
2544 | + VAStatus (*vaPutImage) ( | ||
2545 | + VADriverContextP_0_30 ctx, | ||
2546 | + VASurfaceID surface, | ||
2547 | + VAImageID image, | ||
2548 | + int src_x, | ||
2549 | + int src_y, | ||
2550 | + unsigned int width, | ||
2551 | + unsigned int height, | ||
2552 | + int dest_x, | ||
2553 | + int dest_y | ||
2554 | + ); | ||
2555 | + | ||
2556 | + VAStatus (*vaPutImage2) ( | ||
2557 | + VADriverContextP_0_30 ctx, | ||
2558 | + VASurfaceID surface, | ||
2559 | + VAImageID image, | ||
2560 | + int src_x, | ||
2561 | + int src_y, | ||
2562 | + unsigned int src_width, | ||
2563 | + unsigned int src_height, | ||
2564 | + int dest_x, | ||
2565 | + int dest_y, | ||
2566 | + unsigned int dest_width, | ||
2567 | + unsigned int dest_height | ||
2568 | + ); | ||
2569 | + | ||
2570 | + VAStatus (*vaQuerySubpictureFormats) ( | ||
2571 | + VADriverContextP_0_30 ctx, | ||
2572 | + VAImageFormat *format_list, /* out */ | ||
2573 | + unsigned int *flags, /* out */ | ||
2574 | + unsigned int *num_formats /* out */ | ||
2575 | + ); | ||
2576 | + | ||
2577 | + VAStatus (*vaCreateSubpicture) ( | ||
2578 | + VADriverContextP_0_30 ctx, | ||
2579 | + VAImageID image, | ||
2580 | + VASubpictureID *subpicture /* out */ | ||
2581 | + ); | ||
2582 | + | ||
2583 | + VAStatus (*vaDestroySubpicture) ( | ||
2584 | + VADriverContextP_0_30 ctx, | ||
2585 | + VASubpictureID subpicture | ||
2586 | + ); | ||
2587 | + | ||
2588 | + VAStatus (*vaSetSubpictureImage) ( | ||
2589 | + VADriverContextP_0_30 ctx, | ||
2590 | + VASubpictureID subpicture, | ||
2591 | + VAImageID image | ||
2592 | + ); | ||
2593 | + | ||
2594 | + VAStatus (*vaSetSubpictureChromakey) ( | ||
2595 | + VADriverContextP_0_30 ctx, | ||
2596 | + VASubpictureID subpicture, | ||
2597 | + unsigned int chromakey_min, | ||
2598 | + unsigned int chromakey_max, | ||
2599 | + unsigned int chromakey_mask | ||
2600 | + ); | ||
2601 | + | ||
2602 | + VAStatus (*vaSetSubpictureGlobalAlpha) ( | ||
2603 | + VADriverContextP_0_30 ctx, | ||
2604 | + VASubpictureID subpicture, | ||
2605 | + float global_alpha | ||
2606 | + ); | ||
2607 | + | ||
2608 | + VAStatus (*vaAssociateSubpicture) ( | ||
2609 | + VADriverContextP_0_30 ctx, | ||
2610 | + VASubpictureID subpicture, | ||
2611 | + VASurfaceID *target_surfaces, | ||
2612 | + int num_surfaces, | ||
2613 | + short src_x, /* upper left offset in subpicture */ | ||
2614 | + short src_y, | ||
2615 | + short dest_x, /* upper left offset in surface */ | ||
2616 | + short dest_y, | ||
2617 | + unsigned short width, | ||
2618 | + unsigned short height, | ||
2619 | + /* | ||
2620 | + * whether to enable chroma-keying or global-alpha | ||
2621 | + * see VA_SUBPICTURE_XXX values | ||
2622 | + */ | ||
2623 | + unsigned int flags | ||
2624 | + ); | ||
2625 | + | ||
2626 | + VAStatus (*vaAssociateSubpicture2) ( | ||
2627 | + VADriverContextP_0_30 ctx, | ||
2628 | + VASubpictureID subpicture, | ||
2629 | + VASurfaceID *target_surfaces, | ||
2630 | + int num_surfaces, | ||
2631 | + short src_x, /* upper left offset in subpicture */ | ||
2632 | + short src_y, | ||
2633 | + unsigned short src_width, | ||
2634 | + unsigned short src_height, | ||
2635 | + short dest_x, /* upper left offset in surface */ | ||
2636 | + short dest_y, | ||
2637 | + unsigned short dest_width, | ||
2638 | + unsigned short dest_height, | ||
2639 | + /* | ||
2640 | + * whether to enable chroma-keying or global-alpha | ||
2641 | + * see VA_SUBPICTURE_XXX values | ||
2642 | + */ | ||
2643 | + unsigned int flags | ||
2644 | + ); | ||
2645 | + | ||
2646 | + VAStatus (*vaDeassociateSubpicture) ( | ||
2647 | + VADriverContextP_0_30 ctx, | ||
2648 | + VASubpictureID subpicture, | ||
2649 | + VASurfaceID *target_surfaces, | ||
2650 | + int num_surfaces | ||
2651 | + ); | ||
2652 | + | ||
2653 | + VAStatus (*vaQueryDisplayAttributes) ( | ||
2654 | + VADriverContextP_0_30 ctx, | ||
2655 | + VADisplayAttribute *attr_list, /* out */ | ||
2656 | + int *num_attributes /* out */ | ||
2657 | + ); | ||
2658 | + | ||
2659 | + VAStatus (*vaGetDisplayAttributes) ( | ||
2660 | + VADriverContextP_0_30 ctx, | ||
2661 | + VADisplayAttribute *attr_list, /* in/out */ | ||
2662 | + int num_attributes | ||
2663 | + ); | ||
2664 | + | ||
2665 | + VAStatus (*vaSetDisplayAttributes) ( | ||
2666 | + VADriverContextP_0_30 ctx, | ||
2667 | + VADisplayAttribute *attr_list, | ||
2668 | + int num_attributes | ||
2669 | + ); | ||
2670 | + | ||
2671 | + /* device specific */ | ||
2672 | + VAStatus (*vaCreateSurfaceFromCIFrame) ( | ||
2673 | + VADriverContextP_0_30 ctx, | ||
2674 | + unsigned long frame_id, | ||
2675 | + VASurfaceID *surface /* out */ | ||
2676 | + ); | ||
2677 | + | ||
2678 | + | ||
2679 | + VAStatus (*vaCreateSurfaceFromV4L2Buf) ( | ||
2680 | + VADriverContextP_0_30 ctx, | ||
2681 | + int v4l2_fd, /* file descriptor of V4L2 device */ | ||
2682 | + struct v4l2_format *v4l2_fmt, /* format of V4L2 */ | ||
2683 | + struct v4l2_buffer *v4l2_buf, /* V4L2 buffer */ | ||
2684 | + VASurfaceID *surface /* out */ | ||
2685 | + ); | ||
2686 | + | ||
2687 | + VAStatus (*vaCopySurfaceToBuffer) ( | ||
2688 | + VADriverContextP_0_30 ctx, | ||
2689 | + VASurfaceID surface, | ||
2690 | + unsigned int *fourcc, /* out for follow argument */ | ||
2691 | + unsigned int *luma_stride, | ||
2692 | + unsigned int *chroma_u_stride, | ||
2693 | + unsigned int *chroma_v_stride, | ||
2694 | + unsigned int *luma_offset, | ||
2695 | + unsigned int *chroma_u_offset, | ||
2696 | + unsigned int *chroma_v_offset, | ||
2697 | + void **buffer | ||
2698 | + ); | ||
2699 | +}; | ||
2700 | + | ||
2701 | +/* Driver context (0.30) */ | ||
2702 | +struct VADriverContext_0_30 | ||
2703 | +{ | ||
2704 | + void *pDriverData; | ||
2705 | + struct VADriverVTable_0_30 vtable; | ||
2706 | + | ||
2707 | + void *x11_dpy; | ||
2708 | + int x11_screen; | ||
2709 | + int version_major; | ||
2710 | + int version_minor; | ||
2711 | + int max_profiles; | ||
2712 | + int max_entrypoints; | ||
2713 | + int max_attributes; | ||
2714 | + int max_image_formats; | ||
2715 | + int max_subpic_formats; | ||
2716 | + int max_display_attributes; | ||
2717 | + const char *str_vendor; | ||
2718 | + | ||
2719 | + void *handle; /* dlopen handle */ | ||
2720 | + | ||
2721 | + void *dri_state; | ||
2722 | +}; | ||
2723 | + | ||
2724 | +/* Driver VTable and context (0.31) */ | ||
2725 | +#define VADriverVTable_0_31 VADriverVTable | ||
2726 | +#define VADriverContext_0_31 VADriverContext | ||
2727 | + | ||
2728 | +#endif /* VA_COMPAT_H */ | ||
2729 | diff --git a/src/va_compat_template.h b/src/va_compat_template.h | ||
2730 | new file mode 100644 | ||
2731 | index 0000000..18349de | ||
2732 | --- /dev/null | ||
2733 | +++ b/src/va_compat_template.h | ||
2734 | @@ -0,0 +1,539 @@ | ||
2735 | +/* | ||
2736 | + * Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved. | ||
2737 | + * | ||
2738 | + * Permission is hereby granted, free of charge, to any person obtaining a | ||
2739 | + * copy of this software and associated documentation files (the | ||
2740 | + * "Software"), to deal in the Software without restriction, including | ||
2741 | + * without limitation the rights to use, copy, modify, merge, publish, | ||
2742 | + * distribute, sub license, and/or sell copies of the Software, and to | ||
2743 | + * permit persons to whom the Software is furnished to do so, subject to | ||
2744 | + * the following conditions: | ||
2745 | + * | ||
2746 | + * The above copyright notice and this permission notice (including the | ||
2747 | + * next paragraph) shall be included in all copies or substantial portions | ||
2748 | + * of the Software. | ||
2749 | + * | ||
2750 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
2751 | + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
2752 | + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. | ||
2753 | + * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR | ||
2754 | + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
2755 | + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
2756 | + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
2757 | + */ | ||
2758 | + | ||
2759 | +#undef CONCAT_ | ||
2760 | +#define CONCAT_(x, y) x##y | ||
2761 | +#undef CONCAT | ||
2762 | +#define CONCAT(x, y) CONCAT_(x, y) | ||
2763 | +#undef MKCOMPAT_ | ||
2764 | +#define MKCOMPAT_(NAME,MINOR) CONCAT(CONCAT(NAME,_0_),MINOR) | ||
2765 | +#undef MKCOMPAT | ||
2766 | +#define MKCOMPAT(NAME) MKCOMPAT_(NAME,COMPAT_MINOR) | ||
2767 | +#undef STRUCT | ||
2768 | +#define STRUCT(BUFFER, CODEC) MKCOMPAT(VA##BUFFER##Buffer##CODEC) | ||
2769 | +#undef TRANSLATE_1 | ||
2770 | +#define TRANSLATE_1(NAME) CONCAT(va_compat_translate_,NAME) | ||
2771 | +#undef TRANSLATE_ | ||
2772 | +#define TRANSLATE_(NAME) TRANSLATE_1(MKCOMPAT(NAME)) | ||
2773 | +#undef TRANSLATE | ||
2774 | +#define TRANSLATE(BUFFER, CODEC) TRANSLATE_1(STRUCT(BUFFER,CODEC)) | ||
2775 | + | ||
2776 | +#undef COPY_ARRAY | ||
2777 | +#define COPY_ARRAY(DST, SRC, ARRAY) \ | ||
2778 | + memcpy((DST)->ARRAY, (SRC)->ARRAY, sizeof((DST)->ARRAY)) | ||
2779 | + | ||
2780 | +#undef COPY_FIELD | ||
2781 | +#define COPY_FIELD(DST, SRC, MEMBER) \ | ||
2782 | + (DST)->MEMBER = (SRC)->MEMBER | ||
2783 | + | ||
2784 | +#undef COPY_VTABLE__ | ||
2785 | +#define COPY_VTABLE__(DST, DST_MEMBER, SRC, SRC_MEMBER) \ | ||
2786 | + (DST##_vtable)->DST_MEMBER = (SRC##_vtable)->SRC_MEMBER | ||
2787 | + | ||
2788 | +#undef COPY_VTABLE_ | ||
2789 | +#define COPY_VTABLE_(DST, DST_SUFFIX, SRC, MEMBER) \ | ||
2790 | + COPY_VTABLE__(DST, MEMBER##_##DST_SUFFIX, SRC, MEMBER) | ||
2791 | + | ||
2792 | +#undef COPY_VTABLE | ||
2793 | +#define COPY_VTABLE(DST, SRC, MEMBER) \ | ||
2794 | + COPY_VTABLE__(DST, MEMBER, SRC, MEMBER) | ||
2795 | + | ||
2796 | +/* 0.29 */ | ||
2797 | +#if COMPAT_MAJOR == 0 && COMPAT_MINOR == 29 | ||
2798 | +#undef BFV | ||
2799 | +#define BFV(a, b) a | ||
2800 | +#undef BFM | ||
2801 | +#define BFM(a, b, c) c | ||
2802 | +#undef COPY_BIT_FIELD | ||
2803 | +#define COPY_BIT_FIELD(DST, SRC, FIELD, MEMBER) \ | ||
2804 | + (DST)->MEMBER = (SRC)->FIELD.bits.MEMBER | ||
2805 | +#undef COPY_BIT_FLAG | ||
2806 | +#define COPY_BIT_FLAG(DST, SRC, FIELD, MEMBER) \ | ||
2807 | + (DST)->MEMBER = (SRC)->FIELD.flags.MEMBER | ||
2808 | +#endif | ||
2809 | + | ||
2810 | +/* 0.29 glue to match 0.30 names */ | ||
2811 | +#undef M_raw_coding | ||
2812 | +#undef M_bitplane_present | ||
2813 | +#undef M_luma_flag | ||
2814 | +#undef M_luma | ||
2815 | +#undef M_chroma_flag | ||
2816 | +#undef M_chroma | ||
2817 | + | ||
2818 | +#if COMPAT_MAJOR == 0 && COMPAT_MINOR == 29 | ||
2819 | +#define M_raw_coding raw_coding_flag | ||
2820 | +#define M_bitplane_present bitplane_present_flag | ||
2821 | +#define M_luma_flag range_mapping_luma_flag | ||
2822 | +#define M_luma range_mapping_luma | ||
2823 | +#define M_chroma_flag range_mapping_chroma_flag | ||
2824 | +#define M_chroma range_mapping_chroma | ||
2825 | +#else | ||
2826 | +#define M_raw_coding raw_coding | ||
2827 | +#define M_bitplane_present bitplane_present | ||
2828 | +#define M_luma_flag luma_flag | ||
2829 | +#define M_luma luma | ||
2830 | +#define M_chroma_flag chroma_flag | ||
2831 | +#define M_chroma chroma | ||
2832 | +#endif | ||
2833 | + | ||
2834 | +/* 0.30 */ | ||
2835 | +#if COMPAT_MAJOR == 0 && COMPAT_MINOR == 30 | ||
2836 | +#undef BFV | ||
2837 | +#define BFV(a, b) a.b | ||
2838 | +#undef BFM | ||
2839 | +#define BFM(a, b, c) a.b.c | ||
2840 | +#undef COPY_BIT_FIELD | ||
2841 | +#define COPY_BIT_FIELD(DST, SRC, FIELD, MEMBER) \ | ||
2842 | + (DST)->FIELD.bits.MEMBER = (SRC)->FIELD.bits.MEMBER | ||
2843 | +#undef COPY_BIT_FLAG | ||
2844 | +#define COPY_BIT_FLAG(DST, SRC, FIELD, MEMBER) \ | ||
2845 | + (DST)->FIELD.flags.MEMBER = (SRC)->FIELD.flags.MEMBER | ||
2846 | +#endif | ||
2847 | + | ||
2848 | +#if COMPAT_MAJOR == 0 && COMPAT_MINOR < 31 | ||
2849 | +static VAStatus TRANSLATE_(VAPictureH264)( | ||
2850 | + VACompatContextP ctx, | ||
2851 | + void *dest_pic, | ||
2852 | + const void *src_pic | ||
2853 | +) | ||
2854 | +{ | ||
2855 | + MKCOMPAT(VAPictureH264) *dest = dest_pic; | ||
2856 | + const VAPictureH264 *src = src_pic; | ||
2857 | + | ||
2858 | + COPY_FIELD(dest, src, picture_id); | ||
2859 | + COPY_FIELD(dest, src, flags); | ||
2860 | + COPY_FIELD(dest, src, TopFieldOrderCnt); | ||
2861 | + COPY_FIELD(dest, src, BottomFieldOrderCnt); | ||
2862 | + | ||
2863 | + return VA_STATUS_SUCCESS; | ||
2864 | +} | ||
2865 | + | ||
2866 | +static VAStatus TRANSLATE(PictureParameter,H264)( | ||
2867 | + VACompatContextP ctx, | ||
2868 | + void *dest_buffer, | ||
2869 | + const void *src_buffer | ||
2870 | +) | ||
2871 | +{ | ||
2872 | + STRUCT(PictureParameter,H264) *dest = dest_buffer; | ||
2873 | + const VAPictureParameterBufferH264 *src = src_buffer; | ||
2874 | + VAStatus status; | ||
2875 | + int i; | ||
2876 | + | ||
2877 | + status = TRANSLATE_(VAPictureH264)(ctx, | ||
2878 | + &dest->CurrPic, &src->CurrPic); | ||
2879 | + if (status != VA_STATUS_SUCCESS) | ||
2880 | + return status; | ||
2881 | + | ||
2882 | + for (i = 0; i < 16; i++) { | ||
2883 | + status = TRANSLATE_(VAPictureH264)(ctx, | ||
2884 | + &dest->ReferenceFrames[i], | ||
2885 | + &src->ReferenceFrames[i]); | ||
2886 | + if (status != VA_STATUS_SUCCESS) | ||
2887 | + return status; | ||
2888 | + } | ||
2889 | + | ||
2890 | + COPY_FIELD(dest, src, picture_width_in_mbs_minus1); | ||
2891 | + COPY_FIELD(dest, src, picture_height_in_mbs_minus1); | ||
2892 | + COPY_FIELD(dest, src, bit_depth_luma_minus8); | ||
2893 | + COPY_FIELD(dest, src, bit_depth_chroma_minus8); | ||
2894 | + COPY_FIELD(dest, src, num_ref_frames); | ||
2895 | + dest->BFV(seq_fields, value) = 0; /* reset all bits */ | ||
2896 | + COPY_BIT_FIELD(dest, src, seq_fields, chroma_format_idc); | ||
2897 | + COPY_BIT_FIELD(dest, src, seq_fields, residual_colour_transform_flag); | ||
2898 | + COPY_BIT_FIELD(dest, src, seq_fields, frame_mbs_only_flag); | ||
2899 | + COPY_BIT_FIELD(dest, src, seq_fields, mb_adaptive_frame_field_flag); | ||
2900 | + COPY_BIT_FIELD(dest, src, seq_fields, direct_8x8_inference_flag); | ||
2901 | + COPY_BIT_FIELD(dest, src, seq_fields, MinLumaBiPredSize8x8); | ||
2902 | + COPY_FIELD(dest, src, num_slice_groups_minus1); | ||
2903 | + COPY_FIELD(dest, src, slice_group_map_type); | ||
2904 | + COPY_FIELD(dest, src, pic_init_qp_minus26); | ||
2905 | + COPY_FIELD(dest, src, chroma_qp_index_offset); | ||
2906 | + COPY_FIELD(dest, src, second_chroma_qp_index_offset); | ||
2907 | + dest->BFV(pic_fields, value) = 0; /* reset all bits */ | ||
2908 | + COPY_BIT_FIELD(dest, src, pic_fields, entropy_coding_mode_flag); | ||
2909 | + COPY_BIT_FIELD(dest, src, pic_fields, weighted_pred_flag); | ||
2910 | + COPY_BIT_FIELD(dest, src, pic_fields, weighted_bipred_idc); | ||
2911 | + COPY_BIT_FIELD(dest, src, pic_fields, transform_8x8_mode_flag); | ||
2912 | + COPY_BIT_FIELD(dest, src, pic_fields, field_pic_flag); | ||
2913 | + COPY_BIT_FIELD(dest, src, pic_fields, constrained_intra_pred_flag); | ||
2914 | + COPY_FIELD(dest, src, frame_num); | ||
2915 | + | ||
2916 | + return VA_STATUS_SUCCESS; | ||
2917 | +} | ||
2918 | + | ||
2919 | +static VAStatus TRANSLATE(SliceParameter,H264)( | ||
2920 | + VACompatContextP ctx, | ||
2921 | + void *dest_buffer, | ||
2922 | + const void *src_buffer | ||
2923 | +) | ||
2924 | +{ | ||
2925 | + STRUCT(SliceParameter,H264) *dest = dest_buffer; | ||
2926 | + const VASliceParameterBufferH264 *src = src_buffer; | ||
2927 | + VAStatus status; | ||
2928 | + int i; | ||
2929 | + | ||
2930 | + COPY_FIELD(dest, src, slice_data_size); | ||
2931 | + COPY_FIELD(dest, src, slice_data_offset); | ||
2932 | + COPY_FIELD(dest, src, slice_data_flag); | ||
2933 | + COPY_FIELD(dest, src, slice_data_bit_offset); | ||
2934 | + COPY_FIELD(dest, src, first_mb_in_slice); | ||
2935 | + COPY_FIELD(dest, src, slice_type); | ||
2936 | + COPY_FIELD(dest, src, direct_spatial_mv_pred_flag); | ||
2937 | + COPY_FIELD(dest, src, num_ref_idx_l0_active_minus1); | ||
2938 | + COPY_FIELD(dest, src, num_ref_idx_l1_active_minus1); | ||
2939 | + COPY_FIELD(dest, src, cabac_init_idc); | ||
2940 | + COPY_FIELD(dest, src, slice_qp_delta); | ||
2941 | + COPY_FIELD(dest, src, disable_deblocking_filter_idc); | ||
2942 | + COPY_FIELD(dest, src, slice_alpha_c0_offset_div2); | ||
2943 | + COPY_FIELD(dest, src, slice_beta_offset_div2); | ||
2944 | + for (i = 0; i < 32; i++) { | ||
2945 | + status = TRANSLATE_(VAPictureH264)(ctx, | ||
2946 | + &dest->RefPicList0[i], | ||
2947 | + &src->RefPicList0[i]); | ||
2948 | + if (status != VA_STATUS_SUCCESS) | ||
2949 | + return status; | ||
2950 | + status = TRANSLATE_(VAPictureH264)(ctx, | ||
2951 | + &dest->RefPicList1[i], | ||
2952 | + &src->RefPicList1[i]); | ||
2953 | + if (status != VA_STATUS_SUCCESS) | ||
2954 | + return status; | ||
2955 | + } | ||
2956 | + COPY_FIELD(dest, src, luma_log2_weight_denom); | ||
2957 | + COPY_FIELD(dest, src, chroma_log2_weight_denom); | ||
2958 | + COPY_FIELD(dest, src, luma_weight_l0_flag); | ||
2959 | + COPY_ARRAY(dest, src, luma_weight_l0); | ||
2960 | + COPY_ARRAY(dest, src, luma_offset_l0); | ||
2961 | + COPY_FIELD(dest, src, chroma_weight_l0_flag); | ||
2962 | + COPY_ARRAY(dest, src, chroma_weight_l0); | ||
2963 | + COPY_ARRAY(dest, src, chroma_offset_l0); | ||
2964 | + COPY_FIELD(dest, src, luma_weight_l1_flag); | ||
2965 | + COPY_ARRAY(dest, src, luma_weight_l1); | ||
2966 | + COPY_ARRAY(dest, src, luma_offset_l1); | ||
2967 | + COPY_FIELD(dest, src, chroma_weight_l1_flag); | ||
2968 | + COPY_ARRAY(dest, src, chroma_weight_l1); | ||
2969 | + COPY_ARRAY(dest, src, chroma_offset_l1); | ||
2970 | + | ||
2971 | + return VA_STATUS_SUCCESS; | ||
2972 | +} | ||
2973 | + | ||
2974 | +static VAStatus TRANSLATE(PictureParameter,VC1)( | ||
2975 | + VACompatContextP ctx, | ||
2976 | + void *dest_buffer, | ||
2977 | + const void *src_buffer | ||
2978 | +) | ||
2979 | +{ | ||
2980 | + STRUCT(PictureParameter,VC1) *dest = dest_buffer; | ||
2981 | + const VAPictureParameterBufferVC1 *src = src_buffer; | ||
2982 | + | ||
2983 | + COPY_FIELD(dest, src, forward_reference_picture); | ||
2984 | + COPY_FIELD(dest, src, backward_reference_picture); | ||
2985 | + COPY_FIELD(dest, src, inloop_decoded_picture); | ||
2986 | + dest->BFV(sequence_fields, value) = 0; /* reset all bits */ | ||
2987 | + COPY_BIT_FIELD(dest, src, sequence_fields, interlace); | ||
2988 | + COPY_BIT_FIELD(dest, src, sequence_fields, syncmarker); | ||
2989 | + COPY_BIT_FIELD(dest, src, sequence_fields, overlap); | ||
2990 | + COPY_FIELD(dest, src, coded_width); | ||
2991 | + COPY_FIELD(dest, src, coded_height); | ||
2992 | +#if COMPAT_MAJOR == 0 && COMPAT_MINOR == 30 | ||
2993 | + dest->closed_entry = src->entrypoint_fields.bits.closed_entry; | ||
2994 | + dest->broken_link = src->entrypoint_fields.bits.broken_link; | ||
2995 | + dest->loopfilter = src->entrypoint_fields.bits.loopfilter; | ||
2996 | +#else | ||
2997 | + COPY_BIT_FIELD(dest, src, entrypoint_fields, closed_entry); | ||
2998 | + COPY_BIT_FIELD(dest, src, entrypoint_fields, broken_link); | ||
2999 | + COPY_BIT_FIELD(dest, src, entrypoint_fields, loopfilter); | ||
3000 | +#endif | ||
3001 | + COPY_FIELD(dest, src, conditional_overlap_flag); | ||
3002 | + COPY_FIELD(dest, src, fast_uvmc_flag); | ||
3003 | + dest->BFV(range_mapping_fields, value) = 0; /* reset all bits */ | ||
3004 | + dest->BFM(range_mapping_fields, bits, M_luma_flag) = | ||
3005 | + src->range_mapping_fields.bits.luma_flag; | ||
3006 | + dest->BFM(range_mapping_fields, bits, M_luma) = | ||
3007 | + src->range_mapping_fields.bits.luma; | ||
3008 | + dest->BFM(range_mapping_fields, bits, M_chroma_flag) = | ||
3009 | + src->range_mapping_fields.bits.chroma_flag; | ||
3010 | + dest->BFM(range_mapping_fields, bits, M_chroma) = | ||
3011 | + src->range_mapping_fields.bits.chroma; | ||
3012 | + COPY_FIELD(dest, src, b_picture_fraction); | ||
3013 | + COPY_FIELD(dest, src, cbp_table); | ||
3014 | + COPY_FIELD(dest, src, mb_mode_table); | ||
3015 | + COPY_FIELD(dest, src, range_reduction_frame); | ||
3016 | + COPY_FIELD(dest, src, rounding_control); | ||
3017 | + COPY_FIELD(dest, src, post_processing); | ||
3018 | + COPY_FIELD(dest, src, picture_resolution_index); | ||
3019 | + COPY_FIELD(dest, src, luma_scale); | ||
3020 | + COPY_FIELD(dest, src, luma_shift); | ||
3021 | + dest->BFV(picture_fields, value) = 0; /* reset all bits */ | ||
3022 | + COPY_BIT_FIELD(dest, src, picture_fields, picture_type); | ||
3023 | + COPY_BIT_FIELD(dest, src, picture_fields, frame_coding_mode); | ||
3024 | + COPY_BIT_FIELD(dest, src, picture_fields, top_field_first); | ||
3025 | + COPY_BIT_FIELD(dest, src, picture_fields, is_first_field); | ||
3026 | + COPY_BIT_FIELD(dest, src, picture_fields, intensity_compensation); | ||
3027 | + dest->BFV(M_raw_coding, value) = 0; /* reset all bits */ | ||
3028 | + COPY_BIT_FLAG(dest, src, raw_coding, mv_type_mb); | ||
3029 | + COPY_BIT_FLAG(dest, src, raw_coding, direct_mb); | ||
3030 | + COPY_BIT_FLAG(dest, src, raw_coding, skip_mb); | ||
3031 | + COPY_BIT_FLAG(dest, src, raw_coding, field_tx); | ||
3032 | + COPY_BIT_FLAG(dest, src, raw_coding, forward_mb); | ||
3033 | + COPY_BIT_FLAG(dest, src, raw_coding, ac_pred); | ||
3034 | + COPY_BIT_FLAG(dest, src, raw_coding, overflags); | ||
3035 | + dest->BFV(M_bitplane_present, value) = 0; /* reset all bits */ | ||
3036 | + COPY_BIT_FLAG(dest, src, bitplane_present, bp_mv_type_mb); | ||
3037 | + COPY_BIT_FLAG(dest, src, bitplane_present, bp_direct_mb); | ||
3038 | + COPY_BIT_FLAG(dest, src, bitplane_present, bp_skip_mb); | ||
3039 | + COPY_BIT_FLAG(dest, src, bitplane_present, bp_field_tx); | ||
3040 | + COPY_BIT_FLAG(dest, src, bitplane_present, bp_forward_mb); | ||
3041 | + COPY_BIT_FLAG(dest, src, bitplane_present, bp_ac_pred); | ||
3042 | + COPY_BIT_FLAG(dest, src, bitplane_present, bp_overflags); | ||
3043 | + dest->BFV(reference_fields, value) = 0; /* reset all bits */ | ||
3044 | + COPY_BIT_FIELD(dest, src, reference_fields, reference_distance_flag); | ||
3045 | + COPY_BIT_FIELD(dest, src, reference_fields, reference_distance); | ||
3046 | + COPY_BIT_FIELD(dest, src, reference_fields, num_reference_pictures); | ||
3047 | + COPY_BIT_FIELD(dest, src, reference_fields, reference_field_pic_indicator); | ||
3048 | + dest->BFV(mv_fields, value) = 0; /* reset all bits */ | ||
3049 | + COPY_BIT_FIELD(dest, src, mv_fields, mv_mode); | ||
3050 | + COPY_BIT_FIELD(dest, src, mv_fields, mv_mode2); | ||
3051 | + COPY_BIT_FIELD(dest, src, mv_fields, mv_table); | ||
3052 | + COPY_BIT_FIELD(dest, src, mv_fields, two_mv_block_pattern_table); | ||
3053 | + COPY_BIT_FIELD(dest, src, mv_fields, four_mv_switch); | ||
3054 | + COPY_BIT_FIELD(dest, src, mv_fields, four_mv_block_pattern_table); | ||
3055 | + COPY_BIT_FIELD(dest, src, mv_fields, extended_mv_flag); | ||
3056 | + COPY_BIT_FIELD(dest, src, mv_fields, extended_mv_range); | ||
3057 | + COPY_BIT_FIELD(dest, src, mv_fields, extended_dmv_flag); | ||
3058 | + COPY_BIT_FIELD(dest, src, mv_fields, extended_dmv_range); | ||
3059 | + dest->BFV(pic_quantizer_fields, value) = 0; /* reset all bits */ | ||
3060 | + COPY_BIT_FIELD(dest, src, pic_quantizer_fields, dquant); | ||
3061 | + COPY_BIT_FIELD(dest, src, pic_quantizer_fields, quantizer); | ||
3062 | + COPY_BIT_FIELD(dest, src, pic_quantizer_fields, half_qp); | ||
3063 | + COPY_BIT_FIELD(dest, src, pic_quantizer_fields, pic_quantizer_scale); | ||
3064 | + COPY_BIT_FIELD(dest, src, pic_quantizer_fields, pic_quantizer_type); | ||
3065 | + COPY_BIT_FIELD(dest, src, pic_quantizer_fields, dq_frame); | ||
3066 | + COPY_BIT_FIELD(dest, src, pic_quantizer_fields, dq_profile); | ||
3067 | + COPY_BIT_FIELD(dest, src, pic_quantizer_fields, dq_sb_edge); | ||
3068 | + COPY_BIT_FIELD(dest, src, pic_quantizer_fields, dq_db_edge); | ||
3069 | + COPY_BIT_FIELD(dest, src, pic_quantizer_fields, dq_binary_level); | ||
3070 | + COPY_BIT_FIELD(dest, src, pic_quantizer_fields, alt_pic_quantizer); | ||
3071 | + dest->BFV(transform_fields, value) = 0; /* reset all bits */ | ||
3072 | + COPY_BIT_FIELD(dest, src, transform_fields, variable_sized_transform_flag); | ||
3073 | + COPY_BIT_FIELD(dest, src, transform_fields, mb_level_transform_type_flag); | ||
3074 | + COPY_BIT_FIELD(dest, src, transform_fields, frame_level_transform_type); | ||
3075 | + COPY_BIT_FIELD(dest, src, transform_fields, transform_ac_codingset_idx1); | ||
3076 | + COPY_BIT_FIELD(dest, src, transform_fields, transform_ac_codingset_idx2); | ||
3077 | + COPY_BIT_FIELD(dest, src, transform_fields, intra_transform_dc_table); | ||
3078 | + | ||
3079 | + if (src->picture_fields.bits.picture_type == 4) { | ||
3080 | + dest->BFM(picture_fields, bits, picture_type) = 1; /* P-frame */ | ||
3081 | + ctx->skip_frame = 1; | ||
3082 | + } | ||
3083 | + | ||
3084 | + return VA_STATUS_SUCCESS; | ||
3085 | +} | ||
3086 | + | ||
3087 | +static VAStatus TRANSLATE(PictureParameter,MPEG2)( | ||
3088 | + VACompatContextP ctx, | ||
3089 | + void *dest_buffer, | ||
3090 | + const void *src_buffer | ||
3091 | +) | ||
3092 | +{ | ||
3093 | + STRUCT(PictureParameter,MPEG2) *dest = dest_buffer; | ||
3094 | + const VAPictureParameterBufferMPEG2 *src = src_buffer; | ||
3095 | + | ||
3096 | + COPY_FIELD(dest, src, horizontal_size); | ||
3097 | + COPY_FIELD(dest, src, vertical_size); | ||
3098 | + COPY_FIELD(dest, src, forward_reference_picture); | ||
3099 | + COPY_FIELD(dest, src, backward_reference_picture); | ||
3100 | + COPY_FIELD(dest, src, picture_coding_type); | ||
3101 | + COPY_FIELD(dest, src, f_code); | ||
3102 | + dest->BFV(picture_coding_extension, value) = 0; /* reset all bits */ | ||
3103 | + COPY_BIT_FIELD(dest, src, picture_coding_extension, intra_dc_precision); | ||
3104 | + COPY_BIT_FIELD(dest, src, picture_coding_extension, picture_structure); | ||
3105 | + COPY_BIT_FIELD(dest, src, picture_coding_extension, top_field_first); | ||
3106 | + COPY_BIT_FIELD(dest, src, picture_coding_extension, frame_pred_frame_dct); | ||
3107 | + COPY_BIT_FIELD(dest, src, picture_coding_extension, concealment_motion_vectors); | ||
3108 | + COPY_BIT_FIELD(dest, src, picture_coding_extension, q_scale_type); | ||
3109 | + COPY_BIT_FIELD(dest, src, picture_coding_extension, intra_vlc_format); | ||
3110 | + COPY_BIT_FIELD(dest, src, picture_coding_extension, alternate_scan); | ||
3111 | + COPY_BIT_FIELD(dest, src, picture_coding_extension, repeat_first_field); | ||
3112 | + COPY_BIT_FIELD(dest, src, picture_coding_extension, progressive_frame); | ||
3113 | + COPY_BIT_FIELD(dest, src, picture_coding_extension, is_first_field); | ||
3114 | + | ||
3115 | + return VA_STATUS_SUCCESS; | ||
3116 | +} | ||
3117 | + | ||
3118 | +static VAStatus TRANSLATE(SliceParameter,MPEG2)( | ||
3119 | + VACompatContextP ctx, | ||
3120 | + void *dest_buffer, | ||
3121 | + const void *src_buffer | ||
3122 | +) | ||
3123 | +{ | ||
3124 | + STRUCT(SliceParameter,MPEG2) *dest = dest_buffer; | ||
3125 | + const VASliceParameterBufferMPEG2 *src = src_buffer; | ||
3126 | + | ||
3127 | + COPY_FIELD(dest, src, slice_data_size); | ||
3128 | + COPY_FIELD(dest, src, slice_data_offset); | ||
3129 | + COPY_FIELD(dest, src, slice_data_flag); | ||
3130 | + COPY_FIELD(dest, src, macroblock_offset); | ||
3131 | + COPY_FIELD(dest, src, slice_vertical_position); | ||
3132 | + COPY_FIELD(dest, src, quantiser_scale_code); | ||
3133 | + COPY_FIELD(dest, src, intra_slice_flag); | ||
3134 | + | ||
3135 | + return VA_STATUS_SUCCESS; | ||
3136 | +} | ||
3137 | +#endif | ||
3138 | + | ||
3139 | +static VAStatus TRANSLATE(PictureParameter,MPEG4)( | ||
3140 | + VACompatContextP ctx, | ||
3141 | + void *dest_buffer, | ||
3142 | + const void *src_buffer | ||
3143 | +) | ||
3144 | +{ | ||
3145 | + STRUCT(PictureParameter,MPEG4) *dest = dest_buffer; | ||
3146 | + const VAPictureParameterBufferMPEG4 *src = src_buffer; | ||
3147 | + | ||
3148 | + COPY_FIELD(dest, src, vop_width); | ||
3149 | + COPY_FIELD(dest, src, vop_height); | ||
3150 | + COPY_FIELD(dest, src, forward_reference_picture); | ||
3151 | + COPY_FIELD(dest, src, backward_reference_picture); | ||
3152 | + dest->BFV(vol_fields, value) = 0; /* reset all bits */ | ||
3153 | + COPY_BIT_FIELD(dest, src, vol_fields, short_video_header); | ||
3154 | + COPY_BIT_FIELD(dest, src, vol_fields, chroma_format); | ||
3155 | + COPY_BIT_FIELD(dest, src, vol_fields, interlaced); | ||
3156 | + COPY_BIT_FIELD(dest, src, vol_fields, obmc_disable); | ||
3157 | + COPY_BIT_FIELD(dest, src, vol_fields, sprite_enable); | ||
3158 | + COPY_BIT_FIELD(dest, src, vol_fields, sprite_warping_accuracy); | ||
3159 | + COPY_BIT_FIELD(dest, src, vol_fields, quant_type); | ||
3160 | + COPY_BIT_FIELD(dest, src, vol_fields, quarter_sample); | ||
3161 | + COPY_BIT_FIELD(dest, src, vol_fields, data_partitioned); | ||
3162 | + COPY_BIT_FIELD(dest, src, vol_fields, reversible_vlc); | ||
3163 | + COPY_FIELD(dest, src, no_of_sprite_warping_points); | ||
3164 | + COPY_ARRAY(dest, src, sprite_trajectory_du); | ||
3165 | + COPY_ARRAY(dest, src, sprite_trajectory_dv); | ||
3166 | + COPY_FIELD(dest, src, quant_precision); | ||
3167 | + dest->BFV(vop_fields, value) = 0; /* reset all bits */ | ||
3168 | + COPY_BIT_FIELD(dest, src, vop_fields, vop_coding_type); | ||
3169 | + COPY_BIT_FIELD(dest, src, vop_fields, backward_reference_vop_coding_type); | ||
3170 | + COPY_BIT_FIELD(dest, src, vop_fields, vop_rounding_type); | ||
3171 | + COPY_BIT_FIELD(dest, src, vop_fields, intra_dc_vlc_thr); | ||
3172 | + COPY_BIT_FIELD(dest, src, vop_fields, top_field_first); | ||
3173 | + COPY_BIT_FIELD(dest, src, vop_fields, alternate_vertical_scan_flag); | ||
3174 | + COPY_FIELD(dest, src, vop_fcode_forward); | ||
3175 | + COPY_FIELD(dest, src, vop_fcode_backward); | ||
3176 | + COPY_FIELD(dest, src, num_gobs_in_vop); | ||
3177 | + COPY_FIELD(dest, src, num_macroblocks_in_gob); | ||
3178 | + COPY_FIELD(dest, src, TRB); | ||
3179 | + COPY_FIELD(dest, src, TRD); | ||
3180 | + | ||
3181 | + return VA_STATUS_SUCCESS; | ||
3182 | +} | ||
3183 | + | ||
3184 | +#if COMPAT_MAJOR == 0 && COMPAT_MINOR == 30 | ||
3185 | +static VAStatus TRANSLATE_(VAEncSliceParameterBuffer)( | ||
3186 | + VACompatContextP ctx, | ||
3187 | + void *dest_buffer, | ||
3188 | + const void *src_buffer | ||
3189 | +) | ||
3190 | +{ | ||
3191 | + MKCOMPAT(VAEncSliceParameterBuffer) * const dest = dest_buffer; | ||
3192 | + const VAEncSliceParameterBuffer * const src = src_buffer; | ||
3193 | + | ||
3194 | + COPY_FIELD(dest, src, start_row_number); | ||
3195 | + COPY_FIELD(dest, src, slice_height); | ||
3196 | + dest->BFV(slice_flags, value) = 0; /* reset all bits */ | ||
3197 | + COPY_BIT_FIELD(dest, src, slice_flags, is_intra); | ||
3198 | + COPY_BIT_FIELD(dest, src, slice_flags, disable_deblocking_filter_idc); | ||
3199 | + | ||
3200 | + return VA_STATUS_SUCCESS; | ||
3201 | +} | ||
3202 | +#endif | ||
3203 | + | ||
3204 | +static void TRANSLATE_(VADriverContext)( | ||
3205 | + VACompatContext *dest, | ||
3206 | + const struct MKCOMPAT(VADriverContext) *src | ||
3207 | +) | ||
3208 | +{ | ||
3209 | + VACompatDriverVTable *dest_vtable = &dest->vtable; | ||
3210 | + const struct MKCOMPAT(VADriverVTable) *src_vtable = &src->vtable; | ||
3211 | + | ||
3212 | + memset(dest_vtable, 0, sizeof(*dest_vtable)); | ||
3213 | + COPY_VTABLE(dest, src, vaTerminate); | ||
3214 | + COPY_VTABLE(dest, src, vaQueryConfigProfiles); | ||
3215 | + COPY_VTABLE(dest, src, vaQueryConfigEntrypoints); | ||
3216 | + COPY_VTABLE(dest, src, vaGetConfigAttributes); | ||
3217 | + COPY_VTABLE(dest, src, vaCreateConfig); | ||
3218 | + COPY_VTABLE(dest, src, vaDestroyConfig); | ||
3219 | + COPY_VTABLE(dest, src, vaQueryConfigAttributes); | ||
3220 | + COPY_VTABLE(dest, src, vaCreateSurfaces); | ||
3221 | + COPY_VTABLE(dest, src, vaDestroySurfaces); | ||
3222 | + COPY_VTABLE(dest, src, vaCreateContext); | ||
3223 | + COPY_VTABLE(dest, src, vaDestroyContext); | ||
3224 | + COPY_VTABLE(dest, src, vaCreateBuffer); | ||
3225 | + COPY_VTABLE(dest, src, vaBufferSetNumElements); | ||
3226 | + COPY_VTABLE(dest, src, vaMapBuffer); | ||
3227 | + COPY_VTABLE(dest, src, vaUnmapBuffer); | ||
3228 | + COPY_VTABLE(dest, src, vaDestroyBuffer); | ||
3229 | + COPY_VTABLE(dest, src, vaBeginPicture); | ||
3230 | + COPY_VTABLE(dest, src, vaRenderPicture); | ||
3231 | + COPY_VTABLE(dest, src, vaEndPicture); | ||
3232 | + COPY_VTABLE(dest, src, vaQuerySurfaceStatus); | ||
3233 | + COPY_VTABLE(dest, src, vaPutSurface); | ||
3234 | + COPY_VTABLE(dest, src, vaQueryImageFormats); | ||
3235 | + COPY_VTABLE(dest, src, vaCreateImage); | ||
3236 | + COPY_VTABLE(dest, src, vaDeriveImage); | ||
3237 | + COPY_VTABLE(dest, src, vaDestroyImage); | ||
3238 | + COPY_VTABLE(dest, src, vaSetImagePalette); | ||
3239 | + COPY_VTABLE(dest, src, vaGetImage); | ||
3240 | + COPY_VTABLE(dest, src, vaQuerySubpictureFormats); | ||
3241 | + COPY_VTABLE(dest, src, vaCreateSubpicture); | ||
3242 | + COPY_VTABLE(dest, src, vaDestroySubpicture); | ||
3243 | + COPY_VTABLE(dest, src, vaSetSubpictureImage); | ||
3244 | + COPY_VTABLE(dest, src, vaSetSubpictureChromakey); | ||
3245 | + COPY_VTABLE(dest, src, vaSetSubpictureGlobalAlpha); | ||
3246 | + COPY_VTABLE(dest, src, vaDeassociateSubpicture); | ||
3247 | + COPY_VTABLE(dest, src, vaQueryDisplayAttributes); | ||
3248 | + COPY_VTABLE(dest, src, vaGetDisplayAttributes); | ||
3249 | + COPY_VTABLE(dest, src, vaSetDisplayAttributes); | ||
3250 | +#if COMPAT_MAJOR == 0 && COMPAT_MINOR <= 29 | ||
3251 | + COPY_VTABLE(dest, src, vaSetSubpicturePalette); | ||
3252 | + COPY_VTABLE(dest, src, vaDbgCopySurfaceToBuffer); | ||
3253 | +#endif | ||
3254 | +#if COMPAT_MAJOR == 0 && COMPAT_MINOR >= 30 | ||
3255 | + COPY_VTABLE(dest, src, vaCreateSurfaceFromCIFrame); | ||
3256 | + COPY_VTABLE(dest, src, vaCreateSurfaceFromV4L2Buf); | ||
3257 | + COPY_VTABLE(dest, src, vaCopySurfaceToBuffer); | ||
3258 | +#endif | ||
3259 | +#if COMPAT_MAJOR == 0 && COMPAT_MINOR >= 31 | ||
3260 | + COPY_VTABLE(dest, src, vaSyncSurface); | ||
3261 | + COPY_VTABLE(dest, src, vaPutImage); | ||
3262 | + COPY_VTABLE(dest, src, vaAssociateSubpicture); | ||
3263 | +#else | ||
3264 | + COPY_VTABLE_(dest, pre31, src, vaSyncSurface); | ||
3265 | + COPY_VTABLE_(dest, pre31, src, vaPutImage); | ||
3266 | + COPY_VTABLE_(dest, pre31, src, vaPutImage2); | ||
3267 | + COPY_VTABLE_(dest, pre31, src, vaAssociateSubpicture); | ||
3268 | + COPY_VTABLE_(dest, pre31, src, vaAssociateSubpicture2); | ||
3269 | +#endif | ||
3270 | +} | ||
3271 | + | ||
3272 | +#undef COMPAT_MAJOR | ||
3273 | +#undef COMPAT_MINOR | ||
diff --git a/meta-emenlow/recipes-graphics/libva/libva-0.31.0/392_compat.dso.patch b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/392_compat.dso.patch new file mode 100644 index 0000000000..57ae44f9d4 --- /dev/null +++ b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/392_compat.dso.patch | |||
@@ -0,0 +1,183 @@ | |||
1 | commit 389323f728fb2d6392d266d967eddde40465fd93 | ||
2 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
3 | Date: Fri Oct 16 12:35:27 2009 +0000 | ||
4 | |||
5 | Fix compatibility with older programs linked against libva.so.0. | ||
6 | |||
7 | diff --git a/src/Makefile.am b/src/Makefile.am | ||
8 | index 232d8e8..2d696f1 100644 | ||
9 | --- a/src/Makefile.am | ||
10 | +++ b/src/Makefile.am | ||
11 | @@ -72,3 +72,8 @@ EXTRA_DIST = \ | ||
12 | va_compat_template.h | ||
13 | |||
14 | va_compat.c: va_compat_template.h | ||
15 | + | ||
16 | +lib_LTLIBRARIES += libva-compat.la | ||
17 | +libva_compat_la_SOURCES = va_compat_lib.c | ||
18 | +libva_compat_la_LIBADD = libva-x11.la -ldl | ||
19 | +libva_compat_la_DEPENDENCIES = libva-x11.la | ||
20 | diff --git a/src/va_compat_lib.c b/src/va_compat_lib.c | ||
21 | new file mode 100644 | ||
22 | index 0000000..b7e9ea5 | ||
23 | --- /dev/null | ||
24 | +++ b/src/va_compat_lib.c | ||
25 | @@ -0,0 +1,158 @@ | ||
26 | +/* | ||
27 | + * Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved. | ||
28 | + * | ||
29 | + * Permission is hereby granted, free of charge, to any person obtaining a | ||
30 | + * copy of this software and associated documentation files (the | ||
31 | + * "Software"), to deal in the Software without restriction, including | ||
32 | + * without limitation the rights to use, copy, modify, merge, publish, | ||
33 | + * distribute, sub license, and/or sell copies of the Software, and to | ||
34 | + * permit persons to whom the Software is furnished to do so, subject to | ||
35 | + * the following conditions: | ||
36 | + * | ||
37 | + * The above copyright notice and this permission notice (including the | ||
38 | + * next paragraph) shall be included in all copies or substantial portions | ||
39 | + * of the Software. | ||
40 | + * | ||
41 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
42 | + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
43 | + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. | ||
44 | + * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR | ||
45 | + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
46 | + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
47 | + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
48 | + */ | ||
49 | + | ||
50 | +#define _GNU_SOURCE 1 | ||
51 | +#include <dlfcn.h> | ||
52 | +#include <assert.h> | ||
53 | +#include <stddef.h> | ||
54 | + | ||
55 | +typedef void *VADisplay; | ||
56 | +typedef int VAStatus; | ||
57 | +typedef unsigned int VAGenericID; | ||
58 | +typedef VAGenericID VAContextID; | ||
59 | +typedef VAGenericID VASurfaceID; | ||
60 | +typedef VAGenericID VAImageID; | ||
61 | +typedef VAGenericID VASubpictureID; | ||
62 | + | ||
63 | +#define PREPARE_FUNC(NAME, RET, ARGS) \ | ||
64 | + static RET (*lib_##NAME) ARGS; \ | ||
65 | + if (lib_##NAME == NULL) \ | ||
66 | + lib_##NAME = dlsym(RTLD_NEXT, #NAME); \ | ||
67 | + assert(lib_##NAME != NULL) | ||
68 | + | ||
69 | +VAStatus | ||
70 | +vaSyncSurface( | ||
71 | + VADisplay dpy, | ||
72 | + VAContextID context, | ||
73 | + VASurfaceID render_target | ||
74 | +) | ||
75 | +{ | ||
76 | + PREPARE_FUNC(vaSyncSurface, VAStatus, (VADisplay, VASurfaceID)); | ||
77 | + | ||
78 | + return lib_vaSyncSurface(dpy, render_target); | ||
79 | +} | ||
80 | + | ||
81 | +VAStatus | ||
82 | +vaPutImage( | ||
83 | + VADisplay dpy, | ||
84 | + VASurfaceID surface, | ||
85 | + VAImageID image, | ||
86 | + int src_x, | ||
87 | + int src_y, | ||
88 | + unsigned int width, | ||
89 | + unsigned int height, | ||
90 | + int dest_x, | ||
91 | + int dest_y | ||
92 | +) | ||
93 | +{ | ||
94 | + PREPARE_FUNC(vaPutImage, VAStatus, (VADisplay, VASurfaceID, VAImageID, | ||
95 | + int, int, unsigned int, unsigned int, | ||
96 | + int, int, unsigned int, unsigned int)); | ||
97 | + | ||
98 | + return lib_vaPutImage(dpy, surface, image, | ||
99 | + src_x, src_y, width, height, | ||
100 | + dest_x, dest_y, width, height); | ||
101 | +} | ||
102 | + | ||
103 | +VAStatus | ||
104 | +vaPutImage2( | ||
105 | + VADisplay dpy, | ||
106 | + VASurfaceID surface, | ||
107 | + VAImageID image, | ||
108 | + int src_x, | ||
109 | + int src_y, | ||
110 | + unsigned int src_width, | ||
111 | + unsigned int src_height, | ||
112 | + int dest_x, | ||
113 | + int dest_y, | ||
114 | + unsigned int dest_width, | ||
115 | + unsigned int dest_height | ||
116 | +) | ||
117 | +{ | ||
118 | + PREPARE_FUNC(vaPutImage, VAStatus, (VADisplay, VASurfaceID, VAImageID, | ||
119 | + int, int, unsigned int, unsigned int, | ||
120 | + int, int, unsigned int, unsigned int)); | ||
121 | + | ||
122 | + return lib_vaPutImage(dpy, surface, image, | ||
123 | + src_x, src_y, src_width, src_height, | ||
124 | + dest_x, dest_y, dest_width, dest_height); | ||
125 | +} | ||
126 | + | ||
127 | +VAStatus | ||
128 | +vaAssociateSubpicture( | ||
129 | + VADisplay dpy, | ||
130 | + VASubpictureID subpicture, | ||
131 | + VASurfaceID *target_surfaces, | ||
132 | + int num_surfaces, | ||
133 | + short src_x, | ||
134 | + short src_y, | ||
135 | + short dest_x, | ||
136 | + short dest_y, | ||
137 | + unsigned short width, | ||
138 | + unsigned short height, | ||
139 | + unsigned int flags | ||
140 | +) | ||
141 | +{ | ||
142 | + PREPARE_FUNC(vaAssociateSubpicture, | ||
143 | + VAStatus, (VADisplay, VASubpictureID, VASurfaceID *, int, | ||
144 | + short, short, unsigned short, unsigned short, | ||
145 | + short, short, unsigned short, unsigned short, | ||
146 | + unsigned int)); | ||
147 | + | ||
148 | + return lib_vaAssociateSubpicture(dpy, subpicture, | ||
149 | + target_surfaces, num_surfaces, | ||
150 | + src_x, src_y, width, height, | ||
151 | + dest_x, dest_y, width, height, | ||
152 | + flags); | ||
153 | +} | ||
154 | + | ||
155 | +VAStatus | ||
156 | +vaAssociateSubpicture2( | ||
157 | + VADisplay dpy, | ||
158 | + VASubpictureID subpicture, | ||
159 | + VASurfaceID *target_surfaces, | ||
160 | + int num_surfaces, | ||
161 | + short src_x, | ||
162 | + short src_y, | ||
163 | + unsigned short src_width, | ||
164 | + unsigned short src_height, | ||
165 | + short dest_x, | ||
166 | + short dest_y, | ||
167 | + unsigned short dest_width, | ||
168 | + unsigned short dest_height, | ||
169 | + unsigned int flags | ||
170 | +) | ||
171 | +{ | ||
172 | + PREPARE_FUNC(vaAssociateSubpicture, | ||
173 | + VAStatus, (VADisplay, VASubpictureID, VASurfaceID *, int, | ||
174 | + short, short, unsigned short, unsigned short, | ||
175 | + short, short, unsigned short, unsigned short, | ||
176 | + unsigned int)); | ||
177 | + | ||
178 | + return lib_vaAssociateSubpicture(dpy, subpicture, | ||
179 | + target_surfaces, num_surfaces, | ||
180 | + src_x, src_y, src_width, src_height, | ||
181 | + dest_x, dest_y, dest_width, dest_height, | ||
182 | + flags); | ||
183 | +} | ||
diff --git a/meta-emenlow/recipes-graphics/libva/libva-0.31.0/libdrm-poulsbo.patch b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/libdrm-poulsbo.patch new file mode 100644 index 0000000000..ac38eceb81 --- /dev/null +++ b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/libdrm-poulsbo.patch | |||
@@ -0,0 +1,26 @@ | |||
1 | # Make the libva depend on libdrm-poulsbo instead of libdrm so that the | ||
2 | # emenlow libdrm can coexist with the normal libdrm. | ||
3 | # jdike@linux.intel.com | ||
4 | |||
5 | Index: libva-0.31.0/configure.ac | ||
6 | =================================================================== | ||
7 | --- libva-0.31.0.orig/configure.ac | ||
8 | +++ libva-0.31.0/configure.ac | ||
9 | @@ -99,14 +99,14 @@ AC_SYS_LARGEFILE | ||
10 | PKG_CHECK_MODULES([X11], [x11]) | ||
11 | PKG_CHECK_MODULES([XEXT],[xext]) | ||
12 | PKG_CHECK_MODULES([XFIXES], [xfixes]) | ||
13 | -PKG_CHECK_MODULES([DRM], [libdrm]) | ||
14 | +PKG_CHECK_MODULES([DRM], [libdrm_poulsbo]) | ||
15 | |||
16 | PKG_CHECK_MODULES(GEN4ASM, [intel-gen4asm >= 1.0], [gen4asm=yes], [gen4asm=no]) | ||
17 | AM_CONDITIONAL(HAVE_GEN4ASM, test x$gen4asm = xyes) | ||
18 | |||
19 | # Check for libdrm >= 2.4 (needed for i965_drv_video.so) | ||
20 | -if test x$enable_i965_driver = xyes && ! $PKG_CONFIG --atleast-version=2.4 libdrm; then | ||
21 | - AC_MSG_WARN([libdrm < 2.4 found, disabling build of i965 video driver]) | ||
22 | +if test x$enable_i965_driver = xyes && ! $PKG_CONFIG --atleast-version=2.4 libdrm_poulsbo; then | ||
23 | + AC_MSG_WARN([libdrm_poulsbo < 2.4 found, disabling build of i965 video driver]) | ||
24 | enable_i965_driver=no | ||
25 | fi | ||
26 | AM_CONDITIONAL(BUILD_I965_DRIVER, test x$enable_i965_driver = xyes) | ||
diff --git a/meta-emenlow/recipes-graphics/libva/libva_0.31.0.bb b/meta-emenlow/recipes-graphics/libva/libva_0.31.0.bb new file mode 100644 index 0000000000..a316409876 --- /dev/null +++ b/meta-emenlow/recipes-graphics/libva/libva_0.31.0.bb | |||
@@ -0,0 +1,40 @@ | |||
1 | DESCRIPTION = "Video Acceleration (VA) API for Linux" | ||
2 | LICENSE = "MIT" | ||
3 | LIC_FILES_CHKSUM = "file://COPYING;md5=efc13a0998e678466e556756613c582e" | ||
4 | PR = "r1" | ||
5 | DEPENDS = "libxext" | ||
6 | |||
7 | inherit autotools | ||
8 | |||
9 | SRC_URI = "https://launchpad.net/~gma500/+archive/ppa/+files/libva_0.31.0-1+sds9.1ubuntu1.tar.gz \ | ||
10 | file://033_g45_add_rgba_subpic.patch \ | ||
11 | file://034_g45_fix_return_for_unimpl.patch \ | ||
12 | file://035_g45_add_yv12_image_format.patch \ | ||
13 | file://036_g45_add_vaGetImage.patch \ | ||
14 | file://037_g45_add_vaPutImage.patch \ | ||
15 | file://038_g45_vaPutSurface_cliprects.patch \ | ||
16 | file://102_attribute_visibility.patch \ | ||
17 | file://103_fix_vainfo_deps.patch \ | ||
18 | file://104_fix_libva_pkgconfig_deps.patch \ | ||
19 | file://105_dont_search_LIBGL_DRIVERS_PATH.patch \ | ||
20 | file://108_drivers_path.patch \ | ||
21 | file://203_fix_fglrx_detection.patch \ | ||
22 | file://204_check_ATIFGLEXTENSION.patch \ | ||
23 | file://300_sds_version.patch \ | ||
24 | file://301_vdpau_mpeg4.patch \ | ||
25 | file://320_move_vaPutSurface_flags_def.patch \ | ||
26 | file://321_libva_glx.base.patch \ | ||
27 | file://322_libva_glx.patch \ | ||
28 | file://390_compat.base.patch \ | ||
29 | file://391_compat.patch \ | ||
30 | file://392_compat.dso.patch \ | ||
31 | file://libdrm-poulsbo.patch" | ||
32 | |||
33 | export LDFLAGS="-Wl,-z,defs" | ||
34 | |||
35 | EXTRA_OECONF = "--disable-i965-driver" | ||
36 | |||
37 | FILES_${PN} += "${libdir}/va/drivers/*" | ||
38 | |||
39 | COMPATIBLE_MACHINE = "emenlow" | ||
40 | PACKAGE_ARCH = "${MACHINE_ARCH}" | ||
diff --git a/meta-emenlow/recipes-graphics/psb-firmware/psb-firmware_0.30.bb b/meta-emenlow/recipes-graphics/psb-firmware/psb-firmware_0.30.bb new file mode 100644 index 0000000000..164ea66c82 --- /dev/null +++ b/meta-emenlow/recipes-graphics/psb-firmware/psb-firmware_0.30.bb | |||
@@ -0,0 +1,15 @@ | |||
1 | DESCRIPTION = "Binary firmware for the Poulsbo (psb) 3D X11 driver" | ||
2 | LICENSE = "Intel-binary-only" | ||
3 | LIC_FILES_CHKSUM = "file://COPYING;md5=02c597a2f082b4581596065bb5a521a8" | ||
4 | PR = "r0" | ||
5 | |||
6 | SRC_URI = "https://launchpad.net/~gma500/+archive/ppa/+files/psb-firmware_0.30-0ubuntu1netbook1ubuntu1.tar.gz" | ||
7 | |||
8 | do_install() { | ||
9 | install -d ${D}${base_libdir}/firmware/ | ||
10 | install -m 0644 ${WORKDIR}/psb-firmware-0.30/msvdx_fw.bin ${D}${base_libdir}/firmware/ | ||
11 | } | ||
12 | |||
13 | FILES_${PN} += "${base_libdir}/firmware/msvdx_fw.bin" | ||
14 | |||
15 | COMPATIBLE_MACHINE = "emenlow" | ||
diff --git a/meta-emenlow/recipes-graphics/psb-kernel-source/psb-kernel-source-4.42.0/build.patch b/meta-emenlow/recipes-graphics/psb-kernel-source/psb-kernel-source-4.42.0/build.patch new file mode 100644 index 0000000000..ce6f2aa41b --- /dev/null +++ b/meta-emenlow/recipes-graphics/psb-kernel-source/psb-kernel-source-4.42.0/build.patch | |||
@@ -0,0 +1,175 @@ | |||
1 | # These are various fixes needed to make the psb kernel driver build against | ||
2 | # 2.6.33.2. | ||
3 | # The Makefile patch is specific to the Poky environment - the external kernel | ||
4 | # module build expects the kernel tree it's building against to have fixdep | ||
5 | # and modpost built, which isn't the case here. So, the modules rule makes | ||
6 | # sure that they are built before the module is built. | ||
7 | # Aside from that, the changes involve adding missing header files and | ||
8 | # compensating for a structure field changing name and type. | ||
9 | |||
10 | Index: psb-kernel-source-4.42.0/drm_os_linux.h | ||
11 | =================================================================== | ||
12 | --- psb-kernel-source-4.42.0.orig/drm_os_linux.h | ||
13 | +++ psb-kernel-source-4.42.0/drm_os_linux.h | ||
14 | @@ -50,12 +50,6 @@ | ||
15 | |||
16 | /** IRQ handler arguments and return type and values */ | ||
17 | #define DRM_IRQ_ARGS int irq, void *arg | ||
18 | -/** backwards compatibility with old irq return values */ | ||
19 | -#ifndef IRQ_HANDLED | ||
20 | -typedef void irqreturn_t; | ||
21 | -#define IRQ_HANDLED /* nothing */ | ||
22 | -#define IRQ_NONE /* nothing */ | ||
23 | -#endif | ||
24 | |||
25 | /** AGP types */ | ||
26 | #if __OS_HAS_AGP | ||
27 | Index: psb-kernel-source-4.42.0/Makefile | ||
28 | =================================================================== | ||
29 | --- psb-kernel-source-4.42.0.orig/Makefile | ||
30 | +++ psb-kernel-source-4.42.0/Makefile | ||
31 | @@ -165,7 +165,10 @@ endif | ||
32 | all: modules | ||
33 | |||
34 | modules: includes | ||
35 | - +make -C $(LINUXDIR) $(GETCONFIG) SUBDIRS=`pwd` DRMSRCDIR=`pwd` modules | ||
36 | + +make -C $(LINUXDIR)/scripts/basic fixdep | ||
37 | +# +make -C $(LINUXDIR) SUBDIRS=scripts/mod modpost | ||
38 | + +make -C $(LINUXDIR) SUBDIRS=scripts | ||
39 | + +make -k -C $(LINUXDIR) $(GETCONFIG) SUBDIRS=`pwd` DRMSRCDIR=`pwd` modules | ||
40 | |||
41 | ifeq ($(HEADERFROMBOOT),1) | ||
42 | |||
43 | @@ -243,7 +246,7 @@ dristat: dristat.c | ||
44 | drmstat: drmstat.c | ||
45 | $(CC) $(PRGCFLAGS) $< -o $@ $(DRMSTATLIBS) | ||
46 | |||
47 | -install: | ||
48 | +modules_install: | ||
49 | make -C $(LINUXDIR) $(GETCONFIG) SUBDIRS=`pwd` DRMSRCDIR=`pwd` modules_install | ||
50 | |||
51 | else | ||
52 | Index: psb-kernel-source-4.42.0/drm_edid.c | ||
53 | =================================================================== | ||
54 | --- psb-kernel-source-4.42.0.orig/drm_edid.c | ||
55 | +++ psb-kernel-source-4.42.0/drm_edid.c | ||
56 | @@ -11,6 +11,7 @@ | ||
57 | #include "drm_edid.h" | ||
58 | |||
59 | #include <acpi/acpi_drivers.h> | ||
60 | +#include <linux/i2c.h> | ||
61 | |||
62 | /* Valid EDID header has these bytes */ | ||
63 | static u8 edid_header[] = { 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 }; | ||
64 | @@ -39,7 +40,7 @@ int drm_get_acpi_edid(char *method, char | ||
65 | if (obj && obj->type == ACPI_TYPE_BUFFER) | ||
66 | memcpy(edid, obj->buffer.pointer, obj->buffer.length); | ||
67 | else { | ||
68 | - printk(KERN_ERR PREFIX "Invalid _DDC data\n"); | ||
69 | + printk(KERN_ERR "Invalid _DDC data\n"); | ||
70 | status = -EFAULT; | ||
71 | kfree(obj); | ||
72 | } | ||
73 | Index: psb-kernel-source-4.42.0/drm_ttm.c | ||
74 | =================================================================== | ||
75 | --- psb-kernel-source-4.42.0.orig/drm_ttm.c | ||
76 | +++ psb-kernel-source-4.42.0/drm_ttm.c | ||
77 | @@ -28,6 +28,8 @@ | ||
78 | * Authors: Thomas Hellström <thomas-at-tungstengraphics-dot-com> | ||
79 | */ | ||
80 | |||
81 | +#include "linux/spinlock.h" | ||
82 | +#include "asm/agp.h" | ||
83 | #include "drmP.h" | ||
84 | |||
85 | static void drm_ttm_ipi_handler(void *null) | ||
86 | Index: psb-kernel-source-4.42.0/psb_drv.c | ||
87 | =================================================================== | ||
88 | --- psb-kernel-source-4.42.0.orig/psb_drv.c | ||
89 | +++ psb-kernel-source-4.42.0/psb_drv.c | ||
90 | @@ -34,8 +34,10 @@ | ||
91 | #include <linux/cpu.h> | ||
92 | #include <linux/notifier.h> | ||
93 | #include <linux/fb.h> | ||
94 | +#include "linux/spinlock.h" | ||
95 | +#include "asm/agp.h" | ||
96 | |||
97 | -int drm_psb_debug = 0; | ||
98 | +int drm_psb_debug = 255; | ||
99 | EXPORT_SYMBOL(drm_psb_debug); | ||
100 | static int drm_psb_trap_pagefaults = 0; | ||
101 | static int drm_psb_clock_gating = 0; | ||
102 | Index: psb-kernel-source-4.42.0/intel_lvds.c | ||
103 | =================================================================== | ||
104 | --- psb-kernel-source-4.42.0.orig/intel_lvds.c | ||
105 | +++ psb-kernel-source-4.42.0/intel_lvds.c | ||
106 | @@ -29,6 +29,7 @@ | ||
107 | |||
108 | #include <linux/i2c.h> | ||
109 | #include <linux/backlight.h> | ||
110 | +#include <linux/i2c.h> | ||
111 | #include "drm_crtc.h" | ||
112 | #include "drm_edid.h" | ||
113 | #include "intel_lvds.h" | ||
114 | Index: psb-kernel-source-4.42.0/drm_memory.c | ||
115 | =================================================================== | ||
116 | --- psb-kernel-source-4.42.0.orig/drm_memory.c | ||
117 | +++ psb-kernel-source-4.42.0/drm_memory.c | ||
118 | @@ -264,9 +264,9 @@ static void *agp_remap(unsigned long off | ||
119 | return NULL; | ||
120 | |||
121 | phys_addr_map = | ||
122 | - agpmem->memory->memory + (offset - agpmem->bound) / PAGE_SIZE; | ||
123 | + agpmem->memory->pages + (offset - agpmem->bound) / PAGE_SIZE; | ||
124 | for (i = 0; i < num_pages; ++i) | ||
125 | - page_map[i] = pfn_to_page(phys_addr_map[i] >> PAGE_SHIFT); | ||
126 | + page_map[i] = phys_addr_map[i]; | ||
127 | addr = vmap(page_map, num_pages, VM_IOREMAP, PAGE_AGP); | ||
128 | vfree(page_map); | ||
129 | |||
130 | Index: psb-kernel-source-4.42.0/drm_agpsupport.c | ||
131 | =================================================================== | ||
132 | --- psb-kernel-source-4.42.0.orig/drm_agpsupport.c | ||
133 | +++ psb-kernel-source-4.42.0/drm_agpsupport.c | ||
134 | @@ -524,7 +524,7 @@ static int drm_agp_populate(struct drm_t | ||
135 | DRM_DEBUG("Current page count is %ld\n", (long) mem->page_count); | ||
136 | mem->page_count = 0; | ||
137 | for (cur_page = pages; cur_page < last_page; ++cur_page) | ||
138 | - mem->pages[mem->page_count++] = phys_to_gart(page_to_phys(*cur_page)); | ||
139 | + mem->pages[mem->page_count++] = page_to_phys(*cur_page); | ||
140 | agp_be->mem = mem; | ||
141 | return 0; | ||
142 | } | ||
143 | Index: psb-kernel-source-4.42.0/drm_vm.c | ||
144 | =================================================================== | ||
145 | --- psb-kernel-source-4.42.0.orig/drm_vm.c | ||
146 | +++ psb-kernel-source-4.42.0/drm_vm.c | ||
147 | @@ -145,13 +145,13 @@ static int drm_do_vm_fault(struct vm_are | ||
148 | * Get the page, inc the use count, and return it | ||
149 | */ | ||
150 | offset = (baddr - agpmem->bound) >> PAGE_SHIFT; | ||
151 | - page = virt_to_page(__va(agpmem->memory->memory[offset])); | ||
152 | + page = agpmem->memory->pages[offset]; | ||
153 | get_page(page); | ||
154 | vmf->page = page; | ||
155 | |||
156 | DRM_DEBUG | ||
157 | ("baddr = 0x%lx page = 0x%p, offset = 0x%lx, count=%d\n", | ||
158 | - baddr, __va(agpmem->memory->memory[offset]), offset, | ||
159 | + baddr, agpmem->memory->pages[offset], offset, | ||
160 | page_count(page)); | ||
161 | return 0; | ||
162 | } | ||
163 | Index: psb-kernel-source-4.42.0/psb_drv.h | ||
164 | =================================================================== | ||
165 | --- psb-kernel-source-4.42.0.orig/psb_drv.h | ||
166 | +++ psb-kernel-source-4.42.0/psb_drv.h | ||
167 | @@ -809,7 +809,7 @@ extern int drm_psb_detear; | ||
168 | #define PSB_DEBUG(_flag, _fmt, _arg...) \ | ||
169 | do { \ | ||
170 | if (unlikely((_flag) & drm_psb_debug)) \ | ||
171 | - printk(KERN_DEBUG \ | ||
172 | + printk(KERN_ERR \ | ||
173 | "[psb:0x%02x:%s] " _fmt , _flag, \ | ||
174 | __FUNCTION__ , ##_arg); \ | ||
175 | } while (0) | ||
diff --git a/meta-emenlow/recipes-graphics/psb-kernel-source/psb-kernel-source_4.42.0.bb b/meta-emenlow/recipes-graphics/psb-kernel-source/psb-kernel-source_4.42.0.bb new file mode 100644 index 0000000000..5c1a3e1c27 --- /dev/null +++ b/meta-emenlow/recipes-graphics/psb-kernel-source/psb-kernel-source_4.42.0.bb | |||
@@ -0,0 +1,24 @@ | |||
1 | DESCRIPTION = "Kernel module for the Poulsbo (psb) 2D X11 driver" | ||
2 | LICENSE = "GPLv2" | ||
3 | LIC_FILES_CHKSUM = "file://GPLv2_License.txt;md5=f5ca3155cfeaa64a6ea228b11ad6916d" | ||
4 | PR = "r1" | ||
5 | |||
6 | inherit module | ||
7 | |||
8 | SRC_URI = "https://launchpad.net/~gma500/+archive/ppa/+files/psb-kernel-source_4.42.0-0ubuntu2~1004um2.tar.gz \ | ||
9 | file://build.patch;patch=1" | ||
10 | |||
11 | do_compile () { | ||
12 | oe_runmake LINUXDIR=${STAGING_KERNEL_DIR} DRM_MODULES="psb" | ||
13 | } | ||
14 | |||
15 | do_install () { | ||
16 | mkdir -p ${D}/lib/modules/${KERNEL_VERSION}/extra | ||
17 | cp ${WORKDIR}/${PN}-${PV}/*.ko ${D}/lib/modules/${KERNEL_VERSION}/extra | ||
18 | } | ||
19 | |||
20 | FILES_${PN} += "${base_libdir}/modules/${KERNEL_VERSION}/extra/*.ko" | ||
21 | |||
22 | DEPENDS += "virtual/kernel" | ||
23 | |||
24 | COMPATIBLE_MACHINE = "emenlow" | ||
diff --git a/meta-emenlow/recipes-graphics/xorg-xserver/files/crosscompile.patch b/meta-emenlow/recipes-graphics/xorg-xserver/files/crosscompile.patch new file mode 100644 index 0000000000..2341e40bca --- /dev/null +++ b/meta-emenlow/recipes-graphics/xorg-xserver/files/crosscompile.patch | |||
@@ -0,0 +1,19 @@ | |||
1 | Index: xorg-server-1.7.99.2/configure.ac | ||
2 | =================================================================== | ||
3 | --- xorg-server-1.7.99.2.orig/configure.ac 2010-01-29 16:38:49.000000000 +0000 | ||
4 | +++ xorg-server-1.7.99.2/configure.ac 2010-01-29 16:42:39.000000000 +0000 | ||
5 | @@ -503,14 +503,10 @@ | ||
6 | |||
7 | dnl Uses --default-font-path if set, otherwise checks for /etc/X11/fontpath.d, | ||
8 | dnl otherwise uses standard subdirectories of FONTROOTDIR | ||
9 | -AC_CHECK_FILE([${sysconfdir}/X11/fontpath.d], | ||
10 | - [DEFAULT_FONT_PATH='catalogue:${sysconfdir}/X11/fontpath.d'], | ||
11 | - [ | ||
12 | DEFAULT_FONT_PATH="${FONTMISCDIR}/,${FONTTTFDIR}/,${FONTOTFDIR}/,${FONTTYPE1DIR}/,${FONT100DPIDIR}/,${FONT75DPIDIR}/" | ||
13 | case $host_os in | ||
14 | darwin*) DEFAULT_FONT_PATH="${DEFAULT_FONT_PATH},/Library/Fonts,/System/Library/Fonts" ;; | ||
15 | esac | ||
16 | - ]) | ||
17 | AC_ARG_WITH(default-font-path, AS_HELP_STRING([--with-default-font-path=PATH], [Comma separated list of font dirs]), | ||
18 | [ FONTPATH="$withval" ], | ||
19 | [ FONTPATH="${DEFAULT_FONT_PATH}" ]) | ||
diff --git a/meta-emenlow/recipes-graphics/xorg-xserver/files/fix_open_max_preprocessor_error.patch b/meta-emenlow/recipes-graphics/xorg-xserver/files/fix_open_max_preprocessor_error.patch new file mode 100644 index 0000000000..565832eed8 --- /dev/null +++ b/meta-emenlow/recipes-graphics/xorg-xserver/files/fix_open_max_preprocessor_error.patch | |||
@@ -0,0 +1,13 @@ | |||
1 | Index: git/os/osdep.h | ||
2 | =================================================================== | ||
3 | --- git.orig/os/osdep.h 2008-10-07 18:38:21.000000000 +0100 | ||
4 | +++ git/os/osdep.h 2008-10-07 18:39:36.000000000 +0100 | ||
5 | @@ -92,7 +92,7 @@ | ||
6 | * like sysconf(_SC_OPEN_MAX) is not supported. | ||
7 | */ | ||
8 | |||
9 | -#if OPEN_MAX <= 256 | ||
10 | +#if 0 | ||
11 | #define MAXSOCKS (OPEN_MAX - 1) | ||
12 | #else | ||
13 | #define MAXSOCKS 256 | ||
diff --git a/meta-emenlow/recipes-graphics/xorg-xserver/files/libdrm-poulsbo.patch b/meta-emenlow/recipes-graphics/xorg-xserver/files/libdrm-poulsbo.patch new file mode 100644 index 0000000000..b604cab7c2 --- /dev/null +++ b/meta-emenlow/recipes-graphics/xorg-xserver/files/libdrm-poulsbo.patch | |||
@@ -0,0 +1,26 @@ | |||
1 | # Make the server depend on libdrm-poulsbo instead of libdrm so that the | ||
2 | # emenlow libdrm can coexist with the normal libdrm. | ||
3 | # jdike@linux.intel.com | ||
4 | |||
5 | Index: xorg-server-1.7.99.2/configure.ac | ||
6 | =================================================================== | ||
7 | --- xorg-server-1.7.99.2.orig/configure.ac | ||
8 | +++ xorg-server-1.7.99.2/configure.ac | ||
9 | @@ -763,7 +763,7 @@ dnl List of libraries that require a spe | ||
10 | LIBAPPLEWM="applewm >= 1.4" | ||
11 | LIBDMX="dmx >= 1.0.99.1" | ||
12 | LIBDRI="dri >= 7.1.0" | ||
13 | -LIBDRM="libdrm >= 2.3.0" | ||
14 | +LIBDRM="libdrm_poulsbo >= 2.3.0" | ||
15 | LIBGL="gl >= 7.1.0" | ||
16 | LIBXEXT="xext >= 1.0.99.4" | ||
17 | LIBXI="xi >= 1.2.99.1" | ||
18 | @@ -2002,7 +2002,7 @@ if test "$KDRIVE" = yes; then | ||
19 | XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS xv" | ||
20 | fi | ||
21 | if test "x$DRI" = xyes && test "x$GLX" = xyes; then | ||
22 | - XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS $LIBGL libdrm" | ||
23 | + XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS $LIBGL libdrm_poulsbo" | ||
24 | fi | ||
25 | |||
26 | PKG_CHECK_MODULES(XEPHYR, $XEPHYR_REQUIRED_LIBS, [xephyr="yes"], [xephyr="no"]) | ||
diff --git a/meta-emenlow/recipes-graphics/xorg-xserver/files/macro_tweak.patch b/meta-emenlow/recipes-graphics/xorg-xserver/files/macro_tweak.patch new file mode 100644 index 0000000000..6998adffe9 --- /dev/null +++ b/meta-emenlow/recipes-graphics/xorg-xserver/files/macro_tweak.patch | |||
@@ -0,0 +1,18 @@ | |||
1 | Index: xorg-server-1.5.0/xorg-server.m4 | ||
2 | =================================================================== | ||
3 | --- xorg-server-1.5.0.orig/xorg-server.m4 2007-05-29 20:36:51.000000000 +0100 | ||
4 | +++ xorg-server-1.5.0/xorg-server.m4 2008-11-04 23:56:55.000000000 +0000 | ||
5 | @@ -28,9 +28,12 @@ | ||
6 | # Checks for the $1 define in xorg-server.h (from the sdk). If it | ||
7 | # is defined, then add $1 to $REQUIRED_MODULES. | ||
8 | |||
9 | +m4_pattern_allow(PKG_CONFIG_SYSROOT_DIR) | ||
10 | + | ||
11 | AC_DEFUN([XORG_DRIVER_CHECK_EXT],[ | ||
12 | + PKG_PROG_PKG_CONFIG | ||
13 | SAVE_CFLAGS="$CFLAGS" | ||
14 | - CFLAGS="$CFLAGS -I`pkg-config --variable=sdkdir xorg-server`" | ||
15 | + CFLAGS="$CFLAGS -I$PKG_CONFIG_SYSROOT_DIR`pkg-config --variable=sdkdir xorg-server`" | ||
16 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | ||
17 | #include "xorg-server.h" | ||
18 | #if !defined $1 | ||
diff --git a/meta-emenlow/recipes-graphics/xorg-xserver/files/nodolt.patch b/meta-emenlow/recipes-graphics/xorg-xserver/files/nodolt.patch new file mode 100644 index 0000000000..6b34032a39 --- /dev/null +++ b/meta-emenlow/recipes-graphics/xorg-xserver/files/nodolt.patch | |||
@@ -0,0 +1,12 @@ | |||
1 | Index: git/configure.ac | ||
2 | =================================================================== | ||
3 | --- git.orig/configure.ac 2009-01-15 20:35:31.000000000 +0000 | ||
4 | +++ git/configure.ac 2009-01-15 20:35:38.000000000 +0000 | ||
5 | @@ -62,7 +62,6 @@ | ||
6 | AC_LIBTOOL_WIN32_DLL | ||
7 | AC_DISABLE_STATIC | ||
8 | AC_PROG_LIBTOOL | ||
9 | -DOLT | ||
10 | AC_PROG_MAKE_SET | ||
11 | PKG_PROG_PKG_CONFIG | ||
12 | AC_PROG_LEX | ||
diff --git a/meta-emenlow/recipes-graphics/xorg-xserver/xserver-psb_1.7.99.2.bb b/meta-emenlow/recipes-graphics/xorg-xserver/xserver-psb_1.7.99.2.bb new file mode 100644 index 0000000000..5227faa45c --- /dev/null +++ b/meta-emenlow/recipes-graphics/xorg-xserver/xserver-psb_1.7.99.2.bb | |||
@@ -0,0 +1,21 @@ | |||
1 | require recipes-graphics/xorg-xserver/xserver-xf86-dri-lite.inc | ||
2 | |||
3 | PR = "r3" | ||
4 | |||
5 | PROTO_DEPS += "xf86driproto dri2proto" | ||
6 | |||
7 | DEPENDS += "font-util" | ||
8 | |||
9 | SRC_URI += "file://nodolt.patch \ | ||
10 | file://crosscompile.patch \ | ||
11 | file://libdrm-poulsbo.patch" | ||
12 | |||
13 | # Misc build failure for master HEAD | ||
14 | SRC_URI += "file://fix_open_max_preprocessor_error.patch" | ||
15 | |||
16 | EXTRA_OECONF += "--enable-dri --enable-dri2 --enable-dga --enable-glx" | ||
17 | |||
18 | RDEPENDS_${PN} += "xserver-xorg-video-psb psb-firmware xpsb-glx \ | ||
19 | libdrm-poulsbo libva" | ||
20 | |||
21 | COMPATIBLE_MACHINE = "emenlow" | ||
diff --git a/meta-emenlow/recipes-graphics/xorg-xserver/xserver-xf86-config/emenlow/xorg.conf b/meta-emenlow/recipes-graphics/xorg-xserver/xserver-xf86-config/emenlow/xorg.conf new file mode 100644 index 0000000000..6846263839 --- /dev/null +++ b/meta-emenlow/recipes-graphics/xorg-xserver/xserver-xf86-config/emenlow/xorg.conf | |||
@@ -0,0 +1,13 @@ | |||
1 | Section "ServerFlags" | ||
2 | Option "AutoAddDevices" "False" | ||
3 | EndSection | ||
4 | |||
5 | Section "Device" | ||
6 | Identifier "Configured Video Device" | ||
7 | Driver "psb" | ||
8 | Option "ShadowFB" "False" | ||
9 | EndSection | ||
10 | |||
11 | Section "DRI" | ||
12 | Mode 0666 | ||
13 | EndSection | ||
diff --git a/meta-emenlow/recipes-graphics/xorg-xserver/xserver-xf86-config_0.1.bbappend b/meta-emenlow/recipes-graphics/xorg-xserver/xserver-xf86-config_0.1.bbappend new file mode 100644 index 0000000000..4b8d0e656b --- /dev/null +++ b/meta-emenlow/recipes-graphics/xorg-xserver/xserver-xf86-config_0.1.bbappend | |||
@@ -0,0 +1,3 @@ | |||
1 | THISDIR := "${@os.path.dirname(bb.data.getVar('FILE', d, True))}" | ||
2 | FILESPATH =. "${@base_set_filespath(["${THISDIR}/${PN}"], d)}:" | ||
3 | |||
diff --git a/meta-emenlow/recipes-graphics/xpsb-glx/xpsb-glx-0.18/cross-compile.patch b/meta-emenlow/recipes-graphics/xpsb-glx/xpsb-glx-0.18/cross-compile.patch new file mode 100644 index 0000000000..a231596810 --- /dev/null +++ b/meta-emenlow/recipes-graphics/xpsb-glx/xpsb-glx-0.18/cross-compile.patch | |||
@@ -0,0 +1,58 @@ | |||
1 | Index: mesa/configs/linux-dri | ||
2 | =================================================================== | ||
3 | --- mesa.orig/configs/linux-dri | ||
4 | +++ mesa/configs/linux-dri | ||
5 | @@ -3,11 +3,9 @@ | ||
6 | |||
7 | include $(TOP)/configs/default | ||
8 | |||
9 | -CONFIG_NAME = linux-dri | ||
10 | +$(warning ENVIRONMENT = $(shell printenv)) | ||
11 | |||
12 | -# Compiler and flags | ||
13 | -CC = gcc | ||
14 | -CXX = g++ | ||
15 | +CONFIG_NAME = linux-dri | ||
16 | |||
17 | #MKDEP = /usr/X11R6/bin/makedepend | ||
18 | #MKDEP = gcc -M | ||
19 | @@ -25,8 +23,6 @@ DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOU | ||
20 | -DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING \ | ||
21 | -DHAVE_ALIAS -DHAVE_POSIX_MEMALIGN | ||
22 | |||
23 | -X11_INCLUDES = -I/usr/X11R6/include | ||
24 | - | ||
25 | CFLAGS = -Wall -Wmissing-prototypes -std=c99 -ffast-math \ | ||
26 | $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) $(ASM_FLAGS) | ||
27 | |||
28 | @@ -40,9 +36,6 @@ CXXFLAGS += -fno-strict-aliasing | ||
29 | |||
30 | ASM_SOURCES = | ||
31 | |||
32 | -# Library/program dependencies | ||
33 | -EXTRA_LIB_PATH=-L/usr/X11R6/lib | ||
34 | - | ||
35 | LIBDRM_CFLAGS = `pkg-config --cflags libdrm-poulsbo` | ||
36 | LIBDRM_LIB = `pkg-config --libs libdrm-poulsbo` | ||
37 | DRI_LIB_DEPS = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl $(LIBDRM_LIB) | ||
38 | Index: mesa/configs/default | ||
39 | =================================================================== | ||
40 | --- mesa.orig/configs/default | ||
41 | +++ mesa/configs/default | ||
42 | @@ -17,8 +17,6 @@ MESA_VERSION = $(MESA_MAJOR).$(MESA_MINO | ||
43 | DRM_SOURCE_PATH=$(TOP)/../drm | ||
44 | |||
45 | # Compiler and flags | ||
46 | -CC = cc | ||
47 | -CXX = CC | ||
48 | CFLAGS = -O | ||
49 | CXXFLAGS = -O | ||
50 | LDFLAGS = | ||
51 | @@ -67,7 +65,6 @@ ASM_SOURCES = | ||
52 | # GLw widget sources (Append "GLwMDrawA.c" here and add -lXm to GLW_LIB_DEPS in | ||
53 | # order to build the Motif widget too) | ||
54 | GLW_SOURCES = GLwDrawA.c | ||
55 | -MOTIF_CFLAGS = -I/usr/include/Motif1.2 | ||
56 | |||
57 | |||
58 | # Directories to build | ||
diff --git a/meta-emenlow/recipes-graphics/xpsb-glx/xpsb-glx-0.18/libdrmname.patch b/meta-emenlow/recipes-graphics/xpsb-glx/xpsb-glx-0.18/libdrmname.patch new file mode 100644 index 0000000000..96b94ef2c8 --- /dev/null +++ b/meta-emenlow/recipes-graphics/xpsb-glx/xpsb-glx-0.18/libdrmname.patch | |||
@@ -0,0 +1,63 @@ | |||
1 | Index: mesa/configure.ac | ||
2 | =================================================================== | ||
3 | --- mesa.orig/configure.ac 2010-05-13 13:20:26.000000000 +0100 | ||
4 | +++ mesa/configure.ac 2010-07-25 17:02:58.000000000 +0100 | ||
5 | @@ -524,10 +524,10 @@ | ||
6 | fi | ||
7 | |||
8 | # Check for libdrm | ||
9 | - PKG_CHECK_MODULES([LIBDRM], [libdrm-poulsbo >= $LIBDRM_REQUIRED]) | ||
10 | + PKG_CHECK_MODULES([LIBDRM], [libdrm_poulsbo >= $LIBDRM_REQUIRED]) | ||
11 | PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED]) | ||
12 | - GL_PC_REQ_PRIV="libdrm-poulsbo >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED" | ||
13 | - DRI_PC_REQ_PRIV="libdrm-poulsbo >= $LIBDRM_REQUIRED" | ||
14 | + GL_PC_REQ_PRIV="libdrm_poulsbo >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED" | ||
15 | + DRI_PC_REQ_PRIV="libdrm_poulsbo >= $LIBDRM_REQUIRED" | ||
16 | |||
17 | # find the DRI deps for libGL | ||
18 | if test "$x11_pkgconfig" = yes; then | ||
19 | Index: mesa/configs/linux-dri | ||
20 | =================================================================== | ||
21 | --- mesa.orig/configs/linux-dri 2010-07-25 17:08:01.000000000 +0100 | ||
22 | +++ mesa/configs/linux-dri 2010-07-25 17:08:17.000000000 +0100 | ||
23 | @@ -36,8 +36,8 @@ | ||
24 | |||
25 | ASM_SOURCES = | ||
26 | |||
27 | -LIBDRM_CFLAGS = `pkg-config --cflags libdrm-poulsbo` | ||
28 | -LIBDRM_LIB = `pkg-config --libs libdrm-poulsbo` | ||
29 | +LIBDRM_CFLAGS = `pkg-config --cflags libdrm_poulsbo` | ||
30 | +LIBDRM_LIB = `pkg-config --libs libdrm_poulsbo` | ||
31 | DRI_LIB_DEPS = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl $(LIBDRM_LIB) | ||
32 | GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \ | ||
33 | -lm -lpthread -ldl $(LIBDRM_LIB) | ||
34 | Index: mesa/configs/linux-dri-xcb | ||
35 | =================================================================== | ||
36 | --- mesa.orig/configs/linux-dri-xcb 2010-07-25 17:08:25.000000000 +0100 | ||
37 | +++ mesa/configs/linux-dri-xcb 2010-07-25 17:08:44.000000000 +0100 | ||
38 | @@ -41,8 +41,8 @@ | ||
39 | # Library/program dependencies | ||
40 | EXTRA_LIB_PATH=`pkg-config --libs-only-L x11` | ||
41 | |||
42 | -LIBDRM_CFLAGS = `pkg-config --cflags libdrm-poulsbo` | ||
43 | -LIBDRM_LIB = `pkg-config --libs libdrm-poulsbo` | ||
44 | +LIBDRM_CFLAGS = `pkg-config --cflags libdrm_poulsbo` | ||
45 | +LIBDRM_LIB = `pkg-config --libs libdrm_poulsbo` | ||
46 | DRI_LIB_DEPS = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl $(LIBDRM_LIB) | ||
47 | GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \ | ||
48 | -lm -lpthread -ldl $(LIBDRM_LIB) `pkg-config --libs xcb` \ | ||
49 | Index: mesa/configs/linux-solo | ||
50 | =================================================================== | ||
51 | --- mesa.orig/configs/linux-solo 2010-07-25 17:09:03.000000000 +0100 | ||
52 | +++ mesa/configs/linux-solo 2010-07-25 17:09:13.000000000 +0100 | ||
53 | @@ -16,8 +16,8 @@ | ||
54 | ARCH_FLAGS ?= | ||
55 | |||
56 | # DRM and pciaccess | ||
57 | -LIBDRM_CFLAGS = `pkg-config --cflags libdrm-poulsbo` | ||
58 | -LIBDRM_LIB = `pkg-config --libs libdrm-poulsbo` | ||
59 | +LIBDRM_CFLAGS = `pkg-config --cflags libdrm_poulsbo` | ||
60 | +LIBDRM_LIB = `pkg-config --libs libdrm_poulsbo` | ||
61 | PCIACCESS_CFLAGS = `pkg-config --cflags pciaccess` | ||
62 | PCIACCESS_LIB = `pkg-config --libs pciaccess` | ||
63 | |||
diff --git a/meta-emenlow/recipes-graphics/xpsb-glx/xpsb-glx-0.18/native-matypes.patch b/meta-emenlow/recipes-graphics/xpsb-glx/xpsb-glx-0.18/native-matypes.patch new file mode 100644 index 0000000000..26b1f52a3e --- /dev/null +++ b/meta-emenlow/recipes-graphics/xpsb-glx/xpsb-glx-0.18/native-matypes.patch | |||
@@ -0,0 +1,20 @@ | |||
1 | Index: mesa/src/mesa/x86/Makefile | ||
2 | =================================================================== | ||
3 | --- mesa.orig/src/mesa/x86/Makefile 2010-10-11 16:34:12.664960996 +0100 | ||
4 | +++ mesa/src/mesa/x86/Makefile 2010-10-11 16:34:43.854960861 +0100 | ||
5 | @@ -20,11 +20,12 @@ | ||
6 | -rm -f matypes.h gen_matypes | ||
7 | |||
8 | |||
9 | -gen_matypes: gen_matypes.c | ||
10 | - $(CC) $(INCLUDE_DIRS) $(CFLAGS) gen_matypes.c -o gen_matypes | ||
11 | +#gen_matypes: gen_matypes.c | ||
12 | +# $(CC) $(INCLUDE_DIRS) $(CFLAGS) gen_matypes.c -o gen_matypes | ||
13 | |||
14 | # need some special rules here, unfortunately | ||
15 | -matypes.h: ../main/mtypes.h ../tnl/t_context.h gen_matypes | ||
16 | +matypes.h: ../main/mtypes.h ../tnl/t_context.h | ||
17 | +# gen_matypes | ||
18 | ./gen_matypes > matypes.h | ||
19 | |||
20 | common_x86_asm.o: matypes.h | ||
diff --git a/meta-emenlow/recipes-graphics/xpsb-glx/xpsb-glx_0.18.bb b/meta-emenlow/recipes-graphics/xpsb-glx/xpsb-glx_0.18.bb new file mode 100644 index 0000000000..6ceb1cbe08 --- /dev/null +++ b/meta-emenlow/recipes-graphics/xpsb-glx/xpsb-glx_0.18.bb | |||
@@ -0,0 +1,46 @@ | |||
1 | DESCRIPTION = "X11 drivers for Poulsbo (psb) 3D acceleration" | ||
2 | |||
3 | # There's a mesa implementation in this package, which is presumably | ||
4 | # not Intel proprietary, but it has no obvious license attached to it. | ||
5 | LICENSE = "Intel-binary-only" | ||
6 | LIC_FILES_CHKSUM = "file://${WORKDIR}/${PN}-${PV}/COPYING;md5=02c597a2f082b4581596065bb5a521a8" | ||
7 | PR = "r6" | ||
8 | |||
9 | inherit autotools | ||
10 | |||
11 | PROVIDES = "virtual/libgl mesa-dri" | ||
12 | |||
13 | SRC_URI="https://launchpad.net/~gma500/+archive/ppa/+files/xpsb-glx_0.18-0ubuntu1netbook2~1004um1ubuntu1.tar.gz \ | ||
14 | file://cross-compile.patch \ | ||
15 | file://libdrmname.patch \ | ||
16 | file://native-matypes.patch" | ||
17 | |||
18 | do_configure () { | ||
19 | chmod +x autogen.sh && ./autogen.sh ${CONFIGUREOPTS} && make realclean | ||
20 | cd ${S}/src/mesa/x86/ | ||
21 | ${BUILD_CC} -I../../../include/GL -I../../../include -I.. -I../main -I../math -I../glapi -I../tnl -Wall -Wmissing-prototypes -std=c99 -ffast-math -fPIC -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -D_GNU_SOURCE -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER -DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS -DHAVE_POSIX_MEMALIGN -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM -fno-strict-aliasing gen_matypes.c -o gen_matypes | ||
22 | } | ||
23 | |||
24 | do_install() { | ||
25 | make DESTDIR=${D} install | ||
26 | install -d -m 0755 ${D}/${libdir}/xorg/modules/dri \ | ||
27 | ${D}/${libdir}/xorg/modules/drivers | ||
28 | install -m 0644 ${WORKDIR}/${PN}-${PV}/dri/* \ | ||
29 | ${D}/${libdir}/xorg/modules/dri | ||
30 | install -m 0644 ${WORKDIR}/${PN}-${PV}/drivers/* \ | ||
31 | ${D}/${libdir}/xorg/modules/drivers | ||
32 | } | ||
33 | |||
34 | S = "${WORKDIR}/${PN}-${PV}/mesa" | ||
35 | |||
36 | EXTRA_OEMAKE = "linux-dri-x86" | ||
37 | |||
38 | DEPENDS += "libdrm-poulsbo libxxf86vm dri2proto libxmu libxi glproto makedepend-native" | ||
39 | |||
40 | FILES_${PN} = "${libdir}/* ${libdir}/xorg/modules/dri/* \ | ||
41 | ${libdir}/xorg/modules/drivers/*" | ||
42 | |||
43 | # Multiple virtual/gl providers being built breaks staging | ||
44 | EXCLUDE_FROM_WORLD = "1" | ||
45 | |||
46 | COMPATIBLE_MACHINE = "emenlow" | ||
diff --git a/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/01_disable_lid_timer.patch b/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/01_disable_lid_timer.patch new file mode 100644 index 0000000000..47da3bce04 --- /dev/null +++ b/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/01_disable_lid_timer.patch | |||
@@ -0,0 +1,12 @@ | |||
1 | diff -Nurp xserver-xorg-video-psb-0.30.0+repack.orig/src/psb_driver.c xserver-xorg-video-psb-0.30.0+repack/src/psb_driver.c | ||
2 | --- xserver-xorg-video-psb-0.30.0+repack.orig/src/psb_driver.c 2009-04-17 00:00:46.000000000 +0200 | ||
3 | +++ xserver-xorg-video-psb-0.30.0+repack/src/psb_driver.c 2009-08-06 18:13:43.000000000 +0200 | ||
4 | @@ -753,7 +753,7 @@ psbInitOutputs(ScrnInfoPtr pScrn) | ||
5 | |||
6 | xf86GetOptValBool(pPsb->options, OPTION_NOPANEL, &pPsb->noPanel); | ||
7 | |||
8 | - pPsb->lidTimer = TRUE; | ||
9 | + pPsb->lidTimer = FALSE; | ||
10 | xf86GetOptValBool(pPsb->options, OPTION_LIDTIMER, &pPsb->lidTimer); | ||
11 | |||
12 | xf86GetOptValBool(pPsb->options, OPTION_NOFITTING, &pPsb->noFitting); | ||
diff --git a/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/dri-h.patch b/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/dri-h.patch new file mode 100644 index 0000000000..98ffa27199 --- /dev/null +++ b/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/dri-h.patch | |||
@@ -0,0 +1,20 @@ | |||
1 | Index: xserver-xorg-video-psb-0.32.1/configure.ac | ||
2 | =================================================================== | ||
3 | --- xserver-xorg-video-psb-0.32.1.orig/configure.ac | ||
4 | +++ xserver-xorg-video-psb-0.32.1/configure.ac | ||
5 | @@ -75,12 +75,9 @@ AM_CONDITIONAL(BUILD_EXA, [test "$build_ | ||
6 | AC_HEADER_STDC | ||
7 | |||
8 | if test "$DRI" != no; then | ||
9 | - AC_CHECK_FILE([${sdkdir}/dri.h], | ||
10 | - [have_dri_h="yes"], [have_dri_h="no"]) | ||
11 | - AC_CHECK_FILE([${sdkdir}/sarea.h], | ||
12 | - [have_sarea_h="yes"], [have_sarea_h="no"]) | ||
13 | - AC_CHECK_FILE([${sdkdir}/dristruct.h], | ||
14 | - [have_dristruct_h="yes"], [have_dristruct_h="no"]) | ||
15 | + have_dri_h="yes" | ||
16 | + have_sarea_h="yes" | ||
17 | + have_dristruct_h="yes" | ||
18 | fi | ||
19 | |||
20 | AC_MSG_CHECKING([whether to include DRI support]) | ||
diff --git a/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/libdrm-poulsbo.patch b/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/libdrm-poulsbo.patch new file mode 100644 index 0000000000..0ecc880c02 --- /dev/null +++ b/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/libdrm-poulsbo.patch | |||
@@ -0,0 +1,13 @@ | |||
1 | Index: xserver-xorg-video-psb-0.32.1/configure.ac | ||
2 | =================================================================== | ||
3 | --- xserver-xorg-video-psb-0.32.1.orig/configure.ac | ||
4 | +++ xserver-xorg-video-psb-0.32.1/configure.ac | ||
5 | @@ -94,7 +94,7 @@ AC_MSG_RESULT([$DRI]) | ||
6 | |||
7 | AM_CONDITIONAL(DRI, test x$DRI = xyes) | ||
8 | if test "$DRI" = yes; then | ||
9 | - PKG_CHECK_MODULES(DRI, [libdrm-poulsbo >= 2.0 xf86driproto]) | ||
10 | + PKG_CHECK_MODULES(DRI, [libdrm_poulsbo >= 2.0 xf86driproto]) | ||
11 | AC_DEFINE(XF86DRI,1,[Enable DRI driver support]) | ||
12 | AC_DEFINE(XF86DRI_DEVEL,1,[Enable developmental DRI driver support]) | ||
13 | fi | ||
diff --git a/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/psb_mixed.patch b/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/psb_mixed.patch new file mode 100644 index 0000000000..6065fa5cac --- /dev/null +++ b/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/psb_mixed.patch | |||
@@ -0,0 +1,35 @@ | |||
1 | --- xserver-xorg-video-psb-0.32.1/src/psb_accel.c.orig 2010-07-04 19:27:48.691227698 +0200 | ||
2 | +++ xserver-xorg-video-psb-0.32.1/src/psb_accel.c 2010-07-04 19:27:15.338230809 +0200 | ||
3 | @@ -308,6 +308,14 @@ | ||
4 | } | ||
5 | #endif | ||
6 | |||
7 | +static void* | ||
8 | +psbExaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth, int usage_hint, int bpp, int* new_pitch ) | ||
9 | +{ | ||
10 | + return NULL; | ||
11 | +} | ||
12 | +static void | ||
13 | +psbExaDestroyPixmap(ScreenPtr pScreen, void* driverPriv ){ | ||
14 | +} | ||
15 | static Bool | ||
16 | psbExaPixmapIsOffscreen(PixmapPtr p) | ||
17 | { | ||
18 | @@ -1313,6 +1321,7 @@ | ||
19 | pExa->pixmapOffsetAlign = 8; | ||
20 | pExa->pixmapPitchAlign = 32 * 4; | ||
21 | pExa->flags = EXA_OFFSCREEN_PIXMAPS; | ||
22 | + pExa->flags |= EXA_HANDLES_PIXMAPS | EXA_MIXED_PIXMAPS; | ||
23 | pExa->maxX = 2047; | ||
24 | pExa->maxY = 2047; | ||
25 | pExa->WaitMarker = psbExaWaitMarker; | ||
26 | @@ -1328,6 +1337,9 @@ | ||
27 | pExa->Composite = psbExaSuperComposite; | ||
28 | pExa->DoneComposite = psbExaDoneComposite; | ||
29 | pExa->PixmapIsOffscreen = psbExaPixmapIsOffscreen; | ||
30 | + pExa->CreatePixmap = NULL; | ||
31 | + pExa->CreatePixmap2 = psbExaCreatePixmap; | ||
32 | + pExa->DestroyPixmap = psbExaDestroyPixmap; | ||
33 | pExa->PrepareAccess = psbExaPrepareAccess; | ||
34 | pExa->FinishAccess = psbExaFinishAccess; | ||
35 | pExa->UploadToScreen = psbExaUploadToScreen; | ||
diff --git a/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/psb_xvtempfix.patch b/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/psb_xvtempfix.patch new file mode 100644 index 0000000000..34798c07e9 --- /dev/null +++ b/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/psb_xvtempfix.patch | |||
@@ -0,0 +1,17 @@ | |||
1 | --- xserver-xorg-video-psb-0.36.0-ref/src/psb_video.c 2010-06-07 22:17:46.302760345 +0200 | ||
2 | +++ xserver-xorg-video-psb-0.32/src/psb_video.c 2010-06-10 17:29:23.400003434 +0200 | ||
3 | @@ -686,8 +684,13 @@ | ||
4 | * coordinates) to the backing pixmap. | ||
5 | */ | ||
6 | |||
7 | - while (!psbExaGetSuperOffset(pPixmap, &pre_add, &dstBuf)) | ||
8 | + if(!psbExaGetSuperOffset(pPixmap, &pre_add, &dstBuf)){ | ||
9 | exaMoveInPixmap(pPixmap); | ||
10 | + if(!psbExaGetSuperOffset(pPixmap, &pre_add, &dstBuf)){ | ||
11 | + return FALSE; | ||
12 | + } | ||
13 | + } | ||
14 | + | ||
15 | |||
16 | dst.buffer = mmKernelBuf(dstBuf); | ||
17 | dst.offset = pre_add; | ||
diff --git a/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/stubs.patch b/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/stubs.patch new file mode 100644 index 0000000000..b201d7e314 --- /dev/null +++ b/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/stubs.patch | |||
@@ -0,0 +1,23 @@ | |||
1 | diff -p -up xserver-xorg-video-psb-0.31.0/src/psb_driver.c.orig xserver-xorg-video-psb-0.31.0/src/psb_driver.c | ||
2 | --- xserver-xorg-video-psb-0.31.0/src/psb_driver.c.orig 2010-04-30 08:58:06.798598457 +0200 | ||
3 | +++ xserver-xorg-video-psb-0.31.0/src/psb_driver.c 2010-04-30 09:03:04.186597975 +0200 | ||
4 | @@ -643,6 +643,19 @@ psbPreInitDRI(ScrnInfoPtr pScrn) | ||
5 | return TRUE; | ||
6 | } | ||
7 | |||
8 | +/* removed in Xserver 1.7, add it again so that proprietary Xpsb can be loaded */ | ||
9 | +void | ||
10 | +xf86AddModuleInfo(pointer info, pointer module) | ||
11 | +{ | ||
12 | +} | ||
13 | + | ||
14 | +/* removed in mesa, add it again so that proprietary Xpsb can be loaded */ | ||
15 | +typedef void (*_glapi_warning_func)(void *ctx, const char *str, ...); | ||
16 | +void | ||
17 | +_glapi_set_warning_func( _glapi_warning_func func ) | ||
18 | +{ | ||
19 | +} | ||
20 | + | ||
21 | static Bool | ||
22 | psbPreInitXpsb(ScrnInfoPtr pScrn) | ||
23 | { | ||
diff --git a/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/visibility.patch b/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/visibility.patch new file mode 100644 index 0000000000..2c68805871 --- /dev/null +++ b/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/visibility.patch | |||
@@ -0,0 +1,12 @@ | |||
1 | Index: xserver-xorg-video-psb-0.32.1/configure.ac | ||
2 | =================================================================== | ||
3 | --- xserver-xorg-video-psb-0.32.1.orig/configure.ac | ||
4 | +++ xserver-xorg-video-psb-0.32.1/configure.ac | ||
5 | @@ -107,6 +107,7 @@ AC_DEFINE(INTEL_PSB_DRIVER, 1, [Compatib | ||
6 | |||
7 | AC_SUBST([DRI_CFLAGS]) | ||
8 | AC_SUBST([XORG_CFLAGS]) | ||
9 | +XORG_CFLAGS = `echo $XORG_CFLAGS | sed 's/hidden/default/'` | ||
10 | AC_SUBST([moduledir]) | ||
11 | |||
12 | DRIVER_NAME=psb | ||
diff --git a/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/xorg-x11-drv-psb-0.31.0-ignoreacpi.patch b/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/xorg-x11-drv-psb-0.31.0-ignoreacpi.patch new file mode 100644 index 0000000000..a73a493ec1 --- /dev/null +++ b/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/xorg-x11-drv-psb-0.31.0-ignoreacpi.patch | |||
@@ -0,0 +1,11 @@ | |||
1 | --- xserver-xorg-video-psb-0.31.0/src/psb_driver.c 2009-04-17 11:22:26.000000000 -0700 | ||
2 | +++ xserver-xorg-video-psb-0.31.0/src/psb_driver.c.new 2009-08-14 15:41:35.047596131 -0700 | ||
3 | @@ -909,7 +909,7 @@ | ||
4 | xf86DrvMsg(pScrn->scrnIndex, from, "Use %s cursor.\n", | ||
5 | pPsb->sWCursor ? "software" : "hardware"); | ||
6 | |||
7 | - pPsb->ignoreACPI = FALSE; | ||
8 | + pPsb->ignoreACPI = TRUE; | ||
9 | from = | ||
10 | xf86GetOptValBool(pPsb->options, OPTION_IGNORE_ACPI, | ||
11 | &pPsb->ignoreACPI) | ||
diff --git a/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/xorg-x11-drv-psb-0.31.0-xserver17.patch b/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/xorg-x11-drv-psb-0.31.0-xserver17.patch new file mode 100644 index 0000000000..defed50363 --- /dev/null +++ b/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/xorg-x11-drv-psb-0.31.0-xserver17.patch | |||
@@ -0,0 +1,85 @@ | |||
1 | --- xserver-xorg-video-psb-0.31.0/src/Xpsb.h 2009-04-17 11:22:26.000000000 -0700 | ||
2 | +++ xserver-xorg-video-psb-0.31.0/src/Xpsb.h.new 2009-08-28 09:24:16.333677591 -0700 | ||
3 | @@ -38,7 +38,9 @@ | ||
4 | #include "xf86drm.h" | ||
5 | #include "xf86.h" | ||
6 | #include "xf86_OSproc.h" | ||
7 | +#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6 | ||
8 | #include "xf86Resources.h" | ||
9 | +#endif | ||
10 | #include "compiler.h" | ||
11 | |||
12 | #define XPSB_VOFFSET_X 0 | ||
13 | --- xserver-xorg-video-psb-0.31.0/src/psb_driver.h 2009-04-17 11:22:25.000000000 -0700 | ||
14 | +++ xserver-xorg-video-psb-0.31.0/src/psb_driver.h.new 2009-08-28 09:24:11.822679667 -0700 | ||
15 | @@ -34,7 +34,6 @@ | ||
16 | |||
17 | #include "xf86.h" | ||
18 | #include "xf86_OSproc.h" | ||
19 | -#include "xf86Resources.h" | ||
20 | #include "compiler.h" | ||
21 | #include "xf86PciInfo.h" | ||
22 | #include "vgaHW.h" | ||
23 | @@ -46,8 +45,10 @@ | ||
24 | #include "xf86int10.h" | ||
25 | #include "mibank.h" | ||
26 | #include "dgaproc.h" | ||
27 | +#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6 | ||
28 | #include "xf86Resources.h" | ||
29 | #include "xf86RAC.h" | ||
30 | +#endif | ||
31 | #include "fb.h" | ||
32 | #include "xaa.h" | ||
33 | #include "xf86xv.h" | ||
34 | --- xserver-xorg-video-psb-0.31.0/src/i830_i2c.c 2009-04-17 11:22:24.000000000 -0700 | ||
35 | +++ xserver-xorg-video-psb-0.31.0/src/i830_i2c.c.new 2009-08-28 09:33:06.789804272 -0700 | ||
36 | @@ -31,8 +31,10 @@ | ||
37 | |||
38 | #include "xf86.h" | ||
39 | #include "xf86_OSproc.h" | ||
40 | +#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6 | ||
41 | #include "xf86Resources.h" | ||
42 | #include "xf86RAC.h" | ||
43 | +#endif | ||
44 | #include "xf86cmap.h" | ||
45 | #include "compiler.h" | ||
46 | #include "mibstore.h" | ||
47 | --- xserver-xorg-video-psb-0.31.0/src/psb_video.c 2009-04-17 11:22:26.000000000 -0700 | ||
48 | +++ xserver-xorg-video-psb-0.31.0/src/psb_video.c.new 2009-08-28 09:35:03.874805663 -0700 | ||
49 | @@ -36,7 +36,9 @@ | ||
50 | |||
51 | #include "xf86.h" | ||
52 | #include "xf86_OSproc.h" | ||
53 | +#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6 | ||
54 | #include "xf86Resources.h" | ||
55 | +#endif | ||
56 | #include "compiler.h" | ||
57 | |||
58 | #include "xf86xv.h" | ||
59 | --- xserver-xorg-video-psb-0.31.0/src/psb_driver.c 2009-04-17 11:22:26.000000000 -0700 | ||
60 | +++ xserver-xorg-video-psb-0.31.0/src/psb_driver.c.new 2009-08-28 10:30:32.325553685 -0700 | ||
61 | @@ -317,7 +317,7 @@ | ||
62 | * This data is accessed by the loader. The name must be the module name | ||
63 | * followed by "ModuleData". | ||
64 | */ | ||
65 | -XF86ModuleData psbModuleData = { &psbVersionRec, psbSetup, NULL }; | ||
66 | +_X_EXPORT XF86ModuleData psbModuleData = { &psbVersionRec, psbSetup, NULL }; | ||
67 | |||
68 | static pointer | ||
69 | psbSetup(pointer Module, pointer Options, int *ErrorMajor, int *ErrorMinor) | ||
70 | @@ -1023,11 +1023,13 @@ | ||
71 | |||
72 | PSB_DEBUG(scrnIndex, 3, "Initializing device\n"); | ||
73 | |||
74 | +#ifndef XSERVER_LIBPCIACCESS | ||
75 | if (xf86RegisterResources(pDevice->pEnt->index, NULL, ResExclusive)) { | ||
76 | xf86DrvMsg(scrnIndex, X_ERROR, | ||
77 | "Could not registrer device. Resource conflict.\n"); | ||
78 | return FALSE; | ||
79 | } | ||
80 | +#endif | ||
81 | |||
82 | if (!xf86LoadSubModule(pDevice->pScrns[0], "vgahw")) | ||
83 | return FALSE; | ||
84 | |||
85 | |||
diff --git a/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/xserver-xorg-video-psb-0.31.0-assert.patch b/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/xserver-xorg-video-psb-0.31.0-assert.patch new file mode 100644 index 0000000000..5137a59041 --- /dev/null +++ b/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/xserver-xorg-video-psb-0.31.0-assert.patch | |||
@@ -0,0 +1,11 @@ | |||
1 | diff -p -up xserver-xorg-video-psb-0.31.0/libmm/mm_drm.c.assert xserver-xorg-video-psb-0.31.0/libmm/mm_drm.c | ||
2 | --- xserver-xorg-video-psb-0.31.0/libmm/mm_drm.c.assert 2010-04-26 13:40:50.000000000 +0200 | ||
3 | +++ xserver-xorg-video-psb-0.31.0/libmm/mm_drm.c 2010-04-26 13:48:28.000000000 +0200 | ||
4 | @@ -30,6 +30,7 @@ | ||
5 | #include "xf86mm.h" | ||
6 | #include "xf86drm.h" | ||
7 | #include "stdio.h" | ||
8 | +#include <assert.h> | ||
9 | |||
10 | /* | ||
11 | * This is a simple wrapper around libdrm's buffer interface to be used | ||
diff --git a/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/xserver-xorg-video-psb-0.31.0-comment_unused.patch b/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/xserver-xorg-video-psb-0.31.0-comment_unused.patch new file mode 100644 index 0000000000..ca811b6967 --- /dev/null +++ b/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/xserver-xorg-video-psb-0.31.0-comment_unused.patch | |||
@@ -0,0 +1,75 @@ | |||
1 | diff -p -up xserver-xorg-video-psb-0.31.0/libmm/mm_drm.c.comment_unused xserver-xorg-video-psb-0.31.0/libmm/mm_drm.c | ||
2 | --- xserver-xorg-video-psb-0.31.0/libmm/mm_drm.c.comment_unused 2009-04-17 20:22:26.000000000 +0200 | ||
3 | +++ xserver-xorg-video-psb-0.31.0/libmm/mm_drm.c 2010-04-26 13:40:50.000000000 +0200 | ||
4 | @@ -277,6 +277,7 @@ createFence(struct _MMManager *mm, | ||
5 | return &dFence->mf; | ||
6 | } | ||
7 | |||
8 | +/* | ||
9 | static void | ||
10 | fenceDestroy(struct _MMFence *mf) | ||
11 | { | ||
12 | @@ -288,6 +289,7 @@ fenceDestroy(struct _MMFence *mf) | ||
13 | assert(ret == 0); | ||
14 | free(dFence); | ||
15 | } | ||
16 | +*/ | ||
17 | |||
18 | static int | ||
19 | fenceEmit(struct _MMFence *mf, unsigned fence_class, | ||
20 | @@ -369,7 +371,7 @@ mmCreateDRM(int drmFD) | ||
21 | mm->fenceSignaled = fenceSignaled; | ||
22 | mm->fenceWait = fenceWait; | ||
23 | mm->fenceError = NULL; | ||
24 | - mm->fenceDestroy = fenceDestroy; | ||
25 | + /* mm->fenceDestroy = fenceDestroy; */ | ||
26 | mm->destroy = destroy; | ||
27 | return mm; | ||
28 | |||
29 | diff -p -up xserver-xorg-video-psb-0.31.0/libmm/mm_interface.h.comment_unused xserver-xorg-video-psb-0.31.0/libmm/mm_interface.h | ||
30 | --- xserver-xorg-video-psb-0.31.0/libmm/mm_interface.h.comment_unused 2009-04-17 20:22:26.000000000 +0200 | ||
31 | +++ xserver-xorg-video-psb-0.31.0/libmm/mm_interface.h 2010-04-26 13:45:22.000000000 +0200 | ||
32 | @@ -141,7 +141,7 @@ typedef struct _MMManager | ||
33 | int (*fenceWait) (struct _MMFence * mf, unsigned flushMask, | ||
34 | unsigned flags); | ||
35 | unsigned (*fenceError) (struct _MMFence * mf); | ||
36 | - void (*fenceDestroy) (struct _MMFence * mf); | ||
37 | + /* void (*fenceDestroy) (struct _MMFence * mf); */ | ||
38 | } MMManager; | ||
39 | |||
40 | /* | ||
41 | @@ -204,6 +204,7 @@ mmFenceEmit(struct _MMFence *mf, unsigne | ||
42 | return mf->man->fenceEmit(mf, class, type, flags); | ||
43 | } | ||
44 | |||
45 | +/* | ||
46 | static inline void | ||
47 | mmFenceUnReference(struct _MMFence **mfP) | ||
48 | { | ||
49 | @@ -214,6 +215,7 @@ mmFenceUnReference(struct _MMFence **mfP | ||
50 | } | ||
51 | *mfP = NULL; | ||
52 | } | ||
53 | +*/ | ||
54 | |||
55 | static inline struct _MMFence * | ||
56 | mmFenceReference(struct _MMFence *mf) | ||
57 | diff -p -up xserver-xorg-video-psb-0.31.0/libmm/mm_user.c.comment_unused xserver-xorg-video-psb-0.31.0/libmm/mm_user.c | ||
58 | --- xserver-xorg-video-psb-0.31.0/libmm/mm_user.c.comment_unused 2009-04-17 20:22:26.000000000 +0200 | ||
59 | +++ xserver-xorg-video-psb-0.31.0/libmm/mm_user.c 2010-04-26 13:05:15.000000000 +0200 | ||
60 | @@ -77,6 +77,7 @@ typedef struct _UserSignal | ||
61 | UserManager *man; | ||
62 | } UserSignal; | ||
63 | |||
64 | +/* | ||
65 | void | ||
66 | mmFenceSignal(struct _MMSignal *signal, unsigned class, | ||
67 | unsigned type, unsigned sequence, unsigned error, | ||
68 | @@ -148,6 +149,7 @@ mmFenceSignal(struct _MMSignal *signal, | ||
69 | type |= fence->signalPrevious; | ||
70 | } | ||
71 | } | ||
72 | +*/ | ||
73 | |||
74 | static int | ||
75 | fenceEmit(struct _MMFence *mf, unsigned class, unsigned type, unsigned flags) | ||
diff --git a/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/xserver-xorg-video-psb-0.31.0-greedy.patch b/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/xserver-xorg-video-psb-0.31.0-greedy.patch new file mode 100644 index 0000000000..8758911c71 --- /dev/null +++ b/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/xserver-xorg-video-psb-0.31.0-greedy.patch | |||
@@ -0,0 +1,19 @@ | |||
1 | diff -p -up xserver-xorg-video-psb-0.31.0/src/psb_accel.c.greedy xserver-xorg-video-psb-0.31.0/src/psb_accel.c | ||
2 | --- xserver-xorg-video-psb-0.31.0/src/psb_accel.c.greedy 2009-04-17 20:22:24.000000000 +0200 | ||
3 | +++ xserver-xorg-video-psb-0.31.0/src/psb_accel.c 2010-04-23 14:52:47.000000000 +0200 | ||
4 | @@ -1331,6 +1331,15 @@ psbExaInit(ScrnInfoPtr pScrn) | ||
5 | pExa->FinishAccess = psbExaFinishAccess; | ||
6 | pExa->UploadToScreen = psbExaUploadToScreen; | ||
7 | |||
8 | + if (!xf86FindOptionValue(pScrn->options, "MigrationHeuristic")) { | ||
9 | + const char *default_migration = "greedy"; | ||
10 | + xf86DrvMsg(pScrn->scrnIndex, X_INFO, | ||
11 | + "Using default MigrationHeuristic: %s\n", | ||
12 | + default_migration); | ||
13 | + xf86ReplaceStrOption(pScrn->options, "MigrationHeuristic", default_migration); | ||
14 | + } | ||
15 | + | ||
16 | + | ||
17 | if (!exaDriverInit(pScrn->pScreen, pExa)) { | ||
18 | goto out_err; | ||
19 | } | ||
diff --git a/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/xserver-xorg-video-psb-0.31.0-loader.patch b/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/xserver-xorg-video-psb-0.31.0-loader.patch new file mode 100644 index 0000000000..24cbc0d30e --- /dev/null +++ b/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb-0.32.1/xserver-xorg-video-psb-0.31.0-loader.patch | |||
@@ -0,0 +1,84 @@ | |||
1 | diff -p -up xserver-xorg-video-psb-0.31.0/src/psb_dri.c.loader xserver-xorg-video-psb-0.31.0/src/psb_dri.c | ||
2 | --- xserver-xorg-video-psb-0.31.0/src/psb_dri.c.loader 2009-04-17 20:22:24.000000000 +0200 | ||
3 | +++ xserver-xorg-video-psb-0.31.0/src/psb_dri.c 2010-03-12 15:03:33.000000000 +0100 | ||
4 | @@ -548,8 +548,6 @@ psbDRIScreenInit(ScreenPtr pScreen) | ||
5 | |||
6 | PSB_DEBUG(pScrn->scrnIndex, 3, "psbDRIScreenInit\n"); | ||
7 | |||
8 | - xf86LoaderReqSymLists(driReqSymbols, NULL); | ||
9 | - | ||
10 | pPsb->pDRIInfo = NULL; | ||
11 | |||
12 | /* | ||
13 | diff -p -up xserver-xorg-video-psb-0.31.0/src/psb_driver.c.loader xserver-xorg-video-psb-0.31.0/src/psb_driver.c | ||
14 | --- xserver-xorg-video-psb-0.31.0/src/psb_driver.c.loader 2010-03-12 13:48:52.000000000 +0100 | ||
15 | +++ xserver-xorg-video-psb-0.31.0/src/psb_driver.c 2010-03-12 15:03:26.000000000 +0100 | ||
16 | @@ -329,12 +329,6 @@ psbSetup(pointer Module, pointer Options | ||
17 | if (!Initialised) { | ||
18 | Initialised = TRUE; | ||
19 | xf86AddDriver(&psb, Module, 0); | ||
20 | - LoaderRefSymLists(fbSymbols, ddcSymbols, shadowSymbols, | ||
21 | - psbvgahwSymbols, | ||
22 | -#ifdef XF86DRI | ||
23 | - psbDRMSymbols, psbDRISymbols, | ||
24 | -#endif | ||
25 | - NULL); | ||
26 | return (pointer) TRUE; | ||
27 | } | ||
28 | |||
29 | @@ -639,7 +633,6 @@ psbPreInitDRI(ScrnInfoPtr pScrn) | ||
30 | if (!xf86LoadSubModule(pScrn, "dri")) | ||
31 | return FALSE; | ||
32 | |||
33 | - xf86LoaderReqSymLists(psbDRISymbols, psbDRMSymbols, NULL); | ||
34 | return TRUE; | ||
35 | } | ||
36 | |||
37 | @@ -660,7 +653,6 @@ psbPreInitXpsb(ScrnInfoPtr pScrn) | ||
38 | |||
39 | pPsb->xpsb = TRUE; | ||
40 | |||
41 | - xf86LoaderReqSymLists(psbXpsbSymbols, NULL); | ||
42 | return TRUE; | ||
43 | } | ||
44 | #endif | ||
45 | @@ -680,7 +672,6 @@ psbPreInitAccel(ScrnInfoPtr pScrn) | ||
46 | if (!xf86LoadSubModule(pScrn, "exa")) | ||
47 | return FALSE; | ||
48 | |||
49 | - xf86LoaderReqSymLists(exaSymbols, NULL); | ||
50 | } | ||
51 | |||
52 | xf86DrvMsg(pScrn->scrnIndex, from, "Acceleration %sabled\n", | ||
53 | @@ -720,7 +711,6 @@ psbPreInitShadowFB(ScrnInfoPtr pScrn) | ||
54 | if (!xf86LoadSubModule(pScrn, "shadow")) | ||
55 | return FALSE; | ||
56 | |||
57 | - xf86LoaderReqSymLists(shadowSymbols, NULL); | ||
58 | } | ||
59 | |||
60 | xf86DrvMsg(pScrn->scrnIndex, from, "Shadow framebuffer %sabled\n", | ||
61 | @@ -854,7 +844,6 @@ psbPreInit(ScrnInfoPtr pScrn, int flags) | ||
62 | |||
63 | if (!xf86LoadSubModule(pScrn, "vbe")) | ||
64 | return FALSE; | ||
65 | - xf86LoaderReqSymLists(vbeSymbols, NULL); | ||
66 | |||
67 | /* | ||
68 | * Parse options and load required modules here. | ||
69 | @@ -874,7 +863,6 @@ psbPreInit(ScrnInfoPtr pScrn, int flags) | ||
70 | |||
71 | if (!xf86LoadSubModule(pScrn, "fb")) | ||
72 | return (FALSE); | ||
73 | - xf86LoaderReqSymLists(fbSymbols, NULL); | ||
74 | |||
75 | pScrn->chipset = "Intel GMA500"; | ||
76 | pScrn->monitor = pScrn->confScreen->monitor; | ||
77 | @@ -1033,7 +1021,6 @@ psbDeviceInit(PsbDevicePtr pDevice, int | ||
78 | |||
79 | if (!xf86LoadSubModule(pDevice->pScrns[0], "vgahw")) | ||
80 | return FALSE; | ||
81 | - xf86LoaderReqSymLists(psbvgahwSymbols, NULL); | ||
82 | |||
83 | if (!vgaHWGetHWRec(pDevice->pScrns[0])) | ||
84 | return FALSE; | ||
diff --git a/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb_0.32.1.bb b/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb_0.32.1.bb new file mode 100644 index 0000000000..1ff92bbc61 --- /dev/null +++ b/meta-emenlow/recipes-graphics/xserver-xorg-video-psb/xserver-xorg-video-psb_0.32.1.bb | |||
@@ -0,0 +1,34 @@ | |||
1 | DESCRIPTION = "2D graphics driver for Poulsbo" | ||
2 | LICENSE = "MIT" | ||
3 | LIC_FILES_CHKSUM = "file://MIT_License.txt;md5=732825ecdcf420261531d935fcd914a7" | ||
4 | PR = "r2" | ||
5 | |||
6 | inherit autotools | ||
7 | |||
8 | SRC_URI = "https://launchpad.net/~gma500/+archive/ppa/+files/xserver-xorg-video-psb_0.36.0-0ubuntu3~1004um9.tar.gz \ | ||
9 | file://xorg-x11-drv-psb-0.31.0-ignoreacpi.patch;patch=1 \ | ||
10 | file://xorg-x11-drv-psb-0.31.0-xserver17.patch;patch=1 \ | ||
11 | file://xserver-xorg-video-psb-0.31.0-assert.patch;patch=1 \ | ||
12 | file://xserver-xorg-video-psb-0.31.0-comment_unused.patch;patch=1 \ | ||
13 | file://xserver-xorg-video-psb-0.31.0-greedy.patch;patch=1 \ | ||
14 | file://xserver-xorg-video-psb-0.31.0-loader.patch;patch=1 \ | ||
15 | file://stubs.patch;patch=1 \ | ||
16 | file://01_disable_lid_timer.patch;patch=1 \ | ||
17 | file://psb_xvtempfix.patch;patch=1 \ | ||
18 | file://psb_mixed.patch;patch=1 \ | ||
19 | file://dri-h.patch \ | ||
20 | file://libdrm-poulsbo.patch" | ||
21 | |||
22 | export DRI_CFLAGS="-I${STAGING_INCDIR}/psb -I${STAGING_INCDIR}/psb/drm \ | ||
23 | -I${STAGING_INCDIR}/X11/dri" | ||
24 | |||
25 | export CFLAGS = "-fvisibility=default" | ||
26 | export XORG_CFLAGS="-fvisibility=default -I${STAGING_INCDIR}/xorg \ | ||
27 | -I${STAGING_INCDIR}/pixman-1" | ||
28 | |||
29 | FILES_${PN} += "${libdir}/xorg/modules/drivers/libmm.so \ | ||
30 | ${libdir}/xorg/modules/drivers/psb_drv.so" | ||
31 | |||
32 | DEPENDS += "virtual/libgl virtual/xserver" | ||
33 | |||
34 | COMPATIBLE_MACHINE = "emenlow" | ||