diff --git a/GL/glx/Makefile.am b/GL/glx/Makefile.am index 8eda1531e..4cf56e89d 100644 --- a/GL/glx/Makefile.am +++ b/GL/glx/Makefile.am @@ -14,7 +14,8 @@ AM_CFLAGS = \ -I@MESA_SOURCE@/src/mesa/glapi \ -I@MESA_SOURCE@/src/mesa/main \ -DXFree86Server \ - @GLX_DEFINES@ + @GLX_DEFINES@ \ + @GLX_ARCH_DEFINES@ # none yet #sdk_HEADERS = diff --git a/GL/glx/indirect_size_get.c b/GL/glx/indirect_size_get.c index f64fb7ece..e7eaf97cb 100644 --- a/GL/glx/indirect_size_get.c +++ b/GL/glx/indirect_size_get.c @@ -538,6 +538,7 @@ __glGetBooleanv_size(GLenum e) case GL_UNPACK_SKIP_IMAGES: case GL_UNPACK_IMAGE_HEIGHT: case GL_TEXTURE_3D: + case GL_MAX_3D_TEXTURE_SIZE: case GL_VERTEX_ARRAY: case GL_NORMAL_ARRAY: case GL_COLOR_ARRAY: @@ -612,6 +613,7 @@ __glGetBooleanv_size(GLenum e) /* case GL_CLIENT_ACTIVE_TEXTURE_ARB:*/ case GL_MAX_TEXTURE_UNITS: /* case GL_MAX_TEXTURE_UNITS_ARB:*/ + case GL_MAX_RENDERBUFFER_SIZE_EXT: case GL_TEXTURE_COMPRESSION_HINT: /* case GL_TEXTURE_COMPRESSION_HINT_ARB:*/ case GL_TEXTURE_RECTANGLE_ARB: @@ -714,6 +716,10 @@ __glGetBooleanv_size(GLenum e) case GL_ACTIVE_STENCIL_FACE_EXT: case GL_TEXTURE_BINDING_1D_ARRAY_EXT: case GL_TEXTURE_BINDING_2D_ARRAY_EXT: + case GL_DRAW_FRAMEBUFFER_BINDING_EXT: + case GL_RENDERBUFFER_BINDING_EXT: + case GL_READ_FRAMEBUFFER_BINDING_EXT: + case GL_MAX_COLOR_ATTACHMENTS_EXT: case GL_RASTER_POSITION_UNCLIPPED_IBM: return 1; case GL_SMOOTH_POINT_SIZE_RANGE: diff --git a/Xext/mbuf.c b/Xext/mbuf.c index 199236700..ae0ca1771 100644 --- a/Xext/mbuf.c +++ b/Xext/mbuf.c @@ -61,8 +61,8 @@ in this Software without prior written authorization from The Open Group. static int MultibufferEventBase; static int MultibufferErrorBase; -int MultibufferScreenIndex = -1; -int MultibufferWindowIndex = -1; +static DevPrivateKey MultibufferScreenPrivKey = &MultibufferScreenPrivKey; +static DevPrivateKey MultibufferWindowPrivKey = &MultibufferWindowPrivKey; static void PerformDisplayRequest ( MultibuffersPtr * /* ppMultibuffers */, @@ -200,27 +200,16 @@ MultibufferExtensionInit() ScreenPtr pScreen; MultibufferScreenPtr pMultibufferScreen; - /* - * allocate private pointers in windows and screens. Allocating - * window privates may seem like an unnecessary expense, but every - * PositionWindow call must check to see if the window is - * multi-buffered; a resource lookup is too expensive. - */ - MultibufferScreenIndex = AllocateScreenPrivateIndex (); - if (MultibufferScreenIndex < 0) - return; - MultibufferWindowIndex = AllocateWindowPrivateIndex (); for (i = 0; i < screenInfo.numScreens; i++) { pScreen = screenInfo.screens[i]; - if (!AllocateWindowPrivate (pScreen, MultibufferWindowIndex, 0) || - !(pMultibufferScreen = (MultibufferScreenPtr) xalloc (sizeof (MultibufferScreenRec)))) + if (!(pMultibufferScreen = (MultibufferScreenPtr) xalloc (sizeof (MultibufferScreenRec)))) { for (j = 0; j < i; j++) - xfree (screenInfo.screens[j]->devPrivates[MultibufferScreenIndex].ptr); + xfree (dixLookupPrivate(&screenInfo.screens[j]->devPrivates, MultibufferScreenPrivKey)); return; } - pScreen->devPrivates[MultibufferScreenIndex].ptr = (pointer) pMultibufferScreen; + dixSetPrivate(&pScreen->devPrivates, MultibufferScreenPrivKey, pMultibufferScreen); /* * wrap PositionWindow to resize the pixmap when the window * changes size @@ -260,14 +249,11 @@ ExtensionEntry *extEntry; ScreenPtr pScreen; MultibufferScreenPtr pMultibufferScreen; - if (MultibufferScreenIndex < 0) - return; for (i = 0; i < screenInfo.numScreens; i++) { pScreen = screenInfo.screens[i]; - if (pScreen->devPrivates[MultibufferScreenIndex].ptr) + if ((pMultibufferScreen = (MultibufferScreenPtr)dixLookupPrivate(&pScreen->devPrivates, MultibufferScreenPrivKey))) { - pMultibufferScreen = (MultibufferScreenPtr) pScreen->devPrivates[MultibufferScreenIndex].ptr; pScreen->PositionWindow = pMultibufferScreen->PositionWindow; xfree (pMultibufferScreen); } @@ -427,7 +413,7 @@ CreateImageBuffers (pWin, nbuf, ids, action, hint) pMultibuffers->lastUpdate.milliseconds = 0; pMultibuffers->width = width; pMultibuffers->height = height; - pWin->devPrivates[MultibufferWindowIndex].ptr = (pointer) pMultibuffers; + dixSetPrivate(&pWin->devPrivates, MultibufferWindowPrivKey, pMultibuffers); if (pClearGC) FreeScratchGC(pClearGC); return Success; } @@ -487,7 +473,7 @@ ProcCreateImageBuffers (client) rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; - rep.numberBuffer = ((MultibuffersPtr) (pWin->devPrivates[MultibufferWindowIndex].ptr))->numMultibuffer; + rep.numberBuffer = ((MultibuffersPtr) (dixLookupPrivate(&pWin->devPrivates, MultibufferWindowPrivKey)))->numMultibuffer; if (client->swapped) { swaps(&rep.sequenceNumber, n); @@ -1236,7 +1222,7 @@ GetBufferPointer (pWin, i) { MultibuffersPtr pMultibuffers; - if (!(pMultibuffers = (MultibuffersPtr) pWin->devPrivates[MultibufferWindowIndex].ptr)) + if (!(pMultibuffers = (MultibuffersPtr) dixLookupPrivate(&pWin->devPrivates, MultibufferWindowPrivKey))) return NULL; return (DrawablePtr) pMultibuffers->buffers[i].pPixmap; } @@ -1475,7 +1461,7 @@ DestroyImageBuffers (pWin) { FreeResourceByType (pWin->drawable.id, MultibuffersResType, FALSE); /* Zero out the window's pointer to the buffers so they won't be reused */ - pWin->devPrivates[MultibufferWindowIndex].ptr = NULL; + dixSetPrivate(&pWin->devPrivates, MultibufferWindowPrivKey, NULL); } /* @@ -1503,11 +1489,11 @@ MultibufferPositionWindow (pWin, x, y) Bool clear; pScreen = pWin->drawable.pScreen; - pMultibufferScreen = (MultibufferScreenPtr) pScreen->devPrivates[MultibufferScreenIndex].ptr; + pMultibufferScreen = (MultibufferScreenPtr) dixLookupPrivate(&pScreen->devPrivates, MultibufferScreenPrivKey); (*pMultibufferScreen->PositionWindow) (pWin, x, y); /* if this window is not multibuffered, we're done */ - if (!(pMultibuffers = (MultibuffersPtr) pWin->devPrivates[MultibufferWindowIndex].ptr)) + if (!(pMultibuffers = (MultibuffersPtr) dixLookupPrivate(&pWin->devPrivates, MultibufferWindowPrivKey))) return TRUE; /* if new size is same as old, we're done */ @@ -1620,7 +1606,7 @@ MultibufferDrawableDelete (value, id) if (pDrawable->type == DRAWABLE_WINDOW) { pWin = (WindowPtr) pDrawable; - pMultibuffers = (MultibuffersPtr) pWin->devPrivates[MultibufferWindowIndex].ptr; + pMultibuffers = (MultibuffersPtr) dixLookupPrivate(&pWin->devPrivates, MultibufferWindowPrivKey); pPixmap = pMultibuffers->buffers[pMultibuffers->displayedMultibuffer].pPixmap; } else diff --git a/Xext/xace.c b/Xext/xace.c index 9f8a8cc75..e85a51714 100644 --- a/Xext/xace.c +++ b/Xext/xace.c @@ -262,10 +262,7 @@ XaceResetProc(ExtensionEntry *extEntry) int i; for (i=0; inoClientException); } - static int SProcXCalibrateSetRawMode (ClientPtr client) { @@ -178,6 +177,47 @@ SProcXCalibrateSetRawMode (ClientPtr client) return ProcXCalibrateSetRawMode(client); } +static int +ProcXCalibrateScreenToCoord (ClientPtr client) +{ + REQUEST(xXCalibrateScreenToCoordReq); + xXCalibrateScreenToCoordReply rep; + + REQUEST_SIZE_MATCH (xXCalibrateScreenToCoordReq); + + memset (&rep, 0, sizeof (rep)); + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.x = stuff->x; + rep.y = stuff->y; + + KdScreenToPointerCoords(&rep.x, &rep.y); + + if (client->swapped) + { + int n; + + swaps (&rep.x, n); + swaps (&rep.y, n); + } + WriteToClient(client, sizeof (rep), (char *) &rep); + return (client->noClientException); +} + +static int +SProcXCalibrateScreenToCoord (ClientPtr client) +{ + REQUEST(xXCalibrateScreenToCoordReq); + int n; + + REQUEST_SIZE_MATCH (xXCalibrateScreenToCoordReq); + + swaps(&stuff->x, n); + swaps(&stuff->y, n); + + return ProcXCalibrateScreenToCoord(client); +} + static void XCalibrateResetProc (ExtensionEntry *extEntry) { @@ -192,6 +232,9 @@ ProcXCalibrateDispatch (ClientPtr client) return ProcXCalibrateQueryVersion(client); case X_XCalibrateRawMode: return ProcXCalibrateSetRawMode(client); + case X_XCalibrateScreenToCoord: + return ProcXCalibrateScreenToCoord(client); + default: break; } @@ -211,6 +254,8 @@ SProcXCalibrateDispatch (ClientPtr client) return SProcXCalibrateQueryVersion(client); case X_XCalibrateRawMode: return SProcXCalibrateSetRawMode(client); + case X_XCalibrateScreenToCoord: + return SProcXCalibrateScreenToCoord(client); default: break; } diff --git a/Xext/xselinux.c b/Xext/xselinux.c index bbd8d1a46..4629e9027 100644 --- a/Xext/xselinux.c +++ b/Xext/xselinux.c @@ -175,12 +175,12 @@ SELinuxSelectionToSID(Atom selection, SELinuxStateRec *sid_return) security_id_t sid; if (selabel_lookup(label_hnd, &con, name, SELABEL_X_SELN) < 0) { - ErrorF("XSELinux: a selection label lookup failed!\n"); + ErrorF("SELinux: a selection label lookup failed!\n"); return BadValue; } /* Get a SID for context */ if (avc_context_to_sid(con, &sid) < 0) { - ErrorF("XSELinux: a context_to_SID call failed!\n"); + ErrorF("SELinux: a context_to_SID call failed!\n"); return BadAlloc; } freecon(con); @@ -216,12 +216,12 @@ SELinuxEventToSID(unsigned type, security_id_t sid_of_window, if (!knownEvents[type]) { /* Look in the mappings of event names to contexts */ if (selabel_lookup(label_hnd, &con, name, SELABEL_X_EVENT) < 0) { - ErrorF("XSELinux: an event label lookup failed!\n"); + ErrorF("SELinux: an event label lookup failed!\n"); return BadValue; } /* Get a SID for context */ if (avc_context_to_sid(con, knownEvents + type) < 0) { - ErrorF("XSELinux: a context_to_SID call failed!\n"); + ErrorF("SELinux: a context_to_SID call failed!\n"); return BadAlloc; } freecon(con); @@ -230,7 +230,7 @@ SELinuxEventToSID(unsigned type, security_id_t sid_of_window, /* Perform a transition to obtain the final SID */ if (avc_compute_create(sid_of_window, knownEvents[type], SECCLASS_X_EVENT, &sid_return->sid) < 0) { - ErrorF("XSELinux: a compute_create call failed!\n"); + ErrorF("SELinux: a compute_create call failed!\n"); return BadValue; } @@ -607,13 +607,13 @@ SELinuxExtension(CallbackListPtr *pcbl, pointer unused, pointer calldata) /* Look in the mappings of property names to contexts */ if (selabel_lookup(label_hnd, &con, name, SELABEL_X_EXT) < 0) { - ErrorF("XSELinux: a property label lookup failed!\n"); + ErrorF("SELinux: a property label lookup failed!\n"); rec->status = BadValue; return; } /* Get a SID for context */ if (avc_context_to_sid(con, &sid) < 0) { - ErrorF("XSELinux: a context_to_SID call failed!\n"); + ErrorF("SELinux: a context_to_SID call failed!\n"); rec->status = BadAlloc; return; } @@ -623,7 +623,7 @@ SELinuxExtension(CallbackListPtr *pcbl, pointer unused, pointer calldata) /* Perform a transition to obtain the final SID */ if (avc_compute_create(serv->sid, sid, SECCLASS_X_EXTENSION, &obj->sid) < 0) { - ErrorF("XSELinux: a SID transition call failed!\n"); + ErrorF("SELinux: a SID transition call failed!\n"); freecon(con); rec->status = BadValue; return; @@ -658,13 +658,13 @@ SELinuxProperty(CallbackListPtr *pcbl, pointer unused, pointer calldata) /* Look in the mappings of property names to contexts */ if (selabel_lookup(label_hnd, &con, name, SELABEL_X_PROP) < 0) { - ErrorF("XSELinux: a property label lookup failed!\n"); + ErrorF("SELinux: a property label lookup failed!\n"); rec->status = BadValue; return; } /* Get a SID for context */ if (avc_context_to_sid(con, &sid) < 0) { - ErrorF("XSELinux: a context_to_SID call failed!\n"); + ErrorF("SELinux: a context_to_SID call failed!\n"); rec->status = BadAlloc; return; } @@ -674,7 +674,7 @@ SELinuxProperty(CallbackListPtr *pcbl, pointer unused, pointer calldata) /* Perform a transition to obtain the final SID */ if (avc_compute_create(subj->sid, sid, SECCLASS_X_PROPERTY, &obj->sid) < 0) { - ErrorF("XSELinux: a SID transition call failed!\n"); + ErrorF("SELinux: a SID transition call failed!\n"); freecon(con); rec->status = BadValue; return; @@ -732,7 +732,7 @@ SELinuxResource(CallbackListPtr *pcbl, pointer unused, pointer calldata) /* Perform a transition to obtain the final SID */ if (avc_compute_create(subj->sid, pobj->sid, class, &obj->sid) < 0) { - ErrorF("XSELinux: a compute_create call failed!\n"); + ErrorF("SELinux: a compute_create call failed!\n"); rec->status = BadValue; return; } @@ -766,7 +766,7 @@ SELinuxScreen(CallbackListPtr *pcbl, pointer is_saver, pointer calldata) /* Perform a transition to obtain the final SID */ if (avc_compute_create(subj->sid, subj->sid, SECCLASS_X_SCREEN, &obj->sid) < 0) { - ErrorF("XSELinux: a compute_create call failed!\n"); + ErrorF("SELinux: a compute_create call failed!\n"); rec->status = BadValue; return; } @@ -883,16 +883,16 @@ SELinuxResourceState(CallbackListPtr *pcbl, pointer unused, pointer calldata) security_context_t ctx; int rc = avc_sid_to_context(state->sid, &ctx); if (rc < 0) - FatalError("XSELinux: Failed to get security context!\n"); + FatalError("SELinux: Failed to get security context!\n"); rc = dixChangeWindowProperty(serverClient, pWin, atom_client_ctx, XA_STRING, 8, PropModeReplace, strlen(ctx), ctx, FALSE); if (rc != Success) - FatalError("XSELinux: Failed to set label property on window!\n"); + FatalError("SELinux: Failed to set label property on window!\n"); freecon(ctx); } else - FatalError("XSELinux: Unexpected unlabeled client found\n"); + FatalError("SELinux: Unexpected unlabeled client found\n"); state = dixLookupPrivate(&pWin->devPrivates, stateKey); @@ -900,16 +900,16 @@ SELinuxResourceState(CallbackListPtr *pcbl, pointer unused, pointer calldata) security_context_t ctx; int rc = avc_sid_to_context(state->sid, &ctx); if (rc < 0) - FatalError("XSELinux: Failed to get security context!\n"); + FatalError("SELinux: Failed to get security context!\n"); rc = dixChangeWindowProperty(serverClient, pWin, atom_ctx, XA_STRING, 8, PropModeReplace, strlen(ctx), ctx, FALSE); if (rc != Success) - FatalError("XSELinux: Failed to set label property on window!\n"); + FatalError("SELinux: Failed to set label property on window!\n"); freecon(ctx); } else - FatalError("XSELinux: Unexpected unlabeled window found\n"); + FatalError("SELinux: Unexpected unlabeled window found\n"); } static void @@ -931,7 +931,7 @@ SELinuxSelectionState(CallbackListPtr *pcbl, pointer unused, pointer calldata) if (avc_compute_create(subj->sid, subj->sid, SECCLASS_X_SELECTION, &obj->sid) < 0) { - ErrorF("XSELinux: a compute_create call failed!\n"); + ErrorF("SELinux: a compute_create call failed!\n"); obj->sid = unlabeled_sid; } break; @@ -998,8 +998,8 @@ ProcSELinuxQueryVersion(ClientPtr client) rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; - rep.server_major = XSELINUX_MAJOR_VERSION; - rep.server_minor = XSELINUX_MINOR_VERSION; + rep.server_major = SELINUX_MAJOR_VERSION; + rep.server_minor = SELINUX_MINOR_VERSION; if (client->swapped) { int n; swaps(&rep.sequenceNumber, n); @@ -1145,31 +1145,31 @@ ProcSELinuxDispatch(ClientPtr client) REQUEST(xReq); switch (stuff->data) { case X_SELinuxQueryVersion: - return ProcSELinuxQueryVersion(client); + return ProcSELinuxQueryVersion(client); case X_SELinuxSetSelectionManager: return ProcSELinuxSetSelectionManager(client); case X_SELinuxGetSelectionManager: - return ProcSELinuxGetSelectionManager(client); + return ProcSELinuxGetSelectionManager(client); case X_SELinuxSetDeviceCreateContext: - return ProcSELinuxSetDeviceCreateContext(client); + return ProcSELinuxSetDeviceCreateContext(client); case X_SELinuxGetDeviceCreateContext: - return ProcSELinuxGetDeviceCreateContext(client); + return ProcSELinuxGetDeviceCreateContext(client); case X_SELinuxSetDeviceContext: - return ProcSELinuxSetDeviceContext(client); + return ProcSELinuxSetDeviceContext(client); case X_SELinuxGetDeviceContext: - return ProcSELinuxGetDeviceContext(client); + return ProcSELinuxGetDeviceContext(client); case X_SELinuxSetPropertyCreateContext: - return ProcSELinuxSetPropertyCreateContext(client); + return ProcSELinuxSetPropertyCreateContext(client); case X_SELinuxGetPropertyCreateContext: - return ProcSELinuxGetPropertyCreateContext(client); + return ProcSELinuxGetPropertyCreateContext(client); case X_SELinuxGetPropertyContext: - return ProcSELinuxGetPropertyContext(client); + return ProcSELinuxGetPropertyContext(client); case X_SELinuxSetWindowCreateContext: - return ProcSELinuxSetWindowCreateContext(client); + return ProcSELinuxSetWindowCreateContext(client); case X_SELinuxGetWindowCreateContext: - return ProcSELinuxGetWindowCreateContext(client); + return ProcSELinuxGetWindowCreateContext(client); case X_SELinuxGetWindowContext: - return ProcSELinuxGetWindowContext(client); + return ProcSELinuxGetWindowContext(client); default: return BadRequest; } @@ -1198,69 +1198,82 @@ SProcSELinuxSetSelectionManager(ClientPtr client) return ProcSELinuxSetSelectionManager(client); } -static int -SProcSELinuxGetSelectionManager(ClientPtr client) -{ - return ProcSELinuxGetSelectionManager(client); -} - static int SProcSELinuxSetDeviceCreateContext(ClientPtr client) { - return ProcSELinuxSetDeviceCreateContext(client); -} + REQUEST(SELinuxSetCreateContextReq); + int n; -static int -SProcSELinuxGetDeviceCreateContext(ClientPtr client) -{ - return ProcSELinuxGetDeviceCreateContext(client); + REQUEST_AT_LEAST_SIZE(SELinuxSetCreateContextReq); + swaps(&stuff->context_len,n); + return ProcSELinuxSetDeviceCreateContext(client); } static int SProcSELinuxSetDeviceContext(ClientPtr client) { + REQUEST(SELinuxSetContextReq); + int n; + + REQUEST_AT_LEAST_SIZE(SELinuxSetContextReq); + swapl(&stuff->id,n); + swaps(&stuff->context_len,n); return ProcSELinuxSetDeviceContext(client); } static int SProcSELinuxGetDeviceContext(ClientPtr client) { + REQUEST(SELinuxGetContextReq); + int n; + + REQUEST_SIZE_MATCH(SELinuxGetContextReq); + swapl(&stuff->id,n); return ProcSELinuxGetDeviceContext(client); } static int SProcSELinuxSetPropertyCreateContext(ClientPtr client) { - return ProcSELinuxSetPropertyCreateContext(client); -} + REQUEST(SELinuxSetCreateContextReq); + int n; -static int -SProcSELinuxGetPropertyCreateContext(ClientPtr client) -{ - return ProcSELinuxGetPropertyCreateContext(client); + REQUEST_AT_LEAST_SIZE(SELinuxSetCreateContextReq); + swaps(&stuff->context_len,n); + return ProcSELinuxSetPropertyCreateContext(client); } static int SProcSELinuxGetPropertyContext(ClientPtr client) { + REQUEST(SELinuxGetPropertyContextReq); + int n; + + REQUEST_SIZE_MATCH(SELinuxGetPropertyContextReq); + swapl(&stuff->window,n); + swapl(&stuff->property,n); return ProcSELinuxGetPropertyContext(client); } static int SProcSELinuxSetWindowCreateContext(ClientPtr client) { - return ProcSELinuxSetWindowCreateContext(client); -} + REQUEST(SELinuxSetCreateContextReq); + int n; -static int -SProcSELinuxGetWindowCreateContext(ClientPtr client) -{ - return ProcSELinuxGetWindowCreateContext(client); + REQUEST_AT_LEAST_SIZE(SELinuxSetCreateContextReq); + swaps(&stuff->context_len,n); + return ProcSELinuxSetWindowCreateContext(client); } static int SProcSELinuxGetWindowContext(ClientPtr client) { + REQUEST(SELinuxGetContextReq); + int n; + + REQUEST_SIZE_MATCH(SELinuxGetContextReq); + swapl(&stuff->id,n); return ProcSELinuxGetWindowContext(client); } @@ -1278,11 +1291,11 @@ SProcSELinuxDispatch(ClientPtr client) case X_SELinuxSetSelectionManager: return SProcSELinuxSetSelectionManager(client); case X_SELinuxGetSelectionManager: - return SProcSELinuxGetSelectionManager(client); + return ProcSELinuxGetSelectionManager(client); case X_SELinuxSetDeviceCreateContext: return SProcSELinuxSetDeviceCreateContext(client); case X_SELinuxGetDeviceCreateContext: - return SProcSELinuxGetDeviceCreateContext(client); + return ProcSELinuxGetDeviceCreateContext(client); case X_SELinuxSetDeviceContext: return SProcSELinuxSetDeviceContext(client); case X_SELinuxGetDeviceContext: @@ -1290,13 +1303,13 @@ SProcSELinuxDispatch(ClientPtr client) case X_SELinuxSetPropertyCreateContext: return SProcSELinuxSetPropertyCreateContext(client); case X_SELinuxGetPropertyCreateContext: - return SProcSELinuxGetPropertyCreateContext(client); + return ProcSELinuxGetPropertyCreateContext(client); case X_SELinuxGetPropertyContext: return SProcSELinuxGetPropertyContext(client); case X_SELinuxSetWindowCreateContext: return SProcSELinuxSetWindowCreateContext(client); case X_SELinuxGetWindowCreateContext: - return SProcSELinuxGetWindowCreateContext(client); + return ProcSELinuxGetWindowCreateContext(client); case X_SELinuxGetWindowContext: return SProcSELinuxGetWindowContext(client); default: @@ -1354,7 +1367,7 @@ SELinuxResetProc(ExtensionEntry *extEntry) } void -XSELinuxExtensionInit(INITARGS) +SELinuxExtensionInit(INITARGS) { ExtensionEntry *extEntry; struct selinux_opt options[] = { { SELABEL_OPT_VALIDATE, (char *)1 } }; @@ -1363,46 +1376,51 @@ XSELinuxExtensionInit(INITARGS) /* Setup SELinux stuff */ if (!is_selinux_enabled()) { - ErrorF("XSELinux: Extension failed to load: SELinux not enabled\n"); + ErrorF("SELinux: SELinux not enabled, disabling SELinux support.\n"); return; } selinux_set_callback(SELINUX_CB_LOG, (union selinux_callback)SELinuxLog); selinux_set_callback(SELINUX_CB_AUDIT, (union selinux_callback)SELinuxAudit); - if (selinux_set_mapping(map) < 0) - FatalError("XSELinux: Failed to set up security class mapping\n"); + if (selinux_set_mapping(map) < 0) { + if (errno == EINVAL) { + ErrorF("SELinux: Invalid object class mapping, disabling SELinux support.\n"); + return; + } + FatalError("SELinux: Failed to set up security class mapping\n"); + } if (avc_open(NULL, 0) < 0) - FatalError("XSELinux: Couldn't initialize SELinux userspace AVC\n"); + FatalError("SELinux: Couldn't initialize SELinux userspace AVC\n"); avc_active = 1; label_hnd = selabel_open(SELABEL_CTX_X, options, 1); if (!label_hnd) - FatalError("XSELinux: Failed to open x_contexts mapping in policy\n"); + FatalError("SELinux: Failed to open x_contexts mapping in policy\n"); if (security_get_initial_context("unlabeled", &con) < 0) - FatalError("XSELinux: Failed to look up unlabeled context\n"); + FatalError("SELinux: Failed to look up unlabeled context\n"); if (avc_context_to_sid(con, &unlabeled_sid) < 0) - FatalError("XSELinux: a context_to_SID call failed!\n"); + FatalError("SELinux: a context_to_SID call failed!\n"); freecon(con); /* Prepare for auditing */ audit_fd = audit_open(); if (audit_fd < 0) - FatalError("XSELinux: Failed to open the system audit log\n"); + FatalError("SELinux: Failed to open the system audit log\n"); /* Allocate private storage */ if (!dixRequestPrivate(stateKey, sizeof(SELinuxStateRec))) - FatalError("XSELinux: Failed to allocate private storage.\n"); + FatalError("SELinux: Failed to allocate private storage.\n"); /* Create atoms for doing window labeling */ atom_ctx = MakeAtom("_SELINUX_CONTEXT", 16, TRUE); if (atom_ctx == BAD_RESOURCE) - FatalError("XSELinux: Failed to create atom\n"); + FatalError("SELinux: Failed to create atom\n"); atom_client_ctx = MakeAtom("_SELINUX_CLIENT_CONTEXT", 23, TRUE); if (atom_client_ctx == BAD_RESOURCE) - FatalError("XSELinux: Failed to create atom\n"); + FatalError("SELinux: Failed to create atom\n"); /* Register callbacks */ ret &= dixRegisterPrivateInitFunc(stateKey, SELinuxStateInit, NULL); @@ -1425,11 +1443,11 @@ XSELinuxExtensionInit(INITARGS) ret &= XaceRegisterCallback(XACE_SCREEN_ACCESS, SELinuxScreen, NULL); ret &= XaceRegisterCallback(XACE_SCREENSAVER_ACCESS, SELinuxScreen, truep); if (!ret) - FatalError("XSELinux: Failed to register one or more callbacks\n"); + FatalError("SELinux: Failed to register one or more callbacks\n"); /* Add extension to server */ - extEntry = AddExtension(XSELINUX_EXTENSION_NAME, - XSELinuxNumberEvents, XSELinuxNumberErrors, + extEntry = AddExtension(SELINUX_EXTENSION_NAME, + SELinuxNumberEvents, SELinuxNumberErrors, ProcSELinuxDispatch, SProcSELinuxDispatch, SELinuxResetProc, StandardMinorOpcode); diff --git a/Xext/xselinux.h b/Xext/xselinux.h index ebcc4aae0..ba1380b57 100644 --- a/Xext/xselinux.h +++ b/Xext/xselinux.h @@ -23,11 +23,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "dixaccess.h" /* Extension info */ -#define XSELINUX_EXTENSION_NAME "SELinux" -#define XSELINUX_MAJOR_VERSION 1 -#define XSELINUX_MINOR_VERSION 0 -#define XSELinuxNumberEvents 0 -#define XSELinuxNumberErrors 0 +#define SELINUX_EXTENSION_NAME "SELinux" +#define SELINUX_MAJOR_VERSION 1 +#define SELINUX_MINOR_VERSION 0 +#define SELinuxNumberEvents 0 +#define SELinuxNumberErrors 0 /* Extension protocol */ #define X_SELinuxQueryVersion 0 @@ -138,20 +138,6 @@ typedef struct { CARD32 id; } SELinuxGetContextReq; -typedef struct { - CARD8 type; - CARD8 pad1; - CARD16 sequenceNumber; - CARD32 length; - CARD16 context_len; - CARD16 pad2; - CARD32 pad3; - CARD32 pad4; - CARD32 pad5; - CARD32 pad6; - CARD32 pad7; -} SELinuxGetContextReply; - typedef struct { CARD8 reqType; CARD8 SELinuxReqType; @@ -172,7 +158,7 @@ typedef struct { CARD32 pad5; CARD32 pad6; CARD32 pad7; -} SELinuxGetPropertyContextReply; +} SELinuxGetContextReply; /* Private Flask definitions */ diff --git a/Xext/xvdisp.c b/Xext/xvdisp.c index 8096c8c14..17ff1d788 100644 --- a/Xext/xvdisp.c +++ b/Xext/xvdisp.c @@ -67,7 +67,7 @@ SWriteQueryExtensionReply( swaps(&rep->version, n); swaps(&rep->revision, n); - (void)WriteToClient(client, sz_xvQueryExtensionReply, (char *)&rep); + (void)WriteToClient(client, sz_xvQueryExtensionReply, (char *)rep); return Success; } @@ -83,7 +83,7 @@ SWriteQueryAdaptorsReply( swapl(&rep->length, n); swaps(&rep->num_adaptors, n); - (void)WriteToClient(client, sz_xvQueryAdaptorsReply, (char *)&rep); + (void)WriteToClient(client, sz_xvQueryAdaptorsReply, (char *)rep); return Success; } @@ -99,7 +99,7 @@ SWriteQueryEncodingsReply( swapl(&rep->length, n); swaps(&rep->num_encodings, n); - (void)WriteToClient(client, sz_xvQueryEncodingsReply, (char *)&rep); + (void)WriteToClient(client, sz_xvQueryEncodingsReply, (char *)rep); return Success; } @@ -204,7 +204,7 @@ SWriteGrabPortReply( swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); - (void)WriteToClient(client, sz_xvGrabPortReply, (char *)&rep); + (void)WriteToClient(client, sz_xvGrabPortReply, (char *)rep); return Success; } @@ -220,7 +220,7 @@ SWriteGetPortAttributeReply( swapl(&rep->length, n); swapl(&rep->value, n); - (void)WriteToClient(client, sz_xvGetPortAttributeReply, (char *)&rep); + (void)WriteToClient(client, sz_xvGetPortAttributeReply, (char *)rep); return Success; } @@ -237,7 +237,7 @@ SWriteQueryBestSizeReply( swaps(&rep->actual_width, n); swaps(&rep->actual_height, n); - (void)WriteToClient(client, sz_xvQueryBestSizeReply, (char *)&rep); + (void)WriteToClient(client, sz_xvQueryBestSizeReply, (char *)rep); return Success; } @@ -254,7 +254,7 @@ SWriteQueryPortAttributesReply( swapl(&rep->num_attributes, n); swapl(&rep->text_size, n); - (void)WriteToClient(client, sz_xvQueryPortAttributesReply, (char *)&rep); + (void)WriteToClient(client, sz_xvQueryPortAttributesReply, (char *)rep); return Success; } @@ -273,7 +273,7 @@ SWriteQueryImageAttributesReply( swaps(&rep->width, n); swaps(&rep->height, n); - (void)WriteToClient(client, sz_xvQueryImageAttributesReply, (char *)&rep); + (void)WriteToClient(client, sz_xvQueryImageAttributesReply, (char *)rep); return Success; } @@ -289,7 +289,7 @@ SWriteListImageFormatsReply( swapl(&rep->length, n); swapl(&rep->num_formats, n); - (void)WriteToClient(client, sz_xvListImageFormatsReply, (char *)&rep); + (void)WriteToClient(client, sz_xvListImageFormatsReply, (char *)rep); return Success; } @@ -378,6 +378,7 @@ ProcXvQueryAdaptors(ClientPtr client) xvAdaptorInfo ainfo; xvQueryAdaptorsReply rep; int totalSize, na, nf, rc; + int nameSize; XvAdaptorPtr pa; XvFormatPtr pf; WindowPtr pWin; @@ -439,12 +440,12 @@ ProcXvQueryAdaptors(ClientPtr client) ainfo.base_id = pa->base_id; ainfo.num_ports = pa->nPorts; ainfo.type = pa->type; - ainfo.name_size = strlen(pa->name); + ainfo.name_size = nameSize = strlen(pa->name); ainfo.num_formats = pa->nFormats; _WriteAdaptorInfo(client, &ainfo); - WriteToClient(client, ainfo.name_size, pa->name); + WriteToClient(client, nameSize, pa->name); nf = pa->nFormats; pf = pa->pFormats; @@ -469,6 +470,7 @@ ProcXvQueryEncodings(ClientPtr client) xvEncodingInfo einfo; xvQueryEncodingsReply rep; int totalSize; + int nameSize; XvPortPtr pPort; int ne; XvEncodingPtr pe; @@ -513,13 +515,13 @@ ProcXvQueryEncodings(ClientPtr client) while (ne--) { einfo.encoding = pe->id; - einfo.name_size = strlen(pe->name); + einfo.name_size = nameSize = strlen(pe->name); einfo.width = pe->width; einfo.height = pe->height; einfo.rate.numerator = pe->rate.numerator; einfo.rate.denominator = pe->rate.denominator; _WriteEncodingInfo(client, &einfo); - WriteToClient(client, einfo.name_size, pe->name); + WriteToClient(client, nameSize, pe->name); pe++; } @@ -984,18 +986,19 @@ ProcXvQueryPortAttributes(ClientPtr client) rep.text_size = 0; for(i = 0, pAtt = pPort->pAdaptor->pAttributes; - i < rep.num_attributes; i++, pAtt++) + i < pPort->pAdaptor->nAttributes; i++, pAtt++) { rep.text_size += (strlen(pAtt->name) + 1 + 3) & ~3L; } - rep.length = (rep.num_attributes * sz_xvAttributeInfo) + rep.text_size; + rep.length = (pPort->pAdaptor->nAttributes * sz_xvAttributeInfo) + + rep.text_size; rep.length >>= 2; _WriteQueryPortAttributesReply(client, &rep); for(i = 0, pAtt = pPort->pAdaptor->pAttributes; - i < rep.num_attributes; i++, pAtt++) + i < pPort->pAdaptor->nAttributes; i++, pAtt++) { size = strlen(pAtt->name) + 1; /* pass the NULL */ Info.flags = pAtt->flags; @@ -1211,6 +1214,7 @@ ProcXvQueryImageAttributes(ClientPtr client) XvPortPtr pPort; int *offsets; int *pitches; + int planeLength; REQUEST(xvQueryImageAttributesReq); REQUEST_SIZE_MATCH(xvQueryImageAttributesReq); @@ -1250,7 +1254,7 @@ ProcXvQueryImageAttributes(ClientPtr client) rep.type = X_Reply; rep.sequenceNumber = client->sequence; - rep.length = num_planes << 1; + rep.length = planeLength = num_planes << 1; rep.num_planes = num_planes; rep.width = width; rep.height = height; @@ -1258,8 +1262,8 @@ ProcXvQueryImageAttributes(ClientPtr client) _WriteQueryImageAttributesReply(client, &rep); if(client->swapped) - SwapLongs((CARD32*)offsets, rep.length); - WriteToClient(client, rep.length << 2, (char*)offsets); + SwapLongs((CARD32*)offsets, planeLength); + WriteToClient(client, planeLength << 2, (char*)offsets); xfree(offsets); @@ -1287,13 +1291,13 @@ ProcXvListImageFormats(ClientPtr client) rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.num_formats = pPort->pAdaptor->nImages; - rep.length = rep.num_formats * sz_xvImageFormatInfo >> 2; + rep.length = pPort->pAdaptor->nImages * sz_xvImageFormatInfo >> 2; _WriteListImageFormatsReply(client, &rep); pImage = pPort->pAdaptor->pImages; - for(i = 0; i < rep.num_formats; i++, pImage++) { + for(i = 0; i < pPort->pAdaptor->nImages; i++, pImage++) { info.id = pImage->id; info.type = pImage->type; info.byte_order = pImage->byte_order; diff --git a/config/dbus-core.c b/config/dbus-core.c index eab72a530..9cf153076 100644 --- a/config/dbus-core.c +++ b/config/dbus-core.c @@ -76,7 +76,7 @@ teardown(void) struct config_dbus_core_hook *hook; if (bus_info.timer) { - TimerCancel(bus_info.timer); + TimerFree(bus_info.timer); bus_info.timer = NULL; } @@ -116,6 +116,8 @@ message_filter(DBusConnection *connection, DBusMessage *message, void *data) bus_info.connection = NULL; teardown(); + if (bus_info.timer) + TimerFree(bus_info.timer); bus_info.timer = TimerSet(NULL, 0, 1, reconnect_timer, NULL); return DBUS_HANDLER_RESULT_HANDLED; @@ -186,6 +188,7 @@ static CARD32 reconnect_timer(OsTimerPtr timer, CARD32 time, pointer arg) { if (connect_to_bus()) { + TimerFree(bus_info.timer); bus_info.timer = NULL; return 0; } diff --git a/config/hal.c b/config/hal.c index af96fc2c8..4ab296159 100644 --- a/config/hal.c +++ b/config/hal.c @@ -92,6 +92,8 @@ add_option(InputOption **options, const char *key, const char *value) for (; *options; options = &(*options)->next) ; *options = xcalloc(sizeof(**options), 1); + if (!*options) /* Yeesh. */ + return; (*options)->key = xstrdup(key); (*options)->value = xstrdup(value); (*options)->next = NULL; @@ -156,7 +158,7 @@ device_added(LibHalContext *hal_ctx, const char *udi) char *path = NULL, *driver = NULL, *name = NULL, *xkb_rules = NULL; char *xkb_model = NULL, *xkb_layout = NULL, *xkb_variant = NULL; char *xkb_options = NULL, *config_info = NULL; - InputOption *options = NULL; + InputOption *options = NULL, *tmpo = NULL; DeviceIntPtr dev; DBusError error; int type = TYPE_NONE; @@ -234,6 +236,7 @@ device_added(LibHalContext *hal_ctx, const char *udi) if (NewInputDeviceRequest(options, &dev) != Success) { DebugF("[config/hal] NewInputDeviceRequest failed\n"); + dev = NULL; goto unwind; } @@ -259,6 +262,12 @@ unwind: xfree(xkb_options); if (config_info) xfree(config_info); + while (!dev && (tmpo = options)) { + options = tmpo->next; + xfree(tmpo->key); + xfree(tmpo->value); + xfree(tmpo); + } out_error: dbus_error_free(&error); diff --git a/configure.ac b/configure.ac index 0b718c9f5..0742040c9 100644 --- a/configure.ac +++ b/configure.ac @@ -304,6 +304,7 @@ case $host_cpu in *freebsd*) SYS_LIBS=-lio ;; *netbsd*) AC_DEFINE(USE_ALPHA_PIO, 1, [NetBSD PIO alpha IO]) ;; esac + GLX_ARCH_DEFINES="-D__GLX_ALIGN64 -mieee" ;; arm*) ARM_VIDEO=yes @@ -333,6 +334,7 @@ case $host_cpu in xorg_loader_sparcmuldiv="yes" SPARC64_VIDEO=yes BSD_ARCH_SOURCES="sparc64_video.c ioperm_noop.c" + GLX_ARCH_DEFINES="-D__GLX_ALIGN64" ;; x86_64*|amd64*) use_x86_asm="yes" @@ -347,8 +349,16 @@ case $host_cpu in SYS_LIBS=-lamd64 ;; esac + GLX_ARCH_DEFINES="-D__GLX_ALIGN64" + ;; + ia64*) + GLX_ARCH_DEFINES="-D__GLX_ALIGN64" + ;; + s390*) + GLX_ARCH_DEFINES="-D__GLX_ALIGN64" ;; esac +AC_SUBST(GLX_ARCH_DEFINES) dnl BSD *_video.c selection AM_CONDITIONAL(ALPHA_VIDEO, [test "x$ALPHA_VIDEO" = xyes]) diff --git a/dix/devices.c b/dix/devices.c index a784637c6..e78c1e7ec 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -587,7 +587,8 @@ InitAndStartDevices(WindowPtr root) for (dev = inputInfo.off_devices; dev; dev = dev->next) { DebugF("(dix) initialising device %d\n", dev->id); - ActivateDevice(dev); + if (!dev->inited) + ActivateDevice(dev); } if (!inputInfo.keyboard) { /* In theory, this cannot happen */ diff --git a/dix/dispatch.c b/dix/dispatch.c index 51be6de8f..b3816a51e 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -149,6 +149,8 @@ int ProcInitialConnection(); #ifdef XSERVER_DTRACE #include "registry.h" +#include +typedef const char *string; #include "Xserver-dtrace.h" #endif diff --git a/dix/dixutils.c b/dix/dixutils.c index 786f4e335..dd485d518 100644 --- a/dix/dixutils.c +++ b/dix/dixutils.c @@ -800,7 +800,7 @@ _DeleteCallbackList( for (i = 0; i < numCallbackListsToCleanup; i++) { - if ((listsToCleanup[i] = pcbl) != 0) + if (listsToCleanup[i] == pcbl) { listsToCleanup[i] = NULL; break; diff --git a/dix/privates.c b/dix/privates.c index e04da41b1..47a0e1a29 100644 --- a/dix/privates.c +++ b/dix/privates.c @@ -232,6 +232,8 @@ dixResetPrivates(void) /* reset internal structures */ while (items) { next = items->next; + DeleteCallbackList(&items->initfuncs); + DeleteCallbackList(&items->deletefuncs); xfree(items); items = next; } diff --git a/exa/exa_accel.c b/exa/exa_accel.c index ae951ed9a..c2bfdee6b 100644 --- a/exa/exa_accel.c +++ b/exa/exa_accel.c @@ -739,6 +739,14 @@ exaPolySegment (DrawablePtr pDrawable, GCPtr pGC, int nseg, prect[i].y = pSeg[i].y2; prect[i].height = pSeg[i].y1 - pSeg[i].y2 + 1; } + + /* don't paint last pixel */ + if (pGC->capStyle == CapNotLast) { + if (prect[i].width == 1) + prect[i].height--; + else + prect[i].width--; + } } pGC->ops->PolyFillRect(pDrawable, pGC, nseg, prect); xfree(prect); diff --git a/hw/dmx/glxProxy/Makefile.am b/hw/dmx/glxProxy/Makefile.am index 1fbc8d764..f99549817 100644 --- a/hw/dmx/glxProxy/Makefile.am +++ b/hw/dmx/glxProxy/Makefile.am @@ -32,6 +32,7 @@ libglxproxy_a_SOURCES = compsize.c \ unpack.h AM_CFLAGS = \ + @GLX_ARCH_DEFINES@ \ $(DIX_CFLAGS) \ -I$(top_srcdir)/hw/dmx \ -I$(top_srcdir)/include \ diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c index 7df8651cb..21203a5e8 100644 --- a/hw/kdrive/ephyr/ephyr.c +++ b/hw/kdrive/ephyr/ephyr.c @@ -402,6 +402,7 @@ ephyrUnsetInternalDamage (ScreenPtr pScreen) pPixmap = (*pScreen->GetScreenPixmap) (pScreen); DamageUnregister (&pPixmap->drawable, scrpriv->pDamage); + DamageDestroy (scrpriv->pDamage); RemoveBlockAndWakeupHandlers (ephyrInternalDamageBlockHandler, ephyrInternalDamageWakeupHandler, diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h index 8722ba303..4e04b59f7 100644 --- a/hw/kdrive/src/kdrive.h +++ b/hw/kdrive/src/kdrive.h @@ -832,7 +832,10 @@ KdSetPointerMatrix (KdPointerMatrix *pointer); void KdComputePointerMatrix (KdPointerMatrix *pointer, Rotation randr, int width, int height); - + +void +KdScreenToPointerCoords (int *x, int *y); + void KdBlockHandler (int screen, pointer blockData, diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c index e4cee6c42..c7c10e4e2 100644 --- a/hw/kdrive/src/kinput.c +++ b/hw/kdrive/src/kinput.c @@ -631,6 +631,18 @@ KdComputePointerMatrix (KdPointerMatrix *m, Rotation randr, int width, } } +void +KdScreenToPointerCoords (int *x, int *y) +{ + int (*m)[3] = kdPointerMatrix.matrix; + int div = m[0][1] * m[1][0] - m[1][1] * m[0][0]; + int sx = *x; + int sy = *y; + + *x = (m[0][1] * sy - m[0][1] * m[1][2] + m[1][1] * m[0][2] - m[1][1] * sx) / div; + *y = (m[1][0] * sx + m[0][0] * m[1][2] - m[1][0] * m[0][2] - m[0][0] * sy) / div; +} + static void KdKbdCtrl (DeviceIntPtr pDevice, KeybdCtrl *ctrl) { diff --git a/hw/xfree86/common/xf86DPMS.c b/hw/xfree86/common/xf86DPMS.c index 43efb8ed4..4fb901aae 100644 --- a/hw/xfree86/common/xf86DPMS.c +++ b/hw/xfree86/common/xf86DPMS.c @@ -60,6 +60,7 @@ xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags) ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; DPMSPtr pDPMS; pointer DPMSOpt; + MessageType enabled_from = X_INFO; DPMSKey = &DPMSKey; @@ -78,8 +79,8 @@ xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags) = xf86SetBoolOption(pScrn->options, "dpms", FALSE)) && !DPMSDisabledSwitch) DPMSEnabled = TRUE; + enabled_from = X_CONFIG; xf86MarkOptionUsed(DPMSOpt); - xf86DrvMsg(pScreen->myNum, X_CONFIG, "DPMS enabled\n"); } else if (DPMSEnabledSwitch) { if (!DPMSDisabledSwitch) DPMSEnabled = TRUE; @@ -88,6 +89,8 @@ xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags) else { pDPMS->Enabled = defaultDPMSEnabled; } + if (pDPMS->Enabled) + xf86DrvMsg(pScreen->myNum, enabled_from, "DPMS enabled\n"); pDPMS->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = DPMSClose; DPMSCount++; diff --git a/hw/xfree86/common/xf86Mode.c b/hw/xfree86/common/xf86Mode.c index 782f08b8d..fb899a1e4 100644 --- a/hw/xfree86/common/xf86Mode.c +++ b/hw/xfree86/common/xf86Mode.c @@ -1215,20 +1215,40 @@ inferVirtualSize(ScrnInfoPtr scrp, DisplayModePtr modes, int *vx, int *vy) { float aspect = 0.0; MonPtr mon = scrp->monitor; + xf86MonPtr DDC; int x = 0, y = 0; DisplayModePtr mode; if (!mon) return 0; + DDC = mon->DDC; + + if (DDC && DDC->ver.revision >= 4) { + /* For 1.4, we might actually get native pixel format. How novel. */ + if (PREFERRED_TIMING_MODE(DDC->features.msc)) { + for (mode = modes; mode; mode = mode->next) { + if (mode->type & (M_T_DRIVER | M_T_PREFERRED)) { + x = mode->HDisplay; + y = mode->VDisplay; + goto found; + } + } + } + /* + * Even if we don't, we might get aspect ratio from extra CVT info + * or from the monitor size fields. TODO. + */ + } /* - * technically this triggers if _either_ is zero, which is not what EDID - * says, but if only one is zero this is best effort. also we don't - * know that all projectors are 4:3, but we certainly suspect it. + * Technically this triggers if either is zero. That wasn't legal + * before EDID 1.4, but right now we'll get that wrong. TODO. */ - if (!mon->widthmm || !mon->heightmm) - aspect = 4.0/3.0; - else - aspect = (float)mon->widthmm / (float)mon->heightmm; + if (!aspect) { + if (!mon->widthmm || !mon->heightmm) + aspect = 4.0/3.0; + else + aspect = (float)mon->widthmm / (float)mon->heightmm; + } /* find the largest M_T_DRIVER mode with that aspect ratio */ for (mode = modes; mode; mode = mode->next) { @@ -1252,6 +1272,7 @@ inferVirtualSize(ScrnInfoPtr scrp, DisplayModePtr modes, int *vx, int *vy) return 0; } +found: *vx = x; *vy = y; diff --git a/hw/xfree86/ddc/edid.h b/hw/xfree86/ddc/edid.h index 4487273cd..2496e19e6 100644 --- a/hw/xfree86/ddc/edid.h +++ b/hw/xfree86/ddc/edid.h @@ -1,5 +1,5 @@ - -/* edid.h: defines to parse an EDID block +/* + * edid.h: defines to parse an EDID block * * This file contains all information to interpret a standard EDIC block * transmitted by a display device via DDC (Display Data Channel). So far @@ -125,7 +125,11 @@ #define SYNC _SYNC(GET(D_INPUT)) #define _DFP(x) (x & 0x01) #define DFP _DFP(GET(D_INPUT)) -#define _GAMMA(x) (x == 0xff ? 1.0 : ((x + 100.0)/100.0)) +#define _BPC(x) ((x & 0x70) >> 4) +#define BPC _BPC(GET(D_INPUT)) +#define _DIGITAL_INTERFACE(x) (x & 0x0F) +#define DIGITAL_INTERFACE _DIGITAL_INTERFACE(GET(D_INPUT)) +#define _GAMMA(x) (x == 0xff ? 0.0 : ((x + 100.0)/100.0)) #define GAMMA _GAMMA(GET(D_GAMMA)) #define HSIZE_MAX GET(D_HSIZE) #define VSIZE_MAX GET(D_VSIZE) @@ -241,14 +245,18 @@ #define SERIAL_NUMBER 0xFF #define ASCII_STR 0xFE #define MONITOR_RANGES 0xFD +#define _MIN_V_OFFSET(x) ((!!(x[4] & 0x01)) * 255) +#define _MAX_V_OFFSET(x) ((!!(x[4] & 0x02)) * 255) +#define _MIN_H_OFFSET(x) ((!!(x[4] & 0x04)) * 255) +#define _MAX_H_OFFSET(x) ((!!(x[4] & 0x08)) * 255) #define _MIN_V(x) x[5] -#define MIN_V _MIN_V(c) +#define MIN_V (_MIN_V(c) + _MIN_V_OFFSET(c)) #define _MAX_V(x) x[6] -#define MAX_V _MAX_V(c) +#define MAX_V (_MAX_V(c) + _MAX_V_OFFSET(c)) #define _MIN_H(x) x[7] -#define MIN_H _MIN_H(c) +#define MIN_H (_MIN_H(c) + _MIN_H_OFFSET(c)) #define _MAX_H(x) x[8] -#define MAX_H _MAX_H(c) +#define MAX_H (_MAX_H(c) + _MAX_H_OFFSET(c)) #define _MAX_CLOCK(x) x[9] #define MAX_CLOCK _MAX_CLOCK(c) #define _HAVE_2ND_GTF(x) (x[10] == 0x02) @@ -282,6 +290,9 @@ #define _WHITE_GAMMA2(x) _GAMMA(x[14]) #define WHITE_GAMMA2 _WHITE_GAMMA2(c) #define ADD_STD_TIMINGS 0xFA +#define COLOR_MANAGEMENT_DATA 0xF9 +#define CVT_3BYTE_DATA 0xF8 +#define ADD_EST_TIMINGS 0xF7 #define ADD_DUMMY 0x10 #define _NEXT_DT_MD_SECTION(x) (x = (x + DET_TIMING_INFO_LEN)) @@ -315,11 +326,15 @@ #define DPMS_SUSPEND(x) (x & 0x02) #define DPMS_OFF(x) (x & 0x01) -/* display type */ +/* display type, analog */ #define DISP_MONO 0 #define DISP_RGB 1 #define DISP_MULTCOLOR 2 +/* display color encodings, digital */ +#define DISP_YCRCB444 0x01 +#define DISP_YCRCB422 0x02 + /* Msc stuff EDID Ver > 1.1 */ #define STD_COLOR_SPACE(x) (x & 0x4) #define PREFERRED_TIMING_MODE(x) (x & 0x2) @@ -357,6 +372,9 @@ struct disp_features { unsigned int input_setup:1; unsigned int input_sync:5; unsigned int input_dfp:1; + unsigned int input_bpc:3; + unsigned int input_interface:4; + /* 15 bit hole */ int hsize; int vsize; float gamma; @@ -414,8 +432,13 @@ struct detailed_timings { #define DS_RANGES 0xFD #define DS_WHITE_P 0xFB #define DS_STD_TIMINGS 0xFA +#define DS_CMD 0xF9 +#define DS_CVT 0xF8 +#define DS_EST_III 0xF7 #define DS_DUMMY 0x10 #define DS_UNKOWN 0x100 /* type is an int */ +#define DS_VENDOR 0x101 +#define DS_VENDOR_MAX 0x110 struct monitor_ranges { int min_v; @@ -437,17 +460,33 @@ struct whitePoints{ float white_gamma; }; +struct cvt_timings { + int width; + int height; + int rate; + int rates; +}; + +/* + * Be careful when adding new sections; this structure can't grow, it's + * embedded in the middle of xf86Monitor which is ABI. Sizes below are + * in bytes, for ILP32 systems. If all else fails just copy the section + * literally like serial and friends. + */ struct detailed_monitor_section { int type; union { - struct detailed_timings d_timings; + struct detailed_timings d_timings; /* 56 */ Uchar serial[13]; Uchar ascii_data[13]; Uchar name[13]; - struct monitor_ranges ranges; - struct std_timings std_t[5]; - struct whitePoints wp[2]; - } section; + struct monitor_ranges ranges; /* 40 */ + struct std_timings std_t[5]; /* 80 */ + struct whitePoints wp[2]; /* 32 */ + /* color management data */ + struct cvt_timings cvt[4]; /* 64 */ + /* established timings III */ + } section; /* max: 80 */ }; typedef struct { diff --git a/hw/xfree86/ddc/interpret_edid.c b/hw/xfree86/ddc/interpret_edid.c index 7b4b2b9ec..14b0fd73a 100644 --- a/hw/xfree86/ddc/interpret_edid.c +++ b/hw/xfree86/ddc/interpret_edid.c @@ -1,8 +1,28 @@ - -/* interpret_edid.c: interpret a primary EDID block - * +/* * Copyright 1998 by Egbert Eich + * Copyright 2007 Red Hat, Inc. + * + * 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 + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * them 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 MERCHANTIBILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS 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. + * + * interpret_edid.c: interpret a primary EDID block */ + #ifdef HAVE_XORG_CONFIG_H #include #endif @@ -128,8 +148,12 @@ get_display_section(Uchar *c, struct disp_features *r, r->input_voltage = INPUT_VOLTAGE; r->input_setup = SETUP; r->input_sync = SYNC; - } else if (v->version > 1 || v->revision > 2) + } else if (v->revision == 2 || v->revision == 3) { r->input_dfp = DFP; + } else if (v->revision >= 4) { + r->input_bpc = BPC; + r->input_interface = DIGITAL_INTERFACE; + } r->hsize = HSIZE_MAX; r->vsize = VSIZE_MAX; r->gamma = GAMMA; @@ -154,6 +178,34 @@ get_established_timing_section(Uchar *c, struct established_timings *r) r->t_manu = T_MANU; } +static void +get_cvt_timing_section(Uchar *c, struct cvt_timings *r) +{ + int i; + + for (i = 0; i < 4; i++) { + if (c[0] && c[1] && c[2]) { + r[i].height = (c[0] + ((c[1] & 0xF0) << 8) + 1) * 2; + switch (c[1] & 0xc0) { + case 0x00: r[i].width = r[i].height * 4 / 3; break; + case 0x40: r[i].width = r[i].height * 16 / 9; break; + case 0x80: r[i].width = r[i].height * 16 / 10; break; + case 0xc0: r[i].width = r[i].height * 15 / 9; break; + } + switch (c[2] & 0x60) { + case 0x00: r[i].rate = 50; break; + case 0x20: r[i].rate = 60; break; + case 0x40: r[i].rate = 75; break; + case 0x60: r[i].rate = 85; break; + } + r[i].rates = c[2] & 0x1f; + } else { + return; + } + c += 3; + } +} + static void get_std_timing_section(Uchar *c, struct std_timings *r, struct edid_version *v) @@ -207,6 +259,16 @@ get_dt_md_section(Uchar *c, struct edid_version *ver, det_mon[i].type = DS_STD_TIMINGS; get_dst_timing_section(c,det_mon[i].section.std_t, ver); break; + case COLOR_MANAGEMENT_DATA: + det_mon[i].type = DS_CMD; + break; + case CVT_3BYTE_DATA: + det_mon[i].type = DS_CVT; + get_cvt_timing_section(c, det_mon[i].section.cvt); + break; + case ADD_EST_TIMINGS: + det_mon[i].type = DS_EST_III; + break; case ADD_DUMMY: det_mon[i].type = DS_DUMMY; break; @@ -214,6 +276,9 @@ get_dt_md_section(Uchar *c, struct edid_version *ver, det_mon[i].type = DS_UNKOWN; break; } + if (c[3] <= 0x0F) { + det_mon[i].type = DS_VENDOR + c[3]; + } } else { det_mon[i].type = DT; get_detailed_timing_section(c,&det_mon[i].section.d_timings); @@ -304,13 +369,16 @@ get_detailed_timing_section(Uchar *c, struct detailed_timings *r) r->misc = MISC; } -#define MAX_EDID_MINOR 3 +#define MAX_EDID_MINOR 4 static Bool validate_version(int scrnIndex, struct edid_version *r) { - if (r->version != 1) + if (r->version != 1) { + xf86DrvMsg(scrnIndex, X_ERROR, "Unknown EDID version %d\n", + r->version); return FALSE; + } if (r->revision > MAX_EDID_MINOR) xf86DrvMsg(scrnIndex, X_WARNING, diff --git a/hw/xfree86/ddc/print_edid.c b/hw/xfree86/ddc/print_edid.c index 30b607d4f..d9f18fa9f 100644 --- a/hw/xfree86/ddc/print_edid.c +++ b/hw/xfree86/ddc/print_edid.c @@ -1,8 +1,28 @@ - -/* print_edid.c: print out all information retrieved from display device - * +/* * Copyright 1998 by Egbert Eich + * Copyright 2007 Red Hat, Inc. + * + * 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 + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * them 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 MERCHANTIBILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS 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. + * + * print_edid.c: print out all information retrieved from display device */ + #ifdef HAVE_XORG_CONFIG_H #include #endif @@ -11,53 +31,9 @@ #include "xf86.h" #include "xf86_OSproc.h" #include "xf86DDC.h" +#include "edid.h" -static void print_vendor(int scrnIndex, struct vendor *); -static void print_version(int scrnIndex, struct edid_version *); -static void print_display(int scrnIndex, struct disp_features *, - struct edid_version *); -static void print_established_timings(int scrnIndex, - struct established_timings *); -static void print_std_timings(int scrnIndex, struct std_timings *); -static void print_detailed_monitor_section(int scrnIndex, - struct detailed_monitor_section *); -static void print_detailed_timings(int scrnIndex, struct detailed_timings *); - -static void print_input_features(int scrnIndex, struct disp_features *); -static void print_dpms_features(int scrnIndex, struct disp_features *, - struct edid_version *v); -static void print_whitepoint(int scrnIndex, struct disp_features *); -static void print_number_sections(int scrnIndex, int); - #define EDID_WIDTH 16 - -xf86MonPtr -xf86PrintEDID(xf86MonPtr m) -{ - CARD16 i, j; - char buf[EDID_WIDTH * 2 + 1]; - - if (!(m)) return NULL; - - print_vendor(m->scrnIndex,&m->vendor); - print_version(m->scrnIndex,&m->ver); - print_display(m->scrnIndex,&m->features, &m->ver); - print_established_timings(m->scrnIndex,&m->timings1); - print_std_timings(m->scrnIndex,m->timings2); - print_detailed_monitor_section(m->scrnIndex,m->det_mon); - print_number_sections(m->scrnIndex,m->no_sections); - - xf86DrvMsg(m->scrnIndex, X_INFO, "EDID (in hex):\n"); - - for (i = 0; i < 128; i += j) { - for (j = 0; j < EDID_WIDTH; ++j) { - sprintf(&buf[j * 2], "%02x", m->rawData[i + j]); - } - xf86DrvMsg(m->scrnIndex, X_INFO, "\t%s\n", buf); - } - - return m; -} static void print_vendor(int scrnIndex, struct vendor *c) @@ -66,7 +42,7 @@ print_vendor(int scrnIndex, struct vendor *c) (char *)&c->name, c->prod_id, c->serial); xf86DrvMsg(scrnIndex, X_INFO, "Year: %u Week: %u\n", c->year, c->week); } - + static void print_version(int scrnIndex, struct edid_version *c) { @@ -74,32 +50,38 @@ print_version(int scrnIndex, struct edid_version *c) c->revision); } -static void -print_display(int scrnIndex, struct disp_features *disp, - struct edid_version *version) -{ - print_input_features(scrnIndex,disp); - xf86DrvMsg(scrnIndex,X_INFO,"Max H-Image Size [cm]: "); - if (disp->hsize) - xf86ErrorF("horiz.: %i ",disp->hsize); - else - xf86ErrorF("H-Size may change, "); - if (disp->vsize) - xf86ErrorF("vert.: %i\n",disp->vsize); - else - xf86ErrorF("V-Size may change\n"); - xf86DrvMsg(scrnIndex,X_INFO,"Gamma: %.2f\n", disp->gamma); - print_dpms_features(scrnIndex,disp,version); - print_whitepoint(scrnIndex,disp); -} - +static const char *digital_interfaces[] = { + "undefined", + "DVI", + "HDMI-a", + "HDMI-b", + "MDDI", + "DisplayPort", + "unknown" +}; + static void -print_input_features(int scrnIndex, struct disp_features *c) +print_input_features(int scrnIndex, struct disp_features *c, + struct edid_version *v) { if (DIGITAL(c->input_type)) { - xf86DrvMsg(scrnIndex,X_INFO,"Digital Display Input\n"); - if (DFP1(c->input_dfp)) - xf86DrvMsg(scrnIndex,X_INFO,"DFP 1.x compatible TMDS\n"); + xf86DrvMsg(scrnIndex, X_INFO, "Digital Display Input\n"); + if (v->revision == 2 || v->revision == 3) { + if (DFP1(c->input_dfp)) + xf86DrvMsg(scrnIndex, X_INFO, "DFP 1.x compatible TMDS\n"); + } else if (v->revision >= 4) { + int interface = c->input_interface; + int bpc = c->input_bpc; + if (interface > 6) + interface = 6; /* unknown */ + if (bpc == 0 || bpc == 7) + xf86DrvMsg(scrnIndex, X_INFO, "Undefined color depth\n"); + else + xf86DrvMsg(scrnIndex, X_INFO, "%d bits per channel\n", + bpc * 2 + 4); + xf86DrvMsg(scrnIndex, X_INFO, "Digital interface is %s\n", + digital_interfaces[interface]); + } } else { xf86DrvMsg(scrnIndex,X_INFO,"Analog Display Input, "); xf86ErrorF("Input Voltage Level: "); @@ -146,33 +128,53 @@ print_dpms_features(int scrnIndex, struct disp_features *c, if (DPMS_OFF(c->dpms)) xf86ErrorF(" Off"); } else xf86DrvMsg(scrnIndex,X_INFO,"No DPMS capabilities specified"); - switch (c->display_type){ - case DISP_MONO: - xf86ErrorF("; Monochorome/GrayScale Display\n"); - break; - case DISP_RGB: - xf86ErrorF("; RGB/Color Display\n"); - break; - case DISP_MULTCOLOR: - xf86ErrorF("; Non RGB Multicolor Display\n"); - break; - default: - xf86ErrorF("\n"); - break; + if (!c->input_type) { /* analog */ + switch (c->display_type){ + case DISP_MONO: + xf86ErrorF("; Monochorome/GrayScale Display\n"); + break; + case DISP_RGB: + xf86ErrorF("; RGB/Color Display\n"); + break; + case DISP_MULTCOLOR: + xf86ErrorF("; Non RGB Multicolor Display\n"); + break; + default: + xf86ErrorF("\n"); + break; + } + } else { + int enc = c->display_type; + xf86DrvMsg(scrnIndex, X_INFO, "\nSupported color encodings: " + "RGB 4:4:4 %s%s\n", + enc & DISP_YCRCB444 ? "YCrCb 4:4:4 " : "", + enc & DISP_YCRCB422 ? "YCrCb 4:2:2" : ""); } + if (STD_COLOR_SPACE(c->msc)) xf86DrvMsg(scrnIndex,X_INFO, "Default color space is primary color space\n"); - if (PREFERRED_TIMING_MODE(c->msc)) - xf86DrvMsg(scrnIndex,X_INFO, + + if (PREFERRED_TIMING_MODE(c->msc) || v->revision >= 4) { + xf86DrvMsg(scrnIndex, X_INFO, "First detailed timing is preferred mode\n"); - else if (v->version == 1 && v->revision >= 3) + if (v->revision >= 4) + xf86DrvMsg(scrnIndex, X_INFO, + "Preferred mode is native pixel format and refresh rate\n"); + } else if (v->revision == 3) { xf86DrvMsg(scrnIndex,X_INFO, "First detailed timing not preferred " "mode in violation of standard!"); - if (GFT_SUPPORTED(c->msc)) - xf86DrvMsg(scrnIndex,X_INFO, - "GTF timings supported\n"); + } + + if (v->revision >= 4) { + if (GFT_SUPPORTED(c->msc)) { + xf86DrvMsg(scrnIndex, X_INFO, "Display is continuous-frequency\n"); + } + } else { + if (GFT_SUPPORTED(c->msc)) + xf86DrvMsg(scrnIndex, X_INFO, "GTF timings supported\n"); + } } static void @@ -187,7 +189,37 @@ print_whitepoint(int scrnIndex, struct disp_features *disp) xf86ErrorF("whiteX: %.3f whiteY: %.3f\n", disp->whitex,disp->whitey); } - + +static void +print_display(int scrnIndex, struct disp_features *disp, + struct edid_version *v) +{ + print_input_features(scrnIndex, disp, v); + if (disp->hsize && disp->vsize) { + xf86DrvMsg(scrnIndex, X_INFO, "Max Image Size [cm]: "); + xf86ErrorF("horiz.: %i ", disp->hsize); + xf86ErrorF("vert.: %i\n", disp->vsize); + } else if (v->revision >= 4 && (disp->hsize || disp->vsize)) { + if (disp->hsize) + xf86DrvMsg(scrnIndex, X_INFO, "Aspect ratio: %.2f (landscape)\n", + (disp->hsize + 99) / 100.0); + if (disp->vsize) + xf86DrvMsg(scrnIndex, X_INFO, "Aspect ratio: %.2f (portrait)\n", + 100.0 / (float)(disp->vsize + 99)); + + } else { + xf86DrvMsg(scrnIndex, X_INFO, "Indeterminate output size\n"); + } + + if (!disp->gamma && v->revision >= 1.4) + xf86DrvMsg(scrnIndex, X_INFO, "Gamma defined in extension block\n"); + else + xf86DrvMsg(scrnIndex, X_INFO, "Gamma: %.2f\n", disp->gamma); + + print_dpms_features(scrnIndex, disp, v); + print_whitepoint(scrnIndex, disp); +} + static void print_established_timings(int scrnIndex, struct established_timings *t) { @@ -235,7 +267,68 @@ print_std_timings(int scrnIndex, struct std_timings *t) } } } - + +static void +print_cvt_timings(int si, struct cvt_timings *t) +{ + int i; + + for (i = 0; i < 4; i++) { + if (t[i].height) { + xf86DrvMsg(si, X_INFO, "%dx%d @ %s%s%s%s%s Hz\n", + t[i].width, t[i].height, + t[i].rates & 0x10 ? "50," : "", + t[i].rates & 0x08 ? "60," : "", + t[i].rates & 0x04 ? "75," : "", + t[i].rates & 0x02 ? "85," : "", + t[i].rates & 0x01 ? "60RB" : ""); + } else break; + } +} + +static void +print_detailed_timings(int scrnIndex, struct detailed_timings *t) +{ + + if (t->clock > 15000000) { /* sanity check */ + xf86DrvMsg(scrnIndex,X_INFO,"Supported additional Video Mode:\n"); + xf86DrvMsg(scrnIndex,X_INFO,"clock: %.1f MHz ",t->clock/1000000.0); + xf86ErrorF("Image Size: %i x %i mm\n",t->h_size,t->v_size); + xf86DrvMsg(scrnIndex,X_INFO, + "h_active: %i h_sync: %i h_sync_end %i h_blank_end %i ", + t->h_active, t->h_sync_off + t->h_active, + t->h_sync_off + t->h_sync_width + t->h_active, + t->h_active + t->h_blanking); + xf86ErrorF("h_border: %i\n",t->h_border); + xf86DrvMsg(scrnIndex,X_INFO, + "v_active: %i v_sync: %i v_sync_end %i v_blanking: %i ", + t->v_active, t->v_sync_off + t->v_active, + t->v_sync_off + t->v_sync_width + t->v_active, + t->v_active + t->v_blanking); + xf86ErrorF("v_border: %i\n",t->v_border); + if (IS_STEREO(t->stereo)) { + xf86DrvMsg(scrnIndex,X_INFO,"Stereo: "); + if (IS_RIGHT_STEREO(t->stereo)) { + if (!t->stereo_1) + xf86ErrorF("right channel on sync\n"); + else + xf86ErrorF("left channel on sync\n"); + } else if (IS_LEFT_STEREO(t->stereo)) { + if (!t->stereo_1) + xf86ErrorF("right channel on even line\n"); + else + xf86ErrorF("left channel on evel line\n"); + } + if (IS_4WAY_STEREO(t->stereo)) { + if (!t->stereo_1) + xf86ErrorF("4-way interleaved\n"); + else + xf86ErrorF("side-by-side interleaved"); + } + } + } +} + static void print_detailed_monitor_section(int scrnIndex, struct detailed_monitor_section *m) @@ -290,56 +383,31 @@ print_detailed_monitor_section(int scrnIndex, m[i].section.wp[j].white_y, m[i].section.wp[j].white_gamma); break; + case DS_CMD: + xf86DrvMsg(scrnIndex, X_INFO, + "Color management data: (not decoded)\n"); + break; + case DS_CVT: + xf86DrvMsg(scrnIndex, X_INFO, + "CVT 3-byte-code modes:\n"); + print_cvt_timings(scrnIndex, m[i].section.cvt); + break; + case DS_EST_III: + xf86DrvMsg(scrnIndex, X_INFO, + "Established timings III: (not decoded)\n"); + break; case DS_DUMMY: default: break; } - } -} - -static void -print_detailed_timings(int scrnIndex, struct detailed_timings *t) -{ - - if (t->clock > 15000000) { /* sanity check */ - xf86DrvMsg(scrnIndex,X_INFO,"Supported additional Video Mode:\n"); - xf86DrvMsg(scrnIndex,X_INFO,"clock: %.1f MHz ",t->clock/1000000.0); - xf86ErrorF("Image Size: %i x %i mm\n",t->h_size,t->v_size); - xf86DrvMsg(scrnIndex,X_INFO, - "h_active: %i h_sync: %i h_sync_end %i h_blank_end %i ", - t->h_active, t->h_sync_off + t->h_active, - t->h_sync_off + t->h_sync_width + t->h_active, - t->h_active + t->h_blanking); - xf86ErrorF("h_border: %i\n",t->h_border); - xf86DrvMsg(scrnIndex,X_INFO, - "v_active: %i v_sync: %i v_sync_end %i v_blanking: %i ", - t->v_active, t->v_sync_off + t->v_active, - t->v_sync_off + t->v_sync_width + t->v_active, - t->v_active + t->v_blanking); - xf86ErrorF("v_border: %i\n",t->v_border); - if (IS_STEREO(t->stereo)) { - xf86DrvMsg(scrnIndex,X_INFO,"Stereo: "); - if (IS_RIGHT_STEREO(t->stereo)) { - if (!t->stereo_1) - xf86ErrorF("right channel on sync\n"); - else - xf86ErrorF("left channel on sync\n"); - } else if (IS_LEFT_STEREO(t->stereo)) { - if (!t->stereo_1) - xf86ErrorF("right channel on even line\n"); - else - xf86ErrorF("left channel on evel line\n"); - } - if (IS_4WAY_STEREO(t->stereo)) { - if (!t->stereo_1) - xf86ErrorF("4-way interleaved\n"); - else - xf86ErrorF("side-by-side interleaved"); - } + if (m[i].type >= DS_VENDOR && m[i].type <= DS_VENDOR_MAX) { + xf86DrvMsg(scrnIndex, X_WARNING, + "Unknown vendor-specific block %hx\n", + m[i].type - DS_VENDOR); } } } - + static void print_number_sections(int scrnIndex, int num) { @@ -348,3 +416,30 @@ print_number_sections(int scrnIndex, int num) num); } +xf86MonPtr +xf86PrintEDID(xf86MonPtr m) +{ + CARD16 i, j; + char buf[EDID_WIDTH * 2 + 1]; + + if (!(m)) return NULL; + + print_vendor(m->scrnIndex,&m->vendor); + print_version(m->scrnIndex,&m->ver); + print_display(m->scrnIndex,&m->features, &m->ver); + print_established_timings(m->scrnIndex,&m->timings1); + print_std_timings(m->scrnIndex,m->timings2); + print_detailed_monitor_section(m->scrnIndex,m->det_mon); + print_number_sections(m->scrnIndex,m->no_sections); + + xf86DrvMsg(m->scrnIndex, X_INFO, "EDID (in hex):\n"); + + for (i = 0; i < 128; i += j) { + for (j = 0; j < EDID_WIDTH; ++j) { + sprintf(&buf[j * 2], "%02x", m->rawData[i + j]); + } + xf86DrvMsg(m->scrnIndex, X_INFO, "\t%s\n", buf); + } + + return m; +} diff --git a/hw/xfree86/dixmods/extmod/modinit.h b/hw/xfree86/dixmods/extmod/modinit.h index 191b3ef89..99d714c4f 100644 --- a/hw/xfree86/dixmods/extmod/modinit.h +++ b/hw/xfree86/dixmods/extmod/modinit.h @@ -130,7 +130,7 @@ extern void XaceExtensionInit(INITARGS); #endif #ifdef XSELINUX -extern void XSELinuxExtensionInit(INITARGS); +extern void SELinuxExtensionInit(INITARGS); #endif #if 1 diff --git a/hw/xfree86/dixmods/extmod/xf86misc.c b/hw/xfree86/dixmods/extmod/xf86misc.c index 66278a298..8f4434601 100644 --- a/hw/xfree86/dixmods/extmod/xf86misc.c +++ b/hw/xfree86/dixmods/extmod/xf86misc.c @@ -250,6 +250,7 @@ ProcXF86MiscGetMouseSettings(client) char *devname; pointer mouse; register int n; + int devnamelen; DEBUG_P("XF86MiscGetMouseSettings"); @@ -269,7 +270,7 @@ ProcXF86MiscGetMouseSettings(client) rep.emulate3timeout = MiscExtGetMouseValue(mouse, MISC_MSE_EM3TIMEOUT); rep.chordmiddle = MiscExtGetMouseValue(mouse, MISC_MSE_CHORDMIDDLE); rep.flags = MiscExtGetMouseValue(mouse, MISC_MSE_FLAGS); - rep.devnamelen = (devname? strlen(devname): 0); + devnamelen = rep.devnamelen = (devname? strlen(devname): 0); rep.length = (sizeof(xXF86MiscGetMouseSettingsReply) - sizeof(xGenericReply) + ((rep.devnamelen+3) & ~3)) >> 2; @@ -289,8 +290,8 @@ ProcXF86MiscGetMouseSettings(client) WriteToClient(client, SIZEOF(xXF86MiscGetMouseSettingsReply), (char *)&rep); MiscExtDestroyStruct(mouse, MISC_POINTER); - if (rep.devnamelen) - WriteToClient(client, rep.devnamelen, devname); + if (devnamelen) + WriteToClient(client, devnamelen, devname); return (client->noClientException); } @@ -508,6 +509,7 @@ ProcXF86MiscGetFilePaths(client) const char *modulepath; const char *logfile; register int n; + int configlen, modulelen, loglen; DEBUG_P("XF86MiscGetFilePaths"); @@ -518,9 +520,9 @@ ProcXF86MiscGetFilePaths(client) if (!MiscExtGetFilePaths(&configfile, &modulepath, &logfile)) return BadValue; - rep.configlen = (configfile? strlen(configfile): 0); - rep.modulelen = (modulepath? strlen(modulepath): 0); - rep.loglen = (logfile? strlen(logfile): 0); + configlen = rep.configlen = (configfile? strlen(configfile): 0); + modulelen = rep.modulelen = (modulepath? strlen(modulepath): 0); + loglen = rep.loglen = (logfile? strlen(logfile): 0); rep.length = (SIZEOF(xXF86MiscGetFilePathsReply) - SIZEOF(xGenericReply) + ((rep.configlen + 3) & ~3) + ((rep.modulelen + 3) & ~3) + @@ -535,12 +537,12 @@ ProcXF86MiscGetFilePaths(client) } WriteToClient(client, SIZEOF(xXF86MiscGetFilePathsReply), (char *)&rep); - if (rep.configlen) - WriteToClient(client, rep.configlen, (char *)configfile); - if (rep.modulelen) - WriteToClient(client, rep.modulelen, (char *)modulepath); - if (rep.loglen) - WriteToClient(client, rep.loglen, (char *)logfile); + if (configlen) + WriteToClient(client, configlen, (char *)configfile); + if (modulelen) + WriteToClient(client, modulelen, (char *)modulepath); + if (loglen) + WriteToClient(client, loglen, (char *)logfile); return (client->noClientException); } @@ -553,6 +555,7 @@ ProcXF86MiscPassMessage(client) char *msgtype, *msgval, *retstr; int retval, size; register int n; + int mesglen; REQUEST(xXF86MiscPassMessageReq); @@ -589,7 +592,7 @@ ProcXF86MiscPassMessage(client) rep.type = X_Reply; rep.sequenceNumber = client->sequence; - rep.mesglen = (retstr? strlen(retstr): 0); + mesglen = rep.mesglen = (retstr? strlen(retstr): 0); rep.length = (SIZEOF(xXF86MiscPassMessageReply) - SIZEOF(xGenericReply) + ((rep.mesglen + 3) & ~3)) >> 2; rep.status = 0; @@ -601,8 +604,8 @@ ProcXF86MiscPassMessage(client) } WriteToClient(client, SIZEOF(xXF86MiscPassMessageReply), (char *)&rep); - if (rep.mesglen) - WriteToClient(client, rep.mesglen, (char *)retstr); + if (mesglen) + WriteToClient(client, mesglen, (char *)retstr); xfree(msgtype); xfree(msgval); diff --git a/hw/xfree86/doc/man/xorg.conf.man.pre b/hw/xfree86/doc/man/xorg.conf.man.pre index 77439a517..1369a16c9 100644 --- a/hw/xfree86/doc/man/xorg.conf.man.pre +++ b/hw/xfree86/doc/man/xorg.conf.man.pre @@ -493,7 +493,7 @@ extension) to connect from another host. Default: off. .TP 7 .BI "Option \*qDisableModInDev\*q \*q" boolean \*q -This disables the parts of the __xservername__\-Misc extension that can be used to +This disables the parts of the XFree86\-Misc extension that can be used to modify the input device settings dynamically. Default: that functionality is enabled. .TP 7 @@ -704,6 +704,20 @@ default. .BI "Option \*qIgnoreABI\*q \*q" boolean \*q Allow modules built for a different, potentially incompatible version of the X server to load. Disabled by default. +.TP 7 +.BI "Option \*qAllowEmptyInput\*q \*q" boolean \*q +If enabled, don't add the standard keyboard and mouse drivers, if there are no +input devices in the config file. Disabled by default. +.TP 7 +.BI "Option \*qAutoAddDevices\*q \*q" boolean \*q +If this option is disabled, then no devices will be added from HAL events. +Enabled by default. +.TP 7 +.BI "Option \*qAutoEnableDevices\*q \*q" boolean \*q +If this option is disabled, then the devices will be added (and the +DevicePresenceNotify event sent), but not enabled, thus leaving policy up +to the client. +Enabled by default. .SH "MODULE SECTION" The .B Module @@ -2015,7 +2029,7 @@ These both specify that the upper left corner's coordinates are The .B Absolute keyword is optional. -Some older versions of __xservername__ (4.2 and earlier) don't recognise the +Some older versions of XFree86 (4.2 and earlier) don't recognise the .B Absolute keyword, so it's safest to just specify the coordinates without it. .TP 4 diff --git a/hw/xfree86/dummylib/Makefile.am b/hw/xfree86/dummylib/Makefile.am index 3e70d25fe..ad3f1ea12 100644 --- a/hw/xfree86/dummylib/Makefile.am +++ b/hw/xfree86/dummylib/Makefile.am @@ -13,6 +13,7 @@ STRL_SRCS = $(top_srcdir)/os/strlcat.c $(top_srcdir)/os/strlcpy.c endif libdummy_nonserver_a_SOURCES = \ + dixprivates.c \ fatalerror.c \ logvwrite.c \ $(STRL_SRCS) \ @@ -24,7 +25,6 @@ libdummy_nonserver_a_SOURCES = \ xf86drvmsgverb.c \ xf86errorf.c \ xf86errorfverb.c \ - xf86getpagesize.c \ xf86getverb.c \ xf86info.c \ xf86msg.c \ diff --git a/hw/xfree86/dummylib/xf86getpagesize.c b/hw/xfree86/dummylib/dixprivates.c similarity index 61% rename from hw/xfree86/dummylib/xf86getpagesize.c rename to hw/xfree86/dummylib/dixprivates.c index 8859c7673..40c173a20 100644 --- a/hw/xfree86/dummylib/xf86getpagesize.c +++ b/hw/xfree86/dummylib/dixprivates.c @@ -11,11 +11,9 @@ * Utility functions required by libxf86_os. */ -int xf86getpagesize(void); - -_X_EXPORT int -xf86getpagesize(void) +_X_EXPORT pointer * +dixAllocatePrivate(PrivateRec **privates, const DevPrivateKey key) { - return 4096; /* not used */ + return NULL; /* not used */ } diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index e00fdf3f3..10db86267 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -2192,9 +2192,12 @@ xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus) return mon; } -static char *_xf86ConnectorNames[] = { "None", "VGA", "DVI-I", "DVI-D", - "DVI-A", "Composite", "S-Video", - "Component", "LFP", "Proprietary" }; +static char *_xf86ConnectorNames[] = { + "None", "VGA", "DVI-I", "DVI-D", + "DVI-A", "Composite", "S-Video", + "Component", "LFP", "Proprietary", + "HDMI", "DisplayPort", + }; _X_EXPORT char * xf86ConnectorGetName(xf86ConnectorType connector) { diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h index f312b30cb..62d85bbc9 100644 --- a/hw/xfree86/modes/xf86Crtc.h +++ b/hw/xfree86/modes/xf86Crtc.h @@ -61,7 +61,9 @@ typedef enum _xf86ConnectorType { XF86ConnectorSvideo, XF86ConnectorComponent, XF86ConnectorLFP, - XF86ConnectorProprietary + XF86ConnectorProprietary, + XF86ConnectorHDMI, + XF86ConnectorDisplayPort, } xf86ConnectorType; typedef enum _xf86OutputStatus { diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c index a125d8c82..87a812765 100644 --- a/hw/xfree86/modes/xf86EdidModes.c +++ b/hw/xfree86/modes/xf86EdidModes.c @@ -354,6 +354,36 @@ DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing, return Mode; } +static DisplayModePtr +DDCModesFromCVT(int scrnIndex, struct cvt_timings *t) +{ + DisplayModePtr modes = NULL; + int i; + + for (i = 0; i < 4; i++) { + if (t[i].height) { + if (t[i].rates & 0x10) + modes = xf86ModesAdd(modes, + xf86CVTMode(t[i].width, t[i].height, 50, 0, 0)); + if (t[i].rates & 0x08) + modes = xf86ModesAdd(modes, + xf86CVTMode(t[i].width, t[i].height, 60, 0, 0)); + if (t[i].rates & 0x04) + modes = xf86ModesAdd(modes, + xf86CVTMode(t[i].width, t[i].height, 75, 0, 0)); + if (t[i].rates & 0x02) + modes = xf86ModesAdd(modes, + xf86CVTMode(t[i].width, t[i].height, 85, 0, 0)); + if (t[i].rates & 0x01) + modes = xf86ModesAdd(modes, + xf86CVTMode(t[i].width, t[i].height, 60, 1, 0)); + } else break; + } + + return modes; +} + + /* * */ @@ -504,6 +534,8 @@ xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC) quirks = xf86DDCDetectQuirks(scrnIndex, DDC, TRUE); preferred = PREFERRED_TIMING_MODE(DDC->features.msc); + if (DDC->ver.revision >= 4) + preferred = TRUE; if (quirks & DDC_QUIRK_FIRST_DETAILED_PREFERRED) preferred = TRUE; if (quirks & (DDC_QUIRK_PREFER_LARGE_60 | DDC_QUIRK_PREFER_LARGE_75)) @@ -527,6 +559,10 @@ xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC) quirks); Modes = xf86ModesAdd(Modes, Mode); break; + case DS_CVT: + Mode = DDCModesFromCVT(scrnIndex, det_mon->section.cvt); + Modes = xf86ModesAdd(Modes, Mode); + break; default: break; } diff --git a/hw/xfree86/modes/xf86Rotate.c b/hw/xfree86/modes/xf86Rotate.c index 380478f7f..c129d9b92 100644 --- a/hw/xfree86/modes/xf86Rotate.c +++ b/hw/xfree86/modes/xf86Rotate.c @@ -494,7 +494,8 @@ xf86CrtcRotate (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation) { ScrnInfoPtr pScrn = crtc->scrn; xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); - ScreenPtr pScreen = pScrn->pScreen; + /* if this is called during ScreenInit() we don't have pScrn->pScreen yet */ + ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex]; PictTransform crtc_to_fb, fb_to_crtc; PictureTransformIdentity (&crtc_to_fb); diff --git a/hw/xfree86/os-support/solaris/sun_mouse.c b/hw/xfree86/os-support/solaris/sun_mouse.c index b1b7797f1..a5955ef2c 100644 --- a/hw/xfree86/os-support/solaris/sun_mouse.c +++ b/hw/xfree86/os-support/solaris/sun_mouse.c @@ -122,10 +122,10 @@ static void vuidMouseAdjustFrame(int index, int x, int y, int flags); static int vuidMouseGeneration = 0; static DevPrivateKey vuidMouseScreenKey = &vuidMouseScreenKey; -#define vuidGetMouseScreenPrivate(s) ((VuidMsePtr) \ +#define vuidMouseGetScreenPrivate(s) ( \ dixLookupPrivate(&(s)->devPrivates, vuidMouseScreenKey)) -#define vuidSetMouseScreenPrivate(s,p) \ - dixSetPrivate(&(s)->devPrivates, vuidMouseScreenKey, p) +#define vuidMouseSetScreenPrivate(s,p) \ + dixSetPrivate(&(s)->devPrivates, vuidMouseScreenKey, (void *) p) #endif /* HAVE_ABSOLUTE_MOUSE_SCALING */ static inline diff --git a/hw/xfree86/utils/ioport/ioport.c b/hw/xfree86/utils/ioport/ioport.c index 32213642e..737043462 100644 --- a/hw/xfree86/utils/ioport/ioport.c +++ b/hw/xfree86/utils/ioport/ioport.c @@ -489,4 +489,3 @@ main(argc, argv) return (0); } -#include "xf86getpagesize.c" diff --git a/hw/xquartz/Makefile.am b/hw/xquartz/Makefile.am index 831ba49f4..99d23eb1f 100644 --- a/hw/xquartz/Makefile.am +++ b/hw/xquartz/Makefile.am @@ -1,7 +1,9 @@ noinst_LTLIBRARIES = libXquartz.la AM_CFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS) +AM_OBJCFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS) AM_CPPFLAGS = \ -DBUILD_DATE=\"$(BUILD_DATE)\" \ + -DXSERVER_VERSION=\"$(VERSION)\" \ -DINXQUARTZ \ -DUSE_NEW_CLUT \ -DXFree86Server \ @@ -15,8 +17,9 @@ SUBDIRS = . xpr $(X11APP_SUBDIRS) DIST_SUBDIRS = xpr bundle libXquartz_la_SOURCES = \ - $(top_srcdir)/fb/fbcmap.c \ + $(top_srcdir)/fb/fbcmap_mi.c \ $(top_srcdir)/mi/miinitext.c \ + $(top_srcdir)/Xext/dpmsstubs.c \ X11Application.m \ X11Controller.m \ applewm.c \ diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m index 56db2c477..72537bb65 100644 --- a/hw/xquartz/X11Application.m +++ b/hw/xquartz/X11Application.m @@ -855,7 +855,7 @@ static void send_nsevent (NSEventType type, NSEvent *e) { NSWindow *window; int pointer_x, pointer_y, ev_button, ev_type; // int num_events=0, i=0, state; - xEvent xe; + // xEvent xe; /* convert location to global top-left coordinates */ location = [e locationInWindow]; diff --git a/hw/xquartz/applewm.c b/hw/xquartz/applewm.c index 72dca28e7..c460ec6ae 100644 --- a/hw/xquartz/applewm.c +++ b/hw/xquartz/applewm.c @@ -264,8 +264,7 @@ WMFreeEvents (data, id) } static int -ProcAppleWMSelectInput (client) - register ClientPtr client; +ProcAppleWMSelectInput (register ClientPtr client) { REQUEST(xAppleWMSelectInputReq); WMEventPtr pEvent, pNewEvent, *pHead; @@ -479,13 +478,11 @@ ProcAppleWMSetFrontProcess( } static int -ProcAppleWMSetWindowLevel( - register ClientPtr client -) +ProcAppleWMSetWindowLevel(register ClientPtr client) { REQUEST(xAppleWMSetWindowLevelReq); WindowPtr pWin; - int errno; + int err; REQUEST_SIZE_MATCH(xAppleWMSetWindowLevelReq); @@ -497,9 +494,9 @@ ProcAppleWMSetWindowLevel( return BadValue; } - errno = appleWMProcs->SetWindowLevel(pWin, stuff->level); - if (errno != Success) { - return errno; + err = appleWMProcs->SetWindowLevel(pWin, stuff->level); + if (err != Success) { + return err; } return (client->noClientException); diff --git a/hw/xquartz/bundle/Info.plist b/hw/xquartz/bundle/Info.plist index fce8c964d..5babdfe6e 100644 --- a/hw/xquartz/bundle/Info.plist +++ b/hw/xquartz/bundle/Info.plist @@ -25,9 +25,9 @@ CSResourcesFileMapped NSHumanReadableCopyright - Copyright © 2003-2007, Apple Inc. + Copyright © 2003-2008, Apple Inc. Copyright © 2003, XFree86 Project, Inc. -Copyright © 2003-2007, X.org Project, Inc. +Copyright © 2003-2008, X.org Project, Inc. NSMainNibFile main diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c index 463073485..20bcee592 100644 --- a/hw/xquartz/darwin.c +++ b/hw/xquartz/darwin.c @@ -78,7 +78,7 @@ #include "darwinEvents.h" #include "darwinKeyboard.h" #include "quartz.h" -#include "darwinClut8.h" +//#include "darwinClut8.h" #ifdef ENABLE_DEBUG_LOG FILE *debug_log_fp = NULL; @@ -176,17 +176,10 @@ static Bool DarwinSaveScreen(ScreenPtr pScreen, int on) * This is a callback from dix during AddScreen() from InitOutput(). * Initialize the screen and communicate information about it back to dix. */ -static Bool DarwinAddScreen( - int index, - ScreenPtr pScreen, - int argc, - char **argv ) -{ - int bitsPerRGB, i, dpi; +static Bool DarwinAddScreen(int index, ScreenPtr pScreen, int argc, char **argv) { + int dpi; static int foundIndex = 0; Bool ret; - VisualPtr visual; - ColormapPtr pmap; DarwinFramebufferPtr dfb; // reset index of found screens for each server generation @@ -204,28 +197,13 @@ static Bool DarwinAddScreen( if (! ret) return FALSE; - bitsPerRGB = dfb->bitsPerComponent; - // reset the visual list miClearVisualTypes(); // setup a single visual appropriate for our pixel type - if (dfb->colorType == TrueColor) { - if (!miSetVisualTypes( dfb->colorBitsPerPixel, TrueColorMask, - bitsPerRGB, TrueColor )) { - return FALSE; - } - } else if (dfb->colorType == PseudoColor) { - if (!miSetVisualTypes( dfb->colorBitsPerPixel, PseudoColorMask, - bitsPerRGB, PseudoColor )) { - return FALSE; - } - } else if (dfb->colorType == StaticColor) { - if (!miSetVisualTypes( dfb->colorBitsPerPixel, StaticColorMask, - bitsPerRGB, StaticColor )) { - return FALSE; - } - } else { + if(!miSetVisualTypesAndMasks(dfb->depth, dfb->visuals, dfb->bitsPerRGB, + dfb->preferredCVC, dfb->redMask, + dfb->greenMask, dfb->blueMask)) { return FALSE; } @@ -249,20 +227,28 @@ static Bool DarwinAddScreen( return FALSE; } +// ErrorF("Screen type: %d, %d=%d, %d=%d, %d=%d, %x=%x=%x, %x=%x=%x, %x=%x=%x\n", pScreen->visuals->class, +// pScreen->visuals->offsetRed, dfb->bitsPerRGB * 2, +// pScreen->visuals->offsetGreen, dfb->bitsPerRGB, +// pScreen->visuals->offsetBlue, 0, +// pScreen->visuals->redMask, dfb->redMask, ((1<bitsPerRGB)-1) << pScreen->visuals->offsetRed, +// pScreen->visuals->greenMask, dfb->greenMask, ((1<bitsPerRGB)-1) << pScreen->visuals->offsetGreen, +// pScreen->visuals->blueMask, dfb->blueMask, ((1<bitsPerRGB)-1) << pScreen->visuals->offsetBlue); + // set the RGB order correctly for TrueColor - if (dfb->bitsPerPixel > 8) { - for (i = 0, visual = pScreen->visuals; // someday we may have more than 1 - i < pScreen->numVisuals; i++, visual++) { - if (visual->class == TrueColor) { - visual->offsetRed = bitsPerRGB * 2; - visual->offsetGreen = bitsPerRGB; - visual->offsetBlue = 0; - visual->redMask = ((1<offsetRed; - visual->greenMask = ((1<offsetGreen; - visual->blueMask = ((1<offsetBlue; - } - } - } +// if (dfb->bitsPerPixel > 8) { +// for (i = 0, visual = pScreen->visuals; // someday we may have more than 1 +// i < pScreen->numVisuals; i++, visual++) { +// if (visual->class == TrueColor) { +// visual->offsetRed = bitsPerRGB * 2; +// visual->offsetGreen = bitsPerRGB; +// visual->offsetBlue = 0; +// visual->redMask = ((1<offsetRed; +// visual->greenMask = ((1<offsetGreen; +// visual->blueMask = ((1<offsetBlue; +// } +// } +// } #ifdef RENDER if (! fbPictureInit(pScreen, 0, 0)) { @@ -292,17 +278,16 @@ static Bool DarwinAddScreen( * mode and we're using a fixed color map. Essentially this translates * to Darwin/x86 in 8-bit mode. */ - if( (dfb->colorBitsPerPixel == 8) && - (dfb->colorType == StaticColor) ) - { - pmap = miInstalledMaps[pScreen->myNum]; - visual = pmap->pVisual; - for( i = 0; i < visual->ColormapEntries; i++ ) { - pmap->red[i].co.local.red = darwinClut8[i].red; - pmap->red[i].co.local.green = darwinClut8[i].green; - pmap->red[i].co.local.blue = darwinClut8[i].blue; - } - } +// if(dfb->depth == 8) { +// ColormapPtr map = RootlessGetColormap (pScreen); +// for( i = 0; i < map->pVisual->ColormapEntries; i++ ) { +// Entry *ent = map->red + i; +// ErrorF("Setting lo %d -> r: %04x g: %04x b: %04x\n", i, darwinClut8[i].red, darwinClut8[i].green, darwinClut8[i].blue); +// ent->co.local.red = darwinClut8[i].red; +// ent->co.local.green = darwinClut8[i].green; +// ent->co.local.blue = darwinClut8[i].blue; +// } +// } dixScreenOrigins[index].x = dfb->x; dixScreenOrigins[index].y = dfb->y; @@ -793,24 +778,21 @@ int ddxProcessArgument( int argc, char *argv[], int i ) } if ( !strcmp( argv[i], "-depth" ) ) { - int bitDepth; - if ( i == argc-1 ) { FatalError( "-depth must be followed by a number\n" ); } #ifdef OLD_POWERBOOK_G3 ErrorF( "Ignoring unsupported -depth option on old PowerBook G3\n"); #else - bitDepth = atoi( argv[i+1] ); - if (bitDepth == 8) - darwinDesiredDepth = 0; - else if (bitDepth == 15) - darwinDesiredDepth = 1; - else if (bitDepth == 24) - darwinDesiredDepth = 2; - else + darwinDesiredDepth = atoi( argv[i+1] ); + if(darwinDesiredDepth != -1 && + darwinDesiredDepth != 8 && + darwinDesiredDepth != 15 && + darwinDesiredDepth != 24) { FatalError( "Unsupported pixel depth. Use 8, 15, or 24 bits\n" ); - ErrorF( "Attempting to use pixel depth of %i\n", bitDepth ); + } + + ErrorF( "Attempting to use pixel depth of %i\n", darwinDesiredDepth ); #endif return 2; } @@ -897,24 +879,6 @@ void AbortDDX( void ) ddxGiveUp(); } - -/* - * DPMS extension stubs - */ -Bool DPMSSupported(void) -{ - return FALSE; -} - -void DPMSSet(int level) -{ -} - -int DPMSGet(int *level) -{ - return -1; -} - #include "mivalidate.h" // for union _Validate used by windowstr.h #include "windowstr.h" // for struct _Window #include "scrnintstr.h" // for struct _Screen diff --git a/hw/xquartz/darwin.h b/hw/xquartz/darwin.h index c569d66df..c5e2ed80d 100644 --- a/hw/xquartz/darwin.h +++ b/hw/xquartz/darwin.h @@ -40,10 +40,14 @@ typedef struct { int width; int height; int pitch; - int colorType; + int depth; + int visuals; + int bitsPerRGB; int bitsPerPixel; - int colorBitsPerPixel; - int bitsPerComponent; + int preferredCVC; + Pixel redMask; + Pixel greenMask; + Pixel blueMask; } DarwinFramebufferRec, *DarwinFramebufferPtr; // From darwin.c @@ -120,7 +124,7 @@ enum { #ifdef ENABLE_DEBUG_LOG extern FILE *debug_log_fp; #define DEBUG_LOG_NAME "x11-debug.txt" -#define DEBUG_LOG(msg, args...) if (debug_log_fp) fprintf(debug_log_fp, "%s:%d: " msg, __FUNCTION__, __LINE__, ##args ) +#define DEBUG_LOG(msg, args...) if (debug_log_fp) fprintf(debug_log_fp, "%s:%s:%d " msg, __FILE__, __FUNCTION__, __LINE__, ##args ); fflush(debug_log_fp); #else #define DEBUG_LOG(msg, args...) #endif diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c index 1760792c6..827fd81b8 100644 --- a/hw/xquartz/darwinEvents.c +++ b/hw/xquartz/darwinEvents.c @@ -45,6 +45,7 @@ in this Software without prior written authorization from The Open Group. #include "darwin.h" #include "quartz.h" #include "darwinKeyboard.h" +#include "darwinEvents.h" #include #include @@ -213,9 +214,8 @@ Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr) { * * This should be deprecated in favor of miEQEnqueue -- BB */ -void DarwinEQEnqueue(const xEvent *e) { +void DarwinEQEnqueue(const xEventPtr e) { HWEventQueueType oldtail, newtail; - char byte = 0; oldtail = darwinEventQueue.tail; @@ -253,7 +253,7 @@ void DarwinEQEnqueue(const xEvent *e) { * DarwinEQPointerPost * Post a pointer event. Used by the mipointer.c routines. */ -void DarwinEQPointerPost(xEvent *e) { +void DarwinEQPointerPost(DeviceIntPtr pdev, xEventPtr e) { (*darwinEventQueue.pPtr->processInputProc) (e, (DeviceIntPtr)darwinEventQueue.pPtr, 1); } @@ -274,7 +274,6 @@ void ProcessInputEvents(void) { EventRec *e; int x, y; xEvent xe; - static int old_flags = 0; // last known modifier state // button number and modifier mask of currently pressed fake button input_check_flag=0; diff --git a/hw/xquartz/darwinEvents.h b/hw/xquartz/darwinEvents.h index d6cab2e6c..82cc26bc0 100644 --- a/hw/xquartz/darwinEvents.h +++ b/hw/xquartz/darwinEvents.h @@ -28,12 +28,13 @@ #define _DARWIN_EVENTS_H Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr); -void DarwinEQEnqueue(const xEvent *e); -void DarwinEQPointerPost(xEvent *e); +void DarwinEQEnqueue(const xEventPtr e); +void DarwinEQPointerPost(DeviceIntPtr pDev, xEventPtr e); void DarwinEQSwitchScreen(ScreenPtr pScreen, Bool fromDIX); void DarwinPokeEQ(void); void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int pointer_y); void DarwinSendKeyboardEvents(int ev_type, int keycode); void DarwinSendScrollEvents(float count, int pointer_x, int pointer_y); +void DarwinUpdateModKeys(int flags); #endif /* _DARWIN_EVENTS_H */ diff --git a/hw/xquartz/darwinKeyboard.c b/hw/xquartz/darwinKeyboard.c index f1b90b76a..b368fe9d9 100644 --- a/hw/xquartz/darwinKeyboard.c +++ b/hw/xquartz/darwinKeyboard.c @@ -330,7 +330,7 @@ static void parse_next_char_code(DataStream *s, KeySym *k) { * DarwinReadKeymapFile * Read the appropriate keymapping from a keymapping file. */ -Bool DarwinReadKeymapFile(NXKeyMapping *keyMap) { +static Bool DarwinReadKeymapFile(NXKeyMapping *keyMap) { struct stat st; NXEventSystemDevice info[20]; int interface = 0, handler_id = 0; @@ -439,7 +439,7 @@ Bool DarwinReadKeymapFile(NXKeyMapping *keyMap) { /* * DarwinParseNXKeyMapping */ -Bool DarwinParseNXKeyMapping(darwinKeyboardInfo *info) { +static Bool DarwinParseNXKeyMapping(darwinKeyboardInfo *info) { KeySym *k; int i; short numMods, numKeys, numPadKeys = 0; @@ -933,7 +933,7 @@ int DarwinModifierNXMaskToNXKey(int mask) { return -1; } -const char *DarwinModifierNXMaskTostring(int mask) { +static const char *DarwinModifierNXMaskTostring(int mask) { switch (mask) { case NX_ALPHASHIFTMASK: return "NX_ALPHASHIFTMASK"; case NX_SHIFTMASK: return "NX_SHIFTMASK"; diff --git a/hw/xquartz/darwinXinput.c b/hw/xquartz/darwinXinput.c index ee456a43a..e62ec0ab6 100644 --- a/hw/xquartz/darwinXinput.c +++ b/hw/xquartz/darwinXinput.c @@ -63,6 +63,7 @@ SOFTWARE. #include #include #include "XIstubs.h" +#include "chgkbd.h" /*********************************************************************** * @@ -88,16 +89,12 @@ SOFTWARE. * */ -int -ChangeKeyboardDevice (old_dev, new_dev) - DeviceIntPtr old_dev; - DeviceIntPtr new_dev; - { +int ChangeKeyboardDevice (DeviceIntPtr old_dev, DeviceIntPtr new_dev) { /*********************************************************************** DeleteFocusClassDeviceStruct(old_dev); * defined in xchgptr.c * **********************************************************************/ return BadMatch; - } +} /*********************************************************************** diff --git a/hw/xquartz/quartzAudio.c b/hw/xquartz/quartzAudio.c index 86bb20015..5dee32f54 100644 --- a/hw/xquartz/quartzAudio.c +++ b/hw/xquartz/quartzAudio.c @@ -50,7 +50,7 @@ #include #include -void NSBeep(); +void NSBeep(void); typedef struct QuartzAudioRec { double frequency; diff --git a/hw/xquartz/quartzCocoa.m b/hw/xquartz/quartzCocoa.m index 0086c5ca4..53e3f0897 100644 --- a/hw/xquartz/quartzCocoa.m +++ b/hw/xquartz/quartzCocoa.m @@ -37,6 +37,7 @@ #endif #include "quartzCommon.h" +#include "quartzPasteboard.h" #define BOOL xBOOL #include "darwin.h" diff --git a/hw/xquartz/quartzForeground.c b/hw/xquartz/quartzForeground.c index bfea642d1..0e724de76 100644 --- a/hw/xquartz/quartzForeground.c +++ b/hw/xquartz/quartzForeground.c @@ -32,6 +32,8 @@ #include #include +#include "quartzForeground.h" + int QuartzMoveToForeground() { ProcessSerialNumber psn = { 0, kCurrentProcess }; OSStatus returnCode = TransformProcessType(& psn, kProcessTransformToForegroundApplication); diff --git a/hw/xquartz/quartzForeground.h b/hw/xquartz/quartzForeground.h index 4fc21c72f..b5422ff9c 100644 --- a/hw/xquartz/quartzForeground.h +++ b/hw/xquartz/quartzForeground.h @@ -32,6 +32,6 @@ #ifndef _QUARTZ_FOREGROUND_H_ #define _QUARTZ_FOREGROUND_H_ -int QuartzMoveToForeground(); +int QuartzMoveToForeground(void); #endif /* _QUARTZ_FOREGROUND_H_ */ diff --git a/hw/xquartz/quartzPasteboard.h b/hw/xquartz/quartzPasteboard.h index afcb6e587..d6a8ee815 100644 --- a/hw/xquartz/quartzPasteboard.h +++ b/hw/xquartz/quartzPasteboard.h @@ -34,11 +34,11 @@ #define _QUARTZPASTEBOARD_H // Aqua->X -void QuartzReadPasteboard(); +void QuartzReadPasteboard(void); char * QuartzReadCocoaPasteboard(void); // caller must free string // X->Aqua -void QuartzWritePasteboard(); +void QuartzWritePasteboard(void); void QuartzWriteCocoaPasteboard(char *text); #endif /* _QUARTZPASTEBOARD_H */ diff --git a/hw/xquartz/quartzStartup.c b/hw/xquartz/quartzStartup.c index 1b2a22623..e25e15583 100644 --- a/hw/xquartz/quartzStartup.c +++ b/hw/xquartz/quartzStartup.c @@ -52,8 +52,11 @@ char **envpGlobal; // argcGlobal and argvGlobal // are from dix/globals.c +int main(int argc, char **argv, char **envp); +void _InitHLTB(void); +void DarwinHandleGUI(int argc, char **argv, char **envp); + static void server_thread (void *arg) { - extern int main(int argc, char **argv, char **envp); exit (main (argcGlobal, argvGlobal, envpGlobal)); } @@ -103,8 +106,6 @@ void DarwinHandleGUI(int argc, char **argv, char **envp) { before the main thread when we're _not_ prebound, things fail, so initialize by hand. */ - extern void _InitHLTB(void); - _InitHLTB(); X11ControllerMain(argc, (const char **)argv, server_thread, NULL); exit(0); diff --git a/hw/xquartz/xpr/appledri.c b/hw/xquartz/xpr/appledri.c index 95a443976..b4a4725e2 100644 --- a/hw/xquartz/xpr/appledri.c +++ b/hw/xquartz/xpr/appledri.c @@ -55,6 +55,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "swaprep.h" #include "dri.h" #include "dristruct.h" +#include "xpr.h" static int DRIErrorBase = 0; diff --git a/hw/xquartz/xpr/xprScreen.c b/hw/xquartz/xpr/xprScreen.c index 068b7b177..e4e1fda7e 100644 --- a/hw/xquartz/xpr/xprScreen.c +++ b/hw/xquartz/xpr/xprScreen.c @@ -42,6 +42,7 @@ #include "globals.h" #include "Xplugin.h" #include "applewmExt.h" +#include "micmap.h" // From xprFrame.c WindowPtr xprGetXWindow(xp_window_id wid); @@ -61,53 +62,52 @@ static const char *xprOpenGLBundle = "glxCGL.bundle"; * eventHandler * Callback handler for Xplugin events. */ -static void -eventHandler(unsigned int type, const void *arg, - unsigned int arg_size, void *data) -{ +static void eventHandler(unsigned int type, const void *arg, + unsigned int arg_size, void *data) { switch (type) { - case XP_EVENT_DISPLAY_CHANGED: - DEBUG_LOG("XP_EVENT_DISPLAY_CHANGED\n"); - QuartzMessageServerThread(kXDarwinDisplayChanged, 0); - break; - - case XP_EVENT_WINDOW_STATE_CHANGED: - DEBUG_LOG("XP_EVENT_WINDOW_STATE_CHANGED\n"); - if (arg_size >= sizeof(xp_window_state_event)) { - const xp_window_state_event *ws_arg = arg; - - QuartzMessageServerThread(kXDarwinWindowState, 2, - ws_arg->id, ws_arg->state); - } - break; - - case XP_EVENT_WINDOW_MOVED: - DEBUG_LOG("XP_EVENT_WINDOW_MOVED\n"); - if (arg_size == sizeof(xp_window_id)) { - xp_window_id id = * (xp_window_id *) arg; - WindowPtr pWin = xprGetXWindow(id); - QuartzMessageServerThread(kXDarwinWindowMoved, 1, pWin); - } - break; - - case XP_EVENT_SURFACE_DESTROYED: - DEBUG_LOG("XP_EVENT_SURFACE_DESTROYED\n"); - case XP_EVENT_SURFACE_CHANGED: - DEBUG_LOG("XP_EVENT_SURFACE_CHANGED\n"); - if (arg_size == sizeof(xp_surface_id)) { - int kind; - - if (type == XP_EVENT_SURFACE_DESTROYED) - kind = AppleDRISurfaceNotifyDestroyed; - else - kind = AppleDRISurfaceNotifyChanged; - - DRISurfaceNotify(*(xp_surface_id *) arg, kind); - } - break; - default: - ErrorF("Unknown XP_EVENT type (%d) in xprScreen:eventHandler\n", - type); + case XP_EVENT_DISPLAY_CHANGED: + DEBUG_LOG("XP_EVENT_DISPLAY_CHANGED\n"); + QuartzMessageServerThread(kXDarwinDisplayChanged, 0); + break; + + case XP_EVENT_WINDOW_STATE_CHANGED: + if (arg_size >= sizeof(xp_window_state_event)) { + const xp_window_state_event *ws_arg = arg; + + DEBUG_LOG("XP_EVENT_WINDOW_STATE_CHANGED: id=%d, state=%d\n", ws_arg->id, ws_arg->state); + QuartzMessageServerThread(kXDarwinWindowState, 2, + ws_arg->id, ws_arg->state); + } else { + DEBUG_LOG("XP_EVENT_WINDOW_STATE_CHANGED: ignored\n"); + } + break; + + case XP_EVENT_WINDOW_MOVED: + DEBUG_LOG("XP_EVENT_WINDOW_MOVED\n"); + if (arg_size == sizeof(xp_window_id)) { + xp_window_id id = * (xp_window_id *) arg; + WindowPtr pWin = xprGetXWindow(id); + QuartzMessageServerThread(kXDarwinWindowMoved, 1, pWin); + } + break; + + case XP_EVENT_SURFACE_DESTROYED: + DEBUG_LOG("XP_EVENT_SURFACE_DESTROYED\n"); + case XP_EVENT_SURFACE_CHANGED: + DEBUG_LOG("XP_EVENT_SURFACE_CHANGED\n"); + if (arg_size == sizeof(xp_surface_id)) { + int kind; + + if (type == XP_EVENT_SURFACE_DESTROYED) + kind = AppleDRISurfaceNotifyDestroyed; + else + kind = AppleDRISurfaceNotifyChanged; + + DRISurfaceNotify(*(xp_surface_id *) arg, kind); + } + break; + default: + ErrorF("Unknown XP_EVENT type (%d) in xprScreen:eventHandler\n", type); } } @@ -249,35 +249,59 @@ static Bool xprAddScreen(int index, ScreenPtr pScreen) { DarwinFramebufferPtr dfb = SCREEN_PRIV(pScreen); - - /* If no specific depth chosen, look for the depth of the main display. - Else if 16bpp specified, use that. Else use 32bpp. */ - - dfb->colorType = TrueColor; - dfb->bitsPerComponent = 8; - dfb->bitsPerPixel = 32; - dfb->colorBitsPerPixel = 24; - - if (darwinDesiredDepth == -1) - { - dfb->bitsPerComponent = CGDisplayBitsPerSample(kCGDirectMainDisplay); - dfb->bitsPerPixel = CGDisplayBitsPerPixel(kCGDirectMainDisplay); - dfb->colorBitsPerPixel = - CGDisplaySamplesPerPixel(kCGDirectMainDisplay) * - dfb->bitsPerComponent; + int depth = darwinDesiredDepth; + + if(depth == -1) { + depth = CGDisplaySamplesPerPixel(kCGDirectMainDisplay) * CGDisplayBitsPerSample(kCGDirectMainDisplay); + //dfb->depth = CGDisplaySamplesPerPixel(kCGDirectMainDisplay) * CGDisplayBitsPerSample(kCGDirectMainDisplay); + //dfb->bitsPerRGB = CGDisplayBitsPerSample(kCGDirectMainDisplay); + //dfb->bitsPerPixel = CGDisplayBitsPerPixel(kCGDirectMainDisplay); } - else if (darwinDesiredDepth == 15) - { - dfb->bitsPerComponent = 5; - dfb->bitsPerPixel = 16; - dfb->colorBitsPerPixel = 15; - } - else if (darwinDesiredDepth == 8) - { - dfb->colorType = PseudoColor; - dfb->bitsPerComponent = 8; - dfb->bitsPerPixel = 8; - dfb->colorBitsPerPixel = 8; + + switch(depth) { + case -8: // broken + FatalError("Unsupported color depth %d\n", darwinDesiredDepth); + dfb->visuals = (1 << StaticGray) | (1 << GrayScale); + dfb->preferredCVC = GrayScale; + dfb->depth = 8; + dfb->bitsPerRGB = 8; + dfb->bitsPerPixel = 8; + dfb->redMask = 0; + dfb->greenMask = 0; + dfb->blueMask = 0; + break; + case 8: // broken + dfb->visuals = PseudoColorMask; + dfb->preferredCVC = PseudoColor; + dfb->depth = 8; + dfb->bitsPerRGB = 8; + dfb->bitsPerPixel = 8; + dfb->redMask = 0; + dfb->greenMask = 0; + dfb->blueMask = 0; + break; + case 15: + dfb->visuals = LARGE_VISUALS; + dfb->preferredCVC = TrueColor; + dfb->depth = 15; + dfb->bitsPerRGB = 5; + dfb->bitsPerPixel = 16; + dfb->redMask = 0x7c00; + dfb->greenMask = 0x03e0; + dfb->blueMask = 0x001f; + break; + case 24: + dfb->visuals = LARGE_VISUALS; + dfb->preferredCVC = TrueColor; + dfb->depth = 24; + dfb->bitsPerRGB = 8; + dfb->bitsPerPixel = 32; + dfb->redMask = 0x00ff0000; + dfb->greenMask = 0x0000ff00; + dfb->blueMask = 0x000000ff; + break; + default: + FatalError("Unsupported color depth %d\n", darwinDesiredDepth); } if (noPseudoramiXExtension) diff --git a/mi/miinitext.c b/mi/miinitext.c index 402410092..d2f7869f8 100644 --- a/mi/miinitext.c +++ b/mi/miinitext.c @@ -331,7 +331,7 @@ extern void XaceExtensionInit(INITARGS); extern void SecurityExtensionInit(INITARGS); #endif #ifdef XSELINUX -extern void XSELinuxExtensionInit(INITARGS); +extern void SELinuxExtensionInit(INITARGS); #endif #ifdef XPRINT extern void XpExtensionInit(INITARGS); @@ -611,7 +611,7 @@ InitExtensions(argc, argv) if (!noSecurityExtension) SecurityExtensionInit(); #endif #ifdef XSELINUX - XSELinuxExtensionInit(); + SELinuxExtensionInit(); #endif #ifdef XPRINT XpExtensionInit(); /* server-specific extension, cannot be disabled */ @@ -709,7 +709,7 @@ static ExtensionModule staticExtensions[] = { { SecurityExtensionInit, SECURITY_EXTENSION_NAME, &noSecurityExtension, NULL, NULL }, #endif #ifdef XSELINUX - { XSELinuxExtensionInit, XSELINUX_EXTENSION_NAME, NULL, NULL, NULL }, + { SELinuxExtensionInit, SELINUX_EXTENSION_NAME, NULL, NULL, NULL }, #endif #ifdef XPRINT { XpExtensionInit, XP_PRINTNAME, NULL, NULL, NULL }, diff --git a/miext/rootless/accel/rlAccel.c b/miext/rootless/accel/rlAccel.c index a14412416..f3cb21569 100644 --- a/miext/rootless/accel/rlAccel.c +++ b/miext/rootless/accel/rlAccel.c @@ -51,6 +51,9 @@ static DevPrivateKey rlAccelScreenPrivateKey = &rlAccelScreenPrivateKey; #define RLACCELREC(pScreen) ((rlAccelScreenRec *) \ dixLookupPrivate(&(pScreen)->devPrivates, rlAccelScreenPrivateKey)) +#define SETRLACCELREC(pScreen, v) \ + dixSetPrivate(&(pScreen)->devPrivates, rlAccelScreenPrivateKey, v) + /* This is mostly identical to fbGCOps. */ static GCOps rlAccelOps = { rlFillSpans, @@ -132,7 +135,7 @@ RootlessAccelInit(ScreenPtr pScreen) s = xalloc(sizeof(rlAccelScreenRec)); if (!s) return FALSE; - RLACCELREC(pScreen) = s; + SETRLACCELREC(pScreen, s); // Wrap the screen functions we need s->CreateGC = pScreen->CreateGC; diff --git a/os/connection.c b/os/connection.c index 3b5742c2b..8b6541ce6 100644 --- a/os/connection.c +++ b/os/connection.c @@ -353,7 +353,8 @@ InitConnectionLimits(void) #endif #if !defined(WIN32) - ConnectionTranslation = (int *)xnfalloc(sizeof(int)*(lastfdesc + 1)); + if (!ConnectionTranslation) + ConnectionTranslation = (int *)xnfalloc(sizeof(int)*(lastfdesc + 1)); #else InitConnectionTranslation(); #endif