With commit
e59fa4c46c8("dri2: release texture image.") we updated the
extension without bumping the version number. The patch itself added an
interface required to enable texture_from_pixmap on certain platforms.
The new code was effectively never build, as it depended on
__DRI_TEX_BUFFER_VERSION >= 3, which never came to be in upstream mesa.
This commit bumps the version number, drops the __DRI_TEX_BUFFER_VERSION
checks and resolves all the build conflicts. Additionally it add a version
check as egl and dri3, as require version 2 of the extension which does
not have the releaseTexBuffer hook.
Cc: Juan Zhao <juan.j.zhao@intel.com>
Cc: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
#define __DRI_TEXTURE_FORMAT_RGBA 0x20DA
#define __DRI_TEX_BUFFER "DRI_TexBuffer"
-#define __DRI_TEX_BUFFER_VERSION 2
+#define __DRI_TEX_BUFFER_VERSION 3
struct __DRItexBufferExtensionRec {
__DRIextension base;
dri2_release_tex_image(_EGLDriver *drv,
_EGLDisplay *disp, _EGLSurface *surf, EGLint buffer)
{
-#if __DRI_TEX_BUFFER_VERSION >= 3
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf);
struct dri2_egl_context *dri2_ctx;
default:
assert(0);
}
- if (dri2_dpy->tex_buffer->releaseTexBuffer!=NULL)
- (*dri2_dpy->tex_buffer->releaseTexBuffer)(dri2_ctx->dri_context,
- target,
- dri2_surf->dri_drawable);
-#endif
+
+ if (dri2_dpy->tex_buffer->base.version >= 3 &&
+ dri2_dpy->tex_buffer->releaseTexBuffer != NULL) {
+ (*dri2_dpy->tex_buffer->releaseTexBuffer)(dri2_ctx->dri_context,
+ target,
+ dri2_surf->dri_drawable);
+ }
return EGL_TRUE;
}
return EGL_TRUE;
}
+EGLBoolean
+_eglReleaseTexImage(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf,
+ EGLint buffer)
+{
+ /* TODO: do basic error checking and return success/fail.
+ * Drivers must implement the real stuff.
+ */
+
+ return EGL_TRUE;
+}
+
EGLBoolean
_eglSwapInterval(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
PUBLIC extern EGLBoolean
_eglBindTexImage(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLint buffer);
+PUBLIC extern EGLBoolean
+_eglReleaseTexImage(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf, EGLint buffer);
+
extern EGLBoolean
_eglSwapInterval(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLint interval);
static void
dri2_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_display *pdp =
- (struct dri2_display *) dpyPriv->dri2Display;
struct dri2_screen *psc;
- if (pdraw != NULL) {
+ if (dpyPriv != NULL && pdraw != NULL) {
psc = (struct dri2_screen *) base->psc;
if (psc->texBuffer->base.version >= 3 &&
pdraw->driDrawable);
}
}
-#endif
}
static const struct glx_context_vtable dri2_context_vtable = {
if (pdraw != NULL) {
psc = (struct dri3_screen *) base->psc;
- if (psc->texBuffer->releaseTexBuffer)
+ if (psc->texBuffer->base.version >= 3 &&
+ psc->texBuffer->releaseTexBuffer != NULL)
(*psc->texBuffer->releaseTexBuffer) (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;
+ struct drisw_context *pcp = (struct drisw_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;
+ struct drisw_drawable *pdraw = (struct drisw_drawable *) base;
+ struct drisw_screen *psc;
- if (pdraw != NULL) {
- psc = (struct dri2_screen *) base->psc;
+ if (dpyPriv != NULL && pdraw != NULL) {
+ psc = (struct drisw_screen *) base->psc;
if (!psc->texBuffer)
return;
pdraw->driDrawable);
}
}
-#endif
}
static const struct glx_context_vtable drisw_context_vtable = {