summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/xorg
diff options
context:
space:
mode:
authorYounes Manton <[email protected]>2009-09-28 00:17:33 -0400
committerYounes Manton <[email protected]>2009-09-28 00:17:33 -0400
commit70c44073ad3f333ed40c5c297a934a359c839e94 (patch)
tree06591498326f1a14bdaf09ad17ca065cdbf9f07c /src/gallium/state_trackers/xorg
parentc0745670d830a644c1b398fb0c6bda165c1095fa (diff)
xvmc: Fail on unsupported formats, operations.
Diffstat (limited to 'src/gallium/state_trackers/xorg')
-rw-r--r--src/gallium/state_trackers/xorg/xvmc/context.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/gallium/state_trackers/xorg/xvmc/context.c b/src/gallium/state_trackers/xorg/xvmc/context.c
index ff2bd295ece..6d90dfc367a 100644
--- a/src/gallium/state_trackers/xorg/xvmc/context.c
+++ b/src/gallium/state_trackers/xorg/xvmc/context.c
@@ -7,11 +7,13 @@
#include <pipe/p_state.h>
#include <vl_winsys.h>
#include <util/u_memory.h>
+#include <util/u_debug.h>
#include "xvmc_private.h"
static Status Validate(Display *dpy, XvPortID port, int surface_type_id,
unsigned int width, unsigned int height, int flags,
- bool *found_port, int *screen, int *chroma_format, int *mc_type)
+ bool *found_port, int *screen, int *chroma_format,
+ int *mc_type, int *surface_flags)
{
bool found_surface = false;
XvAdaptorInfo *adaptor_info;
@@ -25,6 +27,7 @@ static Status Validate(Display *dpy, XvPortID port, int surface_type_id,
assert(screen);
assert(chroma_format);
assert(mc_type);
+ assert(surface_flags);
*found_port = false;
@@ -57,6 +60,7 @@ static Status Validate(Display *dpy, XvPortID port, int surface_type_id,
max_height = surface_info[l].max_height;
*chroma_format = surface_info[l].chroma_format;
*mc_type = surface_info[l].mc_type;
+ *surface_flags = surface_info[l].flags;
*screen = i;
}
@@ -118,6 +122,7 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id,
int scrn;
int chroma_format;
int mc_type;
+ int surface_flags;
Status ret;
struct pipe_screen *screen;
struct pipe_video_context *vpipe;
@@ -129,12 +134,26 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id,
return XvMCBadContext;
ret = Validate(dpy, port, surface_type_id, width, height, flags,
- &found_port, &scrn, &chroma_format, &mc_type);
+ &found_port, &scrn, &chroma_format, &mc_type, &surface_flags);
/* Success and XvBadPort have the same value */
if (ret != Success || !found_port)
return ret;
+ /* XXX: Current limits */
+ if (chroma_format != XVMC_CHROMA_FORMAT_420) {
+ debug_printf("[XvMCg3dvl] Cannot decode requested surface type. Unsupported chroma format.\n");
+ return BadImplementation;
+ }
+ if (mc_type != (XVMC_MOCOMP | XVMC_MPEG_2)) {
+ debug_printf("[XvMCg3dvl] Cannot decode requested surface type. Non-MPEG2/Mocomp acceleration unsupported.\n");
+ return BadImplementation;
+ }
+ if (!(surface_flags & XVMC_INTRA_UNSIGNED)) {
+ debug_printf("[XvMCg3dvl] Cannot decode requested surface type. Signed intra unsupported.\n");
+ return BadImplementation;
+ }
+
context_priv = CALLOC(1, sizeof(XvMCContextPrivate));
if (!context_priv)
return BadAlloc;