aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorMaarten Lankhorst <[email protected]>2011-10-31 10:26:02 +0100
committerChristian König <[email protected]>2011-11-03 13:52:01 +0100
commit1eb48c5500e5b3e3319108a1cecf63524fdede0d (patch)
treea690ccd5b7c02cc1836631d4e3c8011b27f733f6 /src/gallium/state_trackers
parentc4d47f065ae2a015a9d2e9a060d71e04d5935c2b (diff)
state_trackers/vdpau: Test if profile is supported first before trying to create decoder
So a nicer error message is returned. Signed-off-by: Maarten Lankhorst <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/vdpau/decode.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/vdpau/decode.c b/src/gallium/state_trackers/vdpau/decode.c
index 7689ce27793..2b23dfde9c5 100644
--- a/src/gallium/state_trackers/vdpau/decode.c
+++ b/src/gallium/state_trackers/vdpau/decode.c
@@ -43,15 +43,18 @@ vlVdpDecoderCreate(VdpDevice device,
{
enum pipe_video_profile p_profile;
struct pipe_context *pipe;
+ struct pipe_screen *screen;
vlVdpDevice *dev;
vlVdpDecoder *vldecoder;
VdpStatus ret;
unsigned i;
+ bool supported;
VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Creating decoder\n");
if (!decoder)
return VDP_STATUS_INVALID_POINTER;
+ *decoder = 0;
if (!(width && height))
return VDP_STATUS_INVALID_VALUE;
@@ -65,6 +68,15 @@ vlVdpDecoderCreate(VdpDevice device,
return VDP_STATUS_INVALID_HANDLE;
pipe = dev->context->pipe;
+ screen = dev->vscreen->pscreen;
+ supported = screen->get_video_param
+ (
+ screen,
+ p_profile,
+ PIPE_VIDEO_CAP_SUPPORTED
+ );
+ if (!supported)
+ return VDP_STATUS_INVALID_DECODER_PROFILE;
vldecoder = CALLOC(1,sizeof(vlVdpDecoder));
if (!vldecoder)