aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/drivers/dri/common
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-10-25 09:22:25 +0200
committermarha <marha@users.sourceforge.net>2013-10-25 09:22:25 +0200
commit5b4c4c77b012ceac7b0f4d3ef2f33d91f01084d0 (patch)
treec532fb2a693321cc9960fd554654e60351d63249 /mesalib/src/mesa/drivers/dri/common
parent42cd4a1fab6d183e218bd8c6bd65f65211af4d7c (diff)
parent270d3a1aa4137dc15d7b7e5a0958cc8c0bef9a1a (diff)
downloadvcxsrv-5b4c4c77b012ceac7b0f4d3ef2f33d91f01084d0.tar.gz
vcxsrv-5b4c4c77b012ceac7b0f4d3ef2f33d91f01084d0.tar.bz2
vcxsrv-5b4c4c77b012ceac7b0f4d3ef2f33d91f01084d0.zip
Merge remote-tracking branch 'origin/released'
* origin/released: fontconfig mesa git update 25 oct 2013 Conflicts: mesalib/src/mesa/drivers/dri/common/dri_util.c mesalib/src/mesa/drivers/dri/swrast/swrast.c
Diffstat (limited to 'mesalib/src/mesa/drivers/dri/common')
-rw-r--r--mesalib/src/mesa/drivers/dri/common/Makefile.am11
-rwxr-xr-x[-rw-r--r--]mesalib/src/mesa/drivers/dri/common/dri_util.c82
-rw-r--r--mesalib/src/mesa/drivers/dri/common/dri_util.h2
-rw-r--r--mesalib/src/mesa/drivers/dri/common/megadriver_stub.c41
4 files changed, 119 insertions, 17 deletions
diff --git a/mesalib/src/mesa/drivers/dri/common/Makefile.am b/mesalib/src/mesa/drivers/dri/common/Makefile.am
index ce4119d0f..9f49ff3ae 100644
--- a/mesalib/src/mesa/drivers/dri/common/Makefile.am
+++ b/mesalib/src/mesa/drivers/dri/common/Makefile.am
@@ -27,11 +27,11 @@ AM_CFLAGS = \
-I$(top_srcdir)/src/mapi \
-I$(top_srcdir)/src/mesa/ \
$(DEFINES) \
- $(LIBDRM_CFLAGS) \
$(VISIBILITY_CFLAGS)
noinst_LTLIBRARIES = \
libdricommon.la \
+ libmegadriver_stub.la \
libdri_test_stubs.la
libdricommon_la_SOURCES = \
@@ -43,4 +43,13 @@ libdri_test_stubs_la_SOURCES = \
dri_test.c
libdri_test_stubs_la_CFLAGS = $(AM_CFLAGS) -DNO_MAIN
+libmegadriver_stub_la_SOURCES = megadriver_stub.c
+
sysconf_DATA = drirc
+
+if DRICOMMON_NEED_LIBDRM
+AM_CFLAGS += $(LIBDRM_CFLAGS)
+libdricommon_la_LDFLAGS = $(LIBDRM_LIBS)
+else
+AM_CFLAGS += -D__NOT_HAVE_DRM_H
+endif
diff --git a/mesalib/src/mesa/drivers/dri/common/dri_util.c b/mesalib/src/mesa/drivers/dri/common/dri_util.c
index 74f3a5d99..7f84e6496 100644..100755
--- a/mesalib/src/mesa/drivers/dri/common/dri_util.c
+++ b/mesalib/src/mesa/drivers/dri/common/dri_util.c
@@ -82,6 +82,23 @@ setupLoaderExtensions(__DRIscreen *psp,
}
/**
+ * This pointer determines which driver API we'll use in the case of the
+ * loader not passing us an explicit driver extensions list (that would,
+ * itself, contain a pointer to a driver API.)
+ *
+ * A driver's driDriverGetExtensions_drivername() can update this pointer to
+ * what it's returning, and a loader that is ignorant of createNewScreen2()
+ * will get the correct driver screen created, as long as no other
+ * driDriverGetExtensions() happened in between the first one and the
+ * createNewScreen().
+ *
+ * This allows the X Server to not require the significant dri_interface.h
+ * updates for doing createNewScreen2(), which would discourage backporting of
+ * the X Server patches to support the new loader interface.
+ */
+const struct __DriverAPIRec *globalDriverAPI = &driDriverAPI;
+
+/**
* This is the first entrypoint in the driver called by the DRI driver loader
* after dlopen()ing it.
*
@@ -89,19 +106,33 @@ setupLoaderExtensions(__DRIscreen *psp,
* Display.
*/
static __DRIscreen *
-dri2CreateNewScreen(int scrn, int fd,
- const __DRIextension **extensions,
- const __DRIconfig ***driver_configs, void *data)
+dri2CreateNewScreen2(int scrn, int fd,
+ const __DRIextension **extensions,
+ const __DRIextension **driver_extensions,
+ const __DRIconfig ***driver_configs, void *data)
{
static const __DRIextension *emptyExtensionList[] = { NULL };
__DRIscreen *psp;
- int gl_version_override;
+ int gl_version_override;
psp = calloc(1, sizeof(*psp));
if (!psp)
return NULL;
- psp->driver = &driDriverAPI;
+ /* By default, use the global driDriverAPI symbol (non-megadrivers). */
+ psp->driver = globalDriverAPI;
+
+ /* If the driver exposes its vtable through its extensions list
+ * (megadrivers), use that instead.
+ */
+ if (driver_extensions) {
+ for (int i = 0; driver_extensions[i]; i++) {
+ if (strcmp(driver_extensions[i]->name, __DRI_DRIVER_VTABLE) == 0) {
+ psp->driver =
+ ((__DRIDriverVtableExtension *)driver_extensions[i])->vtable;
+ }
+ }
+ }
setupLoaderExtensions(psp, extensions);
@@ -155,12 +186,31 @@ dri2CreateNewScreen(int scrn, int fd,
return psp;
}
+static __DRIscreen *
+dri2CreateNewScreen(int scrn, int fd,
+ const __DRIextension **extensions,
+ const __DRIconfig ***driver_configs, void *data)
+{
+ return dri2CreateNewScreen2(scrn, fd, extensions, NULL,
+ driver_configs, data);
+}
+
/** swrast driver createNewScreen entrypoint. */
static __DRIscreen *
-driCreateNewScreen(int scrn, const __DRIextension **extensions,
- const __DRIconfig ***driver_configs, void *data)
+driSWRastCreateNewScreen(int scrn, const __DRIextension **extensions,
+ const __DRIconfig ***driver_configs, void *data)
+{
+ return dri2CreateNewScreen2(scrn, -1, extensions, NULL,
+ driver_configs, data);
+}
+
+static __DRIscreen *
+driSWRastCreateNewScreen2(int scrn, const __DRIextension **extensions,
+ const __DRIextension **driver_extensions,
+ const __DRIconfig ***driver_configs, void *data)
{
- return dri2CreateNewScreen(scrn, -1, extensions, driver_configs, data);
+ return dri2CreateNewScreen2(scrn, -1, extensions, driver_extensions,
+ driver_configs, data);
}
/**
@@ -257,8 +307,8 @@ dri2CreateContextAttribs(__DRIscreen *screen, int api,
unsigned major_version = 1;
unsigned minor_version = 0;
uint32_t flags = 0;
- unsigned i;
- struct gl_context *ctx;
+ unsigned i;
+ struct gl_context *ctx;
assert((num_attribs == 0) || (attribs != NULL));
@@ -691,7 +741,7 @@ const __DRIcoreExtension driCoreExtension = {
/** DRI2 interface */
const __DRIdri2Extension driDRI2Extension = {
- /*.base =*/ { __DRI_DRI2, 3 },
+ /*.base =*/ { __DRI_DRI2, 4 },
/*.createNewScreen =*/ dri2CreateNewScreen,
/*.createNewDrawable =*/ dri2CreateNewDrawable,
@@ -700,15 +750,17 @@ const __DRIdri2Extension driDRI2Extension = {
/*.createNewContextForAPI =*/ dri2CreateNewContextForAPI,
/*.allocateBuffer =*/ dri2AllocateBuffer,
/*.releaseBuffer =*/ dri2ReleaseBuffer,
- /*.createContextAttribs =*/ dri2CreateContextAttribs
+ /*.createContextAttribs =*/ dri2CreateContextAttribs,
+ /*.createNewScreen2 =*/ dri2CreateNewScreen2,
};
const __DRIswrastExtension driSWRastExtension = {
- { __DRI_SWRAST, __DRI_SWRAST_VERSION },
- driCreateNewScreen,
+ { __DRI_SWRAST, 4 },
+ driSWRastCreateNewScreen,
dri2CreateNewDrawable,
dri2CreateNewContextForAPI,
- dri2CreateContextAttribs
+ dri2CreateContextAttribs,
+ driSWRastCreateNewScreen2,
};
const __DRI2configQueryExtension dri2ConfigQueryExtension = {
diff --git a/mesalib/src/mesa/drivers/dri/common/dri_util.h b/mesalib/src/mesa/drivers/dri/common/dri_util.h
index 61c80bc45..5b56061e2 100644
--- a/mesalib/src/mesa/drivers/dri/common/dri_util.h
+++ b/mesalib/src/mesa/drivers/dri/common/dri_util.h
@@ -116,7 +116,7 @@ struct __DriverAPIRec {
};
extern const struct __DriverAPIRec driDriverAPI;
-
+extern const struct __DriverAPIRec *globalDriverAPI;
/**
* Per-screen private driver information.
diff --git a/mesalib/src/mesa/drivers/dri/common/megadriver_stub.c b/mesalib/src/mesa/drivers/dri/common/megadriver_stub.c
new file mode 100644
index 000000000..6bf5d7327
--- /dev/null
+++ b/mesalib/src/mesa/drivers/dri/common/megadriver_stub.c
@@ -0,0 +1,41 @@
+/*
+ * Copyright © 2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include <stdio.h>
+#include "dri_util.h"
+
+static const
+__DRIconfig **stub_error_init_screen(__DRIscreen *psp)
+{
+ fprintf(stderr, "An updated DRI driver loader (libGL.so or X Server) is "
+ "required for this Mesa driver.\n");
+ return NULL;
+}
+
+/**
+ * This is a stub driDriverAPI that is referenced by dri_util.c but should
+ * never be used.
+ */
+const struct __DriverAPIRec driDriverAPI = {
+ .InitScreen = stub_error_init_screen,
+};