[Mesa-dev] [PATCH 2/3 v2] glx: Add teximage vfuncs to drisw
nobled
nobled at dreamwidth.org
Thu May 5 21:32:08 PDT 2011
Copied the implementation from dri2_glx.c.
---
Sorry, accidentally sent an old version that didn't apply and was
missing the release() code that got added between then and now. This
one should work.
src/glx/drisw_glx.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 74 insertions(+), 3 deletions(-)
diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
index 5c7f40c..04c68e2 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,75 @@ 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 glx_display *dpyPriv = __glXInitialize(dpy);
+ struct drisw_drawable *pdraw = (struct drisw_drawable *) base;
+ struct drisw_display *pdp =
+ (struct drisw_display *) dpyPriv->dri2Display;
+ struct drisw_screen *psc;
+
+ if (pdraw != NULL) {
+ psc = (struct drisw_screen *) base->psc;
+
+ if (!psc->texBuffer)
+ return;
+
+/* 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->base.version >= 3 && psc->f->invalidate)
+ 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)
+{
+#if __DRI_TEX_BUFFER_VERSION >= 3
+ struct glx_context *gc = __glXGetCurrentContext();
+ struct dri2_context *pcp = (struct dri2_context *) gc;
+ __GLXDRIdrawable *base = GetGLXDRIDrawable(dpy, drawable);
+ struct glx_display *dpyPriv = __glXInitialize(dpy);
+ struct dri2_drawable *pdraw = (struct dri2_drawable *) base;
+ struct dri2_screen *psc;
+
+ if (pdraw != NULL) {
+ psc = (struct dri2_screen *) base->psc;
+
+ if (!psc->texBuffer)
+ return;
+
+ if (psc->texBuffer->base.version >= 3 &&
+ psc->texBuffer->releaseTexBuffer != NULL) {
+ (*psc->texBuffer->releaseTexBuffer) (pcp->driContext,
+ pdraw->base.textureTarget,
+ pdraw->driDrawable);
+ }
+ }
+#endif
+}
+
static const struct glx_context_vtable drisw_context_vtable = {
drisw_destroy_context,
drisw_bind_context,
@@ -294,8 +365,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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-glx-Add-teximage-vfuncs-to-drisw.patch
Type: text/x-patch
Size: 3598 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20110506/0b9d902b/attachment-0001.bin>
More information about the mesa-dev
mailing list