From 3fac09ad873b8a5239f84d07dc12e8b08a117561 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thomas=20Balling=20S=C3=B8rensen?= Date: Thu, 28 Oct 2010 12:51:35 +0200 Subject: [PATCH] vl: Initial implementation of vlVaQuerySubpictureFormats. --- src/gallium/state_trackers/va/va_subpicture.c | 36 +++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/src/gallium/state_trackers/va/va_subpicture.c b/src/gallium/state_trackers/va/va_subpicture.c index 9317d313c65..442b1acea5a 100644 --- a/src/gallium/state_trackers/va/va_subpicture.c +++ b/src/gallium/state_trackers/va/va_subpicture.c @@ -27,8 +27,29 @@ #include #include +#include #include "va_private.h" +#define NUM_FORMAT_SUPPORTED 2 + +typedef struct { + enum pipe_format; + VAImageFormat va_format; + unsigned int va_flags; +} va_subpicture_formats_supported_t; + +static const va_subpicture_formats_supported_t va_subpicture_formats_supported[NUM_FORMAT_SUPPORTED] = +{ + { PIPE_FORMAT_B8G8R8A8_UNORM, + { VA_FOURCC('B','G','R','A'), VA_LSB_FIRST, 32, + 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000 }, + 0 }, + { PIPE_FORMAT_R8G8B8A8_UNORM, + { VA_FOURCC('R','G','B','A'), VA_LSB_FIRST, 32, + 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 }, + 0 } +}; + VAStatus vlVaQuerySubpictureFormats( VADriverContextP ctx, VAImageFormat *format_list, @@ -37,8 +58,19 @@ vlVaQuerySubpictureFormats( VADriverContextP ctx, { if (!ctx) return VA_STATUS_ERROR_INVALID_CONTEXT; - - return VA_STATUS_ERROR_UNIMPLEMENTED; + + if (!(format_list && flags && num_formats)) + return VA_STATUS_ERROR_UNKNOWN; + + int n = 0; + /* Query supported formats */ + for (n = 0; n < NUM_FORMAT_SUPPORTED; n++) + { + flags[n] = va_subpicture_formats_supported[n].va_flags; + format_list[n] = va_subpicture_formats_supported[n].va_format; + } + + return VA_STATUS_SUCCESS; } -- 2.30.2