From 442442026eb241f05f2b7c03da304e0be047a7da Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 4 Nov 2013 18:09:51 -0800 Subject: dri: add __DRIimageLoaderExtension and __DRIimageDriverExtension MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These provide an interface between the driver and the loader to allocate color buffers through the DRIimage extension interface rather than through a loader-specific extension (as is used by DRI2, for instance). The driver uses the loader 'getBuffers' interface to allocate color buffers. The loader uses the createNewScreen2, createNewDrawable, createNewContext, getAPIMask and createContextAttribs APIS (mostly shared with DRI2). This interface will work with the DRI3 loader, and should also work with GBM and other loaders so that drivers need not be customized for each new loader interface, as long as they provide this image interface. v2: Fix build of i915 and i965 together (by anholt) Signed-off-by: Keith Packard Reviewed-by: Kristian Høgsberg Reviewed-by: Eric Anholt --- src/mesa/drivers/dri/common/dri_util.c | 13 +++++++++++++ src/mesa/drivers/dri/common/dri_util.h | 6 ++++++ 2 files changed, 19 insertions(+) (limited to 'src/mesa/drivers/dri/common') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 46a2da4cb59..86cf24cb881 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -78,6 +78,8 @@ setupLoaderExtensions(__DRIscreen *psp, psp->dri2.useInvalidate = (__DRIuseInvalidateExtension *) extensions[i]; if (strcmp(extensions[i]->name, __DRI_SWRAST_LOADER) == 0) psp->swrast_loader = (__DRIswrastLoaderExtension *) extensions[i]; + if (strcmp(extensions[i]->name, __DRI_IMAGE_LOADER) == 0) + psp->image.loader = (__DRIimageLoaderExtension *) extensions[i]; } } @@ -859,3 +861,14 @@ driImageFormatToGLFormat(uint32_t image_format) return MESA_FORMAT_NONE; } } + +/** Image driver interface */ +const __DRIimageDriverExtension driImageDriverExtension = { + .base = { __DRI_IMAGE_DRIVER, __DRI_IMAGE_DRIVER_VERSION }, + + .createNewScreen2 = driCreateNewScreen2, + .createNewDrawable = driCreateNewDrawable, + .createNewContext = driCreateNewContext, + .getAPIMask = driGetAPIMask, + .createContextAttribs = driCreateContextAttribs, +}; diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index 7fab3e5f720..79a8564ad51 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -176,6 +176,10 @@ struct __DRIscreenRec { __DRIuseInvalidateExtension *useInvalidate; } dri2; + struct { + __DRIimageLoaderExtension *loader; + } image; + driOptionCache optionInfo; driOptionCache optionCache; @@ -285,4 +289,6 @@ dri2InvalidateDrawable(__DRIdrawable *drawable); extern void driUpdateFramebufferSize(struct gl_context *ctx, const __DRIdrawable *dPriv); +extern const __DRIimageDriverExtension driImageDriverExtension; + #endif /* _DRI_UTIL_H_ */ -- cgit v1.2.3