aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86/dri2
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2009-09-09 05:23:48 +0000
committermarha <marha@users.sourceforge.net>2009-09-09 05:23:48 +0000
commit81f91c615982e50bb62708201569c33a3cd3d973 (patch)
tree4f32ecc48a3b7b5e76642f3792338263c53879bd /xorg-server/hw/xfree86/dri2
parentb571a562410f565af2bdde52d9f7f9a23ffae04f (diff)
parenta915739887477b28d924ecc8417ee107d125bd6c (diff)
downloadvcxsrv-81f91c615982e50bb62708201569c33a3cd3d973.tar.gz
vcxsrv-81f91c615982e50bb62708201569c33a3cd3d973.tar.bz2
vcxsrv-81f91c615982e50bb62708201569c33a3cd3d973.zip
svn merge https://vcxsrv.svn.sourceforge.net/svnroot/vcxsrv/branches/released .
Diffstat (limited to 'xorg-server/hw/xfree86/dri2')
-rw-r--r--xorg-server/hw/xfree86/dri2/Makefile.am2
-rw-r--r--xorg-server/hw/xfree86/dri2/Makefile.in37
-rw-r--r--xorg-server/hw/xfree86/dri2/dri2.c251
-rw-r--r--xorg-server/hw/xfree86/dri2/dri2.h50
-rw-r--r--xorg-server/hw/xfree86/dri2/dri2ext.c32
5 files changed, 137 insertions, 235 deletions
diff --git a/xorg-server/hw/xfree86/dri2/Makefile.am b/xorg-server/hw/xfree86/dri2/Makefile.am
index e5bd16bd2..c9fdde2f8 100644
--- a/xorg-server/hw/xfree86/dri2/Makefile.am
+++ b/xorg-server/hw/xfree86/dri2/Makefile.am
@@ -1,7 +1,7 @@
libdri2_la_LTLIBRARIES = libdri2.la
libdri2_la_CFLAGS = \
-DHAVE_XORG_CONFIG_H \
- @GL_CFLAGS@ \
+ @DRI_CFLAGS@ \
@DIX_CFLAGS@ @XORG_CFLAGS@ @DRI2PROTO_CFLAGS@ @LIBDRM_CFLAGS@ \
-I$(top_srcdir)/hw/xfree86/common \
-I$(top_srcdir)/hw/xfree86/os-support/bus
diff --git a/xorg-server/hw/xfree86/dri2/Makefile.in b/xorg-server/hw/xfree86/dri2/Makefile.in
index 25e0ff702..569c4b04a 100644
--- a/xorg-server/hw/xfree86/dri2/Makefile.in
+++ b/xorg-server/hw/xfree86/dri2/Makefile.in
@@ -39,8 +39,11 @@ subdir = hw/xfree86/dri2
DIST_COMMON = $(sdk_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \
+ $(top_srcdir)/m4/dolt.m4 $(top_srcdir)/m4/libtool.m4 \
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/m4/shave.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -50,7 +53,8 @@ CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
$(top_builddir)/include/xorg-config.h \
$(top_builddir)/include/xkb-config.h \
$(top_builddir)/include/xwin-config.h \
- $(top_builddir)/include/kdrive-config.h
+ $(top_builddir)/include/kdrive-config.h \
+ $(top_builddir)/include/version-config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
@@ -103,6 +107,7 @@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
ALLOCA = @ALLOCA@
AMTAR = @AMTAR@
+AM_MAKEFLAGS = @AM_MAKEFLAGS@
APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
APPLE_APPLICATION_ID = @APPLE_APPLICATION_ID@
APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@
@@ -123,9 +128,12 @@ CCASDEPMODE = @CCASDEPMODE@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
+CHANGELOG_CMD = @CHANGELOG_CMD@
COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CWARNFLAGS = @CWARNFLAGS@
+CXX = @CXX@
CYGPATH_W = @CYGPATH_W@
DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
@@ -154,7 +162,9 @@ DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
DRIPROTO_LIBS = @DRIPROTO_LIBS@
DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_CFLAGS = @DRI_CFLAGS@
DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DRI_LIBS = @DRI_LIBS@
DSYMUTIL = @DSYMUTIL@
DTRACE = @DTRACE@
DUMPBIN = @DUMPBIN@
@@ -163,9 +173,13 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
+F77 = @F77@
+FC = @FC@
FGREP = @FGREP@
FILE_MAN_DIR = @FILE_MAN_DIR@
FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_LIBS = @GLIB_LIBS@
GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
GLX_DEFINES = @GLX_DEFINES@
GL_CFLAGS = @GL_CFLAGS@
@@ -204,12 +218,13 @@ LTCOMPILE = @LTCOMPILE@
LTCXXCOMPILE = @LTCXXCOMPILE@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
+MAIN_LIB = @MAIN_LIB@
+MAKEFLAGS = @MAKEFLAGS@
MAKEINFO = @MAKEINFO@
MAKE_HTML = @MAKE_HTML@
MAKE_PDF = @MAKE_PDF@
MAKE_PS = @MAKE_PS@
MAKE_TEXT = @MAKE_TEXT@
-MESA_SOURCE = @MESA_SOURCE@
MISC_MAN_DIR = @MISC_MAN_DIR@
MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
MKDIR_P = @MKDIR_P@
@@ -229,7 +244,6 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
@@ -239,6 +253,7 @@ PERL = @PERL@
PKG_CONFIG = @PKG_CONFIG@
PROJECTROOT = @PROJECTROOT@
PS2PDF = @PS2PDF@
+Q = @Q@
RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
@@ -252,11 +267,10 @@ STRIP = @STRIP@
TSLIB_CFLAGS = @TSLIB_CFLAGS@
TSLIB_LIBS = @TSLIB_LIBS@
UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
-VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
-VENDOR_NAME = @VENDOR_NAME@
+V = @V@
VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
-VENDOR_RELEASE = @VENDOR_RELEASE@
VERSION = @VERSION@
+WINDRES = @WINDRES@
X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
XDMCP_CFLAGS = @XDMCP_CFLAGS@
@@ -292,6 +306,7 @@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
XORG_SYS_LIBS = @XORG_SYS_LIBS@
XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@
XPBPROXY_LIBS = @XPBPROXY_LIBS@
+XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@
XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
XSDL_INCS = @XSDL_INCS@
@@ -316,7 +331,6 @@ YFLAGS = @YFLAGS@
__XCONFIGFILE__ = @__XCONFIGFILE__@
abi_ansic = @abi_ansic@
abi_extension = @abi_extension@
-abi_font = @abi_font@
abi_videodrv = @abi_videodrv@
abi_xinput = @abi_xinput@
abs_builddir = @abs_builddir@
@@ -339,6 +353,7 @@ build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
+distcleancheck_listfiles = @distcleancheck_listfiles@
docdir = @docdir@
driverdir = @driverdir@
dvidir = @dvidir@
@@ -370,7 +385,9 @@ psdir = @psdir@
sbindir = @sbindir@
sdkdir = @sdkdir@
sharedstatedir = @sharedstatedir@
+shavedir = @shavedir@
srcdir = @srcdir@
+symbol_visibility = @symbol_visibility@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
@@ -379,7 +396,7 @@ top_srcdir = @top_srcdir@
libdri2_la_LTLIBRARIES = libdri2.la
libdri2_la_CFLAGS = \
-DHAVE_XORG_CONFIG_H \
- @GL_CFLAGS@ \
+ @DRI_CFLAGS@ \
@DIX_CFLAGS@ @XORG_CFLAGS@ @DRI2PROTO_CFLAGS@ @LIBDRM_CFLAGS@ \
-I$(top_srcdir)/hw/xfree86/common \
-I$(top_srcdir)/hw/xfree86/os-support/bus
diff --git a/xorg-server/hw/xfree86/dri2/dri2.c b/xorg-server/hw/xfree86/dri2/dri2.c
index 580383dbc..d15ced112 100644
--- a/xorg-server/hw/xfree86/dri2/dri2.c
+++ b/xorg-server/hw/xfree86/dri2/dri2.c
@@ -39,6 +39,7 @@
#include "scrnintstr.h"
#include "windowstr.h"
#include "dri2.h"
+#include "xf86VGAarbiter.h"
#include "xf86.h"
@@ -53,7 +54,7 @@ typedef struct _DRI2Drawable {
unsigned int refCount;
int width;
int height;
- DRI2Buffer2Ptr *buffers;
+ DRI2BufferPtr *buffers;
int bufferCount;
unsigned int pendingSequence;
} DRI2DrawableRec, *DRI2DrawablePtr;
@@ -64,9 +65,6 @@ typedef struct _DRI2Screen {
int fd;
unsigned int lastSequence;
- DRI2CreateBuffersProcPtr CreateBuffers;
- DRI2DestroyBuffersProcPtr DestroyBuffers;
-
DRI2CreateBufferProcPtr CreateBuffer;
DRI2DestroyBufferProcPtr DestroyBuffer;
DRI2CopyRegionProcPtr CopyRegion;
@@ -155,13 +153,13 @@ find_attachment(DRI2DrawablePtr pPriv, unsigned attachment)
return -1;
}
-static DRI2Buffer2Ptr
+static DRI2BufferPtr
allocate_or_reuse_buffer(DrawablePtr pDraw, DRI2ScreenPtr ds,
DRI2DrawablePtr pPriv,
unsigned int attachment, unsigned int format,
int dimensions_match)
{
- DRI2Buffer2Ptr buffer;
+ DRI2BufferPtr buffer;
int old_buf;
old_buf = find_attachment(pPriv, attachment);
@@ -178,173 +176,91 @@ allocate_or_reuse_buffer(DrawablePtr pDraw, DRI2ScreenPtr ds,
return buffer;
}
-static DRI2Buffer2Ptr *
+static DRI2BufferPtr *
do_get_buffers(DrawablePtr pDraw, int *width, int *height,
unsigned int *attachments, int count, int *out_count,
int has_format)
{
DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
DRI2DrawablePtr pPriv = DRI2GetDrawable(pDraw);
- DRI2Buffer2Ptr *buffers;
+ DRI2BufferPtr *buffers;
int need_real_front = 0;
int need_fake_front = 0;
int have_fake_front = 0;
int front_format = 0;
- const int dimensions_match = (pDraw->width == pPriv->width)
- && (pDraw->height == pPriv->height);
+ int dimensions_match;
int i;
+ if (!pPriv) {
+ *width = pDraw->width;
+ *height = pDraw->height;
+ *out_count = 0;
+ return NULL;
+ }
- buffers = xalloc((count + 1) * sizeof(buffers[0]));
-
- if (ds->CreateBuffer) {
- /* Version 2 API with CreateBuffer */
- for (i = 0; i < count; i++) {
- const unsigned attachment = *(attachments++);
- const unsigned format = (has_format) ? *(attachments++) : 0;
-
- buffers[i] = allocate_or_reuse_buffer(pDraw, ds, pPriv, attachment,
- format, dimensions_match);
-
- /* If the drawable is a window and the front-buffer is requested,
- * silently add the fake front-buffer to the list of requested
- * attachments. The counting logic in the loop accounts for the case
- * where the client requests both the fake and real front-buffer.
- */
- if (attachment == DRI2BufferBackLeft) {
- need_real_front++;
- front_format = format;
- }
-
- if (attachment == DRI2BufferFrontLeft) {
- need_real_front--;
- front_format = format;
-
- if (pDraw->type == DRAWABLE_WINDOW) {
- need_fake_front++;
- }
- }
-
- if (pDraw->type == DRAWABLE_WINDOW) {
- if (attachment == DRI2BufferFakeFrontLeft) {
- need_fake_front--;
- have_fake_front = 1;
- }
- }
- }
+ dimensions_match = (pDraw->width == pPriv->width)
+ && (pDraw->height == pPriv->height);
- if (need_real_front > 0) {
- buffers[i++] = allocate_or_reuse_buffer(pDraw, ds, pPriv,
- DRI2BufferFrontLeft,
- front_format, dimensions_match);
- }
+ buffers = xalloc((count + 1) * sizeof(buffers[0]));
- if (need_fake_front > 0) {
- buffers[i++] = allocate_or_reuse_buffer(pDraw, ds, pPriv,
- DRI2BufferFakeFrontLeft,
- front_format, dimensions_match);
- have_fake_front = 1;
+ for (i = 0; i < count; i++) {
+ const unsigned attachment = *(attachments++);
+ const unsigned format = (has_format) ? *(attachments++) : 0;
+
+ buffers[i] = allocate_or_reuse_buffer(pDraw, ds, pPriv, attachment,
+ format, dimensions_match);
+
+ /* If the drawable is a window and the front-buffer is requested,
+ * silently add the fake front-buffer to the list of requested
+ * attachments. The counting logic in the loop accounts for the case
+ * where the client requests both the fake and real front-buffer.
+ */
+ if (attachment == DRI2BufferBackLeft) {
+ need_real_front++;
+ front_format = format;
}
- *out_count = i;
-
+ if (attachment == DRI2BufferFrontLeft) {
+ need_real_front--;
+ front_format = format;
- if (pPriv->buffers != NULL) {
- for (i = 0; i < pPriv->bufferCount; i++) {
- if (pPriv->buffers[i] != NULL) {
- (*ds->DestroyBuffer)(pDraw, pPriv->buffers[i]);
- }
+ if (pDraw->type == DRAWABLE_WINDOW) {
+ need_fake_front++;
}
-
- xfree(pPriv->buffers);
}
- } else {
- DRI2BufferPtr buffers1;
- unsigned int temp_buf[32];
- unsigned int *temp = temp_buf;
- int i;
- int buffers_match = 1;
- /* Version 1 API with CreateBuffers */
-
- if ((count + 1) > 32) {
- temp = xalloc((count + 1) * sizeof(temp[0]));
- }
-
- for (i = 0; i < count; i++) {
- const unsigned attachment = *(attachments++);
-
- /* Version 1 doesn't deal with the format at all */
- if (has_format)
- attachments++;
-
- /*
- * Make sure the client also gets the front buffer when
- * it asks for a back buffer
- */
- if (attachment == DRI2BufferBackLeft)
- need_real_front++;
-
- /*
- * If the drawable is a window and the front-buffer is requested,
- * silently add the fake front-buffer to the list of requested
- * attachments. The counting logic in the loop accounts for the
- * case where the client requests both the fake and real
- * front-buffer.
- */
- if (attachment == DRI2BufferFrontLeft) {
- need_real_front--;
- if (pDraw->type == DRAWABLE_WINDOW)
- need_fake_front++;
- }
- if (pDraw->type == DRAWABLE_WINDOW &&
- attachment == DRI2BufferFakeFrontLeft)
- {
+ if (pDraw->type == DRAWABLE_WINDOW) {
+ if (attachment == DRI2BufferFakeFrontLeft) {
need_fake_front--;
have_fake_front = 1;
}
-
- temp[i] = attachment;
- }
-
- if (need_real_front > 0)
- temp[count++] = DRI2BufferFrontLeft;
-
- if (need_fake_front > 0) {
- temp[count++] = DRI2BufferFakeFrontLeft;
- have_fake_front = 1;
}
+ }
- if (count != pPriv->bufferCount)
- buffers_match = 0;
- else {
- for (i = 0; i < count; i++)
- if (pPriv->buffers[i]->attachment != temp[i]) {
- buffers_match = 0;
- break;
- }
- }
- if (pPriv->buffers == NULL || !dimensions_match || !buffers_match)
- {
- buffers1 = (*ds->CreateBuffers)(pDraw, temp, count);
- if (pPriv->buffers != NULL)
- (*ds->DestroyBuffers)(pDraw, (DRI2BufferPtr) pPriv->buffers[0],
- pPriv->bufferCount);
- }
- else
- buffers1 = (DRI2BufferPtr) pPriv->buffers[0];
+ if (need_real_front > 0) {
+ buffers[i++] = allocate_or_reuse_buffer(pDraw, ds, pPriv,
+ DRI2BufferFrontLeft,
+ front_format, dimensions_match);
+ }
- for (i = 0; i < count; i++)
- buffers[i] = (DRI2Buffer2Ptr) &buffers1[i];
+ if (need_fake_front > 0) {
+ buffers[i++] = allocate_or_reuse_buffer(pDraw, ds, pPriv,
+ DRI2BufferFakeFrontLeft,
+ front_format, dimensions_match);
+ have_fake_front = 1;
+ }
- *out_count = count;
+ *out_count = i;
- if (pPriv->buffers)
- xfree (pPriv->buffers);
- if (temp != temp_buf) {
- xfree(temp);
+ if (pPriv->buffers != NULL) {
+ for (i = 0; i < pPriv->bufferCount; i++) {
+ if (pPriv->buffers[i] != NULL) {
+ (*ds->DestroyBuffer)(pDraw, pPriv->buffers[i]);
+ }
}
+
+ xfree(pPriv->buffers);
}
pPriv->buffers = buffers;
@@ -376,7 +292,7 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height,
return pPriv->buffers;
}
-DRI2Buffer2Ptr *
+DRI2BufferPtr *
DRI2GetBuffers(DrawablePtr pDraw, int *width, int *height,
unsigned int *attachments, int count, int *out_count)
{
@@ -384,7 +300,7 @@ DRI2GetBuffers(DrawablePtr pDraw, int *width, int *height,
out_count, FALSE);
}
-DRI2Buffer2Ptr *
+DRI2BufferPtr *
DRI2GetBuffersWithFormat(DrawablePtr pDraw, int *width, int *height,
unsigned int *attachments, int count, int *out_count)
{
@@ -441,14 +357,8 @@ DRI2DestroyDrawable(DrawablePtr pDraw)
if (pPriv->buffers != NULL) {
int i;
- if (ds->DestroyBuffer) {
- for (i = 0; i < pPriv->bufferCount; i++) {
- (*ds->DestroyBuffer)(pDraw, pPriv->buffers[i]);
- }
- } else {
- (*ds->DestroyBuffers)(pDraw, (DRI2BufferPtr) pPriv->buffers[0],
- pPriv->bufferCount);
- }
+ for (i = 0; i < pPriv->bufferCount; i++)
+ (*ds->DestroyBuffer)(pDraw, pPriv->buffers[i]);
xfree(pPriv->buffers);
}
@@ -502,6 +412,15 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
{
DRI2ScreenPtr ds;
+ if (info->version < 3)
+ return FALSE;
+
+ if (!xf86VGAarbiterAllowDRI(pScreen)) {
+ xf86DrvMsg(pScreen->myNum, X_WARNING,
+ "[DRI2] Direct rendering is not supported when VGA arb is necessary for the device\n");
+ return FALSE;
+ }
+
ds = xalloc(sizeof *ds);
if (!ds)
return FALSE;
@@ -510,32 +429,8 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
ds->driverName = info->driverName;
ds->deviceName = info->deviceName;
- /* Prefer the new one-at-a-time buffer API */
- if (info->version >= 2 && info->CreateBuffer && info->DestroyBuffer) {
- ds->CreateBuffer = info->CreateBuffer;
- ds->DestroyBuffer = info->DestroyBuffer;
- ds->CreateBuffers = NULL;
- ds->DestroyBuffers = NULL;
- } else if (info->CreateBuffers && info->DestroyBuffers) {
- xf86DrvMsg(pScreen->myNum, X_WARNING,
- "[DRI2] Version 1 API (broken front buffer rendering)\n");
- ds->CreateBuffer = NULL;
- ds->DestroyBuffer = NULL;
- ds->CreateBuffers = info->CreateBuffers;
- ds->DestroyBuffers = info->DestroyBuffers;
- } else {
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[DRI2] Missing buffer management functions\n");
- xfree(ds);
- return FALSE;
- }
-
- if (!info->CopyRegion) {
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[DRI2] Missing copy region function\n");
- xfree(ds);
- return FALSE;
- }
+ ds->CreateBuffer = info->CreateBuffer;
+ ds->DestroyBuffer = info->DestroyBuffer;
ds->CopyRegion = info->CopyRegion;
dixSetPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey, ds);
diff --git a/xorg-server/hw/xfree86/dri2/dri2.h b/xorg-server/hw/xfree86/dri2/dri2.h
index f3692673a..175471aae 100644
--- a/xorg-server/hw/xfree86/dri2/dri2.h
+++ b/xorg-server/hw/xfree86/dri2/dri2.h
@@ -35,26 +35,18 @@
#include <X11/extensions/dri2tokens.h>
-/* Version 1 structure (for ABI compatibility) */
+/* Version 2 structure (with format at the end) */
typedef struct {
unsigned int attachment;
unsigned int name;
unsigned int pitch;
unsigned int cpp;
unsigned int flags;
+ unsigned int format;
void *driverPrivate;
} DRI2BufferRec, *DRI2BufferPtr;
-/* Version 2 structure (with format at the end) */
-typedef struct {
- unsigned int attachment;
- unsigned int name;
- unsigned int pitch;
- unsigned int cpp;
- unsigned int flags;
- void *driverPrivate;
- unsigned int format;
-} DRI2Buffer2Rec, *DRI2Buffer2Ptr;
+typedef DRI2BufferRec DRI2Buffer2Rec, *DRI2Buffer2Ptr;
typedef DRI2BufferPtr (*DRI2CreateBuffersProcPtr)(DrawablePtr pDraw,
unsigned int *attachments,
@@ -70,16 +62,16 @@ typedef void (*DRI2CopyRegionProcPtr)(DrawablePtr pDraw,
typedef void (*DRI2WaitProcPtr)(WindowPtr pWin,
unsigned int sequence);
-typedef DRI2Buffer2Ptr (*DRI2CreateBufferProcPtr)(DrawablePtr pDraw,
+typedef DRI2BufferPtr (*DRI2CreateBufferProcPtr)(DrawablePtr pDraw,
unsigned int attachment,
unsigned int format);
typedef void (*DRI2DestroyBufferProcPtr)(DrawablePtr pDraw,
- DRI2Buffer2Ptr buffer);
+ DRI2BufferPtr buffer);
/**
* Version of the DRI2InfoRec structure defined in this header
*/
-#define DRI2INFOREC_VERSION 2
+#define DRI2INFOREC_VERSION 3
typedef struct {
unsigned int version; /**< Version of this struct */
@@ -87,46 +79,38 @@ typedef struct {
const char *driverName;
const char *deviceName;
- DRI2CreateBuffersProcPtr CreateBuffers;
- DRI2DestroyBuffersProcPtr DestroyBuffers;
- DRI2CopyRegionProcPtr CopyRegion;
- DRI2WaitProcPtr Wait;
-
- /**
- * \name Fields added in version 2 of the structure.
- */
- /*@{*/
DRI2CreateBufferProcPtr CreateBuffer;
DRI2DestroyBufferProcPtr DestroyBuffer;
- /*@}*/
+ DRI2CopyRegionProcPtr CopyRegion;
+ DRI2WaitProcPtr Wait;
} DRI2InfoRec, *DRI2InfoPtr;
-Bool DRI2ScreenInit(ScreenPtr pScreen,
+extern _X_EXPORT Bool DRI2ScreenInit(ScreenPtr pScreen,
DRI2InfoPtr info);
-void DRI2CloseScreen(ScreenPtr pScreen);
+extern _X_EXPORT void DRI2CloseScreen(ScreenPtr pScreen);
-Bool DRI2Connect(ScreenPtr pScreen,
+extern _X_EXPORT Bool DRI2Connect(ScreenPtr pScreen,
unsigned int driverType,
int *fd,
const char **driverName,
const char **deviceName);
-Bool DRI2Authenticate(ScreenPtr pScreen, drm_magic_t magic);
+extern _X_EXPORT Bool DRI2Authenticate(ScreenPtr pScreen, drm_magic_t magic);
-int DRI2CreateDrawable(DrawablePtr pDraw);
+extern _X_EXPORT int DRI2CreateDrawable(DrawablePtr pDraw);
-void DRI2DestroyDrawable(DrawablePtr pDraw);
+extern _X_EXPORT void DRI2DestroyDrawable(DrawablePtr pDraw);
-DRI2Buffer2Ptr *DRI2GetBuffers(DrawablePtr pDraw,
+extern _X_EXPORT DRI2BufferPtr *DRI2GetBuffers(DrawablePtr pDraw,
int *width,
int *height,
unsigned int *attachments,
int count,
int *out_count);
-int DRI2CopyRegion(DrawablePtr pDraw,
+extern _X_EXPORT int DRI2CopyRegion(DrawablePtr pDraw,
RegionPtr pRegion,
unsigned int dest,
unsigned int src);
@@ -149,7 +133,7 @@ int DRI2CopyRegion(DrawablePtr pDraw,
*/
extern _X_EXPORT void DRI2Version(int *major, int *minor);
-extern _X_EXPORT DRI2Buffer2Ptr *DRI2GetBuffersWithFormat(DrawablePtr pDraw,
+extern _X_EXPORT DRI2BufferPtr *DRI2GetBuffersWithFormat(DrawablePtr pDraw,
int *width, int *height, unsigned int *attachments, int count,
int *out_count);
diff --git a/xorg-server/hw/xfree86/dri2/dri2ext.c b/xorg-server/hw/xfree86/dri2/dri2ext.c
index 3c06174cb..72f9a448b 100644
--- a/xorg-server/hw/xfree86/dri2/dri2ext.c
+++ b/xorg-server/hw/xfree86/dri2/dri2ext.c
@@ -34,7 +34,6 @@
#include <xorg-config.h>
#endif
-#define NEED_REPLIES
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/extensions/dri2proto.h>
@@ -54,10 +53,10 @@ static ExtensionEntry *dri2Extension;
static RESTYPE dri2DrawableRes;
static Bool
-validDrawable(ClientPtr client, XID drawable,
+validDrawable(ClientPtr client, XID drawable, Mask access_mode,
DrawablePtr *pDrawable, int *status)
{
- *status = dixLookupDrawable(pDrawable, drawable, client, 0, DixReadAccess);
+ *status = dixLookupDrawable(pDrawable, drawable, client, 0, access_mode);
if (*status != Success) {
client->errorValue = drawable;
return FALSE;
@@ -106,7 +105,8 @@ ProcDRI2Connect(ClientPtr client)
const char *deviceName;
REQUEST_SIZE_MATCH(xDRI2ConnectReq);
- if (!validDrawable(client, stuff->window, &pDraw, &status))
+ if (!validDrawable(client, stuff->window, DixGetAttrAccess,
+ &pDraw, &status))
return status;
rep.type = X_Reply;
@@ -141,7 +141,8 @@ ProcDRI2Authenticate(ClientPtr client)
int status;
REQUEST_SIZE_MATCH(xDRI2AuthenticateReq);
- if (!validDrawable(client, stuff->window, &pDraw, &status))
+ if (!validDrawable(client, stuff->window, DixGetAttrAccess,
+ &pDraw, &status))
return status;
rep.type = X_Reply;
@@ -162,7 +163,8 @@ ProcDRI2CreateDrawable(ClientPtr client)
REQUEST_SIZE_MATCH(xDRI2CreateDrawableReq);
- if (!validDrawable(client, stuff->drawable, &pDrawable, &status))
+ if (!validDrawable(client, stuff->drawable, DixAddAccess,
+ &pDrawable, &status))
return status;
status = DRI2CreateDrawable(pDrawable);
@@ -185,7 +187,8 @@ ProcDRI2DestroyDrawable(ClientPtr client)
int status;
REQUEST_SIZE_MATCH(xDRI2DestroyDrawableReq);
- if (!validDrawable(client, stuff->drawable, &pDrawable, &status))
+ if (!validDrawable(client, stuff->drawable, DixRemoveAccess,
+ &pDrawable, &status))
return status;
FreeResourceByType(stuff->drawable, dri2DrawableRes, FALSE);
@@ -196,7 +199,7 @@ ProcDRI2DestroyDrawable(ClientPtr client)
static void
send_buffers_reply(ClientPtr client, DrawablePtr pDrawable,
- DRI2Buffer2Ptr *buffers, int count, int width, int height)
+ DRI2BufferPtr *buffers, int count, int width, int height)
{
xDRI2GetBuffersReply rep;
int skip = 0;
@@ -246,12 +249,13 @@ ProcDRI2GetBuffers(ClientPtr client)
{
REQUEST(xDRI2GetBuffersReq);
DrawablePtr pDrawable;
- DRI2Buffer2Ptr *buffers;
+ DRI2BufferPtr *buffers;
int status, width, height, count;
unsigned int *attachments;
REQUEST_FIXED_SIZE(xDRI2GetBuffersReq, stuff->count * 4);
- if (!validDrawable(client, stuff->drawable, &pDrawable, &status))
+ if (!validDrawable(client, stuff->drawable, DixReadAccess | DixWriteAccess,
+ &pDrawable, &status))
return status;
attachments = (unsigned int *) &stuff[1];
@@ -269,12 +273,13 @@ ProcDRI2GetBuffersWithFormat(ClientPtr client)
{
REQUEST(xDRI2GetBuffersReq);
DrawablePtr pDrawable;
- DRI2Buffer2Ptr *buffers;
+ DRI2BufferPtr *buffers;
int status, width, height, count;
unsigned int *attachments;
REQUEST_FIXED_SIZE(xDRI2GetBuffersReq, stuff->count * (2 * 4));
- if (!validDrawable(client, stuff->drawable, &pDrawable, &status))
+ if (!validDrawable(client, stuff->drawable, DixReadAccess | DixWriteAccess,
+ &pDrawable, &status))
return status;
attachments = (unsigned int *) &stuff[1];
@@ -297,7 +302,8 @@ ProcDRI2CopyRegion(ClientPtr client)
REQUEST_SIZE_MATCH(xDRI2CopyRegionReq);
- if (!validDrawable(client, stuff->drawable, &pDrawable, &status))
+ if (!validDrawable(client, stuff->drawable, DixWriteAccess,
+ &pDrawable, &status))
return status;
VERIFY_REGION(pRegion, stuff->region, client, DixReadAccess);