2006-09-17 08:21:37 +02:00
|
|
|
/*
|
|
|
|
* Copyright © 2006 Keith Packard
|
2008-12-09 16:51:37 +01:00
|
|
|
* Copyright © 2008 Red Hat, Inc.
|
2006-09-17 08:21:37 +02:00
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, distribute, and sell this software and its
|
|
|
|
* documentation for any purpose is hereby granted without fee, provided that
|
|
|
|
* the above copyright notice appear in all copies and that both that copyright
|
|
|
|
* notice and this permission notice appear in supporting documentation, and
|
|
|
|
* that the name of the copyright holders not be used in advertising or
|
|
|
|
* publicity pertaining to distribution of the software without specific,
|
|
|
|
* written prior permission. The copyright holders make no representations
|
|
|
|
* about the suitability of this software for any purpose. It is provided "as
|
|
|
|
* is" without express or implied warranty.
|
|
|
|
*
|
|
|
|
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
|
|
|
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
|
|
|
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
|
|
|
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
|
|
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
|
|
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
|
|
|
* OF THIS SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "randrstr.h"
|
2007-10-16 04:46:08 +02:00
|
|
|
#include "registry.h"
|
2006-09-17 08:21:37 +02:00
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
RESTYPE RROutputType;
|
2006-09-18 08:03:23 +02:00
|
|
|
|
2006-10-14 02:34:53 +02:00
|
|
|
/*
|
|
|
|
* Notify the output of some change
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2006-12-13 07:59:03 +01:00
|
|
|
RROutputChanged (RROutputPtr output, Bool configChanged)
|
2006-10-14 02:34:53 +02:00
|
|
|
{
|
|
|
|
ScreenPtr pScreen = output->pScreen;
|
2006-11-09 08:17:55 +01:00
|
|
|
|
2006-10-14 02:34:53 +02:00
|
|
|
output->changed = TRUE;
|
2006-11-09 08:17:55 +01:00
|
|
|
if (pScreen)
|
|
|
|
{
|
|
|
|
rrScrPriv (pScreen);
|
|
|
|
pScrPriv->changed = TRUE;
|
2006-12-13 07:59:03 +01:00
|
|
|
if (configChanged)
|
|
|
|
pScrPriv->configChanged = TRUE;
|
2006-11-09 08:17:55 +01:00
|
|
|
}
|
2006-10-14 02:34:53 +02:00
|
|
|
}
|
|
|
|
|
2006-09-18 08:03:23 +02:00
|
|
|
/*
|
|
|
|
* Create an output
|
|
|
|
*/
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
RROutputPtr
|
2007-03-24 07:41:36 +01:00
|
|
|
RROutputCreate (ScreenPtr pScreen,
|
|
|
|
const char *name,
|
2006-09-18 08:03:23 +02:00
|
|
|
int nameLength,
|
|
|
|
void *devPrivate)
|
|
|
|
{
|
2007-03-24 07:41:36 +01:00
|
|
|
RROutputPtr output;
|
|
|
|
RROutputPtr *outputs;
|
|
|
|
rrScrPrivPtr pScrPriv;
|
2006-09-18 08:03:23 +02:00
|
|
|
|
2006-11-27 04:31:48 +01:00
|
|
|
if (!RRInit())
|
|
|
|
return NULL;
|
2007-03-24 07:41:36 +01:00
|
|
|
|
|
|
|
pScrPriv = rrGetScrPriv(pScreen);
|
|
|
|
|
|
|
|
if (pScrPriv->numOutputs)
|
|
|
|
outputs = xrealloc (pScrPriv->outputs,
|
|
|
|
(pScrPriv->numOutputs + 1) * sizeof (RROutputPtr));
|
|
|
|
else
|
|
|
|
outputs = xalloc (sizeof (RROutputPtr));
|
|
|
|
if (!outputs)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
pScrPriv->outputs = outputs;
|
|
|
|
|
2006-09-18 08:03:23 +02:00
|
|
|
output = xalloc (sizeof (RROutputRec) + nameLength + 1);
|
|
|
|
if (!output)
|
|
|
|
return NULL;
|
|
|
|
output->id = FakeClientID (0);
|
2007-03-24 07:41:36 +01:00
|
|
|
output->pScreen = pScreen;
|
2006-09-18 08:03:23 +02:00
|
|
|
output->name = (char *) (output + 1);
|
|
|
|
output->nameLength = nameLength;
|
|
|
|
memcpy (output->name, name, nameLength);
|
2006-09-18 21:18:22 +02:00
|
|
|
output->name[nameLength] = '\0';
|
2006-09-18 08:03:23 +02:00
|
|
|
output->connection = RR_UnknownConnection;
|
|
|
|
output->subpixelOrder = SubPixelUnknown;
|
2006-11-01 09:29:46 +01:00
|
|
|
output->mmWidth = 0;
|
|
|
|
output->mmHeight = 0;
|
2006-09-18 08:03:23 +02:00
|
|
|
output->crtc = NULL;
|
|
|
|
output->numCrtcs = 0;
|
|
|
|
output->crtcs = NULL;
|
|
|
|
output->numClones = 0;
|
|
|
|
output->clones = NULL;
|
|
|
|
output->numModes = 0;
|
2006-10-06 07:31:35 +02:00
|
|
|
output->numPreferred = 0;
|
2006-09-18 08:03:23 +02:00
|
|
|
output->modes = NULL;
|
2007-02-19 08:49:38 +01:00
|
|
|
output->numUserModes = 0;
|
|
|
|
output->userModes = NULL;
|
2006-09-20 07:48:54 +02:00
|
|
|
output->properties = NULL;
|
2007-09-15 14:01:57 +02:00
|
|
|
output->pendingProperties = FALSE;
|
2006-10-14 02:34:53 +02:00
|
|
|
output->changed = FALSE;
|
2006-09-18 08:03:23 +02:00
|
|
|
output->devPrivate = devPrivate;
|
2006-09-18 21:18:22 +02:00
|
|
|
|
|
|
|
if (!AddResource (output->id, RROutputType, (pointer) output))
|
|
|
|
return NULL;
|
|
|
|
|
2007-03-24 07:41:36 +01:00
|
|
|
pScrPriv->outputs[pScrPriv->numOutputs++] = output;
|
2006-11-09 06:36:35 +01:00
|
|
|
return output;
|
|
|
|
}
|
|
|
|
|
2006-09-18 08:03:23 +02:00
|
|
|
/*
|
|
|
|
* Notify extension that output parameters have been changed
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Bool
|
2006-09-18 08:03:23 +02:00
|
|
|
RROutputSetClones (RROutputPtr output,
|
|
|
|
RROutputPtr *clones,
|
|
|
|
int numClones)
|
|
|
|
{
|
|
|
|
RROutputPtr *newClones;
|
2006-09-20 22:14:53 +02:00
|
|
|
int i;
|
2006-09-18 08:03:23 +02:00
|
|
|
|
2006-09-20 22:14:53 +02:00
|
|
|
if (numClones == output->numClones)
|
|
|
|
{
|
|
|
|
for (i = 0; i < numClones; i++)
|
|
|
|
if (output->clones[i] != clones[i])
|
|
|
|
break;
|
|
|
|
if (i == numClones)
|
|
|
|
return TRUE;
|
|
|
|
}
|
2006-09-20 21:05:52 +02:00
|
|
|
if (numClones)
|
|
|
|
{
|
|
|
|
newClones = xalloc (numClones * sizeof (RROutputPtr));
|
|
|
|
if (!newClones)
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
newClones = NULL;
|
2006-09-18 08:03:23 +02:00
|
|
|
if (output->clones)
|
|
|
|
xfree (output->clones);
|
|
|
|
memcpy (newClones, clones, numClones * sizeof (RROutputPtr));
|
|
|
|
output->clones = newClones;
|
|
|
|
output->numClones = numClones;
|
2006-12-13 07:59:03 +01:00
|
|
|
RROutputChanged (output, TRUE);
|
2006-09-18 08:03:23 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Bool
|
2006-09-18 08:03:23 +02:00
|
|
|
RROutputSetModes (RROutputPtr output,
|
|
|
|
RRModePtr *modes,
|
2006-10-06 07:31:35 +02:00
|
|
|
int numModes,
|
|
|
|
int numPreferred)
|
2006-09-18 08:03:23 +02:00
|
|
|
{
|
|
|
|
RRModePtr *newModes;
|
2006-09-20 22:14:53 +02:00
|
|
|
int i;
|
|
|
|
|
2006-10-06 07:31:35 +02:00
|
|
|
if (numModes == output->numModes && numPreferred == output->numPreferred)
|
2006-09-20 22:14:53 +02:00
|
|
|
{
|
|
|
|
for (i = 0; i < numModes; i++)
|
|
|
|
if (output->modes[i] != modes[i])
|
|
|
|
break;
|
|
|
|
if (i == numModes)
|
|
|
|
{
|
|
|
|
for (i = 0; i < numModes; i++)
|
|
|
|
RRModeDestroy (modes[i]);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
2006-09-18 08:03:23 +02:00
|
|
|
|
2006-09-20 21:05:52 +02:00
|
|
|
if (numModes)
|
|
|
|
{
|
|
|
|
newModes = xalloc (numModes * sizeof (RRModePtr));
|
|
|
|
if (!newModes)
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
newModes = NULL;
|
2006-09-18 08:03:23 +02:00
|
|
|
if (output->modes)
|
2006-09-20 22:14:53 +02:00
|
|
|
{
|
|
|
|
for (i = 0; i < output->numModes; i++)
|
|
|
|
RRModeDestroy (output->modes[i]);
|
2006-09-18 08:03:23 +02:00
|
|
|
xfree (output->modes);
|
2006-09-20 22:14:53 +02:00
|
|
|
}
|
2006-09-18 08:03:23 +02:00
|
|
|
memcpy (newModes, modes, numModes * sizeof (RRModePtr));
|
|
|
|
output->modes = newModes;
|
|
|
|
output->numModes = numModes;
|
2006-10-06 07:31:35 +02:00
|
|
|
output->numPreferred = numPreferred;
|
2006-12-13 07:59:03 +01:00
|
|
|
RROutputChanged (output, TRUE);
|
2006-09-18 08:03:23 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2007-02-19 08:49:38 +01:00
|
|
|
RROutputAddUserMode (RROutputPtr output,
|
|
|
|
RRModePtr mode)
|
|
|
|
{
|
|
|
|
int m;
|
|
|
|
ScreenPtr pScreen = output->pScreen;
|
|
|
|
rrScrPriv(pScreen);
|
|
|
|
RRModePtr *newModes;
|
|
|
|
|
|
|
|
/* Check to see if this mode is already listed for this output */
|
|
|
|
for (m = 0; m < output->numModes + output->numUserModes; m++)
|
|
|
|
{
|
|
|
|
RRModePtr e = (m < output->numModes ?
|
|
|
|
output->modes[m] :
|
|
|
|
output->userModes[m - output->numModes]);
|
|
|
|
if (mode == e)
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check with the DDX to see if this mode is OK */
|
|
|
|
if (pScrPriv->rrOutputValidateMode)
|
|
|
|
if (!pScrPriv->rrOutputValidateMode (pScreen, output, mode))
|
|
|
|
return BadMatch;
|
|
|
|
|
|
|
|
if (output->userModes)
|
|
|
|
newModes = xrealloc (output->userModes,
|
|
|
|
(output->numUserModes + 1) * sizeof (RRModePtr));
|
|
|
|
else
|
|
|
|
newModes = xalloc (sizeof (RRModePtr));
|
|
|
|
if (!newModes)
|
|
|
|
return BadAlloc;
|
|
|
|
|
|
|
|
output->userModes = newModes;
|
|
|
|
output->userModes[output->numUserModes++] = mode;
|
|
|
|
++mode->refcnt;
|
|
|
|
RROutputChanged (output, TRUE);
|
|
|
|
RRTellChanged (pScreen);
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2007-02-19 08:49:38 +01:00
|
|
|
RROutputDeleteUserMode (RROutputPtr output,
|
|
|
|
RRModePtr mode)
|
|
|
|
{
|
|
|
|
int m;
|
|
|
|
|
|
|
|
/* Find this mode in the user mode list */
|
|
|
|
for (m = 0; m < output->numUserModes; m++)
|
|
|
|
{
|
|
|
|
RRModePtr e = output->userModes[m];
|
|
|
|
|
|
|
|
if (mode == e)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* Not there, access error */
|
|
|
|
if (m == output->numUserModes)
|
|
|
|
return BadAccess;
|
|
|
|
|
|
|
|
/* make sure the mode isn't active for this output */
|
|
|
|
if (output->crtc && output->crtc->mode == mode)
|
|
|
|
return BadMatch;
|
|
|
|
|
|
|
|
memmove (output->userModes + m, output->userModes + m + 1,
|
|
|
|
(output->numUserModes - m - 1) * sizeof (RRModePtr));
|
2007-08-07 21:44:19 +02:00
|
|
|
output->numUserModes--;
|
2007-02-19 08:49:38 +01:00
|
|
|
RRModeDestroy (mode);
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Bool
|
2006-09-18 08:03:23 +02:00
|
|
|
RROutputSetCrtcs (RROutputPtr output,
|
|
|
|
RRCrtcPtr *crtcs,
|
|
|
|
int numCrtcs)
|
|
|
|
{
|
|
|
|
RRCrtcPtr *newCrtcs;
|
2006-09-20 22:14:53 +02:00
|
|
|
int i;
|
2006-09-18 08:03:23 +02:00
|
|
|
|
2006-09-20 22:14:53 +02:00
|
|
|
if (numCrtcs == output->numCrtcs)
|
|
|
|
{
|
|
|
|
for (i = 0; i < numCrtcs; i++)
|
|
|
|
if (output->crtcs[i] != crtcs[i])
|
|
|
|
break;
|
|
|
|
if (i == numCrtcs)
|
|
|
|
return TRUE;
|
|
|
|
}
|
2006-09-20 21:05:52 +02:00
|
|
|
if (numCrtcs)
|
|
|
|
{
|
|
|
|
newCrtcs = xalloc (numCrtcs * sizeof (RRCrtcPtr));
|
|
|
|
if (!newCrtcs)
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
newCrtcs = NULL;
|
2006-09-18 08:03:23 +02:00
|
|
|
if (output->crtcs)
|
|
|
|
xfree (output->crtcs);
|
|
|
|
memcpy (newCrtcs, crtcs, numCrtcs * sizeof (RRCrtcPtr));
|
|
|
|
output->crtcs = newCrtcs;
|
|
|
|
output->numCrtcs = numCrtcs;
|
2006-12-13 07:59:03 +01:00
|
|
|
RROutputChanged (output, TRUE);
|
2006-09-18 08:03:23 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Bool
|
2006-09-18 08:03:23 +02:00
|
|
|
RROutputSetConnection (RROutputPtr output,
|
|
|
|
CARD8 connection)
|
|
|
|
{
|
2006-09-20 22:14:53 +02:00
|
|
|
if (output->connection == connection)
|
|
|
|
return TRUE;
|
2006-09-18 08:03:23 +02:00
|
|
|
output->connection = connection;
|
2006-12-13 07:59:03 +01:00
|
|
|
RROutputChanged (output, TRUE);
|
2006-09-18 08:03:23 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Bool
|
2006-09-19 09:46:27 +02:00
|
|
|
RROutputSetSubpixelOrder (RROutputPtr output,
|
|
|
|
int subpixelOrder)
|
|
|
|
{
|
2006-09-20 22:14:53 +02:00
|
|
|
if (output->subpixelOrder == subpixelOrder)
|
|
|
|
return TRUE;
|
|
|
|
|
2006-09-19 09:46:27 +02:00
|
|
|
output->subpixelOrder = subpixelOrder;
|
2006-12-13 07:59:03 +01:00
|
|
|
RROutputChanged (output, FALSE);
|
2006-09-19 09:46:27 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Bool
|
2006-11-01 09:29:46 +01:00
|
|
|
RROutputSetPhysicalSize (RROutputPtr output,
|
|
|
|
int mmWidth,
|
|
|
|
int mmHeight)
|
|
|
|
{
|
|
|
|
if (output->mmWidth == mmWidth && output->mmHeight == mmHeight)
|
|
|
|
return TRUE;
|
|
|
|
output->mmWidth = mmWidth;
|
|
|
|
output->mmHeight = mmHeight;
|
2006-12-13 07:59:03 +01:00
|
|
|
RROutputChanged (output, FALSE);
|
2006-11-01 09:29:46 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2006-09-18 08:03:23 +02:00
|
|
|
RRDeliverOutputEvent(ClientPtr client, WindowPtr pWin, RROutputPtr output)
|
|
|
|
{
|
2006-10-14 02:34:53 +02:00
|
|
|
ScreenPtr pScreen = pWin->drawable.pScreen;
|
|
|
|
rrScrPriv (pScreen);
|
|
|
|
xRROutputChangeNotifyEvent oe;
|
|
|
|
RRCrtcPtr crtc = output->crtc;
|
|
|
|
RRModePtr mode = crtc ? crtc->mode : 0;
|
|
|
|
|
|
|
|
oe.type = RRNotify + RREventBase;
|
|
|
|
oe.subCode = RRNotify_OutputChange;
|
|
|
|
oe.sequenceNumber = client->sequence;
|
|
|
|
oe.timestamp = pScrPriv->lastSetTime.milliseconds;
|
|
|
|
oe.configTimestamp = pScrPriv->lastConfigTime.milliseconds;
|
|
|
|
oe.window = pWin->drawable.id;
|
|
|
|
oe.output = output->id;
|
|
|
|
if (crtc)
|
|
|
|
{
|
|
|
|
oe.crtc = crtc->id;
|
|
|
|
oe.mode = mode ? mode->mode.id : None;
|
|
|
|
oe.rotation = crtc->rotation;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
oe.crtc = None;
|
|
|
|
oe.mode = None;
|
|
|
|
oe.rotation = RR_Rotate_0;
|
|
|
|
}
|
|
|
|
oe.connection = output->connection;
|
|
|
|
oe.subpixelOrder = output->subpixelOrder;
|
|
|
|
WriteEventsToClient (client, 1, (xEvent *) &oe);
|
2006-09-18 08:03:23 +02:00
|
|
|
}
|
2006-09-17 08:21:37 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Destroy a Output at shutdown
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2007-02-19 08:49:38 +01:00
|
|
|
RROutputDestroy (RROutputPtr output)
|
2006-09-17 08:21:37 +02:00
|
|
|
{
|
2007-02-19 08:49:38 +01:00
|
|
|
FreeResource (output->id, 0);
|
2006-09-17 08:21:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
RROutputDestroyResource (pointer value, XID pid)
|
|
|
|
{
|
2006-09-18 08:03:23 +02:00
|
|
|
RROutputPtr output = (RROutputPtr) value;
|
|
|
|
ScreenPtr pScreen = output->pScreen;
|
2007-02-19 08:49:38 +01:00
|
|
|
int m;
|
2006-09-18 08:03:23 +02:00
|
|
|
|
2006-11-09 08:17:55 +01:00
|
|
|
if (pScreen)
|
2006-09-18 08:03:23 +02:00
|
|
|
{
|
2006-11-09 08:17:55 +01:00
|
|
|
rrScrPriv(pScreen);
|
|
|
|
int i;
|
2008-12-08 23:42:47 +01:00
|
|
|
|
|
|
|
if (pScrPriv->primaryOutput == output)
|
|
|
|
pScrPriv->primaryOutput = NULL;
|
2006-11-09 08:17:55 +01:00
|
|
|
|
|
|
|
for (i = 0; i < pScrPriv->numOutputs; i++)
|
2006-09-18 08:03:23 +02:00
|
|
|
{
|
2006-11-09 08:17:55 +01:00
|
|
|
if (pScrPriv->outputs[i] == output)
|
|
|
|
{
|
|
|
|
memmove (pScrPriv->outputs + i, pScrPriv->outputs + i + 1,
|
2006-11-28 06:40:24 +01:00
|
|
|
(pScrPriv->numOutputs - (i + 1)) * sizeof (RROutputPtr));
|
2006-11-09 08:17:55 +01:00
|
|
|
--pScrPriv->numOutputs;
|
|
|
|
break;
|
|
|
|
}
|
2006-09-18 08:03:23 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (output->modes)
|
2007-03-16 04:26:07 +01:00
|
|
|
{
|
|
|
|
for (m = 0; m < output->numModes; m++)
|
|
|
|
RRModeDestroy (output->modes[m]);
|
2006-09-18 08:03:23 +02:00
|
|
|
xfree (output->modes);
|
2007-03-16 04:26:07 +01:00
|
|
|
}
|
2007-02-19 08:49:38 +01:00
|
|
|
|
|
|
|
for (m = 0; m < output->numUserModes; m++)
|
|
|
|
RRModeDestroy (output->userModes[m]);
|
|
|
|
if (output->userModes)
|
|
|
|
xfree (output->userModes);
|
|
|
|
|
2006-09-18 08:03:23 +02:00
|
|
|
if (output->crtcs)
|
|
|
|
xfree (output->crtcs);
|
|
|
|
if (output->clones)
|
|
|
|
xfree (output->clones);
|
2006-09-20 07:48:54 +02:00
|
|
|
RRDeleteAllOutputProperties (output);
|
2006-09-18 08:03:23 +02:00
|
|
|
xfree (output);
|
2006-09-17 08:21:37 +02:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2006-09-20 07:48:54 +02:00
|
|
|
* Initialize output type
|
2006-09-17 08:21:37 +02:00
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Bool
|
2006-09-17 08:21:37 +02:00
|
|
|
RROutputInit (void)
|
|
|
|
{
|
2006-09-18 08:03:23 +02:00
|
|
|
RROutputType = CreateNewResourceType (RROutputDestroyResource);
|
|
|
|
if (!RROutputType)
|
2006-09-17 08:21:37 +02:00
|
|
|
return FALSE;
|
2007-10-11 20:17:17 +02:00
|
|
|
RegisterResourceName (RROutputType, "OUTPUT");
|
2006-09-17 08:21:37 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
2006-09-20 07:48:54 +02:00
|
|
|
|
2006-10-04 06:06:11 +02:00
|
|
|
#define OutputInfoExtra (SIZEOF(xRRGetOutputInfoReply) - 32)
|
2008-12-09 16:51:37 +01:00
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2006-09-20 07:48:54 +02:00
|
|
|
ProcRRGetOutputInfo (ClientPtr client)
|
|
|
|
{
|
2007-03-06 00:31:44 +01:00
|
|
|
REQUEST(xRRGetOutputInfoReq);
|
2006-09-20 07:48:54 +02:00
|
|
|
xRRGetOutputInfoReply rep;
|
|
|
|
RROutputPtr output;
|
|
|
|
CARD8 *extra;
|
|
|
|
unsigned long extraLen;
|
|
|
|
ScreenPtr pScreen;
|
|
|
|
rrScrPrivPtr pScrPriv;
|
|
|
|
RRCrtc *crtcs;
|
|
|
|
RRMode *modes;
|
|
|
|
RROutput *clones;
|
|
|
|
char *name;
|
|
|
|
int i, n;
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xRRGetOutputInfoReq);
|
2006-12-14 20:45:42 +01:00
|
|
|
output = LookupOutput(client, stuff->output, DixReadAccess);
|
2006-09-20 07:48:54 +02:00
|
|
|
|
|
|
|
if (!output)
|
2007-02-19 08:49:38 +01:00
|
|
|
{
|
|
|
|
client->errorValue = stuff->output;
|
2006-09-20 07:48:54 +02:00
|
|
|
return RRErrorBase + BadRROutput;
|
2007-02-19 08:49:38 +01:00
|
|
|
}
|
2006-09-20 07:48:54 +02:00
|
|
|
|
|
|
|
pScreen = output->pScreen;
|
|
|
|
pScrPriv = rrGetScrPriv(pScreen);
|
|
|
|
|
|
|
|
rep.type = X_Reply;
|
|
|
|
rep.sequenceNumber = client->sequence;
|
2006-10-04 06:06:11 +02:00
|
|
|
rep.length = OutputInfoExtra >> 2;
|
2006-09-20 07:48:54 +02:00
|
|
|
rep.timestamp = pScrPriv->lastSetTime.milliseconds;
|
|
|
|
rep.crtc = output->crtc ? output->crtc->id : None;
|
2006-11-01 09:29:46 +01:00
|
|
|
rep.mmWidth = output->mmWidth;
|
|
|
|
rep.mmHeight = output->mmHeight;
|
2006-09-20 07:48:54 +02:00
|
|
|
rep.connection = output->connection;
|
|
|
|
rep.subpixelOrder = output->subpixelOrder;
|
|
|
|
rep.nCrtcs = output->numCrtcs;
|
2007-02-19 08:49:38 +01:00
|
|
|
rep.nModes = output->numModes + output->numUserModes;
|
2006-10-06 07:31:35 +02:00
|
|
|
rep.nPreferred = output->numPreferred;
|
2006-09-20 07:48:54 +02:00
|
|
|
rep.nClones = output->numClones;
|
|
|
|
rep.nameLength = output->nameLength;
|
|
|
|
|
2006-10-04 06:06:11 +02:00
|
|
|
extraLen = ((output->numCrtcs +
|
2007-02-19 08:49:38 +01:00
|
|
|
output->numModes + output->numUserModes +
|
2006-10-04 06:06:11 +02:00
|
|
|
output->numClones +
|
|
|
|
((rep.nameLength + 3) >> 2)) << 2);
|
2006-09-20 07:48:54 +02:00
|
|
|
|
2006-09-20 21:05:52 +02:00
|
|
|
if (extraLen)
|
|
|
|
{
|
2006-10-04 06:06:11 +02:00
|
|
|
rep.length += extraLen >> 2;
|
2006-09-20 21:05:52 +02:00
|
|
|
extra = xalloc (extraLen);
|
|
|
|
if (!extra)
|
|
|
|
return BadAlloc;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
extra = NULL;
|
2006-09-20 07:48:54 +02:00
|
|
|
|
|
|
|
crtcs = (RRCrtc *) extra;
|
|
|
|
modes = (RRMode *) (crtcs + output->numCrtcs);
|
2007-02-19 08:49:38 +01:00
|
|
|
clones = (RROutput *) (modes + output->numModes + output->numUserModes);
|
2006-09-20 07:48:54 +02:00
|
|
|
name = (char *) (clones + output->numClones);
|
|
|
|
|
|
|
|
for (i = 0; i < output->numCrtcs; i++)
|
|
|
|
{
|
|
|
|
crtcs[i] = output->crtcs[i]->id;
|
|
|
|
if (client->swapped)
|
|
|
|
swapl (&crtcs[i], n);
|
|
|
|
}
|
2007-02-19 08:49:38 +01:00
|
|
|
for (i = 0; i < output->numModes + output->numUserModes; i++)
|
2006-09-20 07:48:54 +02:00
|
|
|
{
|
2007-02-19 08:49:38 +01:00
|
|
|
if (i < output->numModes)
|
|
|
|
modes[i] = output->modes[i]->mode.id;
|
|
|
|
else
|
|
|
|
modes[i] = output->userModes[i - output->numModes]->mode.id;
|
2006-09-20 07:48:54 +02:00
|
|
|
if (client->swapped)
|
|
|
|
swapl (&modes[i], n);
|
|
|
|
}
|
|
|
|
for (i = 0; i < output->numClones; i++)
|
|
|
|
{
|
|
|
|
clones[i] = output->clones[i]->id;
|
|
|
|
if (client->swapped)
|
|
|
|
swapl (&clones[i], n);
|
|
|
|
}
|
|
|
|
memcpy (name, output->name, output->nameLength);
|
|
|
|
if (client->swapped) {
|
|
|
|
swaps(&rep.sequenceNumber, n);
|
|
|
|
swapl(&rep.length, n);
|
|
|
|
swapl(&rep.timestamp, n);
|
|
|
|
swapl(&rep.crtc, n);
|
2006-11-01 09:29:46 +01:00
|
|
|
swapl(&rep.mmWidth, n);
|
|
|
|
swapl(&rep.mmHeight, n);
|
2006-09-20 07:48:54 +02:00
|
|
|
swaps(&rep.nCrtcs, n);
|
|
|
|
swaps(&rep.nModes, n);
|
|
|
|
swaps(&rep.nClones, n);
|
|
|
|
swaps(&rep.nameLength, n);
|
|
|
|
}
|
|
|
|
WriteToClient(client, sizeof(xRRGetOutputInfoReply), (char *)&rep);
|
|
|
|
if (extraLen)
|
|
|
|
{
|
|
|
|
WriteToClient (client, extraLen, (char *) extra);
|
|
|
|
xfree (extra);
|
|
|
|
}
|
|
|
|
|
|
|
|
return client->noClientException;
|
|
|
|
}
|
2008-12-09 16:51:37 +01:00
|
|
|
|
2009-01-11 08:43:48 +01:00
|
|
|
static void
|
2008-12-09 16:51:37 +01:00
|
|
|
RRSetPrimaryOutput(ScreenPtr pScreen, rrScrPrivPtr pScrPriv,
|
|
|
|
RROutputPtr output)
|
|
|
|
{
|
|
|
|
if (pScrPriv->primaryOutput == output)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* clear the old primary */
|
|
|
|
if (pScrPriv->primaryOutput) {
|
|
|
|
RROutputChanged(pScrPriv->primaryOutput, 0);
|
|
|
|
pScrPriv->primaryOutput = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* set the new primary */
|
|
|
|
if (output) {
|
|
|
|
pScrPriv->primaryOutput = output;
|
|
|
|
RROutputChanged(output, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
pScrPriv->layoutChanged = TRUE;
|
|
|
|
|
|
|
|
RRTellChanged(pScreen);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
ProcRRSetOutputPrimary(ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xRRSetOutputPrimaryReq);
|
|
|
|
RROutputPtr output = NULL;
|
|
|
|
WindowPtr pWin;
|
|
|
|
rrScrPrivPtr pScrPriv;
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xRRSetOutputPrimaryReq);
|
|
|
|
|
|
|
|
pWin = SecurityLookupIDByType(client, stuff->window, RT_WINDOW,
|
|
|
|
DixReadAccess);
|
|
|
|
|
|
|
|
if (!pWin) {
|
|
|
|
client->errorValue = stuff->window;
|
|
|
|
return BadWindow;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (stuff->output) {
|
|
|
|
output = LookupOutput(client, stuff->output, DixReadAccess);
|
|
|
|
|
|
|
|
if (!output) {
|
|
|
|
client->errorValue = stuff->output;
|
|
|
|
return RRErrorBase + BadRROutput;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (output->pScreen != pWin->drawable.pScreen) {
|
|
|
|
client->errorValue = stuff->window;
|
|
|
|
return BadMatch;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pScrPriv = rrGetScrPriv(pWin->drawable.pScreen);
|
|
|
|
RRSetPrimaryOutput(pWin->drawable.pScreen, pScrPriv, output);
|
|
|
|
|
|
|
|
return client->noClientException;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
ProcRRGetOutputPrimary(ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xRRGetOutputPrimaryReq);
|
|
|
|
WindowPtr pWin;
|
|
|
|
rrScrPrivPtr pScrPriv;
|
|
|
|
xRRGetOutputPrimaryReply rep;
|
|
|
|
RROutputPtr primary = NULL;
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xRRGetOutputPrimaryReq);
|
|
|
|
|
|
|
|
pWin = SecurityLookupIDByType(client, stuff->window, RT_WINDOW,
|
|
|
|
DixReadAccess);
|
|
|
|
|
|
|
|
if (!pWin) {
|
|
|
|
client->errorValue = stuff->window;
|
|
|
|
return BadWindow;
|
|
|
|
}
|
|
|
|
|
|
|
|
pScrPriv = rrGetScrPriv(pWin->drawable.pScreen);
|
|
|
|
if (pScrPriv)
|
|
|
|
primary = pScrPriv->primaryOutput;
|
|
|
|
|
|
|
|
memset(&rep, 0, sizeof(rep));
|
|
|
|
rep.type = X_Reply;
|
|
|
|
rep.sequenceNumber = client->sequence;
|
|
|
|
rep.output = primary ? primary->id : None;
|
|
|
|
|
|
|
|
if (client->swapped) {
|
|
|
|
int n;
|
|
|
|
swaps(&rep.sequenceNumber, n);
|
|
|
|
swapl(&rep.output, n);
|
|
|
|
}
|
|
|
|
|
|
|
|
WriteToClient(client, sizeof(xRRGetOutputPrimaryReply), &rep);
|
|
|
|
|
|
|
|
return client->noClientException;
|
|
|
|
}
|