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"
|
|
|
|
|
2012-03-21 20:55:09 +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
|
2012-03-21 20:55:09 +01:00
|
|
|
RROutputChanged(RROutputPtr output, Bool configChanged)
|
2006-10-14 02:34:53 +02:00
|
|
|
{
|
2013-12-12 10:00:09 +01:00
|
|
|
/* set changed bits on the master screen only */
|
2012-03-21 20:55:09 +01:00
|
|
|
ScreenPtr pScreen = output->pScreen;
|
2013-12-12 10:00:09 +01:00
|
|
|
rrScrPrivPtr mastersp;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2006-10-14 02:34:53 +02:00
|
|
|
output->changed = TRUE;
|
2013-12-12 10:00:09 +01:00
|
|
|
if (!pScreen)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (pScreen->isGPU) {
|
|
|
|
ScreenPtr master = pScreen->current_master;
|
|
|
|
if (!master)
|
|
|
|
return;
|
|
|
|
mastersp = rrGetScrPriv(master);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
mastersp = rrGetScrPriv(pScreen);
|
2006-11-09 08:17:55 +01:00
|
|
|
}
|
2013-12-12 10:00:09 +01:00
|
|
|
|
|
|
|
RRSetChanged(pScreen);
|
|
|
|
if (configChanged)
|
|
|
|
mastersp->configChanged = TRUE;
|
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
|
2012-03-21 20:55:09 +01:00
|
|
|
RROutputCreate(ScreenPtr pScreen,
|
|
|
|
const char *name, int nameLength, void *devPrivate)
|
2006-09-18 08:03:23 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +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())
|
2012-03-21 20:55:09 +01:00
|
|
|
return NULL;
|
|
|
|
|
2007-03-24 07:41:36 +01:00
|
|
|
pScrPriv = rrGetScrPriv(pScreen);
|
|
|
|
|
|
|
|
if (pScrPriv->numOutputs)
|
2015-03-21 21:42:12 +01:00
|
|
|
outputs = reallocarray(pScrPriv->outputs,
|
|
|
|
pScrPriv->numOutputs + 1, sizeof(RROutputPtr));
|
2007-03-24 07:41:36 +01:00
|
|
|
else
|
2012-03-21 20:55:09 +01:00
|
|
|
outputs = malloc(sizeof(RROutputPtr));
|
2007-03-24 07:41:36 +01:00
|
|
|
if (!outputs)
|
2012-03-21 20:55:09 +01:00
|
|
|
return FALSE;
|
2007-03-24 07:41:36 +01:00
|
|
|
|
|
|
|
pScrPriv->outputs = outputs;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
|
|
|
output = malloc(sizeof(RROutputRec) + nameLength + 1);
|
2006-09-18 08:03:23 +02:00
|
|
|
if (!output)
|
2012-03-21 20:55:09 +01:00
|
|
|
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;
|
2012-03-21 20:55:09 +01:00
|
|
|
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;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2013-12-15 10:05:51 +01:00
|
|
|
if (!AddResource(output->id, RROutputType, (void *) output))
|
2012-03-21 20:55:09 +01:00
|
|
|
return NULL;
|
2006-09-18 21:18:22 +02:00
|
|
|
|
2007-03-24 07:41:36 +01:00
|
|
|
pScrPriv->outputs[pScrPriv->numOutputs++] = output;
|
2013-10-30 12:33:50 +01:00
|
|
|
|
|
|
|
RRResourcesChanged(pScreen);
|
|
|
|
|
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
|
2012-03-21 20:55:09 +01:00
|
|
|
RROutputSetClones(RROutputPtr output, RROutputPtr * clones, int numClones)
|
2006-09-18 08:03:23 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
RROutputPtr *newClones;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
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 22:14:53 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
if (numClones) {
|
2015-03-21 21:42:12 +01:00
|
|
|
newClones = xallocarray(numClones, sizeof(RROutputPtr));
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!newClones)
|
|
|
|
return FALSE;
|
2006-09-20 21:05:52 +02:00
|
|
|
}
|
|
|
|
else
|
2012-03-21 20:55:09 +01:00
|
|
|
newClones = NULL;
|
2010-06-06 10:28:30 +02:00
|
|
|
free(output->clones);
|
2012-03-21 20:55:09 +01:00
|
|
|
memcpy(newClones, clones, numClones * sizeof(RROutputPtr));
|
2006-09-18 08:03:23 +02:00
|
|
|
output->clones = newClones;
|
|
|
|
output->numClones = numClones;
|
2012-03-21 20:55:09 +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
|
2012-03-21 20:55:09 +01:00
|
|
|
RROutputSetModes(RROutputPtr output,
|
|
|
|
RRModePtr * modes, int numModes, int numPreferred)
|
2006-09-18 08:03:23 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
RRModePtr *newModes;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (numModes == output->numModes && numPreferred == output->numPreferred) {
|
|
|
|
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-20 22:14:53 +02:00
|
|
|
}
|
2006-09-18 08:03:23 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (numModes) {
|
2015-03-21 21:42:12 +01:00
|
|
|
newModes = xallocarray(numModes, sizeof(RRModePtr));
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!newModes)
|
|
|
|
return FALSE;
|
2006-09-20 21:05:52 +02:00
|
|
|
}
|
|
|
|
else
|
2012-03-21 20:55:09 +01:00
|
|
|
newModes = NULL;
|
|
|
|
if (output->modes) {
|
|
|
|
for (i = 0; i < output->numModes; i++)
|
|
|
|
RRModeDestroy(output->modes[i]);
|
|
|
|
free(output->modes);
|
2006-09-20 22:14:53 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
memcpy(newModes, modes, numModes * sizeof(RRModePtr));
|
2006-09-18 08:03:23 +02:00
|
|
|
output->modes = newModes;
|
|
|
|
output->numModes = numModes;
|
2006-10-06 07:31:35 +02:00
|
|
|
output->numPreferred = numPreferred;
|
2012-03-21 20:55:09 +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
|
2012-03-21 20:55:09 +01:00
|
|
|
RROutputAddUserMode(RROutputPtr output, RRModePtr mode)
|
2007-02-19 08:49:38 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
int m;
|
|
|
|
ScreenPtr pScreen = output->pScreen;
|
|
|
|
|
2007-02-19 08:49:38 +01:00
|
|
|
rrScrPriv(pScreen);
|
2012-03-21 20:55:09 +01:00
|
|
|
RRModePtr *newModes;
|
2007-02-19 08:49:38 +01:00
|
|
|
|
|
|
|
/* Check to see if this mode is already listed for this output */
|
2012-03-21 20:55:09 +01:00
|
|
|
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;
|
2007-02-19 08:49:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Check with the DDX to see if this mode is OK */
|
|
|
|
if (pScrPriv->rrOutputValidateMode)
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!pScrPriv->rrOutputValidateMode(pScreen, output, mode))
|
|
|
|
return BadMatch;
|
2007-02-19 08:49:38 +01:00
|
|
|
|
|
|
|
if (output->userModes)
|
2015-03-21 21:42:12 +01:00
|
|
|
newModes = reallocarray(output->userModes,
|
|
|
|
output->numUserModes + 1, sizeof(RRModePtr));
|
2007-02-19 08:49:38 +01:00
|
|
|
else
|
2012-03-21 20:55:09 +01:00
|
|
|
newModes = malloc(sizeof(RRModePtr));
|
2007-02-19 08:49:38 +01:00
|
|
|
if (!newModes)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadAlloc;
|
2007-02-19 08:49:38 +01:00
|
|
|
|
|
|
|
output->userModes = newModes;
|
|
|
|
output->userModes[output->numUserModes++] = mode;
|
|
|
|
++mode->refcnt;
|
2012-03-21 20:55:09 +01:00
|
|
|
RROutputChanged(output, TRUE);
|
|
|
|
RRTellChanged(pScreen);
|
2007-02-19 08:49:38 +01:00
|
|
|
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
|
2012-03-21 20:55:09 +01:00
|
|
|
RROutputDeleteUserMode(RROutputPtr output, RRModePtr mode)
|
2007-02-19 08:49:38 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
int m;
|
|
|
|
|
2007-02-19 08:49:38 +01:00
|
|
|
/* Find this mode in the user mode list */
|
2012-03-21 20:55:09 +01:00
|
|
|
for (m = 0; m < output->numUserModes; m++) {
|
|
|
|
RRModePtr e = output->userModes[m];
|
2007-02-19 08:49:38 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (mode == e)
|
|
|
|
break;
|
2007-02-19 08:49:38 +01:00
|
|
|
}
|
|
|
|
/* Not there, access error */
|
|
|
|
if (m == output->numUserModes)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadAccess;
|
2007-02-19 08:49:38 +01:00
|
|
|
|
|
|
|
/* make sure the mode isn't active for this output */
|
|
|
|
if (output->crtc && output->crtc->mode == mode)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadMatch;
|
2007-02-19 08:49:38 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
memmove(output->userModes + m, output->userModes + m + 1,
|
|
|
|
(output->numUserModes - m - 1) * sizeof(RRModePtr));
|
2007-08-07 21:44:19 +02:00
|
|
|
output->numUserModes--;
|
2012-03-21 20:55:09 +01:00
|
|
|
RRModeDestroy(mode);
|
2007-02-19 08:49:38 +01:00
|
|
|
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
|
2012-03-21 20:55:09 +01:00
|
|
|
RROutputSetCrtcs(RROutputPtr output, RRCrtcPtr * crtcs, int numCrtcs)
|
2006-09-18 08:03:23 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
RRCrtcPtr *newCrtcs;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
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 22:14:53 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
if (numCrtcs) {
|
2015-03-21 21:42:12 +01:00
|
|
|
newCrtcs = xallocarray(numCrtcs, sizeof(RRCrtcPtr));
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!newCrtcs)
|
|
|
|
return FALSE;
|
2006-09-20 21:05:52 +02:00
|
|
|
}
|
|
|
|
else
|
2012-03-21 20:55:09 +01:00
|
|
|
newCrtcs = NULL;
|
2010-06-06 10:28:30 +02:00
|
|
|
free(output->crtcs);
|
2012-03-21 20:55:09 +01:00
|
|
|
memcpy(newCrtcs, crtcs, numCrtcs * sizeof(RRCrtcPtr));
|
2006-09-18 08:03:23 +02:00
|
|
|
output->crtcs = newCrtcs;
|
|
|
|
output->numCrtcs = numCrtcs;
|
2012-03-21 20:55:09 +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
|
2012-03-21 20:55:09 +01:00
|
|
|
RROutputSetConnection(RROutputPtr output, CARD8 connection)
|
2006-09-18 08:03:23 +02:00
|
|
|
{
|
2006-09-20 22:14:53 +02:00
|
|
|
if (output->connection == connection)
|
2012-03-21 20:55:09 +01:00
|
|
|
return TRUE;
|
2006-09-18 08:03:23 +02:00
|
|
|
output->connection = connection;
|
2012-03-21 20:55:09 +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
|
2012-03-21 20:55:09 +01:00
|
|
|
RROutputSetSubpixelOrder(RROutputPtr output, int subpixelOrder)
|
2006-09-19 09:46:27 +02:00
|
|
|
{
|
2006-09-20 22:14:53 +02:00
|
|
|
if (output->subpixelOrder == subpixelOrder)
|
2012-03-21 20:55:09 +01:00
|
|
|
return TRUE;
|
2006-09-20 22:14:53 +02:00
|
|
|
|
2006-09-19 09:46:27 +02:00
|
|
|
output->subpixelOrder = subpixelOrder;
|
2012-03-21 20:55:09 +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
|
2012-03-21 20:55:09 +01:00
|
|
|
RROutputSetPhysicalSize(RROutputPtr output, int mmWidth, int mmHeight)
|
2006-11-01 09:29:46 +01:00
|
|
|
{
|
|
|
|
if (output->mmWidth == mmWidth && output->mmHeight == mmHeight)
|
2012-03-21 20:55:09 +01:00
|
|
|
return TRUE;
|
2006-11-01 09:29:46 +01:00
|
|
|
output->mmWidth = mmWidth;
|
|
|
|
output->mmHeight = mmHeight;
|
2012-03-21 20:55:09 +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;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
|
|
|
rrScrPriv(pScreen);
|
|
|
|
RRCrtcPtr crtc = output->crtc;
|
2012-07-10 04:12:44 +02:00
|
|
|
RRModePtr mode = crtc ? crtc->mode : NULL;
|
|
|
|
|
|
|
|
xRROutputChangeNotifyEvent oe = {
|
|
|
|
.type = RRNotify + RREventBase,
|
|
|
|
.subCode = RRNotify_OutputChange,
|
|
|
|
.timestamp = pScrPriv->lastSetTime.milliseconds,
|
|
|
|
.configTimestamp = pScrPriv->lastConfigTime.milliseconds,
|
|
|
|
.window = pWin->drawable.id,
|
|
|
|
.output = output->id,
|
|
|
|
.crtc = crtc ? crtc->id : None,
|
|
|
|
.mode = mode ? mode->mode.id : None,
|
|
|
|
.rotation = crtc ? crtc->rotation : RR_Rotate_0,
|
|
|
|
.connection = output->connection,
|
|
|
|
.subpixelOrder = output->subpixelOrder
|
|
|
|
};
|
2012-03-21 20:55:09 +01:00
|
|
|
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
|
2012-03-21 20:55:09 +01:00
|
|
|
RROutputDestroy(RROutputPtr output)
|
2006-09-17 08:21:37 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
FreeResource(output->id, 0);
|
2006-09-17 08:21:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2013-12-15 10:05:51 +01:00
|
|
|
RROutputDestroyResource(void *value, XID pid)
|
2006-09-17 08:21:37 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
RROutputPtr output = (RROutputPtr) value;
|
|
|
|
ScreenPtr pScreen = output->pScreen;
|
|
|
|
int m;
|
|
|
|
|
|
|
|
if (pScreen) {
|
|
|
|
rrScrPriv(pScreen);
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (pScrPriv->primaryOutput == output)
|
|
|
|
pScrPriv->primaryOutput = NULL;
|
|
|
|
|
|
|
|
for (i = 0; i < pScrPriv->numOutputs; i++) {
|
|
|
|
if (pScrPriv->outputs[i] == output) {
|
|
|
|
memmove(pScrPriv->outputs + i, pScrPriv->outputs + i + 1,
|
|
|
|
(pScrPriv->numOutputs - (i + 1)) * sizeof(RROutputPtr));
|
|
|
|
--pScrPriv->numOutputs;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2013-10-30 12:33:50 +01:00
|
|
|
|
|
|
|
RRResourcesChanged(pScreen);
|
2006-09-18 08:03:23 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
if (output->modes) {
|
|
|
|
for (m = 0; m < output->numModes; m++)
|
|
|
|
RRModeDestroy(output->modes[m]);
|
|
|
|
free(output->modes);
|
2007-03-16 04:26:07 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2007-02-19 08:49:38 +01:00
|
|
|
for (m = 0; m < output->numUserModes; m++)
|
2012-03-21 20:55:09 +01:00
|
|
|
RRModeDestroy(output->userModes[m]);
|
2010-06-06 10:28:30 +02:00
|
|
|
free(output->userModes);
|
2007-02-19 08:49:38 +01:00
|
|
|
|
2010-06-06 10:28:30 +02:00
|
|
|
free(output->crtcs);
|
|
|
|
free(output->clones);
|
2012-03-21 20:55:09 +01:00
|
|
|
RRDeleteAllOutputProperties(output);
|
2010-05-05 20:44:06 +02:00
|
|
|
free(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
|
2012-03-21 20:55:09 +01:00
|
|
|
RROutputInit(void)
|
2006-09-17 08:21:37 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
RROutputType = CreateNewResourceType(RROutputDestroyResource, "OUTPUT");
|
2006-09-18 08:03:23 +02:00
|
|
|
if (!RROutputType)
|
2012-03-21 20:55:09 +01:00
|
|
|
return FALSE;
|
2010-09-29 22:51:48 +02:00
|
|
|
|
2006-09-17 08:21:37 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
2006-09-20 07:48:54 +02:00
|
|
|
|
2010-09-29 22:51:48 +02:00
|
|
|
/*
|
|
|
|
* Initialize output type error value
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
RROutputInitErrorValue(void)
|
|
|
|
{
|
|
|
|
SetResourceTypeErrorValue(RROutputType, RRErrorBase + BadRROutput);
|
|
|
|
}
|
|
|
|
|
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
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcRRGetOutputInfo(ClientPtr client)
|
2006-09-20 07:48:54 +02:00
|
|
|
{
|
2007-03-06 00:31:44 +01:00
|
|
|
REQUEST(xRRGetOutputInfoReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
xRRGetOutputInfoReply rep;
|
|
|
|
RROutputPtr output;
|
|
|
|
CARD8 *extra;
|
|
|
|
unsigned long extraLen;
|
|
|
|
ScreenPtr pScreen;
|
|
|
|
rrScrPrivPtr pScrPriv;
|
|
|
|
RRCrtc *crtcs;
|
|
|
|
RRMode *modes;
|
|
|
|
RROutput *clones;
|
|
|
|
char *name;
|
|
|
|
int i;
|
|
|
|
|
2006-09-20 07:48:54 +02:00
|
|
|
REQUEST_SIZE_MATCH(xRRGetOutputInfoReq);
|
2009-04-29 07:04:37 +02:00
|
|
|
VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess);
|
2006-09-20 07:48:54 +02:00
|
|
|
|
|
|
|
pScreen = output->pScreen;
|
|
|
|
pScrPriv = rrGetScrPriv(pScreen);
|
|
|
|
|
2012-07-10 04:12:43 +02:00
|
|
|
rep = (xRRGetOutputInfoReply) {
|
|
|
|
.type = X_Reply,
|
|
|
|
.status = RRSetConfigSuccess,
|
|
|
|
.sequenceNumber = client->sequence,
|
|
|
|
.length = bytes_to_int32(OutputInfoExtra),
|
|
|
|
.timestamp = pScrPriv->lastSetTime.milliseconds,
|
|
|
|
.crtc = output->crtc ? output->crtc->id : None,
|
|
|
|
.mmWidth = output->mmWidth,
|
|
|
|
.mmHeight = output->mmHeight,
|
|
|
|
.connection = output->connection,
|
|
|
|
.subpixelOrder = output->subpixelOrder,
|
|
|
|
.nCrtcs = output->numCrtcs,
|
|
|
|
.nModes = output->numModes + output->numUserModes,
|
|
|
|
.nPreferred = output->numPreferred,
|
|
|
|
.nClones = output->numClones,
|
|
|
|
.nameLength = output->nameLength
|
|
|
|
};
|
2009-07-06 04:24:27 +02:00
|
|
|
extraLen = ((output->numCrtcs +
|
2012-03-21 20:55:09 +01:00
|
|
|
output->numModes + output->numUserModes +
|
|
|
|
output->numClones + bytes_to_int32(rep.nameLength)) << 2);
|
|
|
|
|
|
|
|
if (extraLen) {
|
|
|
|
rep.length += bytes_to_int32(extraLen);
|
|
|
|
extra = malloc(extraLen);
|
|
|
|
if (!extra)
|
|
|
|
return BadAlloc;
|
2006-09-20 21:05:52 +02:00
|
|
|
}
|
|
|
|
else
|
2012-03-21 20:55:09 +01:00
|
|
|
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);
|
2012-03-21 20:55:09 +01:00
|
|
|
|
|
|
|
for (i = 0; i < output->numCrtcs; i++) {
|
|
|
|
crtcs[i] = output->crtcs[i]->id;
|
|
|
|
if (client->swapped)
|
|
|
|
swapl(&crtcs[i]);
|
2006-09-20 07:48:54 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
for (i = 0; i < output->numModes + output->numUserModes; i++) {
|
|
|
|
if (i < output->numModes)
|
|
|
|
modes[i] = output->modes[i]->mode.id;
|
|
|
|
else
|
|
|
|
modes[i] = output->userModes[i - output->numModes]->mode.id;
|
|
|
|
if (client->swapped)
|
|
|
|
swapl(&modes[i]);
|
2006-09-20 07:48:54 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
for (i = 0; i < output->numClones; i++) {
|
|
|
|
clones[i] = output->clones[i]->id;
|
|
|
|
if (client->swapped)
|
|
|
|
swapl(&clones[i]);
|
2006-09-20 07:48:54 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
memcpy(name, output->name, output->nameLength);
|
2006-09-20 07:48:54 +02:00
|
|
|
if (client->swapped) {
|
2012-03-21 20:55:09 +01:00
|
|
|
swaps(&rep.sequenceNumber);
|
|
|
|
swapl(&rep.length);
|
|
|
|
swapl(&rep.timestamp);
|
|
|
|
swapl(&rep.crtc);
|
|
|
|
swapl(&rep.mmWidth);
|
|
|
|
swapl(&rep.mmHeight);
|
|
|
|
swaps(&rep.nCrtcs);
|
|
|
|
swaps(&rep.nModes);
|
2015-01-21 10:22:05 +01:00
|
|
|
swaps(&rep.nPreferred);
|
2012-03-21 20:55:09 +01:00
|
|
|
swaps(&rep.nClones);
|
|
|
|
swaps(&rep.nameLength);
|
2006-09-20 07:48:54 +02:00
|
|
|
}
|
2012-05-13 09:03:35 +02:00
|
|
|
WriteToClient(client, sizeof(xRRGetOutputInfoReply), &rep);
|
2012-03-21 20:55:09 +01:00
|
|
|
if (extraLen) {
|
2012-05-13 09:03:35 +02:00
|
|
|
WriteToClient(client, extraLen, extra);
|
2012-03-21 20:55:09 +01:00
|
|
|
free(extra);
|
2006-09-20 07:48:54 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2006-09-20 07:48:54 +02:00
|
|
|
}
|
2008-12-09 16:51:37 +01:00
|
|
|
|
2009-01-11 08:43:48 +01:00
|
|
|
static void
|
2012-03-21 20:55:09 +01:00
|
|
|
RRSetPrimaryOutput(ScreenPtr pScreen, rrScrPrivPtr pScrPriv, RROutputPtr output)
|
2008-12-09 16:51:37 +01:00
|
|
|
{
|
|
|
|
if (pScrPriv->primaryOutput == output)
|
2012-03-21 20:55:09 +01:00
|
|
|
return;
|
2008-12-09 16:51:37 +01:00
|
|
|
|
|
|
|
/* clear the old primary */
|
|
|
|
if (pScrPriv->primaryOutput) {
|
2012-03-21 20:55:09 +01:00
|
|
|
RROutputChanged(pScrPriv->primaryOutput, 0);
|
|
|
|
pScrPriv->primaryOutput = NULL;
|
2008-12-09 16:51:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* set the new primary */
|
|
|
|
if (output) {
|
2012-03-21 20:55:09 +01:00
|
|
|
pScrPriv->primaryOutput = output;
|
|
|
|
RROutputChanged(output, 0);
|
2008-12-09 16:51:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
pScrPriv->layoutChanged = TRUE;
|
|
|
|
|
|
|
|
RRTellChanged(pScreen);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
ProcRRSetOutputPrimary(ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xRRSetOutputPrimaryReq);
|
|
|
|
RROutputPtr output = NULL;
|
|
|
|
WindowPtr pWin;
|
|
|
|
rrScrPrivPtr pScrPriv;
|
2012-06-22 03:42:46 +02:00
|
|
|
int ret;
|
2016-02-04 14:06:43 +01:00
|
|
|
ScreenPtr slave;
|
2008-12-09 16:51:37 +01:00
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xRRSetOutputPrimaryReq);
|
|
|
|
|
2012-06-22 03:42:46 +02:00
|
|
|
ret = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
|
|
|
if (ret != Success)
|
|
|
|
return ret;
|
2008-12-09 16:51:37 +01:00
|
|
|
|
|
|
|
if (stuff->output) {
|
2012-03-21 20:55:09 +01:00
|
|
|
VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess);
|
2008-12-09 16:51:37 +01:00
|
|
|
|
2015-01-07 00:19:27 +01:00
|
|
|
if (!output->pScreen->isGPU && output->pScreen != pWin->drawable.pScreen) {
|
|
|
|
client->errorValue = stuff->window;
|
|
|
|
return BadMatch;
|
|
|
|
}
|
|
|
|
if (output->pScreen->isGPU && output->pScreen->current_master != pWin->drawable.pScreen) {
|
2012-03-21 20:55:09 +01:00
|
|
|
client->errorValue = stuff->window;
|
|
|
|
return BadMatch;
|
|
|
|
}
|
2008-12-09 16:51:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
pScrPriv = rrGetScrPriv(pWin->drawable.pScreen);
|
2012-06-22 03:45:18 +02:00
|
|
|
if (pScrPriv)
|
2016-02-04 14:06:43 +01:00
|
|
|
{
|
2012-06-22 03:45:18 +02:00
|
|
|
RRSetPrimaryOutput(pWin->drawable.pScreen, pScrPriv, output);
|
2008-12-09 16:51:37 +01:00
|
|
|
|
2016-02-04 14:06:43 +01:00
|
|
|
xorg_list_for_each_entry(slave,
|
xrandrprovider: Do not use separate lists for unbound / source / offload slaves
A single provider can be both a offload and source slave at the same time,
the use of seperate lists breaks in this case e.g. :
xrandr --listproviders
Providers: number : 2
Provider 0: id: 0x7b cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 3 outputs: 2 associated providers: 0 name:modesetting
Provider 1: id: 0x46 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 2 outputs: 5 associated providers: 0 name:modesetting
xrandr --setprovideroutputsource 1 0x7b
xrandr --listproviders
Providers: number : 2
Provider 0: id: 0x7b cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 3 outputs: 2 associated providers: 1 name:modesetting
Provider 1: id: 0x46 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 2 outputs: 5 associated providers: 1 name:modesetting
xrandr --setprovideroffloadsink 1 0x7b
xrandr --listproviders
Providers: number : 3
Provider 0: id: 0x7b cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 3 outputs: 2 associated providers: 2 name:modesetting
Provider 1: id: 0x46 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 2 outputs: 5 associated providers: 2 name:modesetting
Provider 2: id: 0x46 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 2 outputs: 5 associated providers: 2 name:modesetting
Not good. The problem is that the provider with id 0x46 now is on both
the output_slave_list and the offload_slave_list of the master screen.
This commit fixes this by unifying all 3 lists into a single slaves list.
Note that this does change the struct _Screen definition, so this is an ABI
break. I do not expect any of the drivers to actually use the removed / changed
fields so a recompile should suffice.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2016-05-13 15:58:10 +02:00
|
|
|
&pWin->drawable.pScreen->slave_list,
|
|
|
|
slave_head) {
|
|
|
|
if (slave->is_output_slave)
|
|
|
|
RRSetPrimaryOutput(slave, rrGetScrPriv(slave), output);
|
2016-02-04 14:06:43 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2008-12-09 16:51:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
ProcRRGetOutputPrimary(ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xRRGetOutputPrimaryReq);
|
|
|
|
WindowPtr pWin;
|
|
|
|
rrScrPrivPtr pScrPriv;
|
|
|
|
xRRGetOutputPrimaryReply rep;
|
|
|
|
RROutputPtr primary = NULL;
|
2009-04-29 07:04:37 +02:00
|
|
|
int rc;
|
2008-12-09 16:51:37 +01:00
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xRRGetOutputPrimaryReq);
|
|
|
|
|
2009-04-29 07:04:37 +02:00
|
|
|
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
|
|
|
if (rc != Success)
|
2012-03-21 20:55:09 +01:00
|
|
|
return rc;
|
2008-12-09 16:51:37 +01:00
|
|
|
|
|
|
|
pScrPriv = rrGetScrPriv(pWin->drawable.pScreen);
|
|
|
|
if (pScrPriv)
|
2012-03-21 20:55:09 +01:00
|
|
|
primary = pScrPriv->primaryOutput;
|
2008-12-09 16:51:37 +01:00
|
|
|
|
2012-07-10 04:12:43 +02:00
|
|
|
rep = (xRRGetOutputPrimaryReply) {
|
|
|
|
.type = X_Reply,
|
|
|
|
.sequenceNumber = client->sequence,
|
|
|
|
.output = primary ? primary->id : None
|
|
|
|
};
|
2008-12-09 16:51:37 +01:00
|
|
|
|
|
|
|
if (client->swapped) {
|
2012-03-21 20:55:09 +01:00
|
|
|
swaps(&rep.sequenceNumber);
|
|
|
|
swapl(&rep.output);
|
2008-12-09 16:51:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
WriteToClient(client, sizeof(xRRGetOutputPrimaryReply), &rep);
|
|
|
|
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2008-12-09 16:51:37 +01:00
|
|
|
}
|