aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86/dri
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/xfree86/dri')
-rw-r--r--xorg-server/hw/xfree86/dri/Makefile.am30
-rw-r--r--xorg-server/hw/xfree86/dri/dri.c4
-rw-r--r--xorg-server/hw/xfree86/dri/dri.h2
-rw-r--r--xorg-server/hw/xfree86/dri/drimodule.c93
-rw-r--r--xorg-server/hw/xfree86/dri/xf86dri.c156
5 files changed, 98 insertions, 187 deletions
diff --git a/xorg-server/hw/xfree86/dri/Makefile.am b/xorg-server/hw/xfree86/dri/Makefile.am
index 9528d5370..ced04ff38 100644
--- a/xorg-server/hw/xfree86/dri/Makefile.am
+++ b/xorg-server/hw/xfree86/dri/Makefile.am
@@ -1,24 +1,18 @@
-libdri_la_LTLIBRARIES = libdri.la
-libdri_la_CFLAGS = -I$(top_srcdir)/hw/xfree86/common \
- -I$(top_srcdir)/hw/xfree86/os-support \
- -I$(top_srcdir)/hw/xfree86/modes \
- -I$(top_srcdir)/hw/xfree86/ddc \
- -I$(top_srcdir)/hw/xfree86/i2c \
- -I$(top_srcdir)/hw/xfree86/parser \
- -I$(top_srcdir)/hw/xfree86/ramdac \
- -I$(top_srcdir)/hw/xfree86/os-support/bus \
- -I$(top_srcdir)/glx \
- -DHAVE_XORG_CONFIG_H \
- @DIX_CFLAGS@ @XORG_CFLAGS@ @DRIPROTO_CFLAGS@ \
- @LIBDRM_CFLAGS@ \
- @DRI_CFLAGS@
-libdri_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
-libdri_la_LIBADD = @LIBDRM_LIBS@ $(PIXMAN_LIBS)
-libdri_ladir = $(moduledir)/extensions
+noinst_LTLIBRARIES = libdri.la
+AM_CFLAGS = -I$(top_srcdir)/hw/xfree86/common \
+ -I$(top_srcdir)/hw/xfree86/os-support \
+ -I$(top_srcdir)/hw/xfree86/modes \
+ -I$(top_srcdir)/hw/xfree86/ddc \
+ -I$(top_srcdir)/hw/xfree86/i2c \
+ -I$(top_srcdir)/hw/xfree86/parser \
+ -I$(top_srcdir)/hw/xfree86/ramdac \
+ -I$(top_srcdir)/hw/xfree86/os-support/bus \
+ -I$(top_srcdir)/glx \
+ -DHAVE_XORG_CONFIG_H \
+ @DIX_CFLAGS@ @XORG_CFLAGS@
libdri_la_SOURCES = \
dri.c \
dri.h \
- drimodule.c \
dristruct.h \
sarea.h \
xf86dri.c
diff --git a/xorg-server/hw/xfree86/dri/dri.c b/xorg-server/hw/xfree86/dri/dri.c
index 46a9ae457..398178e27 100644
--- a/xorg-server/hw/xfree86/dri/dri.c
+++ b/xorg-server/hw/xfree86/dri/dri.c
@@ -51,6 +51,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "misc.h"
#include "dixstruct.h"
#include "extnsionst.h"
+#include "extinit.h"
#include "colormapst.h"
#include "cursorstr.h"
#include "scrnintstr.h"
@@ -68,6 +69,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "xf86_OSproc.h"
#include "inputstr.h"
#include "xf86VGAarbiter.h"
+#include "xf86Extensions.h"
static int DRIEntPrivIndex = -1;
static DevPrivateKeyRec DRIScreenPrivKeyRec;
@@ -789,6 +791,8 @@ DRIExtensionInit(void)
RegisterBlockAndWakeupHandlers(DRIBlockHandler, DRIWakeupHandler, NULL);
+ drmSetServerInfo(&DRIDRMServerInfo);
+
return TRUE;
}
diff --git a/xorg-server/hw/xfree86/dri/dri.h b/xorg-server/hw/xfree86/dri/dri.h
index 0a4036c35..4bfaf1679 100644
--- a/xorg-server/hw/xfree86/dri/dri.h
+++ b/xorg-server/hw/xfree86/dri/dri.h
@@ -197,7 +197,7 @@ extern _X_EXPORT Bool DRIScreenInit(ScreenPtr pScreen,
extern _X_EXPORT void DRICloseScreen(ScreenPtr pScreen);
-extern _X_EXPORT Bool DRIExtensionInit(void);
+extern Bool DRIExtensionInit(void);
extern _X_EXPORT void DRIReset(void);
diff --git a/xorg-server/hw/xfree86/dri/drimodule.c b/xorg-server/hw/xfree86/dri/drimodule.c
deleted file mode 100644
index 83eca4eb9..000000000
--- a/xorg-server/hw/xfree86/dri/drimodule.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/**************************************************************************
-
-Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
-All Rights Reserved.
-
-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, sub license, 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 NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS 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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <kevin@precisioninsight.com>
- * Rickard E. Faith <faith@precisioninsight.com>
- *
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86Module.h"
-#include "globals.h"
-
-#include "xf86drm.h"
-static MODULESETUPPROTO(driSetup);
-
-drmServerInfo DRIDRMServerInfo;
-
-static XF86ModuleVersionInfo VersRec = {
- "dri",
- MODULEVENDORSTRING,
- MODINFOSTRING1,
- MODINFOSTRING2,
- XORG_VERSION_CURRENT,
- 1, 0, 0,
- ABI_CLASS_EXTENSION,
- ABI_EXTENSION_VERSION,
- MOD_CLASS_NONE,
- {0, 0, 0, 0}
-};
-
-extern void XFree86DRIExtensionInit(INITARGS);
-
-#define _XF86DRI_SERVER_
-#include <X11/dri/xf86driproto.h>
-
-static ExtensionModule XF86DRIExt = {
- XFree86DRIExtensionInit,
- XF86DRINAME,
- &noXFree86DRIExtension,
- NULL,
- NULL
-};
-
-_X_EXPORT XF86ModuleData driModuleData = { &VersRec, driSetup, NULL };
-
-static pointer
-driSetup(pointer module, pointer opts, int *errmaj, int *errmin)
-{
- static Bool setupDone = FALSE;
-
- if (!setupDone) {
- setupDone = TRUE;
- LoadExtension(&XF86DRIExt, FALSE);
- }
- else {
- if (errmaj)
- *errmaj = LDR_ONCEONLY;
- }
-
- drmSetServerInfo(&DRIDRMServerInfo);
-
- /* Need a non-NULL return value to indicate success */
- return (pointer) 1;
-}
diff --git a/xorg-server/hw/xfree86/dri/xf86dri.c b/xorg-server/hw/xfree86/dri/xf86dri.c
index 72ce8690d..ba74bb04f 100644
--- a/xorg-server/hw/xfree86/dri/xf86dri.c
+++ b/xorg-server/hw/xfree86/dri/xf86dri.c
@@ -47,6 +47,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "misc.h"
#include "dixstruct.h"
#include "extnsionst.h"
+#include "extinit.h"
#include "colormapst.h"
#include "cursorstr.h"
#include "scrnintstr.h"
@@ -60,17 +61,17 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "dristruct.h"
#include "xf86drm.h"
#include "protocol-versions.h"
+#include "xf86Extensions.h"
static int DRIErrorBase;
-static void XF86DRIResetProc(ExtensionEntry * extEntry);
+static void XF86DRIResetProc(ExtensionEntry *extEntry);
static unsigned char DRIReqCode = 0;
-extern void XFree86DRIExtensionInit(void);
-
- /*ARGSUSED*/ static void
-XF86DRIResetProc(ExtensionEntry * extEntry)
+/*ARGSUSED*/
+static void
+XF86DRIResetProc(ExtensionEntry *extEntry)
{
DRIReset();
}
@@ -78,15 +79,16 @@ XF86DRIResetProc(ExtensionEntry * extEntry)
static int
ProcXF86DRIQueryVersion(register ClientPtr client)
{
- xXF86DRIQueryVersionReply rep;
+ xXF86DRIQueryVersionReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .majorVersion = SERVER_XF86DRI_MAJOR_VERSION,
+ .minorVersion = SERVER_XF86DRI_MINOR_VERSION,
+ .patchVersion = SERVER_XF86DRI_PATCH_VERSION
+ };
REQUEST_SIZE_MATCH(xXF86DRIQueryVersionReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.majorVersion = SERVER_XF86DRI_MAJOR_VERSION;
- rep.minorVersion = SERVER_XF86DRI_MINOR_VERSION;
- rep.patchVersion = SERVER_XF86DRI_PATCH_VERSION;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
@@ -94,7 +96,7 @@ ProcXF86DRIQueryVersion(register ClientPtr client)
swaps(&rep.minorVersion);
swapl(&rep.patchVersion);
}
- WriteToClient(client, sizeof(xXF86DRIQueryVersionReply), (char *) &rep);
+ WriteToClient(client, sizeof(xXF86DRIQueryVersionReply), &rep);
return Success;
}
@@ -111,18 +113,20 @@ ProcXF86DRIQueryDirectRenderingCapable(register ClientPtr client)
return BadValue;
}
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
-
if (!DRIQueryDirectRenderingCapable(screenInfo.screens[stuff->screen],
&isCapable)) {
return BadValue;
}
- rep.isCapable = isCapable;
if (!LocalClient(client) || client->swapped)
- rep.isCapable = 0;
+ isCapable = 0;
+
+ rep = (xXF86DRIQueryDirectRenderingCapableReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .isCapable = isCapable
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
@@ -131,7 +135,7 @@ ProcXF86DRIQueryDirectRenderingCapable(register ClientPtr client)
WriteToClient(client,
sizeof(xXF86DRIQueryDirectRenderingCapableReply),
- (char *) &rep);
+ &rep);
return Success;
}
@@ -141,6 +145,7 @@ ProcXF86DRIOpenConnection(register ClientPtr client)
xXF86DRIOpenConnectionReply rep;
drm_handle_t hSAREA;
char *busIdString;
+ CARD32 busIdStringLength = 0;
REQUEST(xXF86DRIOpenConnectionReq);
REQUEST_SIZE_MATCH(xXF86DRIOpenConnectionReq);
@@ -154,33 +159,40 @@ ProcXF86DRIOpenConnection(register ClientPtr client)
return BadValue;
}
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.busIdStringLength = 0;
if (busIdString)
- rep.busIdStringLength = strlen(busIdString);
- rep.length =
- bytes_to_int32(SIZEOF(xXF86DRIOpenConnectionReply) -
- SIZEOF(xGenericReply) +
- pad_to_int32(rep.busIdStringLength));
+ busIdStringLength = strlen(busIdString);
- rep.hSAREALow = (CARD32) (hSAREA & 0xffffffff);
+ rep = (xXF86DRIOpenConnectionReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = bytes_to_int32(SIZEOF(xXF86DRIOpenConnectionReply) -
+ SIZEOF(xGenericReply) +
+ pad_to_int32(busIdStringLength)),
+ .busIdStringLength = busIdStringLength,
+
+ .hSAREALow = (CARD32) (hSAREA & 0xffffffff),
#if defined(LONG64) && !defined(__linux__)
- rep.hSAREAHigh = (CARD32) (hSAREA >> 32);
+ .hSAREAHigh = (CARD32) (hSAREA >> 32),
#else
- rep.hSAREAHigh = 0;
+ .hSAREAHigh = 0
#endif
+ };
- WriteToClient(client, sizeof(xXF86DRIOpenConnectionReply), (char *) &rep);
- if (rep.busIdStringLength)
- WriteToClient(client, rep.busIdStringLength, busIdString);
+ WriteToClient(client, sizeof(xXF86DRIOpenConnectionReply), &rep);
+ if (busIdStringLength)
+ WriteToClient(client, busIdStringLength, busIdString);
return Success;
}
static int
ProcXF86DRIAuthConnection(register ClientPtr client)
{
- xXF86DRIAuthConnectionReply rep;
+ xXF86DRIAuthConnectionReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .authenticated = 1
+ };
REQUEST(xXF86DRIAuthConnectionReq);
REQUEST_SIZE_MATCH(xXF86DRIAuthConnectionReq);
@@ -189,16 +201,11 @@ ProcXF86DRIAuthConnection(register ClientPtr client)
return BadValue;
}
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.authenticated = 1;
-
if (!DRIAuthConnection(screenInfo.screens[stuff->screen], stuff->magic)) {
ErrorF("Failed to authenticate %lu\n", (unsigned long) stuff->magic);
rep.authenticated = 0;
}
- WriteToClient(client, sizeof(xXF86DRIAuthConnectionReply), (char *) &rep);
+ WriteToClient(client, sizeof(xXF86DRIAuthConnectionReply), &rep);
return Success;
}
@@ -220,7 +227,11 @@ ProcXF86DRICloseConnection(register ClientPtr client)
static int
ProcXF86DRIGetClientDriverName(register ClientPtr client)
{
- xXF86DRIGetClientDriverNameReply rep;
+ xXF86DRIGetClientDriverNameReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .clientDriverNameLength = 0
+ };
char *clientDriverName;
REQUEST(xXF86DRIGetClientDriverNameReq);
@@ -236,17 +247,13 @@ ProcXF86DRIGetClientDriverName(register ClientPtr client)
(int *) &rep.ddxDriverPatchVersion,
&clientDriverName);
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.clientDriverNameLength = 0;
if (clientDriverName)
rep.clientDriverNameLength = strlen(clientDriverName);
rep.length = bytes_to_int32(SIZEOF(xXF86DRIGetClientDriverNameReply) -
SIZEOF(xGenericReply) +
pad_to_int32(rep.clientDriverNameLength));
- WriteToClient(client,
- sizeof(xXF86DRIGetClientDriverNameReply), (char *) &rep);
+ WriteToClient(client, sizeof(xXF86DRIGetClientDriverNameReply), &rep);
if (rep.clientDriverNameLength)
WriteToClient(client, rep.clientDriverNameLength, clientDriverName);
return Success;
@@ -255,7 +262,11 @@ ProcXF86DRIGetClientDriverName(register ClientPtr client)
static int
ProcXF86DRICreateContext(register ClientPtr client)
{
- xXF86DRICreateContextReply rep;
+ xXF86DRICreateContextReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0
+ };
ScreenPtr pScreen;
REQUEST(xXF86DRICreateContextReq);
@@ -265,10 +276,6 @@ ProcXF86DRICreateContext(register ClientPtr client)
return BadValue;
}
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
-
pScreen = screenInfo.screens[stuff->screen];
if (!DRICreateContext(pScreen,
@@ -277,7 +284,7 @@ ProcXF86DRICreateContext(register ClientPtr client)
return BadValue;
}
- WriteToClient(client, sizeof(xXF86DRICreateContextReply), (char *) &rep);
+ WriteToClient(client, sizeof(xXF86DRICreateContextReply), &rep);
return Success;
}
@@ -301,7 +308,11 @@ ProcXF86DRIDestroyContext(register ClientPtr client)
static int
ProcXF86DRICreateDrawable(ClientPtr client)
{
- xXF86DRICreateDrawableReply rep;
+ xXF86DRICreateDrawableReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0
+ };
DrawablePtr pDrawable;
int rc;
@@ -312,10 +323,6 @@ ProcXF86DRICreateDrawable(ClientPtr client)
return BadValue;
}
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
-
rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
DixReadAccess);
if (rc != Success)
@@ -326,7 +333,7 @@ ProcXF86DRICreateDrawable(ClientPtr client)
return BadValue;
}
- WriteToClient(client, sizeof(xXF86DRICreateDrawableReply), (char *) &rep);
+ WriteToClient(client, sizeof(xXF86DRICreateDrawableReply), &rep);
return Success;
}
@@ -360,7 +367,11 @@ ProcXF86DRIDestroyDrawable(register ClientPtr client)
static int
ProcXF86DRIGetDrawableInfo(register ClientPtr client)
{
- xXF86DRIGetDrawableInfoReply rep;
+ xXF86DRIGetDrawableInfoReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0
+ };
DrawablePtr pDrawable;
int X, Y, W, H;
drm_clip_rect_t *pClipRects, *pClippedRects;
@@ -374,10 +385,6 @@ ProcXF86DRIGetDrawableInfo(register ClientPtr client)
return BadValue;
}
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
-
rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
DixReadAccess);
if (rc != Success)
@@ -444,19 +451,19 @@ ProcXF86DRIGetDrawableInfo(register ClientPtr client)
rep.length = bytes_to_int32(rep.length);
- WriteToClient(client, sizeof(xXF86DRIGetDrawableInfoReply), (char *) &rep);
+ WriteToClient(client, sizeof(xXF86DRIGetDrawableInfoReply), &rep);
if (rep.numClipRects) {
WriteToClient(client,
sizeof(drm_clip_rect_t) * rep.numClipRects,
- (char *) pClippedRects);
+ pClippedRects);
free(pClippedRects);
}
if (rep.numBackClipRects) {
WriteToClient(client,
sizeof(drm_clip_rect_t) * rep.numBackClipRects,
- (char *) pBackClipRects);
+ pBackClipRects);
}
return Success;
@@ -465,7 +472,11 @@ ProcXF86DRIGetDrawableInfo(register ClientPtr client)
static int
ProcXF86DRIGetDeviceInfo(register ClientPtr client)
{
- xXF86DRIGetDeviceInfoReply rep;
+ xXF86DRIGetDeviceInfoReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0
+ };
drm_handle_t hFrameBuffer;
void *pDevPrivate;
@@ -476,10 +487,6 @@ ProcXF86DRIGetDeviceInfo(register ClientPtr client)
return BadValue;
}
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
-
if (!DRIGetDeviceInfo(screenInfo.screens[stuff->screen],
&hFrameBuffer,
(int *) &rep.framebufferOrigin,
@@ -496,16 +503,15 @@ ProcXF86DRIGetDeviceInfo(register ClientPtr client)
rep.hFrameBufferHigh = 0;
#endif
- rep.length = 0;
if (rep.devPrivateSize) {
rep.length = bytes_to_int32(SIZEOF(xXF86DRIGetDeviceInfoReply) -
SIZEOF(xGenericReply) +
pad_to_int32(rep.devPrivateSize));
}
- WriteToClient(client, sizeof(xXF86DRIGetDeviceInfoReply), (char *) &rep);
+ WriteToClient(client, sizeof(xXF86DRIGetDeviceInfoReply), &rep);
if (rep.length) {
- WriteToClient(client, rep.devPrivateSize, (char *) pDevPrivate);
+ WriteToClient(client, rep.devPrivateSize, pDevPrivate);
}
return Success;
}