[Mesa-dev] [PATCH 02/15] st/va: implement vlVaQueryConfigProfiles
Christian König
deathsimple at vodafone.de
Tue Jun 18 02:27:32 PDT 2013
From: Christian König <christian.koenig at amd.com>
Signed-off-by: Christian König <christian.koenig at amd.com>
---
src/gallium/state_trackers/va/config.c | 12 +++++++++
src/gallium/state_trackers/va/context.c | 2 +-
src/gallium/state_trackers/va/va_private.h | 37 ++++++++++++++++++++++++++++
3 files changed, 50 insertions(+), 1 deletion(-)
diff --git a/src/gallium/state_trackers/va/config.c b/src/gallium/state_trackers/va/config.c
index a9c652b..0060973 100644
--- a/src/gallium/state_trackers/va/config.c
+++ b/src/gallium/state_trackers/va/config.c
@@ -26,16 +26,28 @@
*
**************************************************************************/
+#include "pipe/p_screen.h"
+
+#include "vl/vl_winsys.h"
+
#include "va_private.h"
VAStatus
vlVaQueryConfigProfiles(VADriverContextP ctx, VAProfile *profile_list, int *num_profiles)
{
+ struct pipe_screen *pscreen;
+ enum pipe_video_profile p;
+
if (!ctx)
return VA_STATUS_ERROR_INVALID_CONTEXT;
*num_profiles = 0;
+ pscreen = VL_VA_PSCREEN(ctx);
+ for (p = PIPE_VIDEO_PROFILE_MPEG2_SIMPLE; p <= PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH; ++p)
+ if (pscreen->get_video_param(pscreen, p, PIPE_VIDEO_CAP_SUPPORTED))
+ profile_list[(*num_profiles)++] = PipeToProfile(p);
+
return VA_STATUS_SUCCESS;
}
diff --git a/src/gallium/state_trackers/va/context.c b/src/gallium/state_trackers/va/context.c
index 3e6ca0a..5940422 100644
--- a/src/gallium/state_trackers/va/context.c
+++ b/src/gallium/state_trackers/va/context.c
@@ -104,7 +104,7 @@ __vaDriverInit_0_32(VADriverContextP ctx)
ctx->version_major = 0;
ctx->version_minor = 1;
*ctx->vtable = vtable;
- ctx->max_profiles = 1;
+ ctx->max_profiles = PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH - PIPE_VIDEO_PROFILE_UNKNOWN;
ctx->max_entrypoints = 1;
ctx->max_attributes = 1;
ctx->max_image_formats = 1;
diff --git a/src/gallium/state_trackers/va/va_private.h b/src/gallium/state_trackers/va/va_private.h
index adfed8d..5b432a8 100644
--- a/src/gallium/state_trackers/va/va_private.h
+++ b/src/gallium/state_trackers/va/va_private.h
@@ -29,9 +29,46 @@
#ifndef VA_PRIVATE_H
#define VA_PRIVATE_H
+#include <assert.h>
+
#include <va/va.h>
#include <va/va_backend.h>
+#include "pipe/p_video_enums.h"
+
+#define VL_VA_DRIVER(ctx) ((vlVaDriver *)ctx->pDriverData)
+#define VL_VA_PSCREEN(ctx) (VL_VA_DRIVER(ctx)->vscreen->pscreen)
+
+static inline VAProfile
+PipeToProfile(enum pipe_video_profile profile)
+{
+ switch (profile) {
+ case PIPE_VIDEO_PROFILE_MPEG2_SIMPLE:
+ return VAProfileMPEG2Simple;
+ case PIPE_VIDEO_PROFILE_MPEG2_MAIN:
+ return VAProfileMPEG2Main;
+ case PIPE_VIDEO_PROFILE_MPEG4_SIMPLE:
+ return VAProfileMPEG4Simple;
+ case PIPE_VIDEO_PROFILE_MPEG4_ADVANCED_SIMPLE:
+ return VAProfileMPEG4AdvancedSimple;
+ case PIPE_VIDEO_PROFILE_VC1_SIMPLE:
+ return VAProfileVC1Simple;
+ case PIPE_VIDEO_PROFILE_VC1_MAIN:
+ return VAProfileVC1Main;
+ case PIPE_VIDEO_PROFILE_VC1_ADVANCED:
+ return VAProfileVC1Advanced;
+ case PIPE_VIDEO_PROFILE_MPEG4_AVC_BASELINE:
+ return VAProfileH264Baseline;
+ case PIPE_VIDEO_PROFILE_MPEG4_AVC_MAIN:
+ return VAProfileH264Main;
+ case PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH:
+ return VAProfileH264High;
+ default:
+ assert(0);
+ return -1;
+ }
+}
+
typedef struct {
struct vl_screen *vscreen;
} vlVaDriver;
--
1.7.9.5
More information about the mesa-dev
mailing list