> http://cgit.freedesktop.org/mesa/mesa/commit/?id=2b64886c8122227ffa2d86abb9b4a5d79d1e2451
> 2011-03-11 19:49:28 (GMT)
>
> Without this, EXT_texture_from_pixmap is trivially broken.  With it,
> it's merely subtly broken.
>
> Signed-off-by: Adam Jackson <a...@redhat.com>

What does 'subtly broken' mean in this case? Is it related to this
backtrace from August? Or the lack of GLX direct-rendering support?

> http://cgit.freedesktop.org/mesa/mesa/commit/?id=c14b4371ed58859d264b7b2581cfedc9cfd8401f
> 2010-08-13 19:58:11 (GMT)
>
> st/dri: move TFP code to dri_drawable.c
> This is based on a patch by nobled <nob...@dreamwidth.org> and allows the TFP
> extension to be enabled for DRISW also. This patch does not enable TFP for 
> DRISW
> though, because testing on xephyr segfaults here (for both classic and 
> gallium):
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x00786a4a in _mesa_GenTextures (n=1, textures=0xbfffee4c) at 
> main/texobj.c:788
> 788      ASSERT_OUTSIDE_BEGIN_END(ctx);
> (gdb)
> (gdb) where
> \#0  0x00786a4a in _mesa_GenTextures (n=1, textures=0xbfffee4c) at 
> main/texobj.c:788
> \#1  0x0817a004 in __glXDisp_GenTextures ()
> \#2  0x08168498 in __glXDispatch ()
> \#3  0x0808b6ce in Dispatch ()
> \#4  0x08084435 in main ()
>
> The TFP code is generic except for the teximage call. We need to verify that
> DRISW correclty implements whatever hook teximage finally calls.

Do we have a bug report about that somewhere? I'm wondering if it
happens with swrast-classic's TFP implementation, too...

Anyway, hey, anyone remember these GLX patches from September? Anyone
want to commit them? Because other bugs aside, indirect-only
texture-from-pixmap sucks.
From 8fd545534aab1e3f6641b37759d70cab1560d3fa Mon Sep 17 00:00:00 2001
From: nobled <nob...@dreamwidth.org>
Date: Sun, 5 Sep 2010 16:14:01 +0000
Subject: [PATCH 1/3] glx: Add teximage vfuncs to drisw

Copied the implementation from dri2_glx.c.
---
 src/glx/drisw_glx.c |   51 ++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 48 insertions(+), 3 deletions(-)

diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
index 5c7f40c..9eb80e4 100644
--- a/src/glx/drisw_glx.c
+++ b/src/glx/drisw_glx.c
@@ -46,8 +46,10 @@ struct drisw_screen
 
    __DRIscreen *driScreen;
    __GLXDRIscreen vtable;
-   const __DRIcoreExtension *core;
    const __DRIswrastExtension *swrast;
+   const __DRIcoreExtension *core;
+
+   const __DRItexBufferExtension *texBuffer;
    const __DRIconfig **driver_configs;
 
    void *driver;
@@ -287,6 +289,49 @@ drisw_unbind_context(struct glx_context *context, struct glx_context *new)
    driReleaseDrawables(&pcp->base);
 }
 
