Mesa (gallium-screen-context): idenity: wrapped context creation

Keith Whitwell keithw at kemper.freedesktop.org
Thu Feb 4 16:42:57 UTC 2010


Module: Mesa
Branch: gallium-screen-context
Commit: 444f114c3516abf71c430e6e9d0d2ae3b80679d3
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=444f114c3516abf71c430e6e9d0d2ae3b80679d3

Author: Keith Whitwell <keithw at vmware.com>
Date:   Thu Feb  4 16:37:58 2010 +0000

idenity: wrapped context creation

---

 src/gallium/drivers/identity/id_context.c |    2 +-
 src/gallium/drivers/identity/id_context.h |    4 ++++
 src/gallium/drivers/identity/id_public.h  |    3 ---
 src/gallium/drivers/identity/id_screen.c  |   14 ++++++++++++++
 4 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/identity/id_context.c b/src/gallium/drivers/identity/id_context.c
index f9063d9..40962a3 100644
--- a/src/gallium/drivers/identity/id_context.c
+++ b/src/gallium/drivers/identity/id_context.c
@@ -692,7 +692,7 @@ identity_context_create(struct pipe_screen *_screen, struct pipe_context *pipe)
 
    id_pipe->base.winsys = NULL;
    id_pipe->base.screen = _screen;
-   id_pipe->base.priv = pipe->priv;
+   id_pipe->base.priv = pipe->priv; /* expose wrapped data */
    id_pipe->base.draw = NULL;
 
    id_pipe->base.destroy = identity_destroy;
diff --git a/src/gallium/drivers/identity/id_context.h b/src/gallium/drivers/identity/id_context.h
index 75b73fc..6d3c189 100644
--- a/src/gallium/drivers/identity/id_context.h
+++ b/src/gallium/drivers/identity/id_context.h
@@ -39,6 +39,10 @@ struct identity_context {
 };
 
 
+struct pipe_context *
+identity_context_create(struct pipe_screen *screen, struct pipe_context *pipe);
+
+
 static INLINE struct identity_context *
 identity_context(struct pipe_context *pipe)
 {
diff --git a/src/gallium/drivers/identity/id_public.h b/src/gallium/drivers/identity/id_public.h
index 3d2862e..d0d5847 100644
--- a/src/gallium/drivers/identity/id_public.h
+++ b/src/gallium/drivers/identity/id_public.h
@@ -34,7 +34,4 @@ struct pipe_context;
 struct pipe_screen *
 identity_screen_create(struct pipe_screen *screen);
 
-struct pipe_context *
-identity_context_create(struct pipe_screen *screen, struct pipe_context *pipe);
-
 #endif /* ID_PUBLIC_H */
diff --git a/src/gallium/drivers/identity/id_screen.c b/src/gallium/drivers/identity/id_screen.c
index 53eae3e..369887d 100644
--- a/src/gallium/drivers/identity/id_screen.c
+++ b/src/gallium/drivers/identity/id_screen.c
@@ -103,6 +103,19 @@ identity_screen_is_format_supported(struct pipe_screen *_screen,
                                       geom_flags);
 }
 
+static struct pipe_context *
+identity_screen_context_create(struct pipe_screen *_screen,
+                               void *priv)
+{
+   struct identity_screen *id_screen = identity_screen(_screen);
+   struct pipe_screen *screen = id_screen->screen;
+
+   result = screen->context_create(screen, priv);
+   if (result)
+      return identity_context_create(id_screen, result);
+   return NULL;
+}
+
 static struct pipe_texture *
 identity_screen_texture_create(struct pipe_screen *_screen,
                                const struct pipe_texture *templat)
@@ -478,6 +491,7 @@ identity_screen_create(struct pipe_screen *screen)
    id_screen->base.get_param = identity_screen_get_param;
    id_screen->base.get_paramf = identity_screen_get_paramf;
    id_screen->base.is_format_supported = identity_screen_is_format_supported;
+   id_screen->base.context_create = identity_screen_context_create;
    id_screen->base.texture_create = identity_screen_texture_create;
    id_screen->base.texture_blanket = identity_screen_texture_blanket;
    id_screen->base.texture_destroy = identity_screen_texture_destroy;




More information about the mesa-commit mailing list