summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChia-I Wu <olvaffe@gmail.com>2010-02-07 00:51:20 +0800
committerChia-I Wu <olvaffe@gmail.com>2010-02-07 00:53:18 +0800
commit0dccfa6e51242d6e96ce8e7ad1a14720527bceba (patch)
tree586f86461db32c651fabffd7e314e10137e147cd
parentd12c726bdfb580781665e7c1e780064e8eba46a3 (diff)
Update sample implementation (SI) to latest st_api.h.
-rw-r--r--sample-implementation-tmp/0001-gallium-Add-st_api.h.patch83
-rw-r--r--sample-implementation-tmp/0002-gallium-Suffix-st_framebuffer-and-st_context-with-_i.patch175
-rw-r--r--sample-implementation-tmp/0002-st-vega-Implement-st_api-interface.patch (renamed from sample-implementation-tmp/0003-st-vega-Implement-st_api-interface.patch)23
-rw-r--r--sample-implementation-tmp/0003-st-egl-Add-support-for-loading-st_api-modules.patch (renamed from sample-implementation-tmp/0004-st-egl-Add-support-for-loading-st_api-modules.patch)6
-rw-r--r--sample-implementation-tmp/0004-st-egl-Use-st_api.h-instead-of-st_public.h.patch (renamed from sample-implementation-tmp/0005-st-egl-Use-st_api.h-instead-of-st_public.h.patch)132
5 files changed, 159 insertions, 260 deletions
diff --git a/sample-implementation-tmp/0001-gallium-Add-st_api.h.patch b/sample-implementation-tmp/0001-gallium-Add-st_api.h.patch
index 98f1372..8dae1b4 100644
--- a/sample-implementation-tmp/0001-gallium-Add-st_api.h.patch
+++ b/sample-implementation-tmp/0001-gallium-Add-st_api.h.patch
@@ -1,19 +1,19 @@
-From 94e420c2b04c3e14a920106d117a94aaf74404b2 Mon Sep 17 00:00:00 2001
-From: Chia-I Wu <olvaffe@gmail.com>
-Date: Wed, 13 Jan 2010 17:57:35 +0800
-Subject: [PATCH 1/5] gallium: Add st_api.h.
+From 505cf68e37db2a13503466221e70e999edd5b9eb Mon Sep 17 00:00:00 2001
+From: Chia-I Wu <olv@lunarg.com>
+Date: Sun, 7 Feb 2010 00:52:02 +0800
+Subject: [PATCH 1/4] gallium: Add st_api.h.
---
- src/gallium/include/state_tracker/st_api.h | 401 ++++++++++++++++++++++++++++
- 1 files changed, 401 insertions(+), 0 deletions(-)
+ src/gallium/include/state_tracker/st_api.h | 410 ++++++++++++++++++++++++++++
+ 1 files changed, 410 insertions(+), 0 deletions(-)
create mode 100644 src/gallium/include/state_tracker/st_api.h
diff --git a/src/gallium/include/state_tracker/st_api.h b/src/gallium/include/state_tracker/st_api.h
new file mode 100644
-index 0000000..8feaade
+index 0000000..3b35030
--- /dev/null
+++ b/src/gallium/include/state_tracker/st_api.h
-@@ -0,0 +1,401 @@
+@@ -0,0 +1,410 @@
+/**********************************************************
+ * Copyright 2010 VMware, Inc. All rights reserved.
+ *
@@ -79,7 +79,7 @@ index 0000000..8feaade
+};
+
+/**
-+ * Used in st_context->teximage.
++ * Used in st_context_iface->teximage.
+ */
+enum st_texture_type {
+ ST_TEXTURE_1D,
@@ -191,7 +191,7 @@ index 0000000..8feaade
+ * The thread syncronisation is put inside the framebuffer
+ * and only called once the framebuffer has become dirty.
+ */
-+struct st_framebuffer
++struct st_framebuffer_iface
+{
+ /**
+ * Available for the state tracker manager to use.
@@ -211,7 +211,7 @@ index 0000000..8feaade
+ *
+ * @att is one of the front buffer attachments.
+ */
-+ boolean (*flush_front)(struct st_framebuffer *stfb,
++ boolean (*flush_front)(struct st_framebuffer_iface *stfbi,
+ enum st_attachment_type statt);
+
+ /**
@@ -231,7 +231,7 @@ index 0000000..8feaade
+ * the last call might be destroyed. This behavior might change in the
+ * future.
+ */
-+ boolean (*validate)(struct st_framebuffer *stfb,
++ boolean (*validate)(struct st_framebuffer_iface *stfbi,
+ const enum st_attachment_type *statts,
+ unsigned count,
+ struct pipe_texture **out);
@@ -242,7 +242,7 @@ index 0000000..8feaade
+ *
+ * This entity is created from st_api and used by the state tracker manager.
+ */
-+struct st_context
++struct st_context_iface
+{
+ /**
+ * The API of the context.
@@ -257,7 +257,7 @@ index 0000000..8feaade
+ /**
+ * Destroy the context.
+ */
-+ void (*destroy)(struct st_context *stctx);
++ void (*destroy)(struct st_context_iface *stctxi);
+
+ /**
+ * Lock and unlock a state tracker context resource.
@@ -267,9 +267,9 @@ index 0000000..8feaade
+ * can lengthen the lifetime of the data structure, it is valid only until
+ * unlocked.
+ */
-+ void *(*lock_resource)(struct st_context *stctx,
++ void *(*lock_resource)(struct st_context_iface *stctxi,
+ enum st_context_resource_type type, void *res);
-+ void (*unlock_resource)(struct st_context *stctx,
++ void (*unlock_resource)(struct st_context_iface *stctxi,
+ enum st_context_resource_type type, void *res);
+
+ /**
@@ -277,7 +277,7 @@ index 0000000..8feaade
+ *
+ * The state tracker manager calls this function to let the rendering
+ * context know that it should update the textures it got from
-+ * st_framebuffer::validate. It should do so at the latest time possible.
++ * st_framebuffer_iface::validate. It should do so at the latest time possible.
+ * Possible right before sending triangles to the pipe context.
+ *
+ * For certain platforms this function might be called from a thread other
@@ -288,13 +288,13 @@ index 0000000..8feaade
+ *
+ * Thus reducing the sync primitive needed to a single atomic flag.
+ */
-+ void (*notify_invalid_framebuffer)(struct st_context *stctx,
-+ struct st_framebuffer *stfb);
++ void (*notify_invalid_framebuffer)(struct st_context_iface *stctxi,
++ struct st_framebuffer_iface *stfbi);
+
+ /**
+ * Flush all drawing from context to the pipe also flushes the pipe.
+ */
-+ void (*flush)(struct st_context *stctx, unsigned flags,
++ void (*flush)(struct st_context_iface *stctxi, unsigned flags,
+ struct pipe_fence_handle **fence);
+
+ /**
@@ -302,15 +302,15 @@ index 0000000..8feaade
+ *
+ * This function is optional.
+ */
-+ boolean (*teximage)(struct st_context *stctx, enum st_texture_type target,
++ boolean (*teximage)(struct st_context_iface *stctxi, enum st_texture_type target,
+ int level, enum pipe_format internal_format,
+ struct pipe_texture *tex, boolean mipmap);
+
+ /**
+ * Used to implement glXCopyContext.
+ */
-+ void (*copy)(struct st_context *stctx, struct st_context *stsrc,
-+ unsigned mask);
++ void (*copy)(struct st_context_iface *stctxi,
++ struct st_context_iface *stsrci, unsigned mask);
+};
+
+
@@ -322,6 +322,8 @@ index 0000000..8feaade
+ */
+struct st_manager
+{
++ struct pipe_screen *screen;
++
+ /**
+ * Lock and unlock a state tracker manager resource.
+ *
@@ -330,10 +332,20 @@ index 0000000..8feaade
+ * can lengthen the lifetime of the data structure, it is valid only until
+ * unlocked.
+ */
-+ void *(*lock_resource)(struct st_manager *smapi, struct st_context *stctx,
++ void *(*lock_resource)(struct st_manager *smapi,
++ struct st_context_iface *stctxi,
+ enum st_manager_resource_type type, void *res);
-+ void (*unlock_resource)(struct st_manager *smapi, struct st_context *stctx,
++ void (*unlock_resource)(struct st_manager *smapi,
++ struct st_context_iface *stctxi,
+ enum st_manager_resource_type type, void *res);
++
++ /**
++ * Create a pipe context.
++ *
++ * XXX this callback should go away once the pipe_screen can create
++ * contexts.
++ */
++ struct pipe_context *(*create_pipe_context)(struct st_manager *smapi);
+};
+
+/**
@@ -364,28 +376,25 @@ index 0000000..8feaade
+ /**
+ * Create a rendering context.
+ *
-+ * XXX: The pipe argument should go away once
-+ * the pipe_screen can create contexts.
+ * XXX: Is visual needed?
+ */
-+ struct st_context *(*create_context)(struct st_api *stapi,
-+ struct st_manager *smapi,
-+ struct pipe_context *pipe,
-+ const struct st_visual *visual,
-+ struct st_context *stshare);
++ struct st_context_iface *(*create_context)(struct st_api *stapi,
++ struct st_manager *smapi,
++ const struct st_visual *visual,
++ struct st_context_iface *stsharei);
+
+ /**
+ * Bind the context to the calling thread with draw and read as drawables.
+ */
+ boolean (*make_current)(struct st_api *stapi,
-+ struct st_context *stctx,
-+ struct st_framebuffer *stdraw,
-+ struct st_framebuffer *stread);
++ struct st_context_iface *stctxi,
++ struct st_framebuffer_iface *stdrawi,
++ struct st_framebuffer_iface *streadi);
+
+ /**
+ * Get the currently bound context in the calling thread.
+ */
-+ struct st_context *(*get_current)(struct st_api *stapi);
++ struct st_context_iface *(*get_current)(struct st_api *stapi);
+};
+
+/**
@@ -416,5 +425,5 @@ index 0000000..8feaade
+
+#endif /* _ST_API_H_ */
--
-1.6.5
+1.6.4.3
diff --git a/sample-implementation-tmp/0002-gallium-Suffix-st_framebuffer-and-st_context-with-_i.patch b/sample-implementation-tmp/0002-gallium-Suffix-st_framebuffer-and-st_context-with-_i.patch
deleted file mode 100644
index 22990fd..0000000
--- a/sample-implementation-tmp/0002-gallium-Suffix-st_framebuffer-and-st_context-with-_i.patch
+++ /dev/null
@@ -1,175 +0,0 @@
-From e2bd293a0f9c775487ea007c72ba9feca2a52afc Mon Sep 17 00:00:00 2001
-From: Chia-I Wu <olvaffe@gmail.com>
-Date: Tue, 2 Feb 2010 13:45:53 +0800
-Subject: [PATCH 2/5] gallium: Suffix st_framebuffer and st_context with _iface.
-
----
- src/gallium/include/state_tracker/st_api.h | 54 ++++++++++++++-------------
- 1 files changed, 28 insertions(+), 26 deletions(-)
-
-diff --git a/src/gallium/include/state_tracker/st_api.h b/src/gallium/include/state_tracker/st_api.h
-index 8feaade..5a47b63 100644
---- a/src/gallium/include/state_tracker/st_api.h
-+++ b/src/gallium/include/state_tracker/st_api.h
-@@ -63,7 +63,7 @@ enum st_api_type {
- };
-
- /**
-- * Used in st_context->teximage.
-+ * Used in st_context_iface->teximage.
- */
- enum st_texture_type {
- ST_TEXTURE_1D,
-@@ -175,7 +175,7 @@ struct st_visual
- * The thread syncronisation is put inside the framebuffer
- * and only called once the framebuffer has become dirty.
- */
--struct st_framebuffer
-+struct st_framebuffer_iface
- {
- /**
- * Available for the state tracker manager to use.
-@@ -195,7 +195,7 @@ struct st_framebuffer
- *
- * @att is one of the front buffer attachments.
- */
-- boolean (*flush_front)(struct st_framebuffer *stfb,
-+ boolean (*flush_front)(struct st_framebuffer_iface *stfbi,
- enum st_attachment_type statt);
-
- /**
-@@ -215,7 +215,7 @@ struct st_framebuffer
- * the last call might be destroyed. This behavior might change in the
- * future.
- */
-- boolean (*validate)(struct st_framebuffer *stfb,
-+ boolean (*validate)(struct st_framebuffer_iface *stfbi,
- const enum st_attachment_type *statts,
- unsigned count,
- struct pipe_texture **out);
-@@ -226,7 +226,7 @@ struct st_framebuffer
- *
- * This entity is created from st_api and used by the state tracker manager.
- */
--struct st_context
-+struct st_context_iface
- {
- /**
- * The API of the context.
-@@ -241,7 +241,7 @@ struct st_context
- /**
- * Destroy the context.
- */
-- void (*destroy)(struct st_context *stctx);
-+ void (*destroy)(struct st_context_iface *stctxi);
-
- /**
- * Lock and unlock a state tracker context resource.
-@@ -251,9 +251,9 @@ struct st_context
- * can lengthen the lifetime of the data structure, it is valid only until
- * unlocked.
- */
-- void *(*lock_resource)(struct st_context *stctx,
-+ void *(*lock_resource)(struct st_context_iface *stctxi,
- enum st_context_resource_type type, void *res);
-- void (*unlock_resource)(struct st_context *stctx,
-+ void (*unlock_resource)(struct st_context_iface *stctxi,
- enum st_context_resource_type type, void *res);
-
- /**
-@@ -261,7 +261,7 @@ struct st_context
- *
- * The state tracker manager calls this function to let the rendering
- * context know that it should update the textures it got from
-- * st_framebuffer::validate. It should do so at the latest time possible.
-+ * st_framebuffer_iface::validate. It should do so at the latest time possible.
- * Possible right before sending triangles to the pipe context.
- *
- * For certain platforms this function might be called from a thread other
-@@ -272,13 +272,13 @@ struct st_context
- *
- * Thus reducing the sync primitive needed to a single atomic flag.
- */
-- void (*notify_invalid_framebuffer)(struct st_context *stctx,
-- struct st_framebuffer *stfb);
-+ void (*notify_invalid_framebuffer)(struct st_context_iface *stctxi,
-+ struct st_framebuffer_iface *stfbi);
-
- /**
- * Flush all drawing from context to the pipe also flushes the pipe.
- */
-- void (*flush)(struct st_context *stctx, unsigned flags,
-+ void (*flush)(struct st_context_iface *stctxi, unsigned flags,
- struct pipe_fence_handle **fence);
-
- /**
-@@ -286,15 +286,15 @@ struct st_context
- *
- * This function is optional.
- */
-- boolean (*teximage)(struct st_context *stctx, enum st_texture_type target,
-+ boolean (*teximage)(struct st_context_iface *stctxi, enum st_texture_type target,
- int level, enum pipe_format internal_format,
- struct pipe_texture *tex, boolean mipmap);
-
- /**
- * Used to implement glXCopyContext.
- */
-- void (*copy)(struct st_context *stctx, struct st_context *stsrc,
-- unsigned mask);
-+ void (*copy)(struct st_context_iface *stctxi,
-+ struct st_context_iface *stsrci, unsigned mask);
- };
-
-
-@@ -314,9 +314,11 @@ struct st_manager
- * can lengthen the lifetime of the data structure, it is valid only until
- * unlocked.
- */
-- void *(*lock_resource)(struct st_manager *smapi, struct st_context *stctx,
-+ void *(*lock_resource)(struct st_manager *smapi,
-+ struct st_context_iface *stctxi,
- enum st_manager_resource_type type, void *res);
-- void (*unlock_resource)(struct st_manager *smapi, struct st_context *stctx,
-+ void (*unlock_resource)(struct st_manager *smapi,
-+ struct st_context_iface *stctxi,
- enum st_manager_resource_type type, void *res);
- };
-
-@@ -352,24 +354,24 @@ struct st_api
- * the pipe_screen can create contexts.
- * XXX: Is visual needed?
- */
-- struct st_context *(*create_context)(struct st_api *stapi,
-- struct st_manager *smapi,
-- struct pipe_context *pipe,
-- const struct st_visual *visual,
-- struct st_context *stshare);
-+ struct st_context_iface *(*create_context)(struct st_api *stapi,
-+ struct st_manager *smapi,
-+ struct pipe_context *pipe,
-+ const struct st_visual *visual,
-+ struct st_context_iface *stsharei);
-
- /**
- * Bind the context to the calling thread with draw and read as drawables.
- */
- boolean (*make_current)(struct st_api *stapi,
-- struct st_context *stctx,
-- struct st_framebuffer *stdraw,
-- struct st_framebuffer *stread);
-+ struct st_context_iface *stctxi,
-+ struct st_framebuffer_iface *stdrawi,
-+ struct st_framebuffer_iface *streadi);
-
- /**
- * Get the currently bound context in the calling thread.
- */
-- struct st_context *(*get_current)(struct st_api *stapi);
-+ struct st_context_iface *(*get_current)(struct st_api *stapi);
- };
-
- /**
---
-1.6.5
-
diff --git a/sample-implementation-tmp/0003-st-vega-Implement-st_api-interface.patch b/sample-implementation-tmp/0002-st-vega-Implement-st_api-interface.patch
index 4e47567..2289eee 100644
--- a/sample-implementation-tmp/0003-st-vega-Implement-st_api-interface.patch
+++ b/sample-implementation-tmp/0002-st-vega-Implement-st_api-interface.patch
@@ -1,16 +1,16 @@
-From 9cb428781f56af4e210669ed6a1cfd6381932aac Mon Sep 17 00:00:00 2001
+From 15419adf260b9314f487bcb855585821fa6a0d73 Mon Sep 17 00:00:00 2001
From: Chia-I Wu <olvaffe@gmail.com>
Date: Thu, 14 Jan 2010 12:19:32 +0800
-Subject: [PATCH 3/5] st/vega: Implement st_api interface.
+Subject: [PATCH 2/4] st/vega: Implement st_api interface.
---
src/gallium/state_trackers/vega/Makefile | 1 +
src/gallium/state_trackers/vega/api_context.c | 3 +
src/gallium/state_trackers/vega/api_masks.c | 5 +-
- src/gallium/state_trackers/vega/vg_api.c | 368 +++++++++++++++++++++++++
+ src/gallium/state_trackers/vega/vg_api.c | 373 +++++++++++++++++++++++++
src/gallium/state_trackers/vega/vg_api.h | 18 ++
src/gallium/state_trackers/vega/vg_context.h | 6 +
- 6 files changed, 398 insertions(+), 3 deletions(-)
+ 6 files changed, 403 insertions(+), 3 deletions(-)
create mode 100644 src/gallium/state_trackers/vega/vg_api.c
create mode 100644 src/gallium/state_trackers/vega/vg_api.h
@@ -72,10 +72,10 @@ index 9c123a4..9a308f9 100644
cso_save_rasterizer(st->cso_context);
diff --git a/src/gallium/state_trackers/vega/vg_api.c b/src/gallium/state_trackers/vega/vg_api.c
new file mode 100644
-index 0000000..dcde186
+index 0000000..6a85369
--- /dev/null
+++ b/src/gallium/state_trackers/vega/vg_api.c
-@@ -0,0 +1,368 @@
+@@ -0,0 +1,373 @@
+#include "state_tracker/st_api.h"
+
+#include "pipe/p_context.h"
@@ -238,16 +238,21 @@ index 0000000..dcde186
+
+static struct st_context_iface *
+st_api_create_context(struct st_api *stapi, struct st_manager *smapi,
-+ struct pipe_context *pipe,
+ const struct st_visual *visual,
+ struct st_context_iface *shared_stctxi)
+{
+ struct vg_context *shared_ctx = (struct vg_context *) shared_stctxi;
+ struct vg_context *ctx;
++ struct pipe_context *pipe;
+
++ pipe = smapi->create_pipe_context(smapi);
++ if (!pipe)
++ return NULL;
+ ctx = vg_create_context(pipe, NULL, shared_ctx);
-+ if (!ctx)
++ if (!ctx) {
++ pipe->destroy(pipe);
+ return NULL;
++ }
+
+ ctx->iface.api = ST_API_OPENVG;
+ ctx->iface.destroy = st_context_destroy;
@@ -500,5 +505,5 @@ index bc88c8d..91300ff 100644
struct {
--
-1.6.5
+1.6.4.3
diff --git a/sample-implementation-tmp/0004-st-egl-Add-support-for-loading-st_api-modules.patch b/sample-implementation-tmp/0003-st-egl-Add-support-for-loading-st_api-modules.patch
index a8dcce3..1db01c4 100644
--- a/sample-implementation-tmp/0004-st-egl-Add-support-for-loading-st_api-modules.patch
+++ b/sample-implementation-tmp/0003-st-egl-Add-support-for-loading-st_api-modules.patch
@@ -1,7 +1,7 @@
-From f8f6f9c3917a72da94b36912f1cbd0303899a191 Mon Sep 17 00:00:00 2001
+From 83339a659017402745437c03240d1837cad3649f Mon Sep 17 00:00:00 2001
From: Chia-I Wu <olvaffe@gmail.com>
Date: Thu, 14 Jan 2010 16:05:36 +0800
-Subject: [PATCH 4/5] st/egl: Add support for loading st_api modules.
+Subject: [PATCH 3/4] st/egl: Add support for loading st_api modules.
---
src/gallium/state_trackers/egl/common/egl_st_api.c | 116 ++++++++++++++++++++
@@ -185,5 +185,5 @@ index 0000000..f39f318
+
+#endif /* _EGL_ST_API_H_ */
--
-1.6.5
+1.6.4.3
diff --git a/sample-implementation-tmp/0005-st-egl-Use-st_api.h-instead-of-st_public.h.patch b/sample-implementation-tmp/0004-st-egl-Use-st_api.h-instead-of-st_public.h.patch
index f5dbec7..8cc9ba0 100644
--- a/sample-implementation-tmp/0005-st-egl-Use-st_api.h-instead-of-st_public.h.patch
+++ b/sample-implementation-tmp/0004-st-egl-Use-st_api.h-instead-of-st_public.h.patch
@@ -1,21 +1,22 @@
-From 61f5bc139286416251a1e42fad239b53feaa654c Mon Sep 17 00:00:00 2001
-From: Chia-I Wu <olvaffe@gmail.com>
-Date: Mon, 25 Jan 2010 22:18:29 +0800
-Subject: [PATCH 5/5] st/egl: Use st_api.h instead of st_public.h.
+From 6134333acceea0f03bcd92869ab4e13210a4034f Mon Sep 17 00:00:00 2001
+From: Chia-I Wu <olv@lunarg.com>
+Date: Sun, 7 Feb 2010 00:52:11 +0800
+Subject: [PATCH 4/4] st/egl: Use st_api.h instead of st_public.h.
---
- src/gallium/state_trackers/egl/common/egl_g3d.c | 539 ++++++++------------
- src/gallium/state_trackers/egl/common/egl_g3d.h | 19 +-
+ src/gallium/state_trackers/egl/common/egl_g3d.c | 549 ++++++++------------
+ src/gallium/state_trackers/egl/common/egl_g3d.h | 20 +-
src/gallium/state_trackers/egl/common/egl_st.c | 131 -----
src/gallium/state_trackers/egl/common/egl_st.h | 73 ---
+ src/gallium/state_trackers/egl/common/egl_st_api.c | 13 +
.../state_trackers/egl/common/st_public_tmp.h | 20 -
- 5 files changed, 233 insertions(+), 549 deletions(-)
+ 6 files changed, 248 insertions(+), 558 deletions(-)
delete mode 100644 src/gallium/state_trackers/egl/common/egl_st.c
delete mode 100644 src/gallium/state_trackers/egl/common/egl_st.h
delete mode 100644 src/gallium/state_trackers/egl/common/st_public_tmp.h
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c
-index 7021617..8c51e99 100644
+index 7021617..3734756 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d.c
@@ -36,233 +36,26 @@
@@ -355,32 +356,49 @@ index 7021617..8c51e99 100644
#ifdef EGL_MESA_screen_surface
/* enable MESA_screen_surface */
if (gdpy->native->modeset) {
-@@ -652,9 +422,9 @@ egl_g3d_create_context(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
- return NULL;
+@@ -626,6 +396,7 @@ egl_g3d_create_context(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
+ struct egl_g3d_config *gconf = egl_g3d_config(conf);
+ struct egl_g3d_context *gctx;
+ const __GLcontextModes *mode;
++ struct st_visual stvis;
+
+ gctx = CALLOC_STRUCT(egl_g3d_context);
+ if (!gctx) {
+@@ -645,17 +416,11 @@ egl_g3d_create_context(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
}
+ mode = &gconf->native->mode;
+- gctx->pipe =
+- gdpy->native->create_context(gdpy->native, (void *) &gctx->base);
+- if (!gctx->pipe) {
+- free(gctx);
+- return NULL;
+- }
+-
- gctx->st_ctx = gctx->stapi->st_create_context(gctx->pipe, mode,
- (gshare) ? gshare->st_ctx : NULL);
- if (!gctx->st_ctx) {
+- gctx->pipe->destroy(gctx->pipe);
++ /* not sure if a visual is needed */
++ memset(&stvis, 0, sizeof(stvis));
+ gctx->stctxi = gctx->stapi->create_context(gctx->stapi, gdpy->smapi,
-+ gctx->pipe, NULL, (gshare) ? gshare->stctxi : NULL);
++ &stvis, (gshare) ? gshare->stctxi : NULL);
+ if (!gctx->stctxi) {
- gctx->pipe->destroy(gctx->pipe);
free(gctx);
return NULL;
-@@ -675,9 +445,8 @@ destroy_context(_EGLDisplay *dpy, _EGLContext *ctx)
+ }
+@@ -675,9 +440,7 @@ destroy_context(_EGLDisplay *dpy, _EGLContext *ctx)
if (!dpy->Initialized)
_eglLog(_EGL_FATAL, "destroy a context with an unitialized display");
- egl_g3d_realloc_context(dpy, &gctx->base);
- /* it will destroy the associated pipe context */
- gctx->stapi->st_destroy_context(gctx->st_ctx);
-+ /* it will destroy the pipe context */
+ gctx->stctxi->destroy(gctx->stctxi);
free(gctx);
}
-@@ -690,6 +459,140 @@ egl_g3d_destroy_context(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx)
+@@ -690,6 +453,140 @@ egl_g3d_destroy_context(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx)
return EGL_TRUE;
}
@@ -521,7 +539,7 @@ index 7021617..8c51e99 100644
static EGLBoolean
init_surface_geometry(_EGLSurface *surf)
{
-@@ -727,16 +630,13 @@ egl_g3d_create_window_surface(_EGLDriver *drv, _EGLDisplay *dpy,
+@@ -727,16 +624,13 @@ egl_g3d_create_window_surface(_EGLDriver *drv, _EGLDisplay *dpy,
return NULL;
}
@@ -540,7 +558,7 @@ index 7021617..8c51e99 100644
return &gsurf->base;
}
-@@ -767,14 +667,13 @@ egl_g3d_create_pixmap_surface(_EGLDriver *drv, _EGLDisplay *dpy,
+@@ -767,14 +661,13 @@ egl_g3d_create_pixmap_surface(_EGLDriver *drv, _EGLDisplay *dpy,
return NULL;
}
@@ -557,7 +575,7 @@ index 7021617..8c51e99 100644
return &gsurf->base;
}
-@@ -805,15 +704,13 @@ egl_g3d_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *dpy,
+@@ -805,15 +698,13 @@ egl_g3d_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *dpy,
return NULL;
}
@@ -575,7 +593,7 @@ index 7021617..8c51e99 100644
return &gsurf->base;
}
-@@ -831,6 +728,7 @@ destroy_surface(_EGLDisplay *dpy, _EGLSurface *surf)
+@@ -831,6 +722,7 @@ destroy_surface(_EGLDisplay *dpy, _EGLSurface *surf)
pipe_surface_reference(&gsurf->render_surface, NULL);
gsurf->native->destroy(gsurf->native);
@@ -583,7 +601,7 @@ index 7021617..8c51e99 100644
free(gsurf);
}
-@@ -848,6 +746,7 @@ egl_g3d_make_current(_EGLDriver *drv, _EGLDisplay *dpy,
+@@ -848,6 +740,7 @@ egl_g3d_make_current(_EGLDriver *drv, _EGLDisplay *dpy,
{
struct egl_g3d_context *gctx = egl_g3d_context(ctx);
struct egl_g3d_surface *gdraw = egl_g3d_surface(draw);
@@ -591,7 +609,7 @@ index 7021617..8c51e99 100644
struct egl_g3d_context *old_gctx;
EGLBoolean ok = EGL_TRUE;
-@@ -858,34 +757,29 @@ egl_g3d_make_current(_EGLDriver *drv, _EGLDisplay *dpy,
+@@ -858,34 +751,29 @@ egl_g3d_make_current(_EGLDriver *drv, _EGLDisplay *dpy,
if (old_gctx) {
/* flush old context */
@@ -640,7 +658,7 @@ index 7021617..8c51e99 100644
old_gctx->base.WindowRenderBuffer = EGL_NONE;
}
-@@ -912,15 +806,17 @@ egl_g3d_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf)
+@@ -912,15 +800,17 @@ egl_g3d_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf)
return EGL_TRUE;
/* or when the surface is single-buffered */
@@ -661,7 +679,7 @@ index 7021617..8c51e99 100644
/*
* We drew on the back buffer, unless there was no back buffer.
-@@ -933,11 +829,9 @@ egl_g3d_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf)
+@@ -933,11 +823,9 @@ egl_g3d_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf)
if (gctx) {
struct egl_g3d_config *gconf = egl_g3d_config(gsurf->base.Config);
@@ -676,7 +694,7 @@ index 7021617..8c51e99 100644
}
return EGL_TRUE;
-@@ -1011,7 +905,7 @@ egl_g3d_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
+@@ -1011,7 +899,7 @@ egl_g3d_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
/* flush if the surface is current */
if (ctx && ctx->DrawSurface == &gsurf->base) {
struct egl_g3d_context *gctx = egl_g3d_context(ctx);
@@ -685,7 +703,7 @@ index 7021617..8c51e99 100644
PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, NULL);
}
-@@ -1041,8 +935,16 @@ egl_g3d_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
+@@ -1041,8 +929,16 @@ egl_g3d_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
static EGLBoolean
egl_g3d_wait_client(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx)
{
@@ -703,7 +721,7 @@ index 7021617..8c51e99 100644
return EGL_TRUE;
}
-@@ -1072,10 +974,10 @@ egl_g3d_get_proc_address(_EGLDriver *drv, const char *procname)
+@@ -1072,10 +968,10 @@ egl_g3d_get_proc_address(_EGLDriver *drv, const char *procname)
/* in case this is called before a display is initialized */
egl_g3d_init_st(&gdrv->base);
@@ -717,7 +735,7 @@ index 7021617..8c51e99 100644
if (proc)
return proc;
}
-@@ -1091,8 +993,8 @@ egl_g3d_bind_tex_image(_EGLDriver *drv, _EGLDisplay *dpy,
+@@ -1091,8 +987,8 @@ egl_g3d_bind_tex_image(_EGLDriver *drv, _EGLDisplay *dpy,
struct egl_g3d_surface *gsurf = egl_g3d_surface(surf);
_EGLContext *es1 = _eglGetAPIContext(EGL_OPENGL_ES_API);
struct egl_g3d_context *gctx;
@@ -728,7 +746,7 @@ index 7021617..8c51e99 100644
if (!gsurf || gsurf->base.Type != EGL_PBUFFER_BIT)
return _eglError(EGL_BAD_SURFACE, "eglBindTexImage");
-@@ -1103,10 +1005,10 @@ egl_g3d_bind_tex_image(_EGLDriver *drv, _EGLDisplay *dpy,
+@@ -1103,10 +999,10 @@ egl_g3d_bind_tex_image(_EGLDriver *drv, _EGLDisplay *dpy,
switch (gsurf->base.TextureFormat) {
case EGL_TEXTURE_RGB:
@@ -741,7 +759,7 @@ index 7021617..8c51e99 100644
break;
default:
return _eglError(EGL_BAD_MATCH, "eglBindTexImage");
-@@ -1128,15 +1030,18 @@ egl_g3d_bind_tex_image(_EGLDriver *drv, _EGLDisplay *dpy,
+@@ -1128,15 +1024,18 @@ egl_g3d_bind_tex_image(_EGLDriver *drv, _EGLDisplay *dpy,
/* flush properly if the surface is bound */
if (gsurf->base.CurrentContext) {
gctx = egl_g3d_context(gsurf->base.CurrentContext);
@@ -765,7 +783,7 @@ index 7021617..8c51e99 100644
return EGL_TRUE;
}
-@@ -1158,9 +1063,10 @@ egl_g3d_release_tex_image(_EGLDriver *drv, _EGLDisplay *dpy,
+@@ -1158,9 +1057,10 @@ egl_g3d_release_tex_image(_EGLDriver *drv, _EGLDisplay *dpy,
struct egl_g3d_context *gctx = egl_g3d_context(ctx);
/* what if the context the surface binds to is no longer current? */
@@ -779,7 +797,7 @@ index 7021617..8c51e99 100644
}
gsurf->base.BoundToTexture = EGL_FALSE;
-@@ -1198,9 +1104,6 @@ egl_g3d_create_screen_surface(_EGLDriver *drv, _EGLDisplay *dpy,
+@@ -1198,9 +1098,6 @@ egl_g3d_create_screen_surface(_EGLDriver *drv, _EGLDisplay *dpy,
return NULL;
}
@@ -789,7 +807,7 @@ index 7021617..8c51e99 100644
return &gsurf->base;
}
-@@ -1294,6 +1197,12 @@ static void
+@@ -1294,6 +1191,12 @@ static void
egl_g3d_unload(_EGLDriver *drv)
{
struct egl_g3d_driver *gdrv = egl_g3d_driver(drv);
@@ -803,7 +821,7 @@ index 7021617..8c51e99 100644
egl_g3d_destroy_probe(drv, NULL);
free(gdrv);
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.h b/src/gallium/state_trackers/egl/common/egl_g3d.h
-index 3dae8c4..e2b73bb 100644
+index 5d2d9c4..ef92c34 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d.h
+++ b/src/gallium/state_trackers/egl/common/egl_g3d.h
@@ -38,11 +38,11 @@
@@ -820,7 +838,7 @@ index 3dae8c4..e2b73bb 100644
EGLint api_mask;
EGLint probe_key;
-@@ -50,28 +50,27 @@ struct egl_g3d_driver {
+@@ -50,28 +50,26 @@ struct egl_g3d_driver {
struct egl_g3d_display {
struct native_display *native;
@@ -836,8 +854,8 @@ index 3dae8c4..e2b73bb 100644
_EGLContext base;
- const struct egl_g3d_st *stapi;
+- struct pipe_context *pipe;
+ struct st_api *stapi;
- struct pipe_context *pipe;
- struct st_context *st_ctx;
+ struct st_context_iface *stctxi;
@@ -1072,6 +1090,48 @@ index 8fb464b..0000000
-egl_g3d_get_st(enum egl_g3d_st_api api);
-
-#endif /* _EGL_ST_H_ */
+diff --git a/src/gallium/state_trackers/egl/common/egl_st_api.c b/src/gallium/state_trackers/egl/common/egl_st_api.c
+index bfcc49e..465904c 100644
+--- a/src/gallium/state_trackers/egl/common/egl_st_api.c
++++ b/src/gallium/state_trackers/egl/common/egl_st_api.c
+@@ -2,6 +2,7 @@
+ #include "util/u_dl.h"
+ #include "eglimage.h"
+
++#include "egl_g3d.h"
+ #include "egl_st_api.h"
+
+ struct egl_g3d_st_manager {
+@@ -52,17 +53,29 @@ egl_g3d_st_manager_unlock_resource(struct st_manager *smapi,
+ {
+ }
+
++static struct pipe_context *
++egl_g3d_st_manager_create_pipe_context(struct st_manager *smapi)
++{
++ struct egl_g3d_st_manager *gsmapi = egl_g3d_st_manager(smapi);
++ struct egl_g3d_display *gdpy = egl_g3d_display(gsmapi->display);
++
++ return gdpy->native->create_context(gdpy->native, NULL);
++}
++
+ struct st_manager *
+ egl_g3d_create_st_manager(_EGLDisplay *dpy)
+ {
++ struct egl_g3d_display *gdpy = egl_g3d_display(dpy);
+ struct egl_g3d_st_manager *gsmapi;
+
+ gsmapi = CALLOC_STRUCT(egl_g3d_st_manager);
+ if (gsmapi) {
+ gsmapi->display = dpy;
+
++ gsmapi->base.screen = gdpy->native->screen;
+ gsmapi->base.lock_resource = egl_g3d_st_manager_lock_resource;
+ gsmapi->base.unlock_resource = egl_g3d_st_manager_unlock_resource;
++ gsmapi->base.create_pipe_context = egl_g3d_st_manager_create_pipe_context;
+ }
+
+ return &gsmapi->base;;
diff --git a/src/gallium/state_trackers/egl/common/st_public_tmp.h b/src/gallium/state_trackers/egl/common/st_public_tmp.h
deleted file mode 100644
index 507a0ec..0000000
@@ -1099,5 +1159,5 @@ index 507a0ec..0000000
-ST_PUBLIC(st_get_proc_address, st_proc, const char *procname)
-#undef ST_PUBLIC
--
-1.6.5
+1.6.4.3