+static void
+drisw_bind_tex_image(Display * dpy,
+		    GLXDrawable drawable,
+		    int buffer, const int *attrib_list)
+{
+   struct glx_context *gc = __glXGetCurrentContext();
+   struct drisw_context *pcp = (struct drisw_context *) gc;
+   __GLXDRIdrawable *base = GetGLXDRIDrawable(dpy, drawable);
+   struct drisw_drawable *pdraw = (struct drisw_drawable *) base;
+   struct glx_display *dpyPriv = __glXInitialize(dpy);
+   struct drisw_display *pdp =
+      (struct drisw_display *) dpyPriv->dri2Display;
+   struct drisw_screen *psc;
+
+   if (pdraw != NULL) {
+      psc = (struct drisw_screen *) base->psc;
+
+/* FIXME: copied from dri2_glx.c. Can, should drisw do something like this? */
+#if 0 && __DRI2_FLUSH_VERSION >= 3
+      if (!pdp->invalidateAvailable && psc->f)
+	 psc->f->invalidate(pdraw->driDrawable);
+#endif
+
+      if (psc->texBuffer->base.version >= 2 &&
+	  psc->texBuffer->setTexBuffer2 != NULL) {
+	 (*psc->texBuffer->setTexBuffer2) (pcp->driContext,
+					   pdraw->base.textureTarget,
+					   pdraw->base.textureFormat,
+					   pdraw->driDrawable);
+      }
+      else {
+	 (*psc->texBuffer->setTexBuffer) (pcp->driContext,
+					  pdraw->base.textureTarget,
+					  pdraw->driDrawable);
+      }
+   }
+}
+
+static void
+drisw_release_tex_image(Display * dpy, GLXDrawable drawable, int buffer)
+{
+}
+
 static const struct glx_context_vtable drisw_context_vtable = {
    drisw_destroy_context,
    drisw_bind_context,
@@ -294,8 +339,8 @@ static const struct glx_context_vtable drisw_context_vtable = {
    NULL,
    NULL,
    DRI_glXUseXFont,
-   NULL,
-   NULL,
+   drisw_bind_tex_image,
+   drisw_release_tex_image,
 };
 
 static struct glx_context *
-- 
1.7.0.4

From ad0013ef4c24c931679eabb7aec8c9210c6b5868 Mon Sep 17 00:00:00 2001
From: nobled <nob...@dreamwidth.org>
Date: Sun, 5 Sep 2010 16:21:03 +0000
Subject: [PATCH 2/3] glx: Enable GLX_EXT_texture_from_pixmap in software

This makes commits 8d789be03430b80e0ba2fef19d56dd0b8e699ea2,
c14b4371ed58859d264b7b2581cfedc9cfd8401f,
and 2b64886c8122227ffa2d86abb9b4a5d79d1e2451 much more useful.

Now if a software DRI driver advertises it, we can use it in
direct-rendering contexts, instead of only indirect-rendering.
---
 src/glx/drisw_glx.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
index 9eb80e4..cae4a6b 100644
--- a/src/glx/drisw_glx.c
+++ b/src/glx/drisw_glx.c
@@ -483,6 +483,20 @@ static const struct glx_screen_vtable drisw_screen_vtable = {
    drisw_create_context
 };
 
+static void
+driswBindExtensions(struct drisw_screen *psc, const __DRIextension **extensions)
+{
+   int i;
+
+   /* FIXME: Figure out what other extensions can be ported here from dri2. */
+   for (i = 0; extensions[i]; i++) {
+      if ((strcmp(extensions[i]->name, __DRI_TEX_BUFFER) == 0)) {
+	 psc->texBuffer = (__DRItexBufferExtension *) extensions[i];
+	 __glXEnableDirectExtension(&psc->base, "GLX_EXT_texture_from_pixmap");
+      }
+   }
+}
+
 static struct glx_screen *
 driCreateScreen(int screen, struct glx_display *priv)
 {
@@ -532,6 +546,9 @@ driCreateScreen(int screen, struct glx_display *priv)
       goto handle_error;
    }
 
+   extensions = psc->core->getExtensions(psc->driScreen);
+   driswBindExtensions(psc, extensions);
+
    psc->base.configs =
       driConvertConfigs(psc->core, psc->base.configs, driver_configs);
    psc->base.visuals =
-- 
1.7.0.4

From 5213adf13347a70c4e4dc061842b2d9b44976ccf Mon Sep 17 00:00:00 2001
From: nobled <nob...@dreamwidth.org>
Date: Sun, 5 Sep 2010 19:10:58 +0000
Subject: [PATCH 3/3] glx: Check flush DRI extension version at runtime

The DRI driver itself might not have version 3 of the
DRI2 flush extension.
---
 src/glx/dri2_glx.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index fc0237a..57bbc66 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -679,7 +679,7 @@ dri2InvalidateBuffers(Display *dpy, XID drawable)
    struct dri2_drawable *pdp = (struct dri2_drawable *) pdraw;
 
 #if __DRI2_FLUSH_VERSION >= 3
-   if (pdraw && psc->f)
+   if (pdraw && psc->f && psc->f->base.version >= 3)
        psc->f->invalidate(pdp->driDrawable);
 #endif
 }
@@ -702,7 +702,8 @@ dri2_bind_tex_image(Display * dpy,
       psc = (struct dri2_screen *) base->psc;
 
 #if __DRI2_FLUSH_VERSION >= 3
-      if (!pdp->invalidateAvailable && psc->f)
+      if (!pdp->invalidateAvailable && psc->f &&
+           psc->f->base.version >= 3)
 	 psc->f->invalidate(pdraw->driDrawable);
 #endif
 
-- 
1.7.0.4

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to