radeonsi: rename variable to clarify its meaning
[mesa.git] / src / gallium / state_trackers / xvmc / context.c
index 2329e2ae3d8b44cbbc72de44651738399072971d..1ecff5e8ac153c05e9bd42a396803a53a4c742b0 100644 (file)
@@ -67,7 +67,7 @@ static Status Validate(Display *dpy, XvPortID port, int surface_type_id,
 
    *found_port = false;
 
-   for (unsigned int i = 0; i < XScreenCount(dpy); ++i) {
+   for (int i = 0; i < XScreenCount(dpy); ++i) {
       ret = XvQueryAdaptors(dpy, XRootWindow(dpy, i), &num_adaptors, &adaptor_info);
       if (ret != Success)
          return ret;
@@ -87,7 +87,7 @@ static Status Validate(Display *dpy, XvPortID port, int surface_type_id,
                return BadAlloc;
             }
 
-            for (unsigned int l = 0; l < num_types && !found_surface; ++l) {
+            for (int l = 0; l < num_types && !found_surface; ++l) {
                if (surface_info[l].surface_type_id != surface_type_id)
                   continue;
 
@@ -191,7 +191,7 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id,
    Status ret;
    struct vl_screen *vscreen;
    struct pipe_context *pipe;
-   struct pipe_video_codec templat = {};
+   struct pipe_video_codec templat = {0};
    XvMCContextPrivate *context_priv;
    vl_csc_matrix csc;
 
@@ -229,7 +229,9 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id,
       return BadAlloc;
 
    /* TODO: Reuse screen if process creates another context */
-   vscreen = vl_screen_create(dpy, scrn);
+   vscreen = vl_dri3_screen_create(dpy, scrn);
+   if (!vscreen)
+      vscreen = vl_dri2_screen_create(dpy, scrn);
 
    if (!vscreen) {
       XVMC_MSG(XVMC_ERR, "[XvMC] Could not create VL screen.\n");
@@ -237,10 +239,10 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id,
       return BadAlloc;
    }
 
-   pipe = vscreen->pscreen->context_create(vscreen->pscreen, vscreen);
+   pipe = vscreen->pscreen->context_create(vscreen->pscreen, NULL, 0);
    if (!pipe) {
       XVMC_MSG(XVMC_ERR, "[XvMC] Could not create VL context.\n");
-      vl_screen_destroy(vscreen);
+      vscreen->destroy(vscreen);
       FREE(context_priv);
       return BadAlloc;
    }
@@ -258,7 +260,7 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id,
    if (!context_priv->decoder) {
       XVMC_MSG(XVMC_ERR, "[XvMC] Could not create VL decoder.\n");
       pipe->destroy(pipe);
-      vl_screen_destroy(vscreen);
+      vscreen->destroy(vscreen);
       FREE(context_priv);
       return BadAlloc;
    }
@@ -267,7 +269,7 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id,
       XVMC_MSG(XVMC_ERR, "[XvMC] Could not create VL compositor.\n");
       context_priv->decoder->destroy(context_priv->decoder);
       pipe->destroy(pipe);
-      vl_screen_destroy(vscreen);
+      vscreen->destroy(vscreen);
       FREE(context_priv);
       return BadAlloc;
    }
@@ -277,7 +279,7 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id,
       vl_compositor_cleanup(&context_priv->compositor);
       context_priv->decoder->destroy(context_priv->decoder);
       pipe->destroy(pipe);
-      vl_screen_destroy(vscreen);
+      vscreen->destroy(vscreen);
       FREE(context_priv);
       return BadAlloc;
    }
@@ -293,7 +295,7 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id,
       context_priv->color_standard,
       &context_priv->procamp, true, &csc
    );
-   vl_compositor_set_csc_matrix(&context_priv->cstate, (const vl_csc_matrix *)&csc);
+   vl_compositor_set_csc_matrix(&context_priv->cstate, (const vl_csc_matrix *)&csc, 1.0f, 0.0f);
 
    context_priv->vscreen = vscreen;
    context_priv->pipe = pipe;
@@ -332,7 +334,7 @@ Status XvMCDestroyContext(Display *dpy, XvMCContext *context)
    vl_compositor_cleanup_state(&context_priv->cstate);
    vl_compositor_cleanup(&context_priv->compositor);
    context_priv->pipe->destroy(context_priv->pipe);
-   vl_screen_destroy(context_priv->vscreen);
+   context_priv->vscreen->destroy(context_priv->vscreen);
    FREE(context_priv);
    context->privData = NULL;