r300g: align the height of NPOT textures to POT
[mesa.git] / src / gallium / state_trackers / xorg / xvmc / context.c
index 6d90dfc367a63953f57533186a532b8e1be9777b..c8a389385a80796e8db10624ffdbd2cd52509a75 100644 (file)
@@ -1,3 +1,30 @@
+/**************************************************************************
+ * 
+ * Copyright 2009 Younes Manton.
+ * All Rights Reserved.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * 
+ **************************************************************************/
+
 #include <assert.h>
 #include <X11/Xlibint.h>
 #include <X11/extensions/XvMClib.h>
@@ -8,6 +35,7 @@
 #include <vl_winsys.h>
 #include <util/u_memory.h>
 #include <util/u_debug.h>
+#include <vl/vl_csc.h>
 #include "xvmc_private.h"
 
 static Status Validate(Display *dpy, XvPortID port, int surface_type_id,
@@ -127,6 +155,7 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id,
    struct pipe_screen *screen;
    struct pipe_video_context *vpipe;
    XvMCContextPrivate *context_priv;
+   float csc[16];
 
    assert(dpy);
 
@@ -166,7 +195,7 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id,
       return BadAlloc;
    }
 
-   vpipe = vl_video_create(screen, ProfileToPipe(mc_type),
+   vpipe = vl_video_create(dpy, scrn, screen, ProfileToPipe(mc_type),
                            FormatToPipe(chroma_format), width, height);
 
    if (!vpipe) {
@@ -175,6 +204,15 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id,
       return BadAlloc;
    }
 
+   /* TODO: Define some Xv attribs to allow users to specify color standard, procamp */
+   vl_csc_get_matrix
+   (
+      debug_get_bool_option("G3DVL_NO_CSC", FALSE) ?
+      VL_CSC_COLOR_STANDARD_IDENTITY : VL_CSC_COLOR_STANDARD_BT_601,
+      NULL, true, csc
+   );
+   vpipe->set_csc_matrix(vpipe, csc);
+
    context_priv->vpipe = vpipe;
 
    context->context_id = XAllocID(dpy);