aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/drivers/dri/common/dri_util.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-11-08 11:09:17 +0100
committermarha <marha@users.sourceforge.net>2013-11-08 11:09:17 +0100
commit401eb04e4dfb179291befb19d74e2e3148c4e268 (patch)
treebb9056b67a7bdf37cba96fecc69ce81b1809fb03 /mesalib/src/mesa/drivers/dri/common/dri_util.c
parentf7050e0ff2d1dd147ff5ef45f8ff7d8d7833db48 (diff)
downloadvcxsrv-401eb04e4dfb179291befb19d74e2e3148c4e268.tar.gz
vcxsrv-401eb04e4dfb179291befb19d74e2e3148c4e268.tar.bz2
vcxsrv-401eb04e4dfb179291befb19d74e2e3148c4e268.zip
libxtrans libxcb xcb-proto mesa git update 8 nov 2013
libxcb commit e8663a935890ff366f49e356211049dfd0d9756a libxcb/xcb-proto commit 29beba6bf02bda86a5b163ace63e1d0a4d3eee5b libxtrans commit 0153d1670e4a1883e1bb6dd971435d6268eac5ba mesa commit 035cce83f7b3d9a037c9e7cc17a212d6cf7e927f
Diffstat (limited to 'mesalib/src/mesa/drivers/dri/common/dri_util.c')
-rw-r--r--mesalib/src/mesa/drivers/dri/common/dri_util.c156
1 files changed, 118 insertions, 38 deletions
diff --git a/mesalib/src/mesa/drivers/dri/common/dri_util.c b/mesalib/src/mesa/drivers/dri/common/dri_util.c
index c28b0fc41..86cf24cb8 100644
--- a/mesalib/src/mesa/drivers/dri/common/dri_util.c
+++ b/mesalib/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];
}
}
@@ -106,10 +108,10 @@ const struct __DriverAPIRec *globalDriverAPI = &driDriverAPI;
* Display.
*/
static __DRIscreen *
-dri2CreateNewScreen2(int scrn, int fd,
- const __DRIextension **extensions,
- const __DRIextension **driver_extensions,
- const __DRIconfig ***driver_configs, void *data)
+driCreateNewScreen2(int scrn, int fd,
+ const __DRIextension **extensions,
+ const __DRIextension **driver_extensions,
+ const __DRIconfig ***driver_configs, void *data)
{
static const __DRIextension *emptyExtensionList[] = { NULL };
__DRIscreen *psp;
@@ -190,7 +192,7 @@ dri2CreateNewScreen(int scrn, int fd,
const __DRIextension **extensions,
const __DRIconfig ***driver_configs, void *data)
{
- return dri2CreateNewScreen2(scrn, fd, extensions, NULL,
+ return driCreateNewScreen2(scrn, fd, extensions, NULL,
driver_configs, data);
}
@@ -199,7 +201,7 @@ static __DRIscreen *
driSWRastCreateNewScreen(int scrn, const __DRIextension **extensions,
const __DRIconfig ***driver_configs, void *data)
{
- return dri2CreateNewScreen2(scrn, -1, extensions, NULL,
+ return driCreateNewScreen2(scrn, -1, extensions, NULL,
driver_configs, data);
}
@@ -208,7 +210,7 @@ driSWRastCreateNewScreen2(int scrn, const __DRIextension **extensions,
const __DRIextension **driver_extensions,
const __DRIconfig ***driver_configs, void *data)
{
- return dri2CreateNewScreen2(scrn, -1, extensions, driver_extensions,
+ return driCreateNewScreen2(scrn, -1, extensions, driver_extensions,
driver_configs, data);
}
@@ -291,13 +293,13 @@ validate_context_version(__DRIscreen *screen,
/*@{*/
static __DRIcontext *
-dri2CreateContextAttribs(__DRIscreen *screen, int api,
- const __DRIconfig *config,
- __DRIcontext *shared,
- unsigned num_attribs,
- const uint32_t *attribs,
- unsigned *error,
- void *data)
+driCreateContextAttribs(__DRIscreen *screen, int api,
+ const __DRIconfig *config,
+ __DRIcontext *shared,
+ unsigned num_attribs,
+ const uint32_t *attribs,
+ unsigned *error,
+ void *data)
{
__DRIcontext *context;
const struct gl_config *modes = (config != NULL) ? &config->modes : NULL;
@@ -306,6 +308,7 @@ dri2CreateContextAttribs(__DRIscreen *screen, int api,
unsigned major_version = 1;
unsigned minor_version = 0;
uint32_t flags = 0;
+ bool notify_reset = false;
assert((num_attribs == 0) || (attribs != NULL));
@@ -344,6 +347,10 @@ dri2CreateContextAttribs(__DRIscreen *screen, int api,
case __DRI_CTX_ATTRIB_FLAGS:
flags = attribs[i * 2 + 1];
break;
+ case __DRI_CTX_ATTRIB_RESET_STRATEGY:
+ notify_reset = (attribs[i * 2 + 1]
+ != __DRI_CTX_RESET_NO_NOTIFICATION);
+ break;
default:
/* We can't create a context that satisfies the requirements of an
* attribute that we don't understand. Return failure.
@@ -424,7 +431,7 @@ dri2CreateContextAttribs(__DRIscreen *screen, int api,
if (!screen->driver->CreateContext(mesa_api, modes, context,
major_version, minor_version,
- flags, error, shareCtx) ) {
+ flags, notify_reset, error, shareCtx)) {
free(context);
return NULL;
}
@@ -442,22 +449,22 @@ dri2CreateContextAttribs(__DRIscreen *screen, int api,
}
static __DRIcontext *
-dri2CreateNewContextForAPI(__DRIscreen *screen, int api,
- const __DRIconfig *config,
- __DRIcontext *shared, void *data)
+driCreateNewContextForAPI(__DRIscreen *screen, int api,
+ const __DRIconfig *config,
+ __DRIcontext *shared, void *data)
{
unsigned error;
- return dri2CreateContextAttribs(screen, api, config, shared, 0, NULL,
- &error, data);
+ return driCreateContextAttribs(screen, api, config, shared, 0, NULL,
+ &error, data);
}
static __DRIcontext *
-dri2CreateNewContext(__DRIscreen *screen, const __DRIconfig *config,
- __DRIcontext *shared, void *data)
+driCreateNewContext(__DRIscreen *screen, const __DRIconfig *config,
+ __DRIcontext *shared, void *data)
{
- return dri2CreateNewContextForAPI(screen, __DRI_API_OPENGL,
- config, shared, data);
+ return driCreateNewContextForAPI(screen, __DRI_API_OPENGL,
+ config, shared, data);
}
/**
@@ -609,9 +616,9 @@ static void dri_put_drawable(__DRIdrawable *pdp)
}
static __DRIdrawable *
-dri2CreateNewDrawable(__DRIscreen *screen,
- const __DRIconfig *config,
- void *data)
+driCreateNewDrawable(__DRIscreen *screen,
+ const __DRIconfig *config,
+ void *data)
{
__DRIdrawable *pdraw;
@@ -698,7 +705,7 @@ dri2ConfigQueryf(__DRIscreen *screen, const char *var, GLfloat *val)
}
static unsigned int
-dri2GetAPIMask(__DRIscreen *screen)
+driGetAPIMask(__DRIscreen *screen)
{
return screen->api_mask;
}
@@ -729,7 +736,7 @@ const __DRIcoreExtension driCoreExtension = {
.createNewDrawable = NULL,
.destroyDrawable = driDestroyDrawable,
.swapBuffers = driSwapBuffers, /* swrast */
- .createNewContext = dri2CreateNewContext, /* swrast */
+ .createNewContext = driCreateNewContext, /* swrast */
.copyContext = driCopyContext,
.destroyContext = driDestroyContext,
.bindContext = driBindContext,
@@ -741,22 +748,22 @@ const __DRIdri2Extension driDRI2Extension = {
.base = { __DRI_DRI2, 4 },
.createNewScreen = dri2CreateNewScreen,
- .createNewDrawable = dri2CreateNewDrawable,
- .createNewContext = dri2CreateNewContext,
- .getAPIMask = dri2GetAPIMask,
- .createNewContextForAPI = dri2CreateNewContextForAPI,
+ .createNewDrawable = driCreateNewDrawable,
+ .createNewContext = driCreateNewContext,
+ .getAPIMask = driGetAPIMask,
+ .createNewContextForAPI = driCreateNewContextForAPI,
.allocateBuffer = dri2AllocateBuffer,
.releaseBuffer = dri2ReleaseBuffer,
- .createContextAttribs = dri2CreateContextAttribs,
- .createNewScreen2 = dri2CreateNewScreen2,
+ .createContextAttribs = driCreateContextAttribs,
+ .createNewScreen2 = driCreateNewScreen2,
};
const __DRIswrastExtension driSWRastExtension = {
{ __DRI_SWRAST, 4 },
driSWRastCreateNewScreen,
- dri2CreateNewDrawable,
- dri2CreateNewContextForAPI,
- dri2CreateContextAttribs,
+ driCreateNewDrawable,
+ driCreateNewContextForAPI,
+ driCreateContextAttribs,
driSWRastCreateNewScreen2,
};
@@ -792,3 +799,76 @@ driUpdateFramebufferSize(struct gl_context *ctx, const __DRIdrawable *dPriv)
assert(fb->Height == dPriv->h);
}
}
+
+uint32_t
+driGLFormatToImageFormat(gl_format format)
+{
+ switch (format) {
+ case MESA_FORMAT_RGB565:
+ return __DRI_IMAGE_FORMAT_RGB565;
+ case MESA_FORMAT_XRGB8888:
+ return __DRI_IMAGE_FORMAT_XRGB8888;
+ case MESA_FORMAT_ARGB2101010:
+ return __DRI_IMAGE_FORMAT_ARGB2101010;
+ case MESA_FORMAT_XRGB2101010_UNORM:
+ return __DRI_IMAGE_FORMAT_XRGB2101010;
+ case MESA_FORMAT_ARGB8888:
+ return __DRI_IMAGE_FORMAT_ARGB8888;
+ case MESA_FORMAT_RGBA8888_REV:
+ return __DRI_IMAGE_FORMAT_ABGR8888;
+ case MESA_FORMAT_RGBX8888_REV:
+ return __DRI_IMAGE_FORMAT_XBGR8888;
+ case MESA_FORMAT_R8:
+ return __DRI_IMAGE_FORMAT_R8;
+ case MESA_FORMAT_GR88:
+ return __DRI_IMAGE_FORMAT_GR88;
+ case MESA_FORMAT_NONE:
+ return __DRI_IMAGE_FORMAT_NONE;
+ case MESA_FORMAT_SARGB8:
+ return __DRI_IMAGE_FORMAT_SARGB8;
+ default:
+ return 0;
+ }
+}
+
+gl_format
+driImageFormatToGLFormat(uint32_t image_format)
+{
+ switch (image_format) {
+ case __DRI_IMAGE_FORMAT_RGB565:
+ return MESA_FORMAT_RGB565;
+ case __DRI_IMAGE_FORMAT_XRGB8888:
+ return MESA_FORMAT_XRGB8888;
+ case __DRI_IMAGE_FORMAT_ARGB2101010:
+ return MESA_FORMAT_ARGB2101010;
+ case __DRI_IMAGE_FORMAT_XRGB2101010:
+ return MESA_FORMAT_XRGB2101010_UNORM;
+ case __DRI_IMAGE_FORMAT_ARGB8888:
+ return MESA_FORMAT_ARGB8888;
+ case __DRI_IMAGE_FORMAT_ABGR8888:
+ return MESA_FORMAT_RGBA8888_REV;
+ case __DRI_IMAGE_FORMAT_XBGR8888:
+ return MESA_FORMAT_RGBX8888_REV;
+ case __DRI_IMAGE_FORMAT_R8:
+ return MESA_FORMAT_R8;
+ case __DRI_IMAGE_FORMAT_GR88:
+ return MESA_FORMAT_GR88;
+ case __DRI_IMAGE_FORMAT_SARGB8:
+ return MESA_FORMAT_SARGB8;
+ case __DRI_IMAGE_FORMAT_NONE:
+ return MESA_FORMAT_NONE;
+ default:
+ 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,
+};