[g3dvl] make pipe_context mandatory for creation pipe_video_context
[mesa.git] / src / gallium / winsys / g3dvl / dri / dri_winsys.c
index ffb94de4a7bf589347168fc6432df3db6670196a..42b33d191d46401344faaf494a0c2946275e2cab 100644 (file)
@@ -237,21 +237,31 @@ vl_video_create(struct vl_screen *vscreen)
    struct vl_dri_screen *vl_dri_scrn = (struct vl_dri_screen*)vscreen;
    struct vl_dri_context *vl_dri_ctx;
 
+   if (!vscreen->pscreen->video_context_create) {
+      debug_printf("[G3DVL] No video support found on %s/%s.\n",
+                   vscreen->pscreen->get_vendor(vscreen->pscreen),
+                   vscreen->pscreen->get_name(vscreen->pscreen));
+      goto no_vpipe;
+   }
+
    vl_dri_ctx = CALLOC_STRUCT(vl_dri_context);
    if (!vl_dri_ctx)
       goto no_struct;
 
-   if (!vscreen->pscreen->video_context_create) {
+   vl_dri_ctx->base.pipe = vscreen->pscreen->context_create(vscreen->pscreen, vl_dri_ctx);
+   if (!vl_dri_ctx->base.pipe) {
       debug_printf("[G3DVL] No video support found on %s/%s.\n",
                    vscreen->pscreen->get_vendor(vscreen->pscreen),
                    vscreen->pscreen->get_name(vscreen->pscreen));
-      goto no_vpipe;
+      goto no_pipe;
    }
 
-   vl_dri_ctx->base.vpipe = vscreen->pscreen->video_context_create(vscreen->pscreen, vl_dri_ctx);
+   vl_dri_ctx->base.vpipe = vscreen->pscreen->video_context_create(vscreen->pscreen,
+                                                                   vl_dri_ctx->base.pipe,
+                                                                   vl_dri_ctx);
 
    if (!vl_dri_ctx->base.vpipe)
-      goto no_vpipe;
+      goto no_pipe;
 
    vl_dri_ctx->base.vpipe->priv = vl_dri_ctx;
    vl_dri_ctx->base.vscreen = vscreen;
@@ -259,9 +269,11 @@ vl_video_create(struct vl_screen *vscreen)
 
    return &vl_dri_ctx->base;
 
-no_vpipe:
+no_pipe:
    FREE(vl_dri_ctx);
+
 no_struct:
+no_vpipe:
    return NULL;
 }
 
@@ -271,6 +283,7 @@ void vl_video_destroy(struct vl_context *vctx)
 
    assert(vctx);
 
+   vl_dri_ctx->base.pipe->destroy(vl_dri_ctx->base.pipe);
    vl_dri_ctx->base.vpipe->destroy(vl_dri_ctx->base.vpipe);
    FREE(vl_dri_ctx);
 }