aboutsummaryrefslogtreecommitdiff
path: root/xorg-server
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-06-15 08:55:18 +0200
committermarha <marha@users.sourceforge.net>2012-06-15 08:55:18 +0200
commitd6f64084b9bc07d0bdd527f9354f2d1d962ed16d (patch)
tree81b2652d421992fd63143a04885e332e83e18d07 /xorg-server
parent669b562a737c9418c53bfae69c0dbf1aabe318b4 (diff)
parent7a2af605c2c2b0d2e9bbb0b161eba8842acefbcb (diff)
downloadvcxsrv-d6f64084b9bc07d0bdd527f9354f2d1d962ed16d.tar.gz
vcxsrv-d6f64084b9bc07d0bdd527f9354f2d1d962ed16d.tar.bz2
vcxsrv-d6f64084b9bc07d0bdd527f9354f2d1d962ed16d.zip
Merge remote-tracking branch 'origin/released'
Conflicts: fontconfig/src/fcint.h fontconfig/src/fcstat.c mesalib/src/mapi/glapi/gen/GL3x.xml xorg-server/glx/glxext.h
Diffstat (limited to 'xorg-server')
-rw-r--r--xorg-server/Xi/exevents.c25
-rw-r--r--xorg-server/Xi/xichangehierarchy.c6
-rw-r--r--xorg-server/configure.ac2
-rw-r--r--xorg-server/dix/devices.c61
-rw-r--r--xorg-server/dix/events.c12
-rw-r--r--xorg-server/dix/getevents.c5
-rw-r--r--xorg-server/dix/main.c4
-rw-r--r--xorg-server/dix/touch.c23
-rw-r--r--xorg-server/glx/clientinfo.c49
-rw-r--r--xorg-server/glx/createcontext.c213
-rw-r--r--xorg-server/glx/extension_string.c38
-rw-r--r--xorg-server/glx/extension_string.h4
-rw-r--r--xorg-server/glx/glxcmds.c77
-rw-r--r--xorg-server/glx/glxcontext.h13
-rw-r--r--xorg-server/glx/glxdri.c12
-rw-r--r--xorg-server/glx/glxdri2.c161
-rw-r--r--xorg-server/glx/glxdriswrast.c12
-rw-r--r--xorg-server/glx/glxext.c13
-rw-r--r--xorg-server/glx/glxext.h2
-rw-r--r--xorg-server/glx/glxscreens.h5
-rw-r--r--xorg-server/glx/glxserver.h2
-rw-r--r--xorg-server/hw/dmx/dmx.c3
-rw-r--r--xorg-server/hw/xfree86/common/compiler.h17
-rw-r--r--xorg-server/hw/xfree86/fbdevhw/fbdevhwstub.c2
-rw-r--r--xorg-server/hw/xfree86/int10/generic.c8
-rw-r--r--xorg-server/include/dix.h2
-rw-r--r--xorg-server/include/input.h2
-rw-r--r--xorg-server/include/misc.h12
-rw-r--r--xorg-server/test/touch.c5
-rw-r--r--xorg-server/xkb/xkbAccessX.c9
30 files changed, 652 insertions, 147 deletions
diff --git a/xorg-server/Xi/exevents.c b/xorg-server/Xi/exevents.c
index 99224088e..7d7974400 100644
--- a/xorg-server/Xi/exevents.c
+++ b/xorg-server/Xi/exevents.c
@@ -928,10 +928,10 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent *event)
else if (event->type == ET_ProximityOut)
device->proximity->in_proximity = FALSE;
else if (event->type == ET_TouchBegin) {
- BUG_WARN(!b || !v);
- BUG_WARN(!t);
+ BUG_RETURN_VAL(!b || !v, DONT_PROCESS);
+ BUG_RETURN_VAL(!t, DONT_PROCESS);
- if (!b || !t || !b->map[key])
+ if (!b->map[key])
return DONT_PROCESS;
if (!(event->flags & TOUCH_POINTER_EMULATED) ||
@@ -943,10 +943,10 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent *event)
UpdateDeviceMotionMask(device, t->state, DeviceButtonMotionMask);
}
else if (event->type == ET_TouchEnd) {
- BUG_WARN(!b || !v);
- BUG_WARN(!t);
+ BUG_RETURN_VAL(!b || !v, DONT_PROCESS);
+ BUG_RETURN_VAL(!t, DONT_PROCESS);
- if (!b || !t || t->buttonsDown <= 0 || !b->map[key])
+ if (t->buttonsDown <= 0 || !b->map[key])
return DONT_PROCESS;
if (!(event->flags & TOUCH_POINTER_EMULATED))
@@ -1358,9 +1358,8 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
wOtherInputMasks(*win)->inputClients, next)
if (xi2mask_isset(iclients->xi2mask, dev, evtype))
break;
- BUG_WARN(!iclients);
- if (!iclients)
- return FALSE;
+
+ BUG_RETURN_VAL(!iclients, FALSE);
*mask = iclients->xi2mask;
*client = rClient(iclients);
@@ -1373,9 +1372,7 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
wOtherInputMasks(*win)->inputClients, next)
if (iclients->mask[dev->id] & xi_filter)
break;
- BUG_WARN(!iclients);
- if (!iclients)
- return FALSE;
+ BUG_RETURN_VAL(!iclients, FALSE);
*client = rClient(iclients);
}
@@ -1416,9 +1413,7 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
return Success;
nevents = TouchConvertToPointerEvent(ev, &motion, &button);
- BUG_WARN(nevents == 0);
- if (nevents == 0)
- return BadValue;
+ BUG_RETURN_VAL(nevents == 0, BadValue);
if (nevents > 1)
ptrev = &button;
diff --git a/xorg-server/Xi/xichangehierarchy.c b/xorg-server/Xi/xichangehierarchy.c
index 756aaac06..89f16d8be 100644
--- a/xorg-server/Xi/xichangehierarchy.c
+++ b/xorg-server/Xi/xichangehierarchy.c
@@ -293,12 +293,6 @@ remove_master(ClientPtr client, xXIRemoveMasterInfo * r, int flags[MAXDEVICES])
}
}
- /* can't disable until we removed pairing */
- keybd->spriteInfo->paired = NULL;
- ptr->spriteInfo->paired = NULL;
- XTestptr->spriteInfo->paired = NULL;
- XTestkeybd->spriteInfo->paired = NULL;
-
/* disable the remove the devices, XTest devices must be done first
else the sprites they rely on will be destroyed */
DisableDevice(XTestptr, FALSE);
diff --git a/xorg-server/configure.ac b/xorg-server/configure.ac
index 9ae77fbae..fb3d12092 100644
--- a/xorg-server/configure.ac
+++ b/xorg-server/configure.ac
@@ -777,7 +777,7 @@ DRI2PROTO="dri2proto >= 2.7"
XINERAMAPROTO="xineramaproto"
BIGFONTPROTO="xf86bigfontproto >= 1.2.0"
DGAPROTO="xf86dgaproto >= 2.0.99.1"
-GLPROTO="glproto >= 1.4.14"
+GLPROTO="glproto >= 1.4.15"
DMXPROTO="dmxproto >= 2.2.99.1"
VIDMODEPROTO="xf86vidmodeproto >= 2.2.99.1"
WINDOWSWMPROTO="windowswmproto"
diff --git a/xorg-server/dix/devices.c b/xorg-server/dix/devices.c
index 7f70ca69a..02c560216 100644
--- a/xorg-server/dix/devices.c
+++ b/xorg-server/dix/devices.c
@@ -182,12 +182,9 @@ DeviceSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
/* Pair the keyboard to the pointer device. Keyboard events will follow the
* pointer sprite. Only applicable for master devices.
- * If the client is set, the request to pair comes from some client. In this
- * case, we need to check for access. If the client is NULL, it's from an
- * internal automatic pairing, we must always permit this.
*/
static int
-PairDevices(ClientPtr client, DeviceIntPtr ptr, DeviceIntPtr kbd)
+PairDevices(DeviceIntPtr ptr, DeviceIntPtr kbd)
{
if (!ptr)
return BadDevice;
@@ -369,13 +366,12 @@ EnableDevice(DeviceIntPtr dev, BOOL sendevent)
/* mode doesn't matter */
EnterWindow(dev, screenInfo.screens[0]->root, NotifyAncestor);
}
- else if ((other = NextFreePointerDevice()) == NULL) {
- ErrorF("[dix] cannot find pointer to pair with. "
- "This is a bug.\n");
- return FALSE;
+ else {
+ other = NextFreePointerDevice();
+ BUG_RETURN_VAL_MSG(other == NULL, FALSE,
+ "[dix] cannot find pointer to pair with.\n");
+ PairDevices(other, dev);
}
- else
- PairDevices(NULL, other, dev);
}
else {
if (dev->coreEvents)
@@ -436,6 +432,9 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
BOOL enabled;
int flags[MAXDEVICES] = { 0 };
+ if (!dev->enabled)
+ return TRUE;
+
for (prev = &inputInfo.devices;
*prev && (*prev != dev); prev = &(*prev)->next);
if (*prev != dev)
@@ -462,18 +461,19 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
}
if (IsMaster(dev) && dev->spriteInfo->sprite) {
- for (other = inputInfo.devices; other; other = other->next) {
- if (other->spriteInfo->paired == dev) {
- ErrorF("[dix] cannot disable device, still paired. "
- "This is a bug. \n");
- return FALSE;
- }
- }
+ for (other = inputInfo.devices; other; other = other->next)
+ if (other->spriteInfo->paired == dev && !other->spriteInfo->spriteOwner)
+ DisableDevice(other, sendevent);
}
+ if (dev->spriteInfo->paired)
+ dev->spriteInfo->paired = NULL;
+
(void) (*dev->deviceProc) (dev, DEVICE_OFF);
dev->enabled = FALSE;
+ FreeSprite(dev);
+
/* now that the device is disabled, we can reset the signal handler's
* last.slave */
OsBlockSignals();
@@ -505,6 +505,26 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
return TRUE;
}
+void
+DisableAllDevices(void)
+{
+ DeviceIntPtr dev, tmp;
+
+ nt_list_for_each_entry_safe(dev, tmp, inputInfo.devices, next) {
+ if (!IsMaster(dev))
+ DisableDevice(dev, FALSE);
+ }
+ /* master keyboards need to be disabled first */
+ nt_list_for_each_entry_safe(dev, tmp, inputInfo.devices, next) {
+ if (dev->enabled && IsMaster(dev) && IsKeyboardDevice(dev))
+ DisableDevice(dev, FALSE);
+ }
+ nt_list_for_each_entry_safe(dev, tmp, inputInfo.devices, next) {
+ if (dev->enabled)
+ DisableDevice(dev, FALSE);
+ }
+}
+
/**
* Initialise a new device through the driver and tell all clients about the
* new device.
@@ -927,12 +947,7 @@ CloseDevice(DeviceIntPtr dev)
free(classes);
}
- if (DevHasCursor(dev) && dev->spriteInfo->sprite) {
- if (dev->spriteInfo->sprite->current)
- FreeCursor(dev->spriteInfo->sprite->current, None);
- free(dev->spriteInfo->sprite->spriteTrace);
- free(dev->spriteInfo->sprite);
- }
+ FreeSprite(dev);
/* a client may have the device set as client pointer */
for (j = 0; j < currentMaxClients; j++) {
diff --git a/xorg-server/dix/events.c b/xorg-server/dix/events.c
index 47c61d42b..009e21b5d 100644
--- a/xorg-server/dix/events.c
+++ b/xorg-server/dix/events.c
@@ -3198,6 +3198,18 @@ InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin)
#endif
}
+void FreeSprite(DeviceIntPtr dev)
+{
+ if (DevHasCursor(dev) && dev->spriteInfo->sprite) {
+ if (dev->spriteInfo->sprite->current)
+ FreeCursor(dev->spriteInfo->sprite->current, None);
+ free(dev->spriteInfo->sprite->spriteTrace);
+ free(dev->spriteInfo->sprite);
+ }
+ dev->spriteInfo->sprite = NULL;
+}
+
+
/**
* Update the mouse sprite info when the server switches from a pScreen to another.
* Otherwise, the pScreen of the mouse sprite is never updated when we switch
diff --git a/xorg-server/dix/getevents.c b/xorg-server/dix/getevents.c
index 7242c2c79..e1b26783f 100644
--- a/xorg-server/dix/getevents.c
+++ b/xorg-server/dix/getevents.c
@@ -1842,10 +1842,7 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid,
if (flags & TOUCH_CLIENT_ID) { /* A DIX-submitted TouchEnd */
touchpoint.dix_ti = TouchFindByClientID(dev, ddx_touchid);
- BUG_WARN(!touchpoint.dix_ti);
-
- if (!touchpoint.dix_ti)
- return 0;
+ BUG_RETURN_VAL(!touchpoint.dix_ti, 0);
if (!mask_in ||
!valuator_mask_isset(mask_in, 0) ||
diff --git a/xorg-server/dix/main.c b/xorg-server/dix/main.c
index 92f5dcb49..217117eb0 100644
--- a/xorg-server/dix/main.c
+++ b/xorg-server/dix/main.c
@@ -104,6 +104,7 @@ Equipment Corporation.
#include "privates.h"
#include "registry.h"
#include "client.h"
+#include "exevents.h"
#ifdef PANORAMIX
#include "panoramiXsrv.h"
#else
@@ -344,6 +345,7 @@ main(int argc, char *argv[], char *envp[])
#endif
UndisplayDevices();
+ DisableAllDevices();
/* Now free up whatever must be freed */
if (screenIsSaved == SCREEN_SAVER_ON)
@@ -367,7 +369,9 @@ main(int argc, char *argv[], char *envp[])
for (i = 0; i < screenInfo.numScreens; i++)
screenInfo.screens[i]->root = NullWindow;
+
CloseDownDevices();
+
CloseDownEvents();
for (i = screenInfo.numScreens - 1; i >= 0; i--) {
diff --git a/xorg-server/dix/touch.c b/xorg-server/dix/touch.c
index 401cb981a..aa17faf28 100644
--- a/xorg-server/dix/touch.c
+++ b/xorg-server/dix/touch.c
@@ -103,11 +103,11 @@ TouchResizeQueue(ClientPtr client, pointer closure)
tmp = realloc(dev->last.touches, size * sizeof(*dev->last.touches));
if (tmp) {
- int i;
+ int j;
dev->last.touches = tmp;
- for (i = dev->last.num_touches; i < size; i++)
- TouchInitDDXTouchPoint(dev, &dev->last.touches[i]);
+ for (j = dev->last.num_touches; j < size; j++)
+ TouchInitDDXTouchPoint(dev, &dev->last.touches[j]);
dev->last.num_touches = size;
}
@@ -598,8 +598,8 @@ TouchConvertToPointerEvent(const InternalEvent *event,
int ptrtype;
int nevents = 0;
- BUG_WARN(!event);
- BUG_WARN(!motion_event);
+ BUG_RETURN_VAL(!event, 0);
+ BUG_RETURN_VAL(!motion_event, 0);
switch (event->any.type) {
case ET_TouchUpdate:
@@ -627,7 +627,7 @@ TouchConvertToPointerEvent(const InternalEvent *event,
motion_event->device_event.flags = XIPointerEmulated;
if (nevents > 1) {
- BUG_WARN(!button_event);
+ BUG_RETURN_VAL(!button_event, 0);
*button_event = *event;
button_event->any.type = ptrtype;
button_event->device_event.flags = XIPointerEmulated;
@@ -966,10 +966,8 @@ TouchListenerAcceptReject(DeviceIntPtr dev, TouchPointInfoPtr ti, int listener,
int nev;
int i;
- BUG_WARN(listener < 0);
- BUG_WARN(listener >= ti->num_listeners);
- if (listener < 0 || listener >= ti->num_listeners)
- return BadMatch;
+ BUG_RETURN_VAL(listener < 0, BadMatch);
+ BUG_RETURN_VAL(listener >= ti->num_listeners, BadMatch);
if (listener > 0) {
if (mode == XIRejectTouch)
@@ -981,10 +979,7 @@ TouchListenerAcceptReject(DeviceIntPtr dev, TouchPointInfoPtr ti, int listener,
}
events = InitEventList(GetMaximumEventsNum());
- if (!events) {
- BUG_WARN_MSG(TRUE, "Failed to allocate touch ownership events\n");
- return BadAlloc;
- }
+ BUG_RETURN_VAL_MSG(!events, BadAlloc, "Failed to allocate touch ownership events\n");
nev = GetTouchOwnershipEvents(events, dev, ti, mode,
ti->listeners[0].listener, 0);
diff --git a/xorg-server/glx/clientinfo.c b/xorg-server/glx/clientinfo.c
index 15bbf15af..b26ac1a72 100644
--- a/xorg-server/glx/clientinfo.c
+++ b/xorg-server/glx/clientinfo.c
@@ -26,17 +26,62 @@
#include "glxserver.h"
#include "indirect_dispatch.h"
+#include "glxbyteorder.h"
+#include "unpack.h"
int
__glXDisp_SetClientInfoARB(__GLXclientState * cl, GLbyte * pc)
{
- return BadRequest;
+ xGLXSetClientInfoARBReq *req = (xGLXSetClientInfoARBReq *) pc;
+ char *gl_extensions;
+ char *glx_extensions;
+
+ /* Verify that the size of the packet matches the size inferred from the
+ * sizes specified for the various fields.
+ */
+ const unsigned expected_size = sz_xGLXSetClientInfoARBReq
+ + (req->numVersions * 8)
+ + __GLX_PAD(req->numGLExtensionBytes)
+ + __GLX_PAD(req->numGLXExtensionBytes);
+
+ if (req->length != (expected_size / 4))
+ return BadLength;
+
+ /* Verify that the actual length of the GL extension string matches what's
+ * encoded in protocol packet.
+ */
+ gl_extensions = (char *) (req + 1) + (req->numVersions * 8);
+ if (req->numGLExtensionBytes != 0
+ && memchr(gl_extensions, 0,
+ __GLX_PAD(req->numGLExtensionBytes)) == NULL)
+ return BadLength;
+
+ /* Verify that the actual length of the GLX extension string matches
+ * what's encoded in protocol packet.
+ */
+ glx_extensions = gl_extensions + __GLX_PAD(req->numGLExtensionBytes);
+ if (req->numGLXExtensionBytes != 0
+ && memchr(glx_extensions, 0,
+ __GLX_PAD(req->numGLXExtensionBytes)) == NULL)
+ return BadLength;
+
+ free(cl->GLClientextensions);
+ cl->GLClientextensions = strdup(gl_extensions);
+
+ return 0;
}
int
__glXDispSwap_SetClientInfoARB(__GLXclientState * cl, GLbyte * pc)
{
- return BadRequest;
+ xGLXSetClientInfoARBReq *req = (xGLXSetClientInfoARBReq *) pc;
+
+ req->length = bswap_16(req->length);
+ req->numVersions = bswap_32(req->numVersions);
+ req->numGLExtensionBytes = bswap_32(req->numGLExtensionBytes);
+ req->numGLXExtensionBytes = bswap_32(req->numGLXExtensionBytes);
+
+ return __glXDisp_SetClientInfoARB(cl, pc);
}
int
diff --git a/xorg-server/glx/createcontext.c b/xorg-server/glx/createcontext.c
index 9c1eab3e4..025c423fe 100644
--- a/xorg-server/glx/createcontext.c
+++ b/xorg-server/glx/createcontext.c
@@ -24,13 +24,224 @@
#include <dix-config.h>
#endif
+#include <GL/glxtokens.h>
#include "glxserver.h"
+#include "glxext.h"
#include "indirect_dispatch.h"
+#define ALL_VALID_FLAGS \
+ (GLX_CONTEXT_DEBUG_BIT_ARB | GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB)
+
+static Bool
+validate_GL_version(int major_version, int minor_version)
+{
+ if (major_version <= 0 || minor_version < 0)
+ return False;
+
+ switch (major_version) {
+ case 1:
+ if (minor_version > 5)
+ return False;
+ break;
+
+ case 2:
+ if (minor_version > 1)
+ return False;
+ break;
+
+ case 3:
+ if (minor_version > 3)
+ return False;
+ break;
+
+ default:
+ break;
+ }
+
+ return True;
+}
+
+static Bool
+validate_render_type(uint32_t render_type)
+{
+ switch (render_type) {
+ case GLX_RGBA_TYPE:
+ case GLX_COLOR_INDEX_TYPE:
+ return True;
+ default:
+ return False;
+ }
+}
+
int
__glXDisp_CreateContextAttribsARB(__GLXclientState * cl, GLbyte * pc)
{
- return BadRequest;
+ ClientPtr client = cl->client;
+ xGLXCreateContextAttribsARBReq *req = (xGLXCreateContextAttribsARBReq *) pc;
+ int32_t *attribs = (req->numAttribs != 0) ? (int32_t *) (req + 1) : NULL;
+ unsigned i;
+ int major_version = 1;
+ int minor_version = 0;
+ uint32_t flags = 0;
+ uint32_t render_type = GLX_RGBA_TYPE;
+ __GLXcontext *ctx = NULL;
+ __GLXcontext *shareCtx = NULL;
+ __GLXscreen *glxScreen;
+ __GLXconfig *config;
+ int err;
+
+ /* Verify that the size of the packet matches the size inferred from the
+ * sizes specified for the various fields.
+ */
+ const unsigned expected_size = (sz_xGLXCreateContextAttribsARBReq
+ + (req->numAttribs * 8)) / 4;
+
+ if (req->length != expected_size)
+ return BadLength;
+
+ LEGAL_NEW_RESOURCE(req->context, client);
+
+ /* The GLX_ARB_create_context spec says:
+ *
+ * "* If <config> is not a valid GLXFBConfig, GLXBadFBConfig is
+ * generated."
+ *
+ * On the client, the screen comes from the FBConfig, so GLXBadFBConfig
+ * should be issued if the screen is nonsense.
+ */
+ if (!validGlxScreen(client, req->screen, &glxScreen, &err))
+ return __glXError(GLXBadFBConfig);
+
+ if (!validGlxFBConfig(client, glxScreen, req->fbconfig, &config, &err))
+ return __glXError(GLXBadFBConfig);
+
+ /* Validate the context with which the new context should share resources.
+ */
+ if (req->shareList != None) {
+ if (!validGlxContext(client, req->shareList, DixReadAccess,
+ &shareCtx, &err))
+ return err;
+
+ /* The crazy condition is because C doesn't have a logical XOR
+ * operator. Comparing directly for equality may fail if one is 1 and
+ * the other is 2 even though both are logically true.
+ */
+ if (!!req->isDirect != !!shareCtx->isDirect) {
+ client->errorValue = req->shareList;
+ return BadMatch;
+ }
+
+ /* The GLX_ARB_create_context spec says:
+ *
+ * "* If the server context state for <share_context>...was
+ * created on a different screen than the one referenced by
+ * <config>...BadMatch is generated."
+ */
+ if (glxScreen != shareCtx->pGlxScreen) {
+ client->errorValue = shareCtx->pGlxScreen->pScreen->myNum;
+ return BadMatch;
+ }
+ }
+
+ for (i = 0; i < req->numAttribs; i++) {
+ switch (attribs[i * 2]) {
+ case GLX_CONTEXT_MAJOR_VERSION_ARB:
+ major_version = attribs[2 * i + 1];
+ break;
+
+ case GLX_CONTEXT_MINOR_VERSION_ARB:
+ minor_version = attribs[2 * i + 1];
+ break;
+
+ case GLX_CONTEXT_FLAGS_ARB:
+ flags = attribs[2 * i + 1];
+ break;
+
+ case GLX_RENDER_TYPE:
+ render_type = attribs[2 * i + 1];
+ break;
+
+ default:
+ return BadValue;
+ }
+ }
+
+ /* The GLX_ARB_create_context spec says:
+ *
+ * "If attributes GLX_CONTEXT_MAJOR_VERSION_ARB and
+ * GLX_CONTEXT_MINOR_VERSION_ARB, when considered together
+ * with attributes GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB and
+ * GLX_RENDER_TYPE, specify an OpenGL version and feature set
+ * that are not defined, BadMatch is generated.
+ *
+ * ...Feature deprecation was introduced with OpenGL 3.0, so
+ * forward-compatible contexts may only be requested for
+ * OpenGL 3.0 and above. Thus, examples of invalid
+ * combinations of attributes include:
+ *
+ * - Major version < 1 or > 3
+ * - Major version == 1 and minor version < 0 or > 5
+ * - Major version == 2 and minor version < 0 or > 1
+ * - Major version == 3 and minor version > 2
+ * - Forward-compatible flag set and major version < 3
+ * - Color index rendering and major version >= 3"
+ */
+ if (!validate_GL_version(major_version, minor_version))
+ return BadMatch;
+
+ if (major_version < 3
+ && ((flags & GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB) != 0))
+ return BadMatch;
+
+ if (major_version >= 3 && render_type == GLX_COLOR_INDEX_TYPE)
+ return BadMatch;
+
+ if (!validate_render_type(render_type))
+ return BadValue;
+
+ if ((flags & ~ALL_VALID_FLAGS) != 0)
+ return BadValue;
+
+ /* Allocate memory for the new context
+ */
+ if (req->isDirect) {
+ ctx = __glXdirectContextCreate(glxScreen, config, shareCtx);
+ err = BadAlloc;
+ }
+ else {
+ ctx = glxScreen->createContext(glxScreen, config, shareCtx,
+ req->numAttribs, (uint32_t *) attribs,
+ &err);
+ }
+
+ if (ctx == NULL)
+ return err;
+
+ ctx->pGlxScreen = glxScreen;
+ ctx->config = config;
+ ctx->id = req->context;
+ ctx->share_id = req->shareList;
+ ctx->idExists = True;
+ ctx->isCurrent = False;
+ ctx->isDirect = req->isDirect;
+ ctx->hasUnflushedCommands = False;
+ ctx->renderMode = GL_RENDER;
+ ctx->feedbackBuf = NULL;
+ ctx->feedbackBufSize = 0;
+ ctx->selectBuf = NULL;
+ ctx->selectBufSize = 0;
+ ctx->drawPriv = NULL;
+ ctx->readPriv = NULL;
+
+ /* Add the new context to the various global tables of GLX contexts.
+ */
+ if (!__glXAddContext(ctx)) {
+ (*ctx->destroy) (ctx);
+ client->errorValue = req->context;
+ return BadAlloc;
+ }
+
+ return Success;
}
int
diff --git a/xorg-server/glx/extension_string.c b/xorg-server/glx/extension_string.c
index 866f8bf45..6a1a6c6b2 100644
--- a/xorg-server/glx/extension_string.c
+++ b/xorg-server/glx/extension_string.c
@@ -67,23 +67,27 @@ struct extension_info {
static const struct extension_info known_glx_extensions[] = {
/* GLX_ARB_get_proc_address is implemented on the client. */
- {GLX(ARB_multisample), VER(1, 4), Y,},
-
- {GLX(EXT_import_context), VER(0, 0), Y,},
- {GLX(EXT_texture_from_pixmap), VER(0, 0), Y,},
- {GLX(EXT_visual_info), VER(0, 0), Y,},
- {GLX(EXT_visual_rating), VER(0, 0), Y,},
-
- {GLX(MESA_copy_sub_buffer), VER(0, 0), N,},
- {GLX(OML_swap_method), VER(0, 0), Y,},
- {GLX(SGI_make_current_read), VER(1, 3), N,},
- {GLX(SGI_swap_control), VER(0, 0), N,},
- {GLX(SGIS_multisample), VER(0, 0), Y,},
- {GLX(SGIX_fbconfig), VER(1, 3), Y,},
- {GLX(SGIX_pbuffer), VER(1, 3), Y,},
- {GLX(SGIX_visual_select_group), VER(0, 0), Y,},
- {GLX(INTEL_swap_event), VER(1, 4), N,},
- {NULL}
+ /* *INDENT-OFF* */
+ { GLX(ARB_create_context), VER(0,0), N, },
+ { GLX(ARB_create_context_profile), VER(0,0), N, },
+ { GLX(ARB_multisample), VER(1,4), Y, },
+
+ { GLX(EXT_import_context), VER(0,0), Y, },
+ { GLX(EXT_texture_from_pixmap), VER(0,0), Y, },
+ { GLX(EXT_visual_info), VER(0,0), Y, },
+ { GLX(EXT_visual_rating), VER(0,0), Y, },
+
+ { GLX(MESA_copy_sub_buffer), VER(0,0), N, },
+ { GLX(OML_swap_method), VER(0,0), Y, },
+ { GLX(SGI_make_current_read), VER(1,3), N, },
+ { GLX(SGI_swap_control), VER(0,0), N, },
+ { GLX(SGIS_multisample), VER(0,0), Y, },
+ { GLX(SGIX_fbconfig), VER(1,3), Y, },
+ { GLX(SGIX_pbuffer), VER(1,3), Y, },
+ { GLX(SGIX_visual_select_group), VER(0,0), Y, },
+ { GLX(INTEL_swap_event), VER(1,4), N, },
+ { NULL }
+ /* *INDENT-ON* */
};
/**
diff --git a/xorg-server/glx/extension_string.h b/xorg-server/glx/extension_string.h
index e02213f8f..947bf89e6 100644
--- a/xorg-server/glx/extension_string.h
+++ b/xorg-server/glx/extension_string.h
@@ -36,7 +36,9 @@
enum {
/* GLX_ARB_get_proc_address is implemented on the client. */
- ARB_multisample_bit = 0,
+ ARB_create_context_bit = 0,
+ ARB_create_context_profile_bit,
+ ARB_multisample_bit,
EXT_import_context_bit,
EXT_texture_from_pixmap_bit,
EXT_visual_info_bit,
diff --git a/xorg-server/glx/glxcmds.c b/xorg-server/glx/glxcmds.c
index a74f3fcf7..265b8efa5 100644
--- a/xorg-server/glx/glxcmds.c
+++ b/xorg-server/glx/glxcmds.c
@@ -54,7 +54,7 @@
#include "indirect_table.h"
#include "indirect_util.h"
-static int
+_X_HIDDEN int
validGlxScreen(ClientPtr client, int screen, __GLXscreen ** pGlxScreen,
int *err)
{
@@ -71,7 +71,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen ** pGlxScreen,
return TRUE;
}
-static int
+_X_HIDDEN int
validGlxFBConfig(ClientPtr client, __GLXscreen * pGlxScreen, XID id,
__GLXconfig ** config, int *err)
{
@@ -135,7 +135,7 @@ validGlxFBConfigForWindow(ClientPtr client, __GLXconfig * config,
return TRUE;
}
-static int
+_X_HIDDEN int
validGlxContext(ClientPtr client, XID id, int access_mode,
__GLXcontext ** context, int *err)
{
@@ -204,7 +204,7 @@ __glXdirectContextDestroy(__GLXcontext * context)
free(context);
}
-static __GLXcontext *
+_X_HIDDEN __GLXcontext *
__glXdirectContextCreate(__GLXscreen * screen,
__GLXconfig * modes, __GLXcontext * shareContext)
{
@@ -261,20 +261,20 @@ DoCreateContext(__GLXclientState * cl, GLXContextID gcId,
&shareglxc, &err))
return err;
- if (shareglxc->isDirect) {
- /*
- ** NOTE: no support for sharing display lists between direct
- ** contexts, even if they are in the same address space.
- */
-#if 0
- /* Disabling this code seems to allow shared display lists
- * and texture objects to work. We'll leave it disabled for now.
- */
+ /* Page 26 (page 32 of the PDF) of the GLX 1.4 spec says:
+ *
+ * "The server context state for all sharing contexts must exist
+ * in a single address space or a BadMatch error is generated."
+ *
+ * If the share context is indirect, force the new context to also be
+ * indirect. If the shard context is direct but the new context
+ * cannot be direct, generate BadMatch.
+ */
+ if (shareglxc->isDirect && !isDirect) {
client->errorValue = shareList;
return BadMatch;
-#endif
}
- else {
+ else if (!shareglxc->isDirect) {
/*
** Create an indirect context regardless of what the client asked
** for; this way we can share display list space with shareList.
@@ -286,42 +286,45 @@ DoCreateContext(__GLXclientState * cl, GLXContextID gcId,
/*
** Allocate memory for the new context
*/
- if (!isDirect)
- glxc = pGlxScreen->createContext(pGlxScreen, config, shareglxc);
+ if (!isDirect) {
+ /* Without any attributes, the only error that the driver should be
+ * able to generate is BadAlloc. As result, just drop the error
+ * returned from the driver on the floor.
+ */
+ glxc = pGlxScreen->createContext(pGlxScreen, config, shareglxc,
+ 0, NULL, &err);
+ }
else
glxc = __glXdirectContextCreate(pGlxScreen, config, shareglxc);
if (!glxc) {
return BadAlloc;
}
- /*
- ** Initially, setup the part of the context that could be used by
- ** a GL core that needs windowing information (e.g., Mesa).
+ /* Initialize the GLXcontext structure.
*/
glxc->pGlxScreen = pGlxScreen;
glxc->config = config;
-
- /*
- ** Register this context as a resource.
- */
- if (!AddResource(gcId, __glXContextRes, (pointer) glxc)) {
- (*glxc->destroy) (glxc);
- client->errorValue = gcId;
- return BadAlloc;
- }
-
- /*
- ** Finally, now that everything is working, setup the rest of the
- ** context.
- */
glxc->id = gcId;
glxc->share_id = shareList;
glxc->idExists = GL_TRUE;
glxc->isCurrent = GL_FALSE;
glxc->isDirect = isDirect;
+ glxc->hasUnflushedCommands = GL_FALSE;
glxc->renderMode = GL_RENDER;
-
- __glXAddToContextList(glxc);
+ glxc->feedbackBuf = NULL;
+ glxc->feedbackBufSize = 0;
+ glxc->selectBuf = NULL;
+ glxc->selectBufSize = 0;
+ glxc->drawPriv = NULL;
+ glxc->readPriv = NULL;
+
+ /* Add the new context to the various global tables of GLX contexts.
+ */
+ if (!__glXAddContext(glxc)) {
+ (*glxc->destroy) (glxc);
+ client->errorValue = gcId;
+ return BadAlloc;
+ }
return Success;
}
@@ -2412,8 +2415,6 @@ __glXDisp_ClientInfo(__GLXclientState * cl, GLbyte * pc)
if (!memchr(buf, 0, (client->req_len << 2) - sizeof(xGLXClientInfoReq)))
return BadLength;
- cl->GLClientmajorVersion = req->major;
- cl->GLClientminorVersion = req->minor;
free(cl->GLClientextensions);
cl->GLClientextensions = strdup(buf);
diff --git a/xorg-server/glx/glxcontext.h b/xorg-server/glx/glxcontext.h
index ef2c4dbd5..b803a7fd1 100644
--- a/xorg-server/glx/glxcontext.h
+++ b/xorg-server/glx/glxcontext.h
@@ -121,4 +121,17 @@ struct __GLXcontext {
void __glXContextDestroy(__GLXcontext * context);
+extern int validGlxScreen(ClientPtr client, int screen,
+ __GLXscreen ** pGlxScreen, int *err);
+
+extern int validGlxFBConfig(ClientPtr client, __GLXscreen * pGlxScreen,
+ XID id, __GLXconfig ** config, int *err);
+
+extern int validGlxContext(ClientPtr client, XID id, int access_mode,
+ __GLXcontext ** context, int *err);
+
+extern __GLXcontext *__glXdirectContextCreate(__GLXscreen * screen,
+ __GLXconfig * modes,
+ __GLXcontext * shareContext);
+
#endif /* !__GLX_context_h__ */
diff --git a/xorg-server/glx/glxdri.c b/xorg-server/glx/glxdri.c
index 24749dbdd..9e6254756 100644
--- a/xorg-server/glx/glxdri.c
+++ b/xorg-server/glx/glxdri.c
@@ -602,7 +602,10 @@ __glXDRIscreenDestroy(__GLXscreen * baseScreen)
static __GLXcontext *
__glXDRIscreenCreateContext(__GLXscreen * baseScreen,
__GLXconfig * glxConfig,
- __GLXcontext * baseShareContext)
+ __GLXcontext * baseShareContext,
+ unsigned num_attribs,
+ const uint32_t *attribs,
+ int *error)
{
__GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
__GLXDRIcontext *context, *shareContext;
@@ -614,6 +617,13 @@ __glXDRIscreenCreateContext(__GLXscreen * baseScreen,
drm_context_t hwContext;
ScreenPtr pScreen = baseScreen->pScreen;
+ /* DRI1 cannot support createContextAttribs, so these parameters will
+ * never be used.
+ */
+ (void) num_attribs;
+ (void) attribs;
+ (void) error;
+
shareContext = (__GLXDRIcontext *) baseShareContext;
if (shareContext)
driShare = shareContext->driContext;
diff --git a/xorg-server/glx/glxdri2.c b/xorg-server/glx/glxdri2.c
index 6614666ca..7b76c3a5f 100644
--- a/xorg-server/glx/glxdri2.c
+++ b/xorg-server/glx/glxdri2.c
@@ -47,6 +47,7 @@
#include "glxserver.h"
#include "glxutil.h"
#include "glxdricommon.h"
+#include <GL/glxtokens.h>
#include "glapitable.h"
#include "glapi.h"
@@ -377,10 +378,150 @@ __glXDRIscreenDestroy(__GLXscreen * baseScreen)
free(screen);
}
+static Bool
+dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
+ unsigned *major_ver, unsigned *minor_ver,
+ uint32_t *flags, unsigned *error)
+{
+ unsigned i;
+
+ if (num_attribs == 0)
+ return True;
+
+ if (attribs == NULL) {
+ *error = BadImplementation;
+ return False;
+ }
+
+ *major_ver = 1;
+ *minor_ver = 0;
+
+ for (i = 0; i < num_attribs; i++) {
+ switch (attribs[i * 2]) {
+ case GLX_CONTEXT_MAJOR_VERSION_ARB:
+ *major_ver = attribs[i * 2 + 1];
+ break;
+ case GLX_CONTEXT_MINOR_VERSION_ARB:
+ *minor_ver = attribs[i * 2 + 1];
+ break;
+ case GLX_CONTEXT_FLAGS_ARB:
+ *flags = attribs[i * 2 + 1];
+ break;
+ case GLX_RENDER_TYPE:
+ break;
+ default:
+ /* If an unknown attribute is received, fail.
+ */
+ *error = BadValue;
+ return False;
+ }
+ }
+
+ /* Unknown flag value.
+ */
+ if (*flags & ~(__DRI_CTX_FLAG_DEBUG | __DRI_CTX_FLAG_FORWARD_COMPATIBLE)) {
+ *error = BadValue;
+ return False;
+ }
+
+ *error = Success;
+ return True;
+}
+
+static void
+create_driver_context(__GLXDRIcontext * context,
+ __GLXDRIscreen * screen,
+ __GLXDRIconfig * config,
+ __DRIcontext * driShare,
+ unsigned num_attribs,
+ const uint32_t *attribs,
+ int *error)
+{
+ context->driContext = NULL;
+
+#if __DRI_DRI2_VERSION >= 3
+ if (screen->dri2->base.version >= 3) {
+ uint32_t ctx_attribs[3 * 2];
+ unsigned num_ctx_attribs = 0;
+ unsigned dri_err = 0;
+ unsigned major_ver;
+ unsigned minor_ver;
+ uint32_t flags;
+
+ if (num_attribs != 0) {
+ if (!dri2_convert_glx_attribs(num_attribs, attribs,
+ &major_ver, &minor_ver,
+ &flags, (unsigned *) error))
+ return NULL;
+
+ ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_MAJOR_VERSION;
+ ctx_attribs[num_ctx_attribs++] = major_ver;
+ ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_MINOR_VERSION;
+ ctx_attribs[num_ctx_attribs++] = minor_ver;
+
+ if (flags != 0) {
+ ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_FLAGS;
+
+ /* The current __DRI_CTX_FLAG_* values are identical to the
+ * GLX_CONTEXT_*_BIT values.
+ */
+ ctx_attribs[num_ctx_attribs++] = flags;
+ }
+ }
+
+ context->driContext =
+ (*screen->dri2->createContextAttribs)(screen->driScreen,
+ __DRI_API_OPENGL,
+ config->driConfig,
+ driShare,
+ num_ctx_attribs / 2,
+ ctx_attribs,
+ &dri_err,
+ context);
+
+ switch (dri_err) {
+ case __DRI_CTX_ERROR_SUCCESS:
+ *error = Success;
+ break;
+ case __DRI_CTX_ERROR_NO_MEMORY:
+ *error = BadAlloc;
+ break;
+ case __DRI_CTX_ERROR_BAD_API:
+ *error = __glXError(GLXBadProfileARB);
+ break;
+ case __DRI_CTX_ERROR_BAD_VERSION:
+ case __DRI_CTX_ERROR_BAD_FLAG:
+ *error = __glXError(GLXBadFBConfig);
+ break;
+ case __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE:
+ case __DRI_CTX_ERROR_UNKNOWN_FLAG:
+ default:
+ *error = BadValue;
+ break;
+ }
+
+ return;
+ }
+#endif
+
+ if (num_attribs != 0) {
+ *error = BadValue;
+ return;
+ }
+
+ context->driContext =
+ (*screen->dri2->createNewContext) (screen->driScreen,
+ config->driConfig,
+ driShare, context);
+}
+
static __GLXcontext *
__glXDRIscreenCreateContext(__GLXscreen * baseScreen,
__GLXconfig * glxConfig,
- __GLXcontext * baseShareContext)
+ __GLXcontext * baseShareContext,
+ unsigned num_attribs,
+ const uint32_t *attribs,
+ int *error)
{
__GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
__GLXDRIcontext *context, *shareContext;
@@ -394,8 +535,10 @@ __glXDRIscreenCreateContext(__GLXscreen * baseScreen,
driShare = NULL;
context = calloc(1, sizeof *context);
- if (context == NULL)
+ if (context == NULL) {
+ *error = BadAlloc;
return NULL;
+ }
context->base.destroy = __glXDRIcontextDestroy;
context->base.makeCurrent = __glXDRIcontextMakeCurrent;
@@ -404,10 +547,8 @@ __glXDRIscreenCreateContext(__GLXscreen * baseScreen,
context->base.textureFromPixmap = &__glXDRItextureFromPixmap;
context->base.wait = __glXDRIcontextWait;
- context->driContext =
- (*screen->dri2->createNewContext) (screen->driScreen,
- config->driConfig,
- driShare, context);
+ create_driver_context(context, screen, config, driShare, num_attribs,
+ attribs, error);
if (context->driContext == NULL) {
free(context);
return NULL;
@@ -641,6 +782,14 @@ initializeExtensions(__GLXDRIscreen * screen)
__glXEnableExtension(screen->glx_enable_bits, "GLX_INTEL_swap_event");
LogMessage(X_INFO, "AIGLX: enabled GLX_INTEL_swap_event\n");
+#if __DRI_DRI2_VERSION >= 3
+ if (screen->dri2->base.version >= 3) {
+ __glXEnableExtension(screen->glx_enable_bits,
+ "GLX_ARB_create_context");
+ LogMessage(X_INFO, "AIGLX: enabled GLX_ARB_create_context\n");
+ }
+#endif
+
if (DRI2HasSwapControl(pScreen)) {
__glXEnableExtension(screen->glx_enable_bits, "GLX_SGI_swap_control");
__glXEnableExtension(screen->glx_enable_bits, "GLX_MESA_swap_control");
diff --git a/xorg-server/glx/glxdriswrast.c b/xorg-server/glx/glxdriswrast.c
index 9fe2b6d7a..28c381ab4 100644
--- a/xorg-server/glx/glxdriswrast.c
+++ b/xorg-server/glx/glxdriswrast.c
@@ -258,7 +258,10 @@ __glXDRIscreenDestroy(__GLXscreen * baseScreen)
static __GLXcontext *
__glXDRIscreenCreateContext(__GLXscreen * baseScreen,
__GLXconfig * glxConfig,
- __GLXcontext * baseShareContext)
+ __GLXcontext * baseShareContext,
+ unsigned num_attribs,
+ const uint32_t *attribs,
+ int *error)
{
__GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
__GLXDRIcontext *context, *shareContext;
@@ -266,6 +269,13 @@ __glXDRIscreenCreateContext(__GLXscreen * baseScreen,
const __DRIcoreExtension *core = screen->core;
__DRIcontext *driShare;
+ /* DRISWRAST won't support createContextAttribs, so these parameters will
+ * never be used.
+ */
+ (void) num_attribs;
+ (void) attribs;
+ (void) error;
+
shareContext = (__GLXDRIcontext *) baseShareContext;
if (shareContext)
driShare = shareContext->driContext;
diff --git a/xorg-server/glx/glxext.c b/xorg-server/glx/glxext.c
index 8671ed026..f00836495 100644
--- a/xorg-server/glx/glxext.c
+++ b/xorg-server/glx/glxext.c
@@ -166,11 +166,18 @@ DrawableGone(__GLXdrawable * glxPriv, XID xid)
return True;
}
-void
-__glXAddToContextList(__GLXcontext * cx)
+Bool
+__glXAddContext(__GLXcontext * cx)
{
+ /* Register this context as a resource.
+ */
+ if (!AddResource(cx->id, __glXContextRes, (pointer)cx)) {
+ return False;
+ }
+
cx->next = glxAllContexts;
glxAllContexts = cx;
+ return True;
}
static void
@@ -290,8 +297,6 @@ glxClientCallback(CallbackListPtr *list, pointer closure, pointer data)
** By default, assume that the client supports
** GLX major version 1 minor version 0 protocol.
*/
- cl->GLClientmajorVersion = 1;
- cl->GLClientminorVersion = 0;
cl->client = pClient;
break;
diff --git a/xorg-server/glx/glxext.h b/xorg-server/glx/glxext.h
index fd74411d7..37291ae7c 100644
--- a/xorg-server/glx/glxext.h
+++ b/xorg-server/glx/glxext.h
@@ -44,7 +44,7 @@
extern GLboolean __glXFreeContext(__GLXcontext * glxc);
extern void __glXFlushContextCache(void);
-extern void __glXAddToContextList(__GLXcontext * cx);
+extern Bool __glXAddContext(__GLXcontext * cx);
SERVEXTERN void __glXErrorCallBack(GLenum code);
extern void __glXClearErrorOccured(void);
extern GLboolean __glXErrorOccured(void);
diff --git a/xorg-server/glx/glxscreens.h b/xorg-server/glx/glxscreens.h
index 172268b29..b29df58a5 100644
--- a/xorg-server/glx/glxscreens.h
+++ b/xorg-server/glx/glxscreens.h
@@ -117,7 +117,10 @@ struct __GLXscreen {
__GLXcontext *(*createContext) (__GLXscreen * screen,
__GLXconfig * modes,
- __GLXcontext * shareContext);
+ __GLXcontext * shareContext,
+ unsigned num_attribs,
+ const uint32_t *attribs,
+ int *error);
__GLXdrawable *(*createDrawable) (ClientPtr client,
__GLXscreen * context,
diff --git a/xorg-server/glx/glxserver.h b/xorg-server/glx/glxserver.h
index 32279590e..098130436 100644
--- a/xorg-server/glx/glxserver.h
+++ b/xorg-server/glx/glxserver.h
@@ -146,8 +146,6 @@ struct __GLXclientStateRec {
/* Back pointer to X client record */
ClientPtr client;
- int GLClientmajorVersion;
- int GLClientminorVersion;
char *GLClientextensions;
};
diff --git a/xorg-server/hw/dmx/dmx.c b/xorg-server/hw/dmx/dmx.c
index add0e5390..a226c5db1 100644
--- a/xorg-server/hw/dmx/dmx.c
+++ b/xorg-server/hw/dmx/dmx.c
@@ -74,8 +74,9 @@ _DMXXineramaActive(void)
{
#ifdef PANORAMIX
return !noPanoramiXExtension;
-#endif
+#else
return 0;
+#endif
}
static void
diff --git a/xorg-server/hw/xfree86/common/compiler.h b/xorg-server/hw/xfree86/common/compiler.h
index 04231f8f2..dc6f77318 100644
--- a/xorg-server/hw/xfree86/common/compiler.h
+++ b/xorg-server/hw/xfree86/common/compiler.h
@@ -119,6 +119,23 @@ extern _X_EXPORT unsigned int inb(unsigned long);
extern _X_EXPORT unsigned int inw(unsigned long);
extern _X_EXPORT unsigned int inl(unsigned long);
+#ifdef __SUNPRO_C
+extern _X_EXPORT unsigned char xf86ReadMmio8 (void *, unsigned long);
+extern _X_EXPORT unsigned short xf86ReadMmio16Be (void *, unsigned long);
+extern _X_EXPORT unsigned short xf86ReadMmio16Le (void *, unsigned long);
+extern _X_EXPORT unsigned int xf86ReadMmio32Be (void *, unsigned long);
+extern _X_EXPORT unsigned int xf86ReadMmio32Le (void *, unsigned long);
+extern _X_EXPORT void xf86WriteMmio8 (void *, unsigned long, unsigned int);
+extern _X_EXPORT void xf86WriteMmio16Be (void *, unsigned long, unsigned int);
+extern _X_EXPORT void xf86WriteMmio16Le (void *, unsigned long, unsigned int);
+extern _X_EXPORT void xf86WriteMmio32Be (void *, unsigned long, unsigned int);
+extern _X_EXPORT void xf86WriteMmio32Le (void *, unsigned long, unsigned int);
+extern _X_EXPORT void xf86WriteMmio8NB (void *, unsigned long, unsigned int);
+extern _X_EXPORT void xf86WriteMmio16BeNB (void *, unsigned long, unsigned int);
+extern _X_EXPORT void xf86WriteMmio16LeNB (void *, unsigned long, unsigned int);
+extern _X_EXPORT void xf86WriteMmio32BeNB (void *, unsigned long, unsigned int);
+extern _X_EXPORT void xf86WriteMmio32LeNB (void *, unsigned long, unsigned int);
+#endif /* _SUNPRO_C */
#endif /* __sparc__, __arm32__, __alpha__, __nds32__ */
#endif /* __arm__ */
diff --git a/xorg-server/hw/xfree86/fbdevhw/fbdevhwstub.c b/xorg-server/hw/xfree86/fbdevhw/fbdevhwstub.c
index b7b4d2e7d..7d554e60a 100644
--- a/xorg-server/hw/xfree86/fbdevhw/fbdevhwstub.c
+++ b/xorg-server/hw/xfree86/fbdevhw/fbdevhwstub.c
@@ -143,7 +143,7 @@ fbdevHWSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
}
void
-fbdevHWAdjustFrame(ScrnInfoPtr pScrn, int x, int y, int flags)
+fbdevHWAdjustFrame(ScrnInfoPtr pScrn, int x, int y)
{
}
diff --git a/xorg-server/hw/xfree86/int10/generic.c b/xorg-server/hw/xfree86/int10/generic.c
index 5343e47e3..4633120fd 100644
--- a/xorg-server/hw/xfree86/int10/generic.c
+++ b/xorg-server/hw/xfree86/int10/generic.c
@@ -179,7 +179,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
vbiosMem = (char *) base + V_BIOS;
memset(vbiosMem, 0, 2 * V_BIOS_SIZE);
if (pci_device_read_rom(pInt->dev, vbiosMem) < V_BIOS_SIZE) {
- xf86DrvMsg(screen, X_WARNING,
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Unable to retrieve all of segment 0x0C0000.\n");
}
@@ -194,10 +194,10 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
vbiosMem = (unsigned char *) base + bios_location;
if (xf86IsEntityPrimary(entityIndex)) {
- if (int10_check_bios(screen, bios_location >> 4, vbiosMem))
+ if (int10_check_bios(pScrn->scrnIndex, bios_location >> 4, vbiosMem))
done = TRUE;
else
- xf86DrvMsg(screen, X_INFO,
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"No legacy BIOS found -- trying PCI\n");
}
if (!done) {
@@ -207,7 +207,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
err = pci_device_read_rom(rom_device, vbiosMem);
if (err) {
- xf86DrvMsg(screen, X_ERROR, "Cannot read V_BIOS (5) %s\n",
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Cannot read V_BIOS (5) %s\n",
strerror(err));
goto error1;
}
diff --git a/xorg-server/include/dix.h b/xorg-server/include/dix.h
index 5dc2ac568..3d8b0e575 100644
--- a/xorg-server/include/dix.h
+++ b/xorg-server/include/dix.h
@@ -395,6 +395,8 @@ DeliverTouchEvents(DeviceIntPtr /* dev */ ,
extern void
InitializeSprite(DeviceIntPtr /* pDev */ ,
WindowPtr /* pWin */ );
+extern void
+FreeSprite(DeviceIntPtr pDev);
extern void
UpdateSpriteForScreen(DeviceIntPtr /* pDev */ ,
diff --git a/xorg-server/include/input.h b/xorg-server/include/input.h
index bcf98a63e..5747f3cd2 100644
--- a/xorg-server/include/input.h
+++ b/xorg-server/include/input.h
@@ -264,7 +264,7 @@ extern _X_EXPORT Bool ActivateDevice(DeviceIntPtr /*device */ ,
extern _X_EXPORT Bool DisableDevice(DeviceIntPtr /*device */ ,
BOOL /* sendevent */ );
-
+extern void DisableAllDevices(void);
extern int InitAndStartDevices(void);
extern void CloseDownDevices(void);
diff --git a/xorg-server/include/misc.h b/xorg-server/include/misc.h
index aa5d2fde8..023ac2fad 100644
--- a/xorg-server/include/misc.h
+++ b/xorg-server/include/misc.h
@@ -391,4 +391,16 @@ extern _X_EXPORT unsigned long serverGeneration;
#define BUG_WARN(cond) __BUG_WARN_MSG(cond, 0, NULL)
+#define BUG_RETURN(cond) \
+ do { if (cond) { __BUG_WARN_MSG(cond, 0, NULL); return; } } while(0)
+
+#define BUG_RETURN_MSG(cond, ...) \
+ do { if (cond) { __BUG_WARN_MSG(cond, 1, __VA_ARGS__); return; } } while(0)
+
+#define BUG_RETURN_VAL(cond, val) \
+ do { if (cond) { __BUG_WARN_MSG(cond, 0, NULL); return (val); } } while(0)
+
+#define BUG_RETURN_VAL_MSG(cond, val, ...) \
+ do { if (cond) { __BUG_WARN_MSG(cond, 1, __VA_ARGS__); return (val); } } while(0)
+
#endif /* MISC_H */
diff --git a/xorg-server/test/touch.c b/xorg-server/test/touch.c
index 2ec535b43..df1db11de 100644
--- a/xorg-server/test/touch.c
+++ b/xorg-server/test/touch.c
@@ -40,6 +40,7 @@ touch_grow_queue(void)
int i;
memset(&dev, 0, sizeof(dev));
+ dev.name = "test device";
dev.id = 2;
dev.valuator = &val;
val.numAxes = 5;
@@ -94,6 +95,7 @@ touch_find_ddxid(void)
int i;
memset(&dev, 0, sizeof(dev));
+ dev.name = "test device";
dev.id = 2;
dev.valuator = &val;
val.numAxes = 5;
@@ -162,6 +164,7 @@ touch_begin_ddxtouch(void)
int size = 5;
memset(&dev, 0, sizeof(dev));
+ dev.name = "test device";
dev.id = 2;
dev.valuator = &val;
val.numAxes = 5;
@@ -209,6 +212,7 @@ touch_begin_touch(void)
screenInfo.screens[0] = &screen;
memset(&dev, 0, sizeof(dev));
+ dev.name = "test device";
dev.id = 2;
memset(&sprite, 0, sizeof(sprite));
@@ -247,6 +251,7 @@ touch_init(void)
screenInfo.screens[0] = &screen;
memset(&dev, 0, sizeof(dev));
+ dev.name = "test device";
memset(&sprite, 0, sizeof(sprite));
dev.spriteInfo = &sprite;
diff --git a/xorg-server/xkb/xkbAccessX.c b/xorg-server/xkb/xkbAccessX.c
index 95e28e789..fe28e12d7 100644
--- a/xorg-server/xkb/xkbAccessX.c
+++ b/xorg-server/xkb/xkbAccessX.c
@@ -295,10 +295,15 @@ AccessXKRGExpire(OsTimerPtr timer, CARD32 now, pointer arg)
cn.eventType = 0;
cn.requestMajor = 0;
cn.requestMinor = 0;
- if (xkbi->desc->ctrls->enabled_ctrls & XkbSlowKeysMask)
+ if (xkbi->desc->ctrls->enabled_ctrls & XkbSlowKeysMask) {
AccessXKRGTurnOff((DeviceIntPtr) arg, &cn);
- else
+ LogMessage(X_INFO, "XKB SlowKeys are disabled.\n");
+ }
+ else {
AccessXKRGTurnOn((DeviceIntPtr) arg, XkbSlowKeysMask, &cn);
+ LogMessage(X_INFO, "XKB SlowKeys are now enabled. Hold shift to disable.\n");
+ }
+
return 0;
}