generic-poky/meta-emenlow/packages/libva/libva-0.31.0/035_g45_add_yv12_image_form...

103 lines
3.5 KiB
Diff

From 23b23e8d65551779f10aedddee7882c2e71ac162 Mon Sep 17 00:00:00 2001
From: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
Date: Wed, 4 Nov 2009 13:01:44 +0000
Subject: [PATCH] [G45] Add YV12 image format.
---
i965_drv_video/i965_drv_video.c | 50 ++++++++++++++++++++++++++++++++++++++-
i965_drv_video/i965_drv_video.h | 2 +-
2 files changed, 50 insertions(+), 2 deletions(-)
diff --git a/i965_drv_video/i965_drv_video.c b/i965_drv_video/i965_drv_video.c
index 1f026bc..8558d0e 100644
--- a/i965_drv_video/i965_drv_video.c
+++ b/i965_drv_video/i965_drv_video.c
@@ -54,6 +54,36 @@ enum {
I965_SURFACETYPE_INDEXED
};
+/* List of supported image formats */
+typedef struct {
+ unsigned int type;
+ VAImageFormat va_format;
+} i965_image_format_map_t;
+
+static const i965_image_format_map_t
+i965_image_formats_map[I965_MAX_IMAGE_FORMATS + 1] = {
+ { I965_SURFACETYPE_YUV,
+ { VA_FOURCC('Y','V','1','2'), VA_LSB_FIRST, 12, } },
+};
+
+static const i965_image_format_map_t *
+get_image_format(const VAImageFormat *va_format)
+{
+ unsigned int i;
+ for (i = 0; i965_image_formats_map[i].type != 0; i++) {
+ const i965_image_format_map_t * const m = &i965_image_formats_map[i];
+ if (m->va_format.fourcc == va_format->fourcc &&
+ (m->type == I965_SURFACETYPE_RGBA ?
+ (m->va_format.byte_order == va_format->byte_order &&
+ m->va_format.red_mask == va_format->red_mask &&
+ m->va_format.green_mask == va_format->green_mask &&
+ m->va_format.blue_mask == va_format->blue_mask &&
+ m->va_format.alpha_mask == va_format->alpha_mask) : 1))
+ return m;
+ }
+ return NULL;
+}
+
/* List of supported subpicture formats */
typedef struct {
unsigned int type;
@@ -398,8 +428,16 @@ i965_QueryImageFormats(VADriverContextP ctx,
VAImageFormat *format_list, /* out */
int *num_formats) /* out */
{
+ int n;
+
+ for (n = 0; i965_image_formats_map[n].va_format.fourcc != 0; n++) {
+ const i965_image_format_map_t * const m = &i965_image_formats_map[n];
+ if (format_list)
+ format_list[n] = m->va_format;
+ }
+
if (num_formats)
- *num_formats = 0;
+ *num_formats = n;
return VA_STATUS_SUCCESS;
}
@@ -1236,6 +1274,16 @@ i965_CreateImage(VADriverContextP ctx,
image->offsets[0] = 0;
image->data_size = image->offsets[0] + image->pitches[0] * height;
break;
+ case VA_FOURCC('Y','V','1','2'):
+ image->num_planes = 3;
+ image->pitches[0] = width;
+ image->offsets[0] = 0;
+ image->pitches[1] = width2;
+ image->offsets[1] = size;
+ image->pitches[2] = width2;
+ image->offsets[2] = size + size2;
+ image->data_size = size + 2 * size2;
+ break;
default:
goto error;
}
diff --git a/i965_drv_video/i965_drv_video.h b/i965_drv_video/i965_drv_video.h
index 4d775da..f512793 100644
--- a/i965_drv_video/i965_drv_video.h
+++ b/i965_drv_video/i965_drv_video.h
@@ -41,7 +41,7 @@
#define I965_MAX_PROFILES 11
#define I965_MAX_ENTRYPOINTS 5
#define I965_MAX_CONFIG_ATTRIBUTES 10
-#define I965_MAX_IMAGE_FORMATS 10
+#define I965_MAX_IMAGE_FORMATS 1
#define I965_MAX_SUBPIC_FORMATS 4
#define I965_MAX_DISPLAY_ATTRIBUTES 4
#define I965_STR_VENDOR "i965 Driver 0.1"
--
1.5.4.3