[g3dvl] make pipe_context mandatory for creation pipe_video_context
authorChristian König <deathsimple@vodafone.de>
Fri, 8 Jul 2011 10:03:13 +0000 (12:03 +0200)
committerChristian König <deathsimple@vodafone.de>
Fri, 8 Jul 2011 10:03:13 +0000 (12:03 +0200)
14 files changed:
src/gallium/auxiliary/vl/vl_context.c
src/gallium/drivers/r300/Makefile
src/gallium/drivers/r300/r300_screen.c
src/gallium/drivers/r300/r300_video_context.c [deleted file]
src/gallium/drivers/r300/r300_video_context.h [deleted file]
src/gallium/drivers/r600/Makefile
src/gallium/drivers/r600/r600_pipe.c
src/gallium/drivers/r600/r600_video_context.c [deleted file]
src/gallium/drivers/r600/r600_video_context.h [deleted file]
src/gallium/drivers/softpipe/sp_screen.c
src/gallium/include/pipe/p_screen.h
src/gallium/winsys/g3dvl/dri/dri_winsys.c
src/gallium/winsys/g3dvl/vl_winsys.h
src/gallium/winsys/g3dvl/xlib/xsp_winsys.c

index 46e1981cc9ff714c666843cbc857ff8c2f568d9e..87de24c540280cea992ed3841fe0896f4fb97e9f 100644 (file)
@@ -42,8 +42,6 @@ vl_context_destroy(struct pipe_video_context *context)
 
    assert(context);
 
-   ctx->pipe->destroy(ctx->pipe);
-
    FREE(ctx);
 }
 
index dfedf353877590aeec90c4061cf4ccff6ff58626..4088216adcbf10ef8ba074823e73e2be6e6bf50c 100644 (file)
@@ -26,7 +26,6 @@ C_SOURCES = \
        r300_texture.c \
        r300_texture_desc.c \
        r300_tgsi_to_rc.c \
-       r300_video_context.c \
        r300_transfer.c
 
 LIBRARY_INCLUDES = \
index 53437d3ad080a9a4c002e7aa0af94e13f09e3126..854fc39e0149724efb8d83cedad9f041a7205fcc 100644 (file)
@@ -25,6 +25,7 @@
 #include "util/u_format_s3tc.h"
 #include "util/u_memory.h"
 #include "os/os_time.h"
+#include "vl/vl_context.h"
 #include "vl/vl_video_buffer.h"
 
 #include "r300_context.h"
@@ -32,7 +33,6 @@
 #include "r300_screen_buffer.h"
 #include "r300_state_inlines.h"
 #include "r300_public.h"
-#include "r300_video_context.h"
 
 #include "draw/draw_context.h"
 
@@ -425,6 +425,14 @@ static boolean r300_is_format_supported(struct pipe_screen* screen,
     return retval == usage;
 }
 
+static struct pipe_video_context *
+r300_video_create(struct pipe_screen *screen, struct pipe_context *pipe, void *priv)
+{
+   assert(screen);
+
+   return vl_create_context(pipe);
+}
+
 static void r300_destroy_screen(struct pipe_screen* pscreen)
 {
     struct r300_screen* r300screen = r300_screen(pscreen);
diff --git a/src/gallium/drivers/r300/r300_video_context.c b/src/gallium/drivers/r300/r300_video_context.c
deleted file mode 100644 (file)
index 697e45a..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2009-2010  Advanced Micro Devices, Inc.
- *
- * 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, sublicense,
- * 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 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 NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) 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 <vl/vl_context.h>
-#include <util/u_video.h>
-#include "r300_video_context.h"
-
-struct pipe_video_context *
-r300_video_create(struct pipe_screen *screen, void *priv)
-{
-   struct pipe_context *pipe;
-
-   assert(screen);
-
-   pipe = screen->context_create(screen, priv);
-   if (!pipe)
-      return NULL;
-
-   return vl_create_context(pipe);
-}
diff --git a/src/gallium/drivers/r300/r300_video_context.h b/src/gallium/drivers/r300/r300_video_context.h
deleted file mode 100644 (file)
index aaae14c..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2009-2010  Advanced Micro Devices, Inc.
- *
- * 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, sublicense,
- * 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 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 NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) 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.
- */
-
-#ifndef __R300_VIDEO_CONTEXT_H__
-#define __R300_VIDEO_CONTEXT_H__
-
-#include <pipe/p_video_context.h>
-
-struct pipe_video_context *
-r300_video_create(struct pipe_screen *screen, void *priv);
-
-#endif
index 3dda3a6339f55cbb449807bc6e1f21d4568ece59..7e21e3e32b1d4831669d0d3a81bf14511c2c124e 100644 (file)
@@ -16,7 +16,6 @@ C_SOURCES = \
        r600_shader.c \
        r600_state.c \
        r600_texture.c \
-       r600_video_context.c \
        r700_asm.c \
        evergreen_state.c \
        eg_asm.c \
index 4b923f8670450c7a370bbd0b47736c25ed0577fe..9e0b0ea3e4992fb54686a8834c1b3d1ba8d2b5c7 100644 (file)
@@ -38,6 +38,7 @@
 #include <util/u_memory.h>
 #include <util/u_inlines.h>
 #include "util/u_upload_mgr.h"
+#include <vl/vl_context.h>
 #include <vl/vl_video_buffer.h>
 #include "os/os_time.h"
 #include <pipebuffer/pb_buffer.h>
@@ -47,7 +48,6 @@
 #include "r600_shader.h"
 #include "r600_pipe.h"
 #include "r600_state_inlines.h"
-#include "r600_video_context.h"
 
 /*
  * pipe_context
@@ -301,6 +301,14 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void
        return &rctx->context;
 }
 
+static struct pipe_video_context *
+r600_video_create(struct pipe_screen *screen, struct pipe_context *pipe, void *priv)
+{
+       assert(screen && pipe);
+
+       return vl_create_context(pipe);
+}
+
 /*
  * pipe_screen
  */
diff --git a/src/gallium/drivers/r600/r600_video_context.c b/src/gallium/drivers/r600/r600_video_context.c
deleted file mode 100644 (file)
index 5f0d5f5..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2010 Christian König
- * 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 "r600_video_context.h"
-#include "util/u_video.h"
-#include <vl/vl_context.h>
-
-struct pipe_video_context *
-r600_video_create(struct pipe_screen *screen, void *priv)
-{
-   struct pipe_context *pipe;
-
-   assert(screen);
-
-   pipe = screen->context_create(screen, priv);
-   if (!pipe)
-      return NULL;
-
-   return vl_create_context(pipe);
-}
diff --git a/src/gallium/drivers/r600/r600_video_context.h b/src/gallium/drivers/r600/r600_video_context.h
deleted file mode 100644 (file)
index f579980..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef __R600_VIDEO_CONTEXT_H__
-#define __R600_VIDEO_CONTEXT_H__
-
-#include <pipe/p_video_context.h>
-
-struct pipe_video_context *
-r600_video_create(struct pipe_screen *screen, void *priv);
-
-#endif
index b978fb4f61e4a2e0ba9dd27523029fa1d15dd985..2a5485209d1b9eb1b6b93ba6e433b4bc54376d42 100644 (file)
@@ -301,18 +301,11 @@ softpipe_flush_frontbuffer(struct pipe_screen *_screen,
 }
 
 static struct pipe_video_context *
-sp_video_create(struct pipe_screen *screen, void *priv)
+sp_video_create(struct pipe_screen *screen, struct pipe_context *context, void *priv)
 {
-   struct pipe_context *pipe;
-
    assert(screen);
 
-   pipe = screen->context_create(screen, NULL);
-   if (!pipe)
-      return NULL;
-
-   /* TODO: Use slice buffering for softpipe when implemented, no advantage to buffering an entire picture with softpipe */
-   return vl_create_context(pipe);
+   return vl_create_context(context);
 }
 
 /**
index 011724a79ccc6fc1f10237092408ceeb6303a2fb..32869bb71e807acd7234e71018e21f10b81b6cda 100644 (file)
@@ -100,7 +100,9 @@ struct pipe_screen {
 
    struct pipe_context * (*context_create)( struct pipe_screen *, void *priv );
 
-   struct pipe_video_context * (*video_context_create)( struct pipe_screen *screen, void *priv );
+   struct pipe_video_context * (*video_context_create)( struct pipe_screen *screen,
+                                                        struct pipe_context *context,
+                                                        void *priv );
 
    /**
     * Check if the given pipe_format is supported as a texture or
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);
 }
index 152a4a622927d0e788ebfd11745de00320a46b2d..2d80c1d9b3279fe1b69614fc9c9ee917d2f9977b 100644 (file)
@@ -44,6 +44,7 @@ struct vl_screen
 struct vl_context
 {
    struct vl_screen *vscreen;
+   struct pipe_context *pipe;
    struct pipe_video_context *vpipe;
 };
 
index 1a67e2436e47bd7fc8260aa81a44a3ff11be4fdc..3caf6603243254c2ccd9c966c7b283150f0c4b39 100644 (file)
@@ -172,18 +172,26 @@ void vl_screen_destroy(struct vl_screen *vscreen)
 struct vl_context*
 vl_video_create(struct vl_screen *vscreen)
 {
+   struct pipe_video_context *pipe;
    struct pipe_video_context *vpipe;
    struct vl_context *vctx;
 
    assert(vscreen);
    assert(vscreen->pscreen->video_context_create);
 
-   vpipe = vscreen->pscreen->video_context_create(vscreen->pscreen, NULL);
-   if (!vpipe)
+   pipe = vscreen->pscreen->context_create(vscreen->pscreen, NULL);
+   if (!pipe)
       return NULL;
 
+   vpipe = vscreen->pscreen->video_context_create(vscreen->pscreen, pipe, NULL);
+   if (!vpipe) {
+      pipe->destroy(pipe);
+      return NULL;
+   }
+
    vctx = CALLOC_STRUCT(vl_context);
    if (!vctx) {
+      pipe->destroy(pipe);
       vpipe->destroy(vpipe);
       return NULL;
    }
@@ -199,6 +207,7 @@ void vl_video_destroy(struct vl_context *vctx)
 {
    assert(vctx);
 
+   vctx->pipe->destroy(vctx->pipe);
    vctx->vpipe->destroy(vctx->vpipe);
    FREE(vctx);
 }