st/xorg: Fix include style
[mesa.git] / src / gallium / state_trackers / xorg / xvmc / context.c
index 6f136f2b12154397a9b2a9fc7a5f7a4da110a0c8..172f16cfb6375d639cb70f3711b251a72a337e93 100644 (file)
  **************************************************************************/
 
 #include <assert.h>
+
 #include <X11/Xlibint.h>
 #include <X11/extensions/XvMClib.h>
-#include <pipe/p_screen.h>
-#include <pipe/p_video_context.h>
-#include <pipe/p_video_state.h>
-#include <pipe/p_state.h>
-#include <vl_winsys.h>
-#include <util/u_memory.h>
-#include <vl/vl_csc.h>
+
+#include "pipe/p_screen.h"
+#include "pipe/p_video_decoder.h"
+#include "pipe/p_video_state.h"
+#include "pipe/p_state.h"
+
+#include "util/u_memory.h"
+
+#include "vl/vl_csc.h"
+#include "vl_winsys.h"
+
 #include "xvmc_private.h"
 
 static Status Validate(Display *dpy, XvPortID port, int surface_type_id,
@@ -48,7 +53,7 @@ static Status Validate(Display *dpy, XvPortID port, int surface_type_id,
    XvAdaptorInfo *adaptor_info;
    unsigned int num_adaptors;
    int num_types;
-   unsigned int max_width, max_height;
+   unsigned int max_width = 0, max_height = 0;
    Status ret;
 
    assert(dpy);
@@ -239,13 +244,14 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id,
       return BadAlloc;
    }
 
-   context_priv->decoder = vctx->vpipe->create_decoder(vctx->vpipe,
-                                                       ProfileToPipe(mc_type),
-                                                       (mc_type & XVMC_IDCT) ?
-                                                          PIPE_VIDEO_ENTRYPOINT_IDCT :
-                                                          PIPE_VIDEO_ENTRYPOINT_MC,
-                                                       FormatToPipe(chroma_format),
-                                                       width, height);
+   context_priv->decoder = vctx->pipe->create_video_decoder
+   (
+      vctx->pipe,
+      ProfileToPipe(mc_type),
+      (mc_type & XVMC_IDCT) ? PIPE_VIDEO_ENTRYPOINT_IDCT : PIPE_VIDEO_ENTRYPOINT_MC,
+      FormatToPipe(chroma_format),
+      width, height
+   );
 
    if (!context_priv->decoder) {
       XVMC_MSG(XVMC_ERR, "[XvMC] Could not create VL decoder.\n");
@@ -255,8 +261,7 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id,
       return BadAlloc;
    }
 
-   context_priv->compositor = vctx->vpipe->create_compositor(vctx->vpipe);
-   if (!context_priv->compositor) {
+   if (!vl_compositor_init(&context_priv->compositor, vctx->pipe)) {
       XVMC_MSG(XVMC_ERR, "[XvMC] Could not create VL compositor.\n");
       context_priv->decoder->destroy(context_priv->decoder);
       vl_video_destroy(vctx);
@@ -265,14 +270,17 @@ 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 */
+   context_priv->color_standard =
+      debug_get_bool_option("G3DVL_NO_CSC", FALSE) ?
+      VL_CSC_COLOR_STANDARD_IDENTITY : VL_CSC_COLOR_STANDARD_BT_601;
+   context_priv->procamp = vl_default_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
+      context_priv->color_standard,
+      &context_priv->procamp, true, csc
    );
-   context_priv->compositor->set_csc_matrix(context_priv->compositor, csc);
+   vl_compositor_set_csc_matrix(&context_priv->compositor, csc);
 
    context_priv->vctx = vctx;
    context_priv->subpicture_max_width = subpic_max_w;
@@ -310,8 +318,9 @@ Status XvMCDestroyContext(Display *dpy, XvMCContext *context)
    context_priv = context->privData;
    vctx = context_priv->vctx;
    vscreen = vctx->vscreen;
+   pipe_surface_reference(&context_priv->drawable_surface, NULL);
    context_priv->decoder->destroy(context_priv->decoder);
-   context_priv->compositor->destroy(context_priv->compositor);
+   vl_compositor_cleanup(&context_priv->compositor);
    vl_video_destroy(vctx);
    vl_screen_destroy(vscreen);
    FREE(context_priv);