2006-09-17 08:21:37 +02:00
|
|
|
/*
|
|
|
|
* Copyright © 2006 Keith Packard
|
2010-11-15 20:29:14 +01:00
|
|
|
* Copyright 2010 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"
|
2006-09-20 07:48:54 +02:00
|
|
|
#include "swaprep.h"
|
2010-11-15 20:29:14 +01:00
|
|
|
#include "mipointer.h"
|
2006-09-17 08:21:37 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
RESTYPE RRCrtcType;
|
2006-09-17 08:21:37 +02:00
|
|
|
|
2006-10-14 02:34:53 +02:00
|
|
|
/*
|
|
|
|
* Notify the CRTC 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
|
|
|
RRCrtcChanged(RRCrtcPtr crtc, Bool layoutChanged)
|
2006-10-14 02:34:53 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
ScreenPtr pScreen = crtc->pScreen;
|
2006-10-14 02:34:53 +02:00
|
|
|
|
|
|
|
crtc->changed = TRUE;
|
2012-03-21 20:55:09 +01:00
|
|
|
if (pScreen) {
|
|
|
|
rrScrPriv(pScreen);
|
|
|
|
|
2013-01-09 05:23:57 +01:00
|
|
|
RRSetChanged(pScreen);
|
2012-03-21 20:55:09 +01:00
|
|
|
/*
|
|
|
|
* Send ConfigureNotify on any layout change
|
|
|
|
*/
|
|
|
|
if (layoutChanged)
|
|
|
|
pScrPriv->layoutChanged = TRUE;
|
2006-11-09 06:36:35 +01:00
|
|
|
}
|
2006-10-14 02:34:53 +02:00
|
|
|
}
|
|
|
|
|
2006-09-17 08:21:37 +02:00
|
|
|
/*
|
|
|
|
* Create a CRTC
|
|
|
|
*/
|
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
|
|
|
RRCrtcPtr
|
2012-03-21 20:55:09 +01:00
|
|
|
RRCrtcCreate(ScreenPtr pScreen, void *devPrivate)
|
2006-09-17 08:21:37 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
RRCrtcPtr crtc;
|
|
|
|
RRCrtcPtr *crtcs;
|
|
|
|
rrScrPrivPtr pScrPriv;
|
2007-03-24 07:41:36 +01: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);
|
|
|
|
|
|
|
|
/* make space for the crtc pointer */
|
|
|
|
if (pScrPriv->numCrtcs)
|
2015-03-21 21:42:12 +01:00
|
|
|
crtcs = reallocarray(pScrPriv->crtcs,
|
|
|
|
pScrPriv->numCrtcs + 1, sizeof(RRCrtcPtr));
|
2007-03-24 07:41:36 +01:00
|
|
|
else
|
2012-03-21 20:55:09 +01:00
|
|
|
crtcs = malloc(sizeof(RRCrtcPtr));
|
2007-03-24 07:41:36 +01:00
|
|
|
if (!crtcs)
|
2012-03-21 20:55:09 +01:00
|
|
|
return FALSE;
|
2007-03-24 07:41:36 +01:00
|
|
|
pScrPriv->crtcs = crtcs;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
|
|
|
crtc = calloc(1, sizeof(RRCrtcRec));
|
2006-09-17 08:21:37 +02:00
|
|
|
if (!crtc)
|
2012-03-21 20:55:09 +01:00
|
|
|
return NULL;
|
|
|
|
crtc->id = FakeClientID(0);
|
2007-03-24 07:41:36 +01:00
|
|
|
crtc->pScreen = pScreen;
|
2006-09-17 08:21:37 +02:00
|
|
|
crtc->mode = NULL;
|
|
|
|
crtc->x = 0;
|
|
|
|
crtc->y = 0;
|
|
|
|
crtc->rotation = RR_Rotate_0;
|
|
|
|
crtc->rotations = RR_Rotate_0;
|
|
|
|
crtc->outputs = NULL;
|
|
|
|
crtc->numOutputs = 0;
|
2006-09-20 07:48:54 +02:00
|
|
|
crtc->gammaSize = 0;
|
|
|
|
crtc->gammaRed = crtc->gammaBlue = crtc->gammaGreen = NULL;
|
2006-10-14 02:34:53 +02:00
|
|
|
crtc->changed = FALSE;
|
2006-09-17 08:21:37 +02:00
|
|
|
crtc->devPrivate = devPrivate;
|
2012-03-21 20:55:09 +01:00
|
|
|
RRTransformInit(&crtc->client_pending_transform);
|
|
|
|
RRTransformInit(&crtc->client_current_transform);
|
|
|
|
pixman_transform_init_identity(&crtc->transform);
|
|
|
|
pixman_f_transform_init_identity(&crtc->f_transform);
|
|
|
|
pixman_f_transform_init_identity(&crtc->f_inverse);
|
2006-09-18 21:18:22 +02:00
|
|
|
|
2013-12-15 10:05:51 +01:00
|
|
|
if (!AddResource(crtc->id, RRCrtcType, (void *) crtc))
|
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
|
|
|
/* attach the screen and crtc together */
|
|
|
|
crtc->pScreen = pScreen;
|
|
|
|
pScrPriv->crtcs[pScrPriv->numCrtcs++] = crtc;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2013-10-30 12:33:50 +01:00
|
|
|
RRResourcesChanged(pScreen);
|
|
|
|
|
2006-11-09 06:36:35 +01:00
|
|
|
return crtc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2007-03-24 07:41:36 +01:00
|
|
|
* Set the allowed rotations on a CRTC
|
2006-11-09 06:36:35 +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
|
|
|
void
|
2012-03-21 20:55:09 +01:00
|
|
|
RRCrtcSetRotations(RRCrtcPtr crtc, Rotation rotations)
|
2006-11-09 06:36:35 +01:00
|
|
|
{
|
2007-03-24 07:41:36 +01:00
|
|
|
crtc->rotations = rotations;
|
2006-09-17 08:21:37 +02:00
|
|
|
}
|
|
|
|
|
2008-03-18 23:35:44 +01:00
|
|
|
/*
|
|
|
|
* Set whether transforms are allowed on a CRTC
|
|
|
|
*/
|
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
|
|
|
RRCrtcSetTransformSupport(RRCrtcPtr crtc, Bool transforms)
|
2008-03-18 23:35:44 +01:00
|
|
|
{
|
|
|
|
crtc->transforms = transforms;
|
|
|
|
}
|
|
|
|
|
2006-09-17 08:21:37 +02:00
|
|
|
/*
|
|
|
|
* Notify the extension that the Crtc has been reconfigured,
|
|
|
|
* the driver calls this whenever it has updated the mode
|
|
|
|
*/
|
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
|
|
|
RRCrtcNotify(RRCrtcPtr crtc,
|
|
|
|
RRModePtr mode,
|
|
|
|
int x,
|
|
|
|
int y,
|
|
|
|
Rotation rotation,
|
|
|
|
RRTransformPtr transform, int numOutputs, RROutputPtr * outputs)
|
2006-09-17 08:21:37 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
int i, j;
|
|
|
|
|
2006-10-06 07:31:35 +02:00
|
|
|
/*
|
|
|
|
* Check to see if any of the new outputs were
|
|
|
|
* not in the old list and mark them as changed
|
|
|
|
*/
|
2012-03-21 20:55:09 +01:00
|
|
|
for (i = 0; i < numOutputs; i++) {
|
|
|
|
for (j = 0; j < crtc->numOutputs; j++)
|
|
|
|
if (outputs[i] == crtc->outputs[j])
|
|
|
|
break;
|
|
|
|
if (j == crtc->numOutputs) {
|
|
|
|
outputs[i]->crtc = crtc;
|
|
|
|
RROutputChanged(outputs[i], FALSE);
|
|
|
|
RRCrtcChanged(crtc, FALSE);
|
|
|
|
}
|
2006-10-06 07:31:35 +02:00
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Check to see if any of the old outputs are
|
|
|
|
* not in the new list and mark them as changed
|
|
|
|
*/
|
2012-03-21 20:55:09 +01:00
|
|
|
for (j = 0; j < crtc->numOutputs; j++) {
|
|
|
|
for (i = 0; i < numOutputs; i++)
|
|
|
|
if (outputs[i] == crtc->outputs[j])
|
|
|
|
break;
|
|
|
|
if (i == numOutputs) {
|
|
|
|
if (crtc->outputs[j]->crtc == crtc)
|
|
|
|
crtc->outputs[j]->crtc = NULL;
|
|
|
|
RROutputChanged(crtc->outputs[j], FALSE);
|
|
|
|
RRCrtcChanged(crtc, FALSE);
|
|
|
|
}
|
2006-10-06 07:31:35 +02:00
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Reallocate the crtc output array if necessary
|
|
|
|
*/
|
2012-03-21 20:55:09 +01:00
|
|
|
if (numOutputs != crtc->numOutputs) {
|
|
|
|
RROutputPtr *newoutputs;
|
|
|
|
|
|
|
|
if (numOutputs) {
|
|
|
|
if (crtc->numOutputs)
|
2015-03-21 21:42:12 +01:00
|
|
|
newoutputs = reallocarray(crtc->outputs,
|
|
|
|
numOutputs, sizeof(RROutputPtr));
|
2012-03-21 20:55:09 +01:00
|
|
|
else
|
2015-03-21 21:42:12 +01:00
|
|
|
newoutputs = xallocarray(numOutputs, sizeof(RROutputPtr));
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!newoutputs)
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
free(crtc->outputs);
|
|
|
|
newoutputs = NULL;
|
|
|
|
}
|
|
|
|
crtc->outputs = newoutputs;
|
|
|
|
crtc->numOutputs = numOutputs;
|
2006-09-17 08:21:37 +02:00
|
|
|
}
|
2006-10-06 07:31:35 +02:00
|
|
|
/*
|
|
|
|
* Copy the new list of outputs into the crtc
|
|
|
|
*/
|
2012-03-21 20:55:09 +01:00
|
|
|
memcpy(crtc->outputs, outputs, numOutputs * sizeof(RROutputPtr));
|
2006-10-06 07:31:35 +02:00
|
|
|
/*
|
|
|
|
* Update remaining crtc fields
|
|
|
|
*/
|
2012-03-21 20:55:09 +01:00
|
|
|
if (mode != crtc->mode) {
|
|
|
|
if (crtc->mode)
|
|
|
|
RRModeDestroy(crtc->mode);
|
|
|
|
crtc->mode = mode;
|
|
|
|
if (mode != NULL)
|
|
|
|
mode->refcnt++;
|
|
|
|
RRCrtcChanged(crtc, TRUE);
|
2006-09-17 08:21:37 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
if (x != crtc->x) {
|
|
|
|
crtc->x = x;
|
|
|
|
RRCrtcChanged(crtc, TRUE);
|
2006-09-17 08:21:37 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
if (y != crtc->y) {
|
|
|
|
crtc->y = y;
|
|
|
|
RRCrtcChanged(crtc, TRUE);
|
2006-09-17 08:21:37 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
if (rotation != crtc->rotation) {
|
|
|
|
crtc->rotation = rotation;
|
|
|
|
RRCrtcChanged(crtc, TRUE);
|
2006-09-21 07:43:05 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!RRTransformEqual(transform, &crtc->client_current_transform)) {
|
|
|
|
RRTransformCopy(&crtc->client_current_transform, transform);
|
|
|
|
RRCrtcChanged(crtc, TRUE);
|
2008-03-21 10:39:49 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
if (crtc->changed && mode) {
|
|
|
|
RRTransformCompute(x, y,
|
|
|
|
mode->mode.width, mode->mode.height,
|
|
|
|
rotation,
|
|
|
|
&crtc->client_current_transform,
|
|
|
|
&crtc->transform, &crtc->f_transform,
|
|
|
|
&crtc->f_inverse);
|
2008-03-27 19:46:39 +01:00
|
|
|
}
|
2006-09-17 08:21:37 +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
|
|
|
void
|
2012-03-21 20:55:09 +01:00
|
|
|
RRDeliverCrtcEvent(ClientPtr client, WindowPtr pWin, RRCrtcPtr crtc)
|
2006-09-18 08:03:23 +02:00
|
|
|
{
|
2006-10-06 07:31:35 +02:00
|
|
|
ScreenPtr pScreen = pWin->drawable.pScreen;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
|
|
|
rrScrPriv(pScreen);
|
|
|
|
RRModePtr mode = crtc->mode;
|
|
|
|
|
2012-07-10 04:12:44 +02:00
|
|
|
xRRCrtcChangeNotifyEvent ce = {
|
|
|
|
.type = RRNotify + RREventBase,
|
|
|
|
.subCode = RRNotify_CrtcChange,
|
|
|
|
.timestamp = pScrPriv->lastSetTime.milliseconds,
|
|
|
|
.window = pWin->drawable.id,
|
|
|
|
.crtc = crtc->id,
|
|
|
|
.mode = mode ? mode->mode.id : None,
|
|
|
|
.rotation = crtc->rotation,
|
|
|
|
.x = mode ? crtc->x : 0,
|
|
|
|
.y = mode ? crtc->y : 0,
|
|
|
|
.width = mode ? mode->mode.width : 0,
|
|
|
|
.height = mode ? mode->mode.height : 0
|
|
|
|
};
|
2012-03-21 20:55:09 +01:00
|
|
|
WriteEventsToClient(client, 1, (xEvent *) &ce);
|
2006-09-18 08:03:23 +02:00
|
|
|
}
|
|
|
|
|
2007-03-24 07:41:36 +01:00
|
|
|
static Bool
|
2012-03-21 20:55:09 +01:00
|
|
|
RRCrtcPendingProperties(RRCrtcPtr crtc)
|
2007-03-24 07:41:36 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
ScreenPtr pScreen = crtc->pScreen;
|
|
|
|
|
2007-03-24 07:41:36 +01:00
|
|
|
rrScrPriv(pScreen);
|
2012-03-21 20:55:09 +01:00
|
|
|
int o;
|
2007-03-24 07:41:36 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
for (o = 0; o < pScrPriv->numOutputs; o++) {
|
|
|
|
RROutputPtr output = pScrPriv->outputs[o];
|
|
|
|
|
|
|
|
if (output->crtc == crtc && output->pendingProperties)
|
|
|
|
return TRUE;
|
2007-03-24 07:41:36 +01:00
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2010-11-15 20:29:14 +01:00
|
|
|
static void
|
|
|
|
crtc_bounds(RRCrtcPtr crtc, int *left, int *right, int *top, int *bottom)
|
|
|
|
{
|
|
|
|
*left = crtc->x;
|
|
|
|
*top = crtc->y;
|
|
|
|
|
|
|
|
switch (crtc->rotation) {
|
|
|
|
case RR_Rotate_0:
|
|
|
|
case RR_Rotate_180:
|
|
|
|
default:
|
2012-03-21 20:55:09 +01:00
|
|
|
*right = crtc->x + crtc->mode->mode.width;
|
|
|
|
*bottom = crtc->y + crtc->mode->mode.height;
|
|
|
|
return;
|
2010-11-15 20:29:14 +01:00
|
|
|
case RR_Rotate_90:
|
|
|
|
case RR_Rotate_270:
|
2012-03-21 20:55:09 +01:00
|
|
|
*right = crtc->x + crtc->mode->mode.height;
|
|
|
|
*bottom = crtc->y + crtc->mode->mode.width;
|
|
|
|
return;
|
2010-11-15 20:29:14 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* overlapping counts as adjacent */
|
|
|
|
static Bool
|
|
|
|
crtcs_adjacent(const RRCrtcPtr a, const RRCrtcPtr b)
|
|
|
|
{
|
|
|
|
/* left, right, top, bottom... */
|
|
|
|
int al, ar, at, ab;
|
|
|
|
int bl, br, bt, bb;
|
2012-03-21 20:55:09 +01:00
|
|
|
int cl, cr, ct, cb; /* the overlap, if any */
|
2010-11-15 20:29:14 +01:00
|
|
|
|
|
|
|
crtc_bounds(a, &al, &ar, &at, &ab);
|
|
|
|
crtc_bounds(b, &bl, &br, &bt, &bb);
|
|
|
|
|
|
|
|
cl = max(al, bl);
|
|
|
|
cr = min(ar, br);
|
|
|
|
ct = max(at, bt);
|
|
|
|
cb = min(ab, bb);
|
|
|
|
|
|
|
|
return (cl <= cr) && (ct <= cb);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Depth-first search and mark all CRTCs reachable from cur */
|
|
|
|
static void
|
2012-03-21 20:55:09 +01:00
|
|
|
mark_crtcs(rrScrPrivPtr pScrPriv, int *reachable, int cur)
|
2010-11-15 20:29:14 +01:00
|
|
|
{
|
|
|
|
int i;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2010-11-15 20:29:14 +01:00
|
|
|
reachable[cur] = TRUE;
|
|
|
|
for (i = 0; i < pScrPriv->numCrtcs; ++i) {
|
|
|
|
if (reachable[i] || !pScrPriv->crtcs[i]->mode)
|
|
|
|
continue;
|
|
|
|
if (crtcs_adjacent(pScrPriv->crtcs[cur], pScrPriv->crtcs[i]))
|
|
|
|
mark_crtcs(pScrPriv, reachable, i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-03-21 20:55:09 +01:00
|
|
|
RRComputeContiguity(ScreenPtr pScreen)
|
2010-11-15 20:29:14 +01:00
|
|
|
{
|
|
|
|
rrScrPriv(pScreen);
|
|
|
|
Bool discontiguous = TRUE;
|
|
|
|
int i, n = pScrPriv->numCrtcs;
|
|
|
|
|
|
|
|
int *reachable = calloc(n, sizeof(int));
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2010-11-15 20:29:14 +01:00
|
|
|
if (!reachable)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
/* Find first enabled CRTC and start search for reachable CRTCs from it */
|
|
|
|
for (i = 0; i < n; ++i) {
|
|
|
|
if (pScrPriv->crtcs[i]->mode) {
|
|
|
|
mark_crtcs(pScrPriv, reachable, i);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check that all enabled CRTCs were marked as reachable */
|
|
|
|
for (i = 0; i < n; ++i)
|
|
|
|
if (pScrPriv->crtcs[i]->mode && !reachable[i])
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
discontiguous = FALSE;
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
out:
|
2010-11-15 20:29:14 +01:00
|
|
|
free(reachable);
|
|
|
|
pScrPriv->discontiguous = discontiguous;
|
|
|
|
}
|
|
|
|
|
2015-11-26 03:39:25 +01:00
|
|
|
static void
|
|
|
|
rrDestroySharedPixmap(RRCrtcPtr crtc, PixmapPtr pPixmap) {
|
2015-12-02 10:21:12 +01:00
|
|
|
ScreenPtr master = crtc->pScreen->current_master;
|
|
|
|
|
|
|
|
if (master && pPixmap->master_pixmap) {
|
2015-11-26 03:39:25 +01:00
|
|
|
/*
|
|
|
|
* Unref the pixmap twice: once for the original reference, and once
|
|
|
|
* for the reference implicitly added by PixmapShareToSlave.
|
|
|
|
*/
|
2016-05-06 02:46:14 +02:00
|
|
|
PixmapUnshareSlavePixmap(pPixmap);
|
|
|
|
|
2015-12-02 10:21:12 +01:00
|
|
|
master->DestroyPixmap(pPixmap->master_pixmap);
|
|
|
|
master->DestroyPixmap(pPixmap->master_pixmap);
|
2015-11-26 03:39:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
crtc->pScreen->DestroyPixmap(pPixmap);
|
|
|
|
}
|
|
|
|
|
2012-06-20 13:37:12 +02:00
|
|
|
void
|
|
|
|
RRCrtcDetachScanoutPixmap(RRCrtcPtr crtc)
|
|
|
|
{
|
|
|
|
rrScrPriv(crtc->pScreen);
|
|
|
|
|
|
|
|
if (crtc->scanout_pixmap) {
|
2016-06-17 05:06:47 +02:00
|
|
|
ScreenPtr master = crtc->pScreen->current_master;
|
|
|
|
PixmapPtr mscreenpix = master->GetScreenPixmap(master);
|
|
|
|
|
|
|
|
if (crtc->scanout_pixmap_back) {
|
|
|
|
pScrPriv->rrDisableSharedPixmapFlipping(crtc);
|
|
|
|
|
|
|
|
master->StopFlippingPixmapTracking(mscreenpix,
|
|
|
|
crtc->scanout_pixmap,
|
|
|
|
crtc->scanout_pixmap_back);
|
|
|
|
|
|
|
|
rrDestroySharedPixmap(crtc, crtc->scanout_pixmap_back);
|
|
|
|
crtc->scanout_pixmap_back = NULL;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
pScrPriv->rrCrtcSetScanoutPixmap(crtc, NULL);
|
|
|
|
master->StopPixmapTracking(mscreenpix, crtc->scanout_pixmap);
|
|
|
|
}
|
|
|
|
|
2015-11-26 03:39:25 +01:00
|
|
|
rrDestroySharedPixmap(crtc, crtc->scanout_pixmap);
|
2016-06-17 05:06:47 +02:00
|
|
|
crtc->scanout_pixmap = NULL;
|
2012-06-20 13:37:12 +02:00
|
|
|
}
|
2016-06-17 05:06:47 +02:00
|
|
|
|
2012-06-20 13:37:12 +02:00
|
|
|
RRCrtcChanged(crtc, TRUE);
|
|
|
|
}
|
|
|
|
|
2015-11-26 03:39:26 +01:00
|
|
|
static PixmapPtr
|
|
|
|
rrCreateSharedPixmap(RRCrtcPtr crtc, ScreenPtr master,
|
|
|
|
int width, int height, int depth,
|
2015-06-30 06:54:42 +02:00
|
|
|
int x, int y, Rotation rotation)
|
2012-06-20 13:37:12 +02:00
|
|
|
{
|
|
|
|
PixmapPtr mpix, spix;
|
2015-11-26 03:39:26 +01:00
|
|
|
|
|
|
|
mpix = master->CreatePixmap(master, width, height, depth,
|
|
|
|
CREATE_PIXMAP_USAGE_SHARED);
|
|
|
|
if (!mpix)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
spix = PixmapShareToSlave(mpix, crtc->pScreen);
|
|
|
|
if (spix == NULL) {
|
|
|
|
master->DestroyPixmap(mpix);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return spix;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Bool
|
|
|
|
rrSetupPixmapSharing(RRCrtcPtr crtc, int width, int height,
|
|
|
|
int x, int y, Rotation rotation)
|
|
|
|
{
|
2012-06-20 13:37:12 +02:00
|
|
|
ScreenPtr master = crtc->pScreen->current_master;
|
2016-06-17 05:06:47 +02:00
|
|
|
rrScrPrivPtr pMasterScrPriv = rrGetScrPriv(master);
|
|
|
|
rrScrPrivPtr pSlaveScrPriv = rrGetScrPriv(crtc->pScreen);
|
|
|
|
|
2012-06-20 13:37:12 +02:00
|
|
|
int depth;
|
|
|
|
PixmapPtr mscreenpix;
|
2016-06-17 05:06:47 +02:00
|
|
|
PixmapPtr spix_front;
|
|
|
|
|
|
|
|
/* Create a pixmap on the master screen, then get a shared handle for it.
|
|
|
|
Create a shared pixmap on the slave screen using the handle.
|
|
|
|
|
|
|
|
If sync == FALSE --
|
|
|
|
Set slave screen to scanout shared linear pixmap.
|
|
|
|
Set the master screen to do dirty updates to the shared pixmap
|
|
|
|
from the screen pixmap on its own accord.
|
|
|
|
|
|
|
|
If sync == TRUE --
|
|
|
|
If any of the below steps fail, clean up and fall back to sync == FALSE.
|
|
|
|
Create another shared pixmap on the slave screen using the handle.
|
|
|
|
Set slave screen to prepare for scanout and flipping between shared
|
|
|
|
linear pixmaps.
|
|
|
|
Set the master screen to do dirty updates to the shared pixmaps from the
|
|
|
|
screen pixmap when prompted to by us or the slave.
|
|
|
|
Prompt the master to do a dirty update on the first shared pixmap, then
|
|
|
|
defer to the slave.
|
2012-06-20 13:37:12 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
mscreenpix = master->GetScreenPixmap(master);
|
2015-11-26 03:39:31 +01:00
|
|
|
depth = mscreenpix->drawable.depth;
|
2012-06-20 13:37:12 +02:00
|
|
|
|
|
|
|
if (crtc->scanout_pixmap)
|
|
|
|
RRCrtcDetachScanoutPixmap(crtc);
|
|
|
|
|
|
|
|
if (width == 0 && height == 0) {
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2016-06-17 05:06:47 +02:00
|
|
|
spix_front = rrCreateSharedPixmap(crtc, master,
|
|
|
|
width, height, depth,
|
|
|
|
x, y, rotation);
|
|
|
|
if (spix_front == NULL) {
|
2012-06-20 13:37:12 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2016-06-17 05:06:47 +02:00
|
|
|
/* Both source and sink must support required ABI funcs for flipping */
|
|
|
|
if (pSlaveScrPriv->rrEnableSharedPixmapFlipping &&
|
|
|
|
pSlaveScrPriv->rrDisableSharedPixmapFlipping &&
|
|
|
|
pMasterScrPriv->rrStartFlippingPixmapTracking &&
|
|
|
|
master->PresentSharedPixmap &&
|
|
|
|
master->StopFlippingPixmapTracking) {
|
|
|
|
|
|
|
|
PixmapPtr spix_back = rrCreateSharedPixmap(crtc, master,
|
|
|
|
width, height, depth,
|
|
|
|
x, y, rotation);
|
|
|
|
if (spix_back == NULL)
|
|
|
|
goto fail;
|
|
|
|
|
|
|
|
if (!pSlaveScrPriv->rrEnableSharedPixmapFlipping(crtc,
|
|
|
|
spix_front, spix_back))
|
|
|
|
goto fail;
|
|
|
|
|
|
|
|
crtc->scanout_pixmap = spix_front;
|
|
|
|
crtc->scanout_pixmap_back = spix_back;
|
|
|
|
|
|
|
|
if (!pMasterScrPriv->rrStartFlippingPixmapTracking(crtc, mscreenpix,
|
|
|
|
spix_front,
|
|
|
|
spix_back,
|
|
|
|
x, y, 0, 0,
|
|
|
|
rotation)) {
|
|
|
|
pSlaveScrPriv->rrDisableSharedPixmapFlipping(crtc);
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
master->PresentSharedPixmap(spix_front);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
fail: /* If flipping funcs fail, just fall back to unsynchronized */
|
|
|
|
if (spix_back)
|
|
|
|
rrDestroySharedPixmap(crtc, spix_back);
|
|
|
|
|
|
|
|
crtc->scanout_pixmap = NULL;
|
|
|
|
crtc->scanout_pixmap_back = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
ErrorF("randr: falling back to unsynchronized pixmap sharing\n");
|
|
|
|
|
|
|
|
if (!pSlaveScrPriv->rrCrtcSetScanoutPixmap(crtc, spix_front)) {
|
|
|
|
rrDestroySharedPixmap(crtc, spix_front);
|
|
|
|
ErrorF("randr: failed to set shadow slave pixmap\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
crtc->scanout_pixmap = spix_front;
|
|
|
|
|
|
|
|
master->StartPixmapTracking(mscreenpix, spix_front, x, y, 0, 0, rotation);
|
2012-06-20 13:37:12 +02:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2015-06-30 06:54:42 +02:00
|
|
|
static void crtc_to_box(BoxPtr box, RRCrtcPtr crtc)
|
|
|
|
{
|
|
|
|
box->x1 = crtc->x;
|
|
|
|
box->y1 = crtc->y;
|
|
|
|
switch (crtc->rotation) {
|
|
|
|
case RR_Rotate_0:
|
|
|
|
case RR_Rotate_180:
|
|
|
|
default:
|
|
|
|
box->x2 = crtc->x + crtc->mode->mode.width;
|
|
|
|
box->y2 = crtc->y + crtc->mode->mode.height;
|
|
|
|
break;
|
|
|
|
case RR_Rotate_90:
|
|
|
|
case RR_Rotate_270:
|
|
|
|
box->x2 = crtc->x + crtc->mode->mode.height;
|
|
|
|
box->y2 = crtc->y + crtc->mode->mode.width;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-20 13:37:12 +02:00
|
|
|
static Bool
|
|
|
|
rrCheckPixmapBounding(ScreenPtr pScreen,
|
2015-06-30 06:54:42 +02:00
|
|
|
RRCrtcPtr rr_crtc, Rotation rotation,
|
|
|
|
int x, int y, int w, int h)
|
2012-06-20 13:37:12 +02:00
|
|
|
{
|
|
|
|
RegionRec root_pixmap_region, total_region, new_crtc_region;
|
2013-02-14 01:02:02 +01:00
|
|
|
int c;
|
2012-06-20 13:37:12 +02:00
|
|
|
BoxRec newbox;
|
|
|
|
BoxPtr newsize;
|
|
|
|
ScreenPtr slave;
|
|
|
|
int new_width, new_height;
|
|
|
|
PixmapPtr screen_pixmap = pScreen->GetScreenPixmap(pScreen);
|
|
|
|
rrScrPriv(pScreen);
|
|
|
|
|
|
|
|
PixmapRegionInit(&root_pixmap_region, screen_pixmap);
|
|
|
|
RegionInit(&total_region, NULL, 0);
|
|
|
|
|
|
|
|
/* have to iterate all the crtcs of the attached gpu masters
|
|
|
|
and all their output slaves */
|
|
|
|
for (c = 0; c < pScrPriv->numCrtcs; c++) {
|
2015-03-19 13:19:23 +01:00
|
|
|
RRCrtcPtr crtc = pScrPriv->crtcs[c];
|
|
|
|
|
|
|
|
if (crtc == rr_crtc) {
|
2012-06-20 13:37:12 +02:00
|
|
|
newbox.x1 = x;
|
|
|
|
newbox.y1 = y;
|
2015-06-30 06:54:42 +02:00
|
|
|
if (rotation == RR_Rotate_90 ||
|
|
|
|
rotation == RR_Rotate_270) {
|
|
|
|
newbox.x2 = x + h;
|
|
|
|
newbox.y2 = y + w;
|
|
|
|
} else {
|
|
|
|
newbox.x2 = x + w;
|
|
|
|
newbox.y2 = y + h;
|
|
|
|
}
|
2012-06-20 13:37:12 +02:00
|
|
|
} else {
|
2015-03-19 13:19:23 +01:00
|
|
|
if (!crtc->mode)
|
2012-06-20 13:37:12 +02:00
|
|
|
continue;
|
2015-06-30 06:54:42 +02:00
|
|
|
crtc_to_box(&newbox, crtc);
|
2012-06-20 13:37:12 +02:00
|
|
|
}
|
|
|
|
RegionInit(&new_crtc_region, &newbox, 1);
|
|
|
|
RegionUnion(&total_region, &total_region, &new_crtc_region);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
xorg_list_for_each_entry(slave, &pScreen->slave_list, slave_head) {
|
2013-12-15 10:57:09 +01:00
|
|
|
rrScrPrivPtr slave_priv = rrGetScrPriv(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
|
|
|
|
|
|
|
if (!slave->is_output_slave)
|
|
|
|
continue;
|
|
|
|
|
2014-05-12 23:55:04 +02:00
|
|
|
for (c = 0; c < slave_priv->numCrtcs; c++) {
|
2015-03-19 13:19:23 +01:00
|
|
|
RRCrtcPtr slave_crtc = slave_priv->crtcs[c];
|
|
|
|
|
|
|
|
if (slave_crtc == rr_crtc) {
|
2012-06-20 13:37:12 +02:00
|
|
|
newbox.x1 = x;
|
|
|
|
newbox.y1 = y;
|
2015-06-30 06:54:42 +02:00
|
|
|
if (rotation == RR_Rotate_90 ||
|
|
|
|
rotation == RR_Rotate_270) {
|
|
|
|
newbox.x2 = x + h;
|
|
|
|
newbox.y2 = y + w;
|
|
|
|
} else {
|
|
|
|
newbox.x2 = x + w;
|
|
|
|
newbox.y2 = y + h;
|
|
|
|
}
|
2012-06-20 13:37:12 +02:00
|
|
|
}
|
|
|
|
else {
|
2015-03-19 13:19:23 +01:00
|
|
|
if (!slave_crtc->mode)
|
2012-06-20 13:37:12 +02:00
|
|
|
continue;
|
2015-06-30 06:54:42 +02:00
|
|
|
crtc_to_box(&newbox, slave_crtc);
|
2012-06-20 13:37:12 +02:00
|
|
|
}
|
2014-05-12 23:55:04 +02:00
|
|
|
RegionInit(&new_crtc_region, &newbox, 1);
|
|
|
|
RegionUnion(&total_region, &total_region, &new_crtc_region);
|
|
|
|
}
|
2012-06-20 13:37:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
newsize = RegionExtents(&total_region);
|
|
|
|
new_width = newsize->x2 - newsize->x1;
|
|
|
|
new_height = newsize->y2 - newsize->y1;
|
|
|
|
|
|
|
|
if (new_width == screen_pixmap->drawable.width &&
|
|
|
|
new_height == screen_pixmap->drawable.height) {
|
|
|
|
} else {
|
2013-02-14 01:02:02 +01:00
|
|
|
pScrPriv->rrScreenSetSize(pScreen, new_width, new_height, 0, 0);
|
2012-06-20 13:37:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* set shatters TODO */
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2006-09-17 08:21:37 +02:00
|
|
|
/*
|
|
|
|
* Request that the Crtc be reconfigured
|
|
|
|
*/
|
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
|
|
|
RRCrtcSet(RRCrtcPtr crtc,
|
|
|
|
RRModePtr mode,
|
|
|
|
int x,
|
|
|
|
int y, Rotation rotation, int numOutputs, RROutputPtr * outputs)
|
2006-09-17 08:21:37 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
ScreenPtr pScreen = crtc->pScreen;
|
|
|
|
Bool ret = FALSE;
|
|
|
|
Bool recompute = TRUE;
|
2014-02-10 18:07:33 +01:00
|
|
|
Bool crtcChanged;
|
|
|
|
int o;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2007-03-23 09:03:40 +01:00
|
|
|
rrScrPriv(pScreen);
|
2006-09-17 08:21:37 +02:00
|
|
|
|
2014-02-10 18:07:33 +01:00
|
|
|
crtcChanged = FALSE;
|
|
|
|
for (o = 0; o < numOutputs; o++) {
|
|
|
|
if (outputs[o] && outputs[o]->crtc != crtc) {
|
|
|
|
crtcChanged = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-18 21:18:22 +02:00
|
|
|
/* See if nothing changed */
|
|
|
|
if (crtc->mode == mode &&
|
2012-03-21 20:55:09 +01:00
|
|
|
crtc->x == x &&
|
|
|
|
crtc->y == y &&
|
|
|
|
crtc->rotation == rotation &&
|
|
|
|
crtc->numOutputs == numOutputs &&
|
|
|
|
!memcmp(crtc->outputs, outputs, numOutputs * sizeof(RROutputPtr)) &&
|
2014-02-10 18:07:33 +01:00
|
|
|
!RRCrtcPendingProperties(crtc) && !RRCrtcPendingTransform(crtc) &&
|
|
|
|
!crtcChanged) {
|
2012-03-21 20:55:09 +01:00
|
|
|
recompute = FALSE;
|
|
|
|
ret = TRUE;
|
2006-09-18 21:18:22 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
else {
|
2012-06-20 13:37:12 +02:00
|
|
|
if (pScreen->isGPU) {
|
|
|
|
ScreenPtr master = pScreen->current_master;
|
|
|
|
int width = 0, height = 0;
|
|
|
|
|
|
|
|
if (mode) {
|
|
|
|
width = mode->mode.width;
|
|
|
|
height = mode->mode.height;
|
|
|
|
}
|
|
|
|
ret = rrCheckPixmapBounding(master, crtc,
|
2015-06-30 06:54:42 +02:00
|
|
|
rotation, x, y, width, height);
|
2012-06-20 13:37:12 +02:00
|
|
|
if (!ret)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (pScreen->current_master) {
|
2015-11-26 03:39:26 +01:00
|
|
|
ret = rrSetupPixmapSharing(crtc, width, height, x, y, rotation);
|
2012-06-20 13:37:12 +02:00
|
|
|
}
|
|
|
|
}
|
2006-11-09 06:36:35 +01:00
|
|
|
#if RANDR_12_INTERFACE
|
2012-03-21 20:55:09 +01:00
|
|
|
if (pScrPriv->rrCrtcSet) {
|
|
|
|
ret = (*pScrPriv->rrCrtcSet) (pScreen, crtc, mode, x, y,
|
|
|
|
rotation, numOutputs, outputs);
|
|
|
|
}
|
|
|
|
else
|
2006-11-09 06:36:35 +01:00
|
|
|
#endif
|
2012-03-21 20:55:09 +01:00
|
|
|
{
|
2007-03-23 09:03:40 +01:00
|
|
|
#if RANDR_10_INTERFACE
|
2012-03-21 20:55:09 +01:00
|
|
|
if (pScrPriv->rrSetConfig) {
|
|
|
|
RRScreenSize size;
|
|
|
|
RRScreenRate rate;
|
|
|
|
|
|
|
|
if (!mode) {
|
|
|
|
RRCrtcNotify(crtc, NULL, x, y, rotation, NULL, 0, NULL);
|
|
|
|
ret = TRUE;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
size.width = mode->mode.width;
|
|
|
|
size.height = mode->mode.height;
|
|
|
|
if (outputs[0]->mmWidth && outputs[0]->mmHeight) {
|
|
|
|
size.mmWidth = outputs[0]->mmWidth;
|
|
|
|
size.mmHeight = outputs[0]->mmHeight;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
size.mmWidth = pScreen->mmWidth;
|
|
|
|
size.mmHeight = pScreen->mmHeight;
|
|
|
|
}
|
|
|
|
size.nRates = 1;
|
|
|
|
rate.rate = RRVerticalRefresh(&mode->mode);
|
|
|
|
size.pRates = &rate;
|
|
|
|
ret =
|
|
|
|
(*pScrPriv->rrSetConfig) (pScreen, rotation, rate.rate,
|
|
|
|
&size);
|
|
|
|
/*
|
|
|
|
* Old 1.0 interface tied screen size to mode size
|
|
|
|
*/
|
|
|
|
if (ret) {
|
|
|
|
RRCrtcNotify(crtc, mode, x, y, rotation, NULL, 1,
|
|
|
|
outputs);
|
|
|
|
RRScreenSizeNotify(pScreen);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-09-17 08:21:37 +02:00
|
|
|
#endif
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
|
|
|
if (ret) {
|
|
|
|
|
|
|
|
RRTellChanged(pScreen);
|
|
|
|
|
|
|
|
for (o = 0; o < numOutputs; o++)
|
|
|
|
RRPostPendingProperties(outputs[o]);
|
|
|
|
}
|
2006-11-09 06:36:35 +01:00
|
|
|
}
|
2010-11-15 20:29:14 +01:00
|
|
|
|
|
|
|
if (recompute)
|
2012-03-21 20:55:09 +01:00
|
|
|
RRComputeContiguity(pScreen);
|
2010-11-15 20:29:14 +01:00
|
|
|
|
2007-03-23 09:03:40 +01:00
|
|
|
return ret;
|
2006-09-17 08:21:37 +02:00
|
|
|
}
|
|
|
|
|
2008-03-13 22:26:01 +01:00
|
|
|
/*
|
|
|
|
* Return crtc transform
|
|
|
|
*/
|
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
|
|
|
RRTransformPtr
|
2012-03-21 20:55:09 +01:00
|
|
|
RRCrtcGetTransform(RRCrtcPtr crtc)
|
2008-03-13 22:26:01 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
RRTransformPtr transform = &crtc->client_pending_transform;
|
2008-03-15 08:36:45 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (pixman_transform_is_identity(&transform->transform))
|
|
|
|
return NULL;
|
2008-03-15 08:36:45 +01:00
|
|
|
return transform;
|
2008-03-13 22:26:01 +01:00
|
|
|
}
|
|
|
|
|
2008-03-14 05:31:12 +01:00
|
|
|
/*
|
|
|
|
* Check whether the pending and current transforms are the same
|
|
|
|
*/
|
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
|
|
|
RRCrtcPendingTransform(RRCrtcPtr crtc)
|
2008-03-14 05:31:12 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
return memcmp(&crtc->client_current_transform.transform,
|
|
|
|
&crtc->client_pending_transform.transform,
|
|
|
|
sizeof(PictTransform)) != 0;
|
2008-03-13 22:26:01 +01:00
|
|
|
}
|
|
|
|
|
2006-09-17 08:21:37 +02:00
|
|
|
/*
|
|
|
|
* Destroy a Crtc 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
|
|
|
RRCrtcDestroy(RRCrtcPtr crtc)
|
2006-09-17 08:21:37 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
FreeResource(crtc->id, 0);
|
2006-09-17 08:21:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2013-12-15 10:05:51 +01:00
|
|
|
RRCrtcDestroyResource(void *value, XID pid)
|
2006-09-17 08:21:37 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
RRCrtcPtr crtc = (RRCrtcPtr) value;
|
|
|
|
ScreenPtr pScreen = crtc->pScreen;
|
2006-09-17 08:21:37 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (pScreen) {
|
|
|
|
rrScrPriv(pScreen);
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < pScrPriv->numCrtcs; i++) {
|
|
|
|
if (pScrPriv->crtcs[i] == crtc) {
|
|
|
|
memmove(pScrPriv->crtcs + i, pScrPriv->crtcs + i + 1,
|
|
|
|
(pScrPriv->numCrtcs - (i + 1)) * sizeof(RRCrtcPtr));
|
|
|
|
--pScrPriv->numCrtcs;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2013-10-30 12:33:50 +01:00
|
|
|
|
|
|
|
RRResourcesChanged(pScreen);
|
2006-09-17 08:21:37 +02:00
|
|
|
}
|
2012-06-20 13:37:12 +02:00
|
|
|
|
|
|
|
if (crtc->scanout_pixmap)
|
|
|
|
RRCrtcDetachScanoutPixmap(crtc);
|
2010-06-06 10:28:30 +02:00
|
|
|
free(crtc->gammaRed);
|
2007-03-16 04:26:07 +01:00
|
|
|
if (crtc->mode)
|
2012-03-21 20:55:09 +01:00
|
|
|
RRModeDestroy(crtc->mode);
|
2010-05-05 20:44:06 +02:00
|
|
|
free(crtc);
|
2006-09-17 08:21:37 +02:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2006-09-20 07:48:54 +02:00
|
|
|
/*
|
|
|
|
* Request that the Crtc gamma be 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
|
|
|
RRCrtcGammaSet(RRCrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue)
|
2006-09-20 07:48:54 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
Bool ret = TRUE;
|
|
|
|
|
2006-09-20 07:48:54 +02:00
|
|
|
#if RANDR_12_INTERFACE
|
2012-03-21 20:55:09 +01:00
|
|
|
ScreenPtr pScreen = crtc->pScreen;
|
2006-09-20 07:48:54 +02:00
|
|
|
#endif
|
2012-03-21 20:55:09 +01:00
|
|
|
|
|
|
|
memcpy(crtc->gammaRed, red, crtc->gammaSize * sizeof(CARD16));
|
|
|
|
memcpy(crtc->gammaGreen, green, crtc->gammaSize * sizeof(CARD16));
|
|
|
|
memcpy(crtc->gammaBlue, blue, crtc->gammaSize * sizeof(CARD16));
|
2006-09-20 07:48:54 +02:00
|
|
|
#if RANDR_12_INTERFACE
|
2012-03-21 20:55:09 +01:00
|
|
|
if (pScreen) {
|
|
|
|
rrScrPriv(pScreen);
|
|
|
|
if (pScrPriv->rrCrtcSetGamma)
|
|
|
|
ret = (*pScrPriv->rrCrtcSetGamma) (pScreen, crtc);
|
2006-11-09 06:36:35 +01:00
|
|
|
}
|
2006-09-20 07:48:54 +02:00
|
|
|
#endif
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2008-12-17 16:56:26 +01:00
|
|
|
/*
|
|
|
|
* Request current gamma back from the DDX (if possible).
|
|
|
|
* This includes gamma size.
|
|
|
|
*/
|
|
|
|
Bool
|
|
|
|
RRCrtcGammaGet(RRCrtcPtr crtc)
|
|
|
|
{
|
|
|
|
Bool ret = TRUE;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2008-12-17 16:56:26 +01:00
|
|
|
#if RANDR_12_INTERFACE
|
2012-03-21 20:55:09 +01:00
|
|
|
ScreenPtr pScreen = crtc->pScreen;
|
2008-12-17 16:56:26 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if RANDR_12_INTERFACE
|
2012-03-21 20:55:09 +01:00
|
|
|
if (pScreen) {
|
2008-12-17 16:56:26 +01:00
|
|
|
rrScrPriv(pScreen);
|
|
|
|
if (pScrPriv->rrCrtcGetGamma)
|
|
|
|
ret = (*pScrPriv->rrCrtcGetGamma) (pScreen, crtc);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2006-09-20 07:48:54 +02:00
|
|
|
/*
|
|
|
|
* Notify the extension that the Crtc gamma has been changed
|
|
|
|
* The driver calls this whenever it has changed the gamma values
|
|
|
|
* in the RRCrtcRec
|
|
|
|
*/
|
|
|
|
|
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
|
|
|
RRCrtcGammaNotify(RRCrtcPtr crtc)
|
2006-09-20 07:48:54 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
return TRUE; /* not much going on here */
|
2006-09-20 07:48:54 +02:00
|
|
|
}
|
|
|
|
|
2011-02-23 20:17:42 +01:00
|
|
|
static void
|
2012-03-21 20:55:09 +01:00
|
|
|
RRModeGetScanoutSize(RRModePtr mode, PictTransformPtr transform,
|
|
|
|
int *width, int *height)
|
2007-01-24 17:29:20 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
BoxRec box;
|
2008-03-17 21:57:47 +01:00
|
|
|
|
|
|
|
if (mode == NULL) {
|
2012-03-21 20:55:09 +01:00
|
|
|
*width = 0;
|
|
|
|
*height = 0;
|
|
|
|
return;
|
2007-01-24 17:29:20 +01:00
|
|
|
}
|
|
|
|
|
2008-03-17 21:57:47 +01:00
|
|
|
box.x1 = 0;
|
|
|
|
box.y1 = 0;
|
|
|
|
box.x2 = mode->mode.width;
|
|
|
|
box.y2 = mode->mode.height;
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
pixman_transform_bounds(transform, &box);
|
2008-03-17 21:57:47 +01:00
|
|
|
*width = box.x2 - box.x1;
|
|
|
|
*height = box.y2 - box.y1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the width/height that the crtc scans out from the framebuffer
|
|
|
|
*/
|
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
|
2008-03-17 21:57:47 +01:00
|
|
|
RRCrtcGetScanoutSize(RRCrtcPtr crtc, int *width, int *height)
|
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
RRModeGetScanoutSize(crtc->mode, &crtc->transform, width, height);
|
2007-01-24 17:29:20 +01:00
|
|
|
}
|
|
|
|
|
2006-09-20 07:48:54 +02:00
|
|
|
/*
|
|
|
|
* Set the size of the gamma table at server startup time
|
|
|
|
*/
|
|
|
|
|
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
|
|
|
RRCrtcGammaSetSize(RRCrtcPtr crtc, int size)
|
2006-09-20 07:48:54 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
CARD16 *gamma;
|
2006-09-20 07:48:54 +02:00
|
|
|
|
|
|
|
if (size == crtc->gammaSize)
|
2012-03-21 20:55:09 +01:00
|
|
|
return TRUE;
|
|
|
|
if (size) {
|
2015-03-21 21:42:12 +01:00
|
|
|
gamma = xallocarray(size, 3 * sizeof(CARD16));
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!gamma)
|
|
|
|
return FALSE;
|
2006-09-20 21:05:52 +02:00
|
|
|
}
|
|
|
|
else
|
2012-03-21 20:55:09 +01:00
|
|
|
gamma = NULL;
|
2010-06-06 10:28:30 +02:00
|
|
|
free(crtc->gammaRed);
|
2006-09-20 07:48:54 +02:00
|
|
|
crtc->gammaRed = gamma;
|
|
|
|
crtc->gammaGreen = gamma + size;
|
2012-03-21 20:55:09 +01:00
|
|
|
crtc->gammaBlue = gamma + size * 2;
|
2006-09-20 07:48:54 +02:00
|
|
|
crtc->gammaSize = size;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2008-03-14 05:31:12 +01:00
|
|
|
/*
|
|
|
|
* Set the pending CRTC transformation
|
|
|
|
*/
|
|
|
|
|
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
|
|
|
RRCrtcTransformSet(RRCrtcPtr crtc,
|
|
|
|
PictTransformPtr transform,
|
|
|
|
struct pixman_f_transform *f_transform,
|
|
|
|
struct pixman_f_transform *f_inverse,
|
|
|
|
char *filter_name,
|
|
|
|
int filter_len, xFixed * params, int nparams)
|
2008-03-14 05:31:12 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
PictFilterPtr filter = NULL;
|
|
|
|
int width = 0, height = 0;
|
2008-03-15 08:36:45 +01:00
|
|
|
|
2008-03-18 23:35:44 +01:00
|
|
|
if (!crtc->transforms)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadValue;
|
|
|
|
|
|
|
|
if (filter_len) {
|
|
|
|
filter = PictureFindFilter(crtc->pScreen, filter_name, filter_len);
|
|
|
|
if (!filter)
|
|
|
|
return BadName;
|
|
|
|
if (filter->ValidateParams) {
|
|
|
|
if (!filter->ValidateParams(crtc->pScreen, filter->id,
|
|
|
|
params, nparams, &width, &height))
|
|
|
|
return BadMatch;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
width = filter->width;
|
|
|
|
height = filter->height;
|
|
|
|
}
|
2008-03-15 08:36:45 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
else {
|
|
|
|
if (nparams)
|
|
|
|
return BadMatch;
|
2008-03-15 08:36:45 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!RRTransformSetFilter(&crtc->client_pending_transform,
|
|
|
|
filter, params, nparams, width, height))
|
|
|
|
return BadAlloc;
|
2008-03-15 08:36:45 +01:00
|
|
|
|
|
|
|
crtc->client_pending_transform.transform = *transform;
|
2008-03-19 08:46:35 +01:00
|
|
|
crtc->client_pending_transform.f_transform = *f_transform;
|
|
|
|
crtc->client_pending_transform.f_inverse = *f_inverse;
|
2008-03-14 05:31:12 +01:00
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
2006-09-17 08:21:37 +02:00
|
|
|
/*
|
|
|
|
* Initialize crtc type
|
|
|
|
*/
|
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
|
|
|
RRCrtcInit(void)
|
2006-09-17 08:21:37 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
RRCrtcType = CreateNewResourceType(RRCrtcDestroyResource, "CRTC");
|
2006-09-18 08:03:23 +02:00
|
|
|
if (!RRCrtcType)
|
2012-03-21 20:55:09 +01:00
|
|
|
return FALSE;
|
|
|
|
|
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 crtc type error value
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
RRCrtcInitErrorValue(void)
|
|
|
|
{
|
|
|
|
SetResourceTypeErrorValue(RRCrtcType, RRErrorBase + BadRRCrtc);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
ProcRRGetCrtcInfo(ClientPtr client)
|
2006-09-20 07:48:54 +02:00
|
|
|
{
|
2007-03-06 00:31:44 +01:00
|
|
|
REQUEST(xRRGetCrtcInfoReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
xRRGetCrtcInfoReply rep;
|
|
|
|
RRCrtcPtr crtc;
|
|
|
|
CARD8 *extra;
|
|
|
|
unsigned long extraLen;
|
|
|
|
ScreenPtr pScreen;
|
|
|
|
rrScrPrivPtr pScrPriv;
|
|
|
|
RRModePtr mode;
|
|
|
|
RROutput *outputs;
|
|
|
|
RROutput *possible;
|
|
|
|
int i, j, k;
|
|
|
|
int width, height;
|
|
|
|
BoxRec panned_area;
|
|
|
|
|
2006-09-20 07:48:54 +02:00
|
|
|
REQUEST_SIZE_MATCH(xRRGetCrtcInfoReq);
|
2009-04-29 07:04:37 +02:00
|
|
|
VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
|
2006-09-20 07:48:54 +02:00
|
|
|
|
2006-11-09 06:36:35 +01:00
|
|
|
/* All crtcs must be associated with screens before client
|
|
|
|
* requests are processed
|
|
|
|
*/
|
2006-09-20 07:48:54 +02:00
|
|
|
pScreen = crtc->pScreen;
|
|
|
|
pScrPriv = rrGetScrPriv(pScreen);
|
|
|
|
|
|
|
|
mode = crtc->mode;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2012-07-10 04:12:43 +02:00
|
|
|
rep = (xRRGetCrtcInfoReply) {
|
|
|
|
.type = X_Reply,
|
|
|
|
.status = RRSetConfigSuccess,
|
|
|
|
.sequenceNumber = client->sequence,
|
|
|
|
.length = 0,
|
|
|
|
.timestamp = pScrPriv->lastSetTime.milliseconds
|
|
|
|
};
|
2009-01-31 00:43:04 +01:00
|
|
|
if (pScrPriv->rrGetPanning &&
|
2012-03-21 20:55:09 +01:00
|
|
|
pScrPriv->rrGetPanning(pScreen, crtc, &panned_area, NULL, NULL) &&
|
|
|
|
(panned_area.x2 > panned_area.x1) && (panned_area.y2 > panned_area.y1))
|
2009-01-31 00:43:04 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
rep.x = panned_area.x1;
|
|
|
|
rep.y = panned_area.y1;
|
|
|
|
rep.width = panned_area.x2 - panned_area.x1;
|
|
|
|
rep.height = panned_area.y2 - panned_area.y1;
|
2009-01-31 00:43:04 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
else {
|
|
|
|
RRCrtcGetScanoutSize(crtc, &width, &height);
|
|
|
|
rep.x = crtc->x;
|
|
|
|
rep.y = crtc->y;
|
|
|
|
rep.width = width;
|
|
|
|
rep.height = height;
|
2009-01-31 00:43:04 +01:00
|
|
|
}
|
2006-10-06 07:31:35 +02:00
|
|
|
rep.mode = mode ? mode->mode.id : 0;
|
2006-09-20 07:48:54 +02:00
|
|
|
rep.rotation = crtc->rotation;
|
|
|
|
rep.rotations = crtc->rotations;
|
|
|
|
rep.nOutput = crtc->numOutputs;
|
|
|
|
k = 0;
|
|
|
|
for (i = 0; i < pScrPriv->numOutputs; i++)
|
2012-03-21 20:55:09 +01:00
|
|
|
for (j = 0; j < pScrPriv->outputs[i]->numCrtcs; j++)
|
|
|
|
if (pScrPriv->outputs[i]->crtcs[j] == crtc)
|
|
|
|
k++;
|
2006-09-20 07:48:54 +02:00
|
|
|
rep.nPossibleOutput = k;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2006-09-20 07:48:54 +02:00
|
|
|
rep.length = rep.nOutput + rep.nPossibleOutput;
|
|
|
|
|
|
|
|
extraLen = rep.length << 2;
|
2012-03-21 20:55:09 +01:00
|
|
|
if (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
|
|
|
|
|
|
|
outputs = (RROutput *) extra;
|
|
|
|
possible = (RROutput *) (outputs + rep.nOutput);
|
2012-03-21 20:55:09 +01:00
|
|
|
|
|
|
|
for (i = 0; i < crtc->numOutputs; i++) {
|
|
|
|
outputs[i] = crtc->outputs[i]->id;
|
|
|
|
if (client->swapped)
|
|
|
|
swapl(&outputs[i]);
|
2006-09-20 07:48:54 +02:00
|
|
|
}
|
|
|
|
k = 0;
|
|
|
|
for (i = 0; i < pScrPriv->numOutputs; i++)
|
2012-03-21 20:55:09 +01:00
|
|
|
for (j = 0; j < pScrPriv->outputs[i]->numCrtcs; j++)
|
|
|
|
if (pScrPriv->outputs[i]->crtcs[j] == crtc) {
|
|
|
|
possible[k] = pScrPriv->outputs[i]->id;
|
|
|
|
if (client->swapped)
|
|
|
|
swapl(&possible[k]);
|
|
|
|
k++;
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
swaps(&rep.x);
|
|
|
|
swaps(&rep.y);
|
|
|
|
swaps(&rep.width);
|
|
|
|
swaps(&rep.height);
|
|
|
|
swapl(&rep.mode);
|
|
|
|
swaps(&rep.rotation);
|
|
|
|
swaps(&rep.rotations);
|
|
|
|
swaps(&rep.nOutput);
|
|
|
|
swaps(&rep.nPossibleOutput);
|
2006-09-20 07:48:54 +02:00
|
|
|
}
|
2012-05-13 09:03:35 +02:00
|
|
|
WriteToClient(client, sizeof(xRRGetCrtcInfoReply), &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
|
|
|
}
|
|
|
|
|
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
|
|
|
ProcRRSetCrtcConfig(ClientPtr client)
|
2006-09-20 07:48:54 +02:00
|
|
|
{
|
|
|
|
REQUEST(xRRSetCrtcConfigReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
xRRSetCrtcConfigReply rep;
|
|
|
|
ScreenPtr pScreen;
|
|
|
|
rrScrPrivPtr pScrPriv;
|
|
|
|
RRCrtcPtr crtc;
|
|
|
|
RRModePtr mode;
|
|
|
|
int numOutputs;
|
|
|
|
RROutputPtr *outputs = NULL;
|
|
|
|
RROutput *outputIds;
|
|
|
|
TimeStamp time;
|
|
|
|
Rotation rotation;
|
2012-06-22 03:42:46 +02:00
|
|
|
int ret, i, j;
|
2012-07-10 04:12:42 +02:00
|
|
|
CARD8 status;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2006-09-20 07:48:54 +02:00
|
|
|
REQUEST_AT_LEAST_SIZE(xRRSetCrtcConfigReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
numOutputs = (stuff->length - bytes_to_int32(SIZEOF(xRRSetCrtcConfigReq)));
|
|
|
|
|
2009-04-29 07:04:37 +02:00
|
|
|
VERIFY_RR_CRTC(stuff->crtc, crtc, DixSetAttrAccess);
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (stuff->mode == None) {
|
|
|
|
mode = NULL;
|
|
|
|
if (numOutputs > 0)
|
|
|
|
return BadMatch;
|
2006-09-20 07:48:54 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
else {
|
|
|
|
VERIFY_RR_MODE(stuff->mode, mode, DixSetAttrAccess);
|
|
|
|
if (numOutputs == 0)
|
|
|
|
return BadMatch;
|
2006-09-20 07:48:54 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
if (numOutputs) {
|
2015-03-21 21:42:12 +01:00
|
|
|
outputs = xallocarray(numOutputs, sizeof(RROutputPtr));
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!outputs)
|
|
|
|
return BadAlloc;
|
2006-09-20 21:05:52 +02:00
|
|
|
}
|
|
|
|
else
|
2012-03-21 20:55:09 +01:00
|
|
|
outputs = NULL;
|
|
|
|
|
2006-11-16 18:48:33 +01:00
|
|
|
outputIds = (RROutput *) (stuff + 1);
|
2012-03-21 20:55:09 +01:00
|
|
|
for (i = 0; i < numOutputs; i++) {
|
2013-12-15 10:05:51 +01:00
|
|
|
ret = dixLookupResourceByType((void **) (outputs + i), outputIds[i],
|
2012-03-21 20:55:09 +01:00
|
|
|
RROutputType, client, DixSetAttrAccess);
|
2012-06-22 03:42:46 +02:00
|
|
|
if (ret != Success) {
|
2012-03-21 20:55:09 +01:00
|
|
|
free(outputs);
|
2012-06-22 03:42:46 +02:00
|
|
|
return ret;
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
|
|
|
/* validate crtc for this output */
|
|
|
|
for (j = 0; j < outputs[i]->numCrtcs; j++)
|
|
|
|
if (outputs[i]->crtcs[j] == crtc)
|
|
|
|
break;
|
|
|
|
if (j == outputs[i]->numCrtcs) {
|
|
|
|
free(outputs);
|
|
|
|
return BadMatch;
|
|
|
|
}
|
|
|
|
/* validate mode for this output */
|
|
|
|
for (j = 0; j < outputs[i]->numModes + outputs[i]->numUserModes; j++) {
|
|
|
|
RRModePtr m = (j < outputs[i]->numModes ?
|
|
|
|
outputs[i]->modes[j] :
|
|
|
|
outputs[i]->userModes[j - outputs[i]->numModes]);
|
|
|
|
if (m == mode)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (j == outputs[i]->numModes + outputs[i]->numUserModes) {
|
|
|
|
free(outputs);
|
|
|
|
return BadMatch;
|
|
|
|
}
|
2006-09-20 07:48:54 +02:00
|
|
|
}
|
2007-02-27 02:45:40 +01:00
|
|
|
/* validate clones */
|
2012-03-21 20:55:09 +01:00
|
|
|
for (i = 0; i < numOutputs; i++) {
|
|
|
|
for (j = 0; j < numOutputs; j++) {
|
|
|
|
int k;
|
|
|
|
|
|
|
|
if (i == j)
|
|
|
|
continue;
|
|
|
|
for (k = 0; k < outputs[i]->numClones; k++) {
|
|
|
|
if (outputs[i]->clones[k] == outputs[j])
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (k == outputs[i]->numClones) {
|
|
|
|
free(outputs);
|
|
|
|
return BadMatch;
|
|
|
|
}
|
|
|
|
}
|
2007-02-27 02:45:40 +01:00
|
|
|
}
|
2006-09-20 07:48:54 +02:00
|
|
|
|
|
|
|
pScreen = crtc->pScreen;
|
|
|
|
pScrPriv = rrGetScrPriv(pScreen);
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2006-09-20 07:48:54 +02:00
|
|
|
time = ClientTimeToServerTime(stuff->timestamp);
|
2012-03-21 20:55:09 +01:00
|
|
|
|
|
|
|
if (!pScrPriv) {
|
|
|
|
time = currentTime;
|
2012-07-10 04:12:42 +02:00
|
|
|
status = RRSetConfigFailed;
|
2012-03-21 20:55:09 +01:00
|
|
|
goto sendReply;
|
2006-09-20 07:48:54 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2006-10-06 07:31:35 +02:00
|
|
|
/*
|
|
|
|
* Validate requested rotation
|
|
|
|
*/
|
|
|
|
rotation = (Rotation) stuff->rotation;
|
|
|
|
|
|
|
|
/* test the rotation bits only! */
|
|
|
|
switch (rotation & 0xf) {
|
|
|
|
case RR_Rotate_0:
|
|
|
|
case RR_Rotate_90:
|
|
|
|
case RR_Rotate_180:
|
|
|
|
case RR_Rotate_270:
|
2012-03-21 20:55:09 +01:00
|
|
|
break;
|
2006-10-06 07:31:35 +02:00
|
|
|
default:
|
2012-03-21 20:55:09 +01:00
|
|
|
/*
|
|
|
|
* Invalid rotation
|
|
|
|
*/
|
|
|
|
client->errorValue = stuff->rotation;
|
|
|
|
free(outputs);
|
|
|
|
return BadValue;
|
2006-10-06 07:31:35 +02:00
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (mode) {
|
|
|
|
if ((~crtc->rotations) & rotation) {
|
|
|
|
/*
|
|
|
|
* requested rotation or reflection not supported by screen
|
|
|
|
*/
|
|
|
|
client->errorValue = stuff->rotation;
|
|
|
|
free(outputs);
|
|
|
|
return BadMatch;
|
|
|
|
}
|
|
|
|
|
2006-09-21 18:52:04 +02:00
|
|
|
#ifdef RANDR_12_INTERFACE
|
2012-03-21 20:55:09 +01:00
|
|
|
/*
|
|
|
|
* Check screen size bounds if the DDX provides a 1.2 interface
|
|
|
|
* for setting screen size. Else, assume the CrtcSet sets
|
|
|
|
* the size along with the mode. If the driver supports transforms,
|
|
|
|
* then it must allow crtcs to display a subset of the screen, so
|
|
|
|
* only do this check for drivers without transform support.
|
|
|
|
*/
|
|
|
|
if (pScrPriv->rrScreenSetSize && !crtc->transforms) {
|
|
|
|
int source_width;
|
|
|
|
int source_height;
|
|
|
|
PictTransform transform;
|
|
|
|
struct pixman_f_transform f_transform, f_inverse;
|
2012-05-29 15:41:39 +02:00
|
|
|
int width, height;
|
|
|
|
|
|
|
|
if (pScreen->isGPU) {
|
|
|
|
width = pScreen->current_master->width;
|
|
|
|
height = pScreen->current_master->height;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
width = pScreen->width;
|
|
|
|
height = pScreen->height;
|
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
|
|
|
|
RRTransformCompute(stuff->x, stuff->y,
|
|
|
|
mode->mode.width, mode->mode.height,
|
|
|
|
rotation,
|
|
|
|
&crtc->client_pending_transform,
|
|
|
|
&transform, &f_transform, &f_inverse);
|
|
|
|
|
|
|
|
RRModeGetScanoutSize(mode, &transform, &source_width,
|
|
|
|
&source_height);
|
2012-05-29 15:41:39 +02:00
|
|
|
if (stuff->x + source_width > width) {
|
2012-03-21 20:55:09 +01:00
|
|
|
client->errorValue = stuff->x;
|
|
|
|
free(outputs);
|
|
|
|
return BadValue;
|
|
|
|
}
|
|
|
|
|
2012-05-29 15:41:39 +02:00
|
|
|
if (stuff->y + source_height > height) {
|
2012-03-21 20:55:09 +01:00
|
|
|
client->errorValue = stuff->y;
|
|
|
|
free(outputs);
|
|
|
|
return BadValue;
|
|
|
|
}
|
|
|
|
}
|
2006-09-20 07:48:54 +02:00
|
|
|
#endif
|
2006-09-21 18:52:04 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
|
|
|
|
if (!RRCrtcSet(crtc, mode, stuff->x, stuff->y,
|
|
|
|
rotation, numOutputs, outputs)) {
|
2012-07-10 04:12:42 +02:00
|
|
|
status = RRSetConfigFailed;
|
2012-03-21 20:55:09 +01:00
|
|
|
goto sendReply;
|
2006-09-21 04:42:34 +02:00
|
|
|
}
|
2012-07-10 04:12:42 +02:00
|
|
|
status = RRSetConfigSuccess;
|
2009-05-28 23:43:27 +02:00
|
|
|
pScrPriv->lastSetTime = time;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
|
|
|
sendReply:
|
2010-06-06 10:28:30 +02:00
|
|
|
free(outputs);
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2012-07-10 04:12:43 +02:00
|
|
|
rep = (xRRSetCrtcConfigReply) {
|
|
|
|
.type = X_Reply,
|
|
|
|
.status = status,
|
|
|
|
.sequenceNumber = client->sequence,
|
|
|
|
.length = 0,
|
|
|
|
.newTimestamp = pScrPriv->lastSetTime.milliseconds
|
|
|
|
};
|
2006-09-20 07:48:54 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (client->swapped) {
|
|
|
|
swaps(&rep.sequenceNumber);
|
|
|
|
swapl(&rep.length);
|
|
|
|
swapl(&rep.newTimestamp);
|
2006-09-20 07:48:54 +02:00
|
|
|
}
|
2012-05-13 09:03:35 +02:00
|
|
|
WriteToClient(client, sizeof(xRRSetCrtcConfigReply), &rep);
|
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-11-28 17:51:20 +01:00
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcRRGetPanning(ClientPtr client)
|
2008-11-28 17:51:20 +01:00
|
|
|
{
|
|
|
|
REQUEST(xRRGetPanningReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
xRRGetPanningReply rep;
|
|
|
|
RRCrtcPtr crtc;
|
|
|
|
ScreenPtr pScreen;
|
|
|
|
rrScrPrivPtr pScrPriv;
|
|
|
|
BoxRec total;
|
|
|
|
BoxRec tracking;
|
|
|
|
INT16 border[4];
|
|
|
|
|
2008-11-28 17:51:20 +01:00
|
|
|
REQUEST_SIZE_MATCH(xRRGetPanningReq);
|
2009-04-29 07:04:37 +02:00
|
|
|
VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
|
2008-11-28 17:51:20 +01:00
|
|
|
|
|
|
|
/* All crtcs must be associated with screens before client
|
|
|
|
* requests are processed
|
|
|
|
*/
|
|
|
|
pScreen = crtc->pScreen;
|
|
|
|
pScrPriv = rrGetScrPriv(pScreen);
|
|
|
|
|
2009-02-17 18:59:16 +01:00
|
|
|
if (!pScrPriv)
|
2012-03-21 20:55:09 +01:00
|
|
|
return RRErrorBase + BadRRCrtc;
|
2008-11-28 17:51:20 +01:00
|
|
|
|
2012-07-10 04:12:43 +02:00
|
|
|
rep = (xRRGetPanningReply) {
|
|
|
|
.type = X_Reply,
|
|
|
|
.status = RRSetConfigSuccess,
|
|
|
|
.sequenceNumber = client->sequence,
|
|
|
|
.length = 1,
|
|
|
|
.timestamp = pScrPriv->lastSetTime.milliseconds
|
|
|
|
};
|
2008-11-28 17:51:20 +01:00
|
|
|
|
2009-02-17 18:59:16 +01:00
|
|
|
if (pScrPriv->rrGetPanning &&
|
2012-03-21 20:55:09 +01:00
|
|
|
pScrPriv->rrGetPanning(pScreen, crtc, &total, &tracking, border)) {
|
|
|
|
rep.left = total.x1;
|
|
|
|
rep.top = total.y1;
|
|
|
|
rep.width = total.x2 - total.x1;
|
|
|
|
rep.height = total.y2 - total.y1;
|
|
|
|
rep.track_left = tracking.x1;
|
|
|
|
rep.track_top = tracking.y1;
|
|
|
|
rep.track_width = tracking.x2 - tracking.x1;
|
|
|
|
rep.track_height = tracking.y2 - tracking.y1;
|
|
|
|
rep.border_left = border[0];
|
|
|
|
rep.border_top = border[1];
|
|
|
|
rep.border_right = border[2];
|
|
|
|
rep.border_bottom = border[3];
|
2009-02-17 18:59:16 +01:00
|
|
|
}
|
2008-11-28 17:51:20 +01:00
|
|
|
|
|
|
|
if (client->swapped) {
|
2012-03-21 20:55:09 +01:00
|
|
|
swaps(&rep.sequenceNumber);
|
|
|
|
swapl(&rep.length);
|
|
|
|
swapl(&rep.timestamp);
|
|
|
|
swaps(&rep.left);
|
|
|
|
swaps(&rep.top);
|
|
|
|
swaps(&rep.width);
|
|
|
|
swaps(&rep.height);
|
|
|
|
swaps(&rep.track_left);
|
|
|
|
swaps(&rep.track_top);
|
|
|
|
swaps(&rep.track_width);
|
|
|
|
swaps(&rep.track_height);
|
|
|
|
swaps(&rep.border_left);
|
|
|
|
swaps(&rep.border_top);
|
|
|
|
swaps(&rep.border_right);
|
|
|
|
swaps(&rep.border_bottom);
|
2008-11-28 17:51:20 +01:00
|
|
|
}
|
2012-05-13 09:03:35 +02:00
|
|
|
WriteToClient(client, sizeof(xRRGetPanningReply), &rep);
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2008-11-28 17:51:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcRRSetPanning(ClientPtr client)
|
2008-11-28 17:51:20 +01:00
|
|
|
{
|
|
|
|
REQUEST(xRRSetPanningReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
xRRSetPanningReply rep;
|
|
|
|
RRCrtcPtr crtc;
|
|
|
|
ScreenPtr pScreen;
|
|
|
|
rrScrPrivPtr pScrPriv;
|
|
|
|
TimeStamp time;
|
|
|
|
BoxRec total;
|
|
|
|
BoxRec tracking;
|
|
|
|
INT16 border[4];
|
2012-07-10 04:12:42 +02:00
|
|
|
CARD8 status;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2008-11-28 17:51:20 +01:00
|
|
|
REQUEST_SIZE_MATCH(xRRSetPanningReq);
|
2009-04-29 07:04:37 +02:00
|
|
|
VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
|
2008-11-28 17:51:20 +01:00
|
|
|
|
|
|
|
/* All crtcs must be associated with screens before client
|
|
|
|
* requests are processed
|
|
|
|
*/
|
|
|
|
pScreen = crtc->pScreen;
|
|
|
|
pScrPriv = rrGetScrPriv(pScreen);
|
|
|
|
|
|
|
|
if (!pScrPriv) {
|
2012-03-21 20:55:09 +01:00
|
|
|
time = currentTime;
|
2012-07-10 04:12:42 +02:00
|
|
|
status = RRSetConfigFailed;
|
2012-03-21 20:55:09 +01:00
|
|
|
goto sendReply;
|
2008-11-28 17:51:20 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2008-11-28 17:51:20 +01:00
|
|
|
time = ClientTimeToServerTime(stuff->timestamp);
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2008-11-28 17:51:20 +01:00
|
|
|
if (!pScrPriv->rrGetPanning)
|
2012-03-21 20:55:09 +01:00
|
|
|
return RRErrorBase + BadRRCrtc;
|
2008-11-28 17:51:20 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
total.x1 = stuff->left;
|
|
|
|
total.y1 = stuff->top;
|
|
|
|
total.x2 = total.x1 + stuff->width;
|
|
|
|
total.y2 = total.y1 + stuff->height;
|
2008-11-28 17:51:20 +01:00
|
|
|
tracking.x1 = stuff->track_left;
|
|
|
|
tracking.y1 = stuff->track_top;
|
2008-12-11 17:51:20 +01:00
|
|
|
tracking.x2 = tracking.x1 + stuff->track_width;
|
|
|
|
tracking.y2 = tracking.y1 + stuff->track_height;
|
2012-03-21 20:55:09 +01:00
|
|
|
border[0] = stuff->border_left;
|
|
|
|
border[1] = stuff->border_top;
|
|
|
|
border[2] = stuff->border_right;
|
|
|
|
border[3] = stuff->border_bottom;
|
2008-11-28 17:51:20 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!pScrPriv->rrSetPanning(pScreen, crtc, &total, &tracking, border))
|
|
|
|
return BadMatch;
|
2008-11-28 17:51:20 +01:00
|
|
|
|
2009-05-28 23:43:27 +02:00
|
|
|
pScrPriv->lastSetTime = time;
|
|
|
|
|
2012-07-10 04:12:42 +02:00
|
|
|
status = RRSetConfigSuccess;
|
2008-11-28 17:51:20 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
sendReply:
|
2012-07-10 04:12:43 +02:00
|
|
|
rep = (xRRSetPanningReply) {
|
|
|
|
.type = X_Reply,
|
|
|
|
.status = status,
|
|
|
|
.sequenceNumber = client->sequence,
|
|
|
|
.length = 0,
|
|
|
|
.newTimestamp = pScrPriv->lastSetTime.milliseconds
|
|
|
|
};
|
2008-11-28 17:51:20 +01:00
|
|
|
|
|
|
|
if (client->swapped) {
|
2012-03-21 20:55:09 +01:00
|
|
|
swaps(&rep.sequenceNumber);
|
|
|
|
swapl(&rep.length);
|
|
|
|
swapl(&rep.newTimestamp);
|
2008-11-28 17:51:20 +01:00
|
|
|
}
|
2012-05-13 09:03:35 +02:00
|
|
|
WriteToClient(client, sizeof(xRRSetPanningReply), &rep);
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2008-11-28 17:51:20 +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
|
|
|
ProcRRGetCrtcGammaSize(ClientPtr client)
|
2006-09-20 07:48:54 +02:00
|
|
|
{
|
|
|
|
REQUEST(xRRGetCrtcGammaSizeReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
xRRGetCrtcGammaSizeReply reply;
|
|
|
|
RRCrtcPtr crtc;
|
2006-09-20 07:48:54 +02:00
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xRRGetCrtcGammaSizeReq);
|
2009-04-29 07:04:37 +02:00
|
|
|
VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
|
2008-12-17 16:56:26 +01:00
|
|
|
|
|
|
|
/* Gamma retrieval failed, any better error? */
|
|
|
|
if (!RRCrtcGammaGet(crtc))
|
|
|
|
return RRErrorBase + BadRRCrtc;
|
|
|
|
|
2012-07-10 04:12:43 +02:00
|
|
|
reply = (xRRGetCrtcGammaSizeReply) {
|
|
|
|
.type = X_Reply,
|
|
|
|
.sequenceNumber = client->sequence,
|
|
|
|
.length = 0,
|
|
|
|
.size = crtc->gammaSize
|
|
|
|
};
|
2006-09-20 07:48:54 +02:00
|
|
|
if (client->swapped) {
|
2012-03-21 20:55:09 +01:00
|
|
|
swaps(&reply.sequenceNumber);
|
|
|
|
swapl(&reply.length);
|
|
|
|
swaps(&reply.size);
|
2006-09-20 07:48:54 +02:00
|
|
|
}
|
2012-05-13 09:03:35 +02:00
|
|
|
WriteToClient(client, sizeof(xRRGetCrtcGammaSizeReply), &reply);
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2006-09-20 07:48:54 +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
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcRRGetCrtcGamma(ClientPtr client)
|
2006-09-20 07:48:54 +02:00
|
|
|
{
|
|
|
|
REQUEST(xRRGetCrtcGammaReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
xRRGetCrtcGammaReply reply;
|
|
|
|
RRCrtcPtr crtc;
|
|
|
|
unsigned long len;
|
|
|
|
char *extra = NULL;
|
|
|
|
|
2006-09-20 07:48:54 +02:00
|
|
|
REQUEST_SIZE_MATCH(xRRGetCrtcGammaReq);
|
2009-04-29 07:04:37 +02:00
|
|
|
VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
|
2008-12-17 16:56:26 +01:00
|
|
|
|
|
|
|
/* Gamma retrieval failed, any better error? */
|
|
|
|
if (!RRCrtcGammaGet(crtc))
|
|
|
|
return RRErrorBase + BadRRCrtc;
|
|
|
|
|
2006-09-20 07:48:54 +02:00
|
|
|
len = crtc->gammaSize * 3 * 2;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2008-08-21 01:32:03 +02:00
|
|
|
if (crtc->gammaSize) {
|
2012-03-21 20:55:09 +01:00
|
|
|
extra = malloc(len);
|
|
|
|
if (!extra)
|
|
|
|
return BadAlloc;
|
2008-08-21 01:32:03 +02:00
|
|
|
}
|
|
|
|
|
2012-07-10 04:12:43 +02:00
|
|
|
reply = (xRRGetCrtcGammaReply) {
|
|
|
|
.type = X_Reply,
|
|
|
|
.sequenceNumber = client->sequence,
|
|
|
|
.length = bytes_to_int32(len),
|
|
|
|
.size = crtc->gammaSize
|
|
|
|
};
|
2006-09-20 07:48:54 +02:00
|
|
|
if (client->swapped) {
|
2012-03-21 20:55:09 +01:00
|
|
|
swaps(&reply.sequenceNumber);
|
|
|
|
swapl(&reply.length);
|
|
|
|
swaps(&reply.size);
|
2006-09-20 07:48:54 +02:00
|
|
|
}
|
2012-05-13 09:03:35 +02:00
|
|
|
WriteToClient(client, sizeof(xRRGetCrtcGammaReply), &reply);
|
2012-03-21 20:55:09 +01:00
|
|
|
if (crtc->gammaSize) {
|
|
|
|
memcpy(extra, crtc->gammaRed, len);
|
|
|
|
client->pSwapReplyFunc = (ReplySwapPtr) CopySwap16Write;
|
|
|
|
WriteSwappedDataToClient(client, len, extra);
|
|
|
|
free(extra);
|
2006-09-20 07:48:54 +02:00
|
|
|
}
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2006-09-20 07:48:54 +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
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcRRSetCrtcGamma(ClientPtr client)
|
2006-09-20 07:48:54 +02:00
|
|
|
{
|
|
|
|
REQUEST(xRRSetCrtcGammaReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
RRCrtcPtr crtc;
|
|
|
|
unsigned long len;
|
|
|
|
CARD16 *red, *green, *blue;
|
|
|
|
|
2007-02-02 00:10:29 +01:00
|
|
|
REQUEST_AT_LEAST_SIZE(xRRSetCrtcGammaReq);
|
2009-04-29 07:04:37 +02:00
|
|
|
VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
|
2012-03-21 20:55:09 +01:00
|
|
|
|
|
|
|
len = client->req_len - bytes_to_int32(sizeof(xRRSetCrtcGammaReq));
|
2006-09-20 07:48:54 +02:00
|
|
|
if (len < (stuff->size * 3 + 1) >> 1)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadLength;
|
2006-09-20 07:48:54 +02:00
|
|
|
|
|
|
|
if (stuff->size != crtc->gammaSize)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadMatch;
|
|
|
|
|
2006-09-20 07:48:54 +02:00
|
|
|
red = (CARD16 *) (stuff + 1);
|
|
|
|
green = red + crtc->gammaSize;
|
|
|
|
blue = green + crtc->gammaSize;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
|
|
|
RRCrtcGammaSet(crtc, red, green, blue);
|
2006-09-20 07:48:54 +02:00
|
|
|
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
2008-03-14 05:31:12 +01:00
|
|
|
/* Version 1.3 additions */
|
|
|
|
|
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
|
|
|
ProcRRSetCrtcTransform(ClientPtr client)
|
2008-03-14 05:31:12 +01:00
|
|
|
{
|
|
|
|
REQUEST(xRRSetCrtcTransformReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
RRCrtcPtr crtc;
|
|
|
|
PictTransform transform;
|
2008-11-24 22:08:48 +01:00
|
|
|
struct pixman_f_transform f_transform, f_inverse;
|
2012-03-21 20:55:09 +01:00
|
|
|
char *filter;
|
|
|
|
int nbytes;
|
|
|
|
xFixed *params;
|
|
|
|
int nparams;
|
2008-03-14 05:31:12 +01:00
|
|
|
|
2008-03-15 08:36:45 +01:00
|
|
|
REQUEST_AT_LEAST_SIZE(xRRSetCrtcTransformReq);
|
2009-04-29 07:04:37 +02:00
|
|
|
VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
|
2008-03-14 05:31:12 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
PictTransform_from_xRenderTransform(&transform, &stuff->transform);
|
|
|
|
pixman_f_transform_from_pixman_transform(&f_transform, &transform);
|
|
|
|
if (!pixman_f_transform_invert(&f_inverse, &f_transform))
|
|
|
|
return BadMatch;
|
2008-03-14 05:31:12 +01:00
|
|
|
|
2008-03-15 08:36:45 +01:00
|
|
|
filter = (char *) (stuff + 1);
|
|
|
|
nbytes = stuff->nbytesFilter;
|
2009-07-06 04:24:27 +02:00
|
|
|
params = (xFixed *) (filter + pad_to_int32(nbytes));
|
2008-03-15 08:36:45 +01:00
|
|
|
nparams = ((xFixed *) stuff + client->req_len) - params;
|
|
|
|
if (nparams < 0)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadLength;
|
2008-03-15 08:36:45 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
return RRCrtcTransformSet(crtc, &transform, &f_transform, &f_inverse,
|
|
|
|
filter, nbytes, params, nparams);
|
2008-03-14 05:31:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#define CrtcTransformExtra (SIZEOF(xRRGetCrtcTransformReply) - 32)
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2008-03-15 08:36:45 +01:00
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
transform_filter_length(RRTransformPtr transform)
|
2008-03-15 08:36:45 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
int nbytes, nparams;
|
2008-03-15 08:36:45 +01:00
|
|
|
|
|
|
|
if (transform->filter == NULL)
|
2012-03-21 20:55:09 +01:00
|
|
|
return 0;
|
|
|
|
nbytes = strlen(transform->filter->name);
|
2008-03-15 08:36:45 +01:00
|
|
|
nparams = transform->nparams;
|
2012-03-21 20:55:09 +01:00
|
|
|
return pad_to_int32(nbytes) + (nparams * sizeof(xFixed));
|
2008-03-15 08:36:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
transform_filter_encode(ClientPtr client, char *output,
|
|
|
|
CARD16 *nbytesFilter,
|
|
|
|
CARD16 *nparamsFilter, RRTransformPtr transform)
|
2008-03-15 08:36:45 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
int nbytes, nparams;
|
2008-03-15 08:36:45 +01:00
|
|
|
|
|
|
|
if (transform->filter == NULL) {
|
2012-03-21 20:55:09 +01:00
|
|
|
*nbytesFilter = 0;
|
|
|
|
*nparamsFilter = 0;
|
|
|
|
return 0;
|
2008-03-15 08:36:45 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
nbytes = strlen(transform->filter->name);
|
2008-03-15 08:36:45 +01:00
|
|
|
nparams = transform->nparams;
|
|
|
|
*nbytesFilter = nbytes;
|
|
|
|
*nparamsFilter = nparams;
|
2012-03-21 20:55:09 +01:00
|
|
|
memcpy(output, transform->filter->name, nbytes);
|
2008-03-15 08:36:45 +01:00
|
|
|
while ((nbytes & 3) != 0)
|
2012-03-21 20:55:09 +01:00
|
|
|
output[nbytes++] = 0;
|
|
|
|
memcpy(output + nbytes, transform->params, nparams * sizeof(xFixed));
|
2008-03-15 08:36:45 +01:00
|
|
|
if (client->swapped) {
|
2012-03-21 20:55:09 +01:00
|
|
|
swaps(nbytesFilter);
|
|
|
|
swaps(nparamsFilter);
|
|
|
|
SwapLongs((CARD32 *) (output + nbytes), nparams);
|
2008-03-15 08:36:45 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
nbytes += nparams * sizeof(xFixed);
|
2008-03-17 21:57:47 +01:00
|
|
|
return nbytes;
|
2008-03-15 08:36:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-03-21 20:55:09 +01:00
|
|
|
transform_encode(ClientPtr client, xRenderTransform * wire,
|
|
|
|
PictTransform * pict)
|
2008-03-15 08:36:45 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
xRenderTransform_from_PictTransform(wire, pict);
|
2008-03-15 08:36:45 +01:00
|
|
|
if (client->swapped)
|
2012-03-21 20:55:09 +01:00
|
|
|
SwapLongs((CARD32 *) wire, bytes_to_int32(sizeof(xRenderTransform)));
|
2008-03-15 08:36:45 +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
|
|
|
ProcRRGetCrtcTransform(ClientPtr client)
|
2008-03-14 05:31:12 +01:00
|
|
|
{
|
|
|
|
REQUEST(xRRGetCrtcTransformReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
xRRGetCrtcTransformReply *reply;
|
|
|
|
RRCrtcPtr crtc;
|
|
|
|
int nextra;
|
|
|
|
RRTransformPtr current, pending;
|
|
|
|
char *extra;
|
2008-03-14 05:31:12 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
REQUEST_SIZE_MATCH(xRRGetCrtcTransformReq);
|
2009-04-29 07:04:37 +02:00
|
|
|
VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
|
2008-03-14 05:31:12 +01:00
|
|
|
|
2008-03-15 08:36:45 +01:00
|
|
|
pending = &crtc->client_pending_transform;
|
|
|
|
current = &crtc->client_current_transform;
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
nextra = (transform_filter_length(pending) +
|
|
|
|
transform_filter_length(current));
|
2008-03-15 08:36:45 +01:00
|
|
|
|
2012-07-10 04:12:42 +02:00
|
|
|
reply = calloc(1, sizeof(xRRGetCrtcTransformReply) + nextra);
|
2008-03-15 08:36:45 +01:00
|
|
|
if (!reply)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadAlloc;
|
2008-03-15 08:36:45 +01:00
|
|
|
|
|
|
|
extra = (char *) (reply + 1);
|
|
|
|
reply->type = X_Reply;
|
|
|
|
reply->sequenceNumber = client->sequence;
|
2009-07-06 04:24:27 +02:00
|
|
|
reply->length = bytes_to_int32(CrtcTransformExtra + nextra);
|
2008-03-15 08:36:45 +01:00
|
|
|
|
2008-03-18 23:35:44 +01:00
|
|
|
reply->hasTransforms = crtc->transforms;
|
2008-03-15 08:36:45 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
transform_encode(client, &reply->pendingTransform, &pending->transform);
|
|
|
|
extra += transform_filter_encode(client, extra,
|
|
|
|
&reply->pendingNbytesFilter,
|
|
|
|
&reply->pendingNparamsFilter, pending);
|
2008-03-15 08:36:45 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
transform_encode(client, &reply->currentTransform, ¤t->transform);
|
|
|
|
extra += transform_filter_encode(client, extra,
|
|
|
|
&reply->currentNbytesFilter,
|
|
|
|
&reply->currentNparamsFilter, current);
|
2008-03-15 08:36:45 +01:00
|
|
|
|
2008-03-14 05:31:12 +01:00
|
|
|
if (client->swapped) {
|
2012-03-21 20:55:09 +01:00
|
|
|
swaps(&reply->sequenceNumber);
|
|
|
|
swapl(&reply->length);
|
2008-03-14 05:31:12 +01:00
|
|
|
}
|
2012-05-13 09:03:35 +02:00
|
|
|
WriteToClient(client, sizeof(xRRGetCrtcTransformReply) + nextra, reply);
|
2010-05-05 20:44:06 +02:00
|
|
|
free(reply);
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2008-03-14 05:31:12 +01:00
|
|
|
}
|
2010-11-15 20:29:14 +01:00
|
|
|
|
2015-03-19 13:26:29 +01:00
|
|
|
static Bool
|
|
|
|
check_all_screen_crtcs(ScreenPtr pScreen, int *x, int *y)
|
2010-11-15 20:29:14 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
rrScrPriv(pScreen);
|
2010-11-15 20:29:14 +01:00
|
|
|
int i;
|
|
|
|
for (i = 0; i < pScrPriv->numCrtcs; i++) {
|
2012-03-21 20:55:09 +01:00
|
|
|
RRCrtcPtr crtc = pScrPriv->crtcs[i];
|
2010-11-15 20:29:14 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
int left, right, top, bottom;
|
2010-11-15 20:29:14 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!crtc->mode)
|
|
|
|
continue;
|
2010-11-15 20:29:14 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
crtc_bounds(crtc, &left, &right, &top, &bottom);
|
2010-11-15 20:29:14 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if ((*x >= left) && (*x < right) && (*y >= top) && (*y < bottom))
|
2012-05-29 15:37:11 +02:00
|
|
|
return TRUE;
|
2010-11-15 20:29:14 +01:00
|
|
|
}
|
2012-05-29 15:37:11 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2015-03-19 13:26:29 +01:00
|
|
|
static Bool
|
|
|
|
constrain_all_screen_crtcs(DeviceIntPtr pDev, ScreenPtr pScreen, int *x, int *y)
|
2012-05-29 15:37:11 +02:00
|
|
|
{
|
|
|
|
rrScrPriv(pScreen);
|
|
|
|
int i;
|
2010-11-15 20:29:14 +01:00
|
|
|
|
|
|
|
/* if we're trying to escape, clamp to the CRTC we're coming from */
|
|
|
|
for (i = 0; i < pScrPriv->numCrtcs; i++) {
|
2012-03-21 20:55:09 +01:00
|
|
|
RRCrtcPtr crtc = pScrPriv->crtcs[i];
|
|
|
|
int nx, ny;
|
|
|
|
int left, right, top, bottom;
|
|
|
|
|
|
|
|
if (!crtc->mode)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
crtc_bounds(crtc, &left, &right, &top, &bottom);
|
|
|
|
miPointerGetPosition(pDev, &nx, &ny);
|
|
|
|
|
|
|
|
if ((nx >= left) && (nx < right) && (ny >= top) && (ny < bottom)) {
|
|
|
|
if (*x < left)
|
|
|
|
*x = left;
|
|
|
|
if (*x >= right)
|
|
|
|
*x = right - 1;
|
|
|
|
if (*y < top)
|
|
|
|
*y = top;
|
|
|
|
if (*y >= bottom)
|
|
|
|
*y = bottom - 1;
|
|
|
|
|
2012-05-29 15:37:11 +02:00
|
|
|
return TRUE;
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
2010-11-15 20:29:14 +01:00
|
|
|
}
|
2012-05-29 15:37:11 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
RRConstrainCursorHarder(DeviceIntPtr pDev, ScreenPtr pScreen, int mode, int *x,
|
|
|
|
int *y)
|
|
|
|
{
|
|
|
|
rrScrPriv(pScreen);
|
|
|
|
Bool ret;
|
|
|
|
ScreenPtr slave;
|
|
|
|
|
|
|
|
/* intentional dead space -> let it float */
|
|
|
|
if (pScrPriv->discontiguous)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* if we're moving inside a crtc, we're fine */
|
|
|
|
ret = check_all_screen_crtcs(pScreen, x, y);
|
|
|
|
if (ret == TRUE)
|
|
|
|
return;
|
|
|
|
|
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
|
|
|
xorg_list_for_each_entry(slave, &pScreen->slave_list, slave_head) {
|
|
|
|
if (!slave->is_output_slave)
|
|
|
|
continue;
|
|
|
|
|
2012-05-29 15:37:11 +02:00
|
|
|
ret = check_all_screen_crtcs(slave, x, y);
|
|
|
|
if (ret == TRUE)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if we're trying to escape, clamp to the CRTC we're coming from */
|
|
|
|
ret = constrain_all_screen_crtcs(pDev, pScreen, x, y);
|
|
|
|
if (ret == TRUE)
|
|
|
|
return;
|
|
|
|
|
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
|
|
|
xorg_list_for_each_entry(slave, &pScreen->slave_list, slave_head) {
|
|
|
|
if (!slave->is_output_slave)
|
|
|
|
continue;
|
|
|
|
|
2012-05-29 15:37:11 +02:00
|
|
|
ret = constrain_all_screen_crtcs(pDev, slave, x, y);
|
|
|
|
if (ret == TRUE)
|
|
|
|
return;
|
|
|
|
}
|
2010-11-15 20:29:14 +01:00
|
|
|
}
|
2012-06-26 11:00:21 +02:00
|
|
|
|
|
|
|
Bool
|
|
|
|
RRReplaceScanoutPixmap(DrawablePtr pDrawable, PixmapPtr pPixmap, Bool enable)
|
|
|
|
{
|
|
|
|
rrScrPriv(pDrawable->pScreen);
|
|
|
|
Bool ret = TRUE;
|
2014-10-06 11:02:22 +02:00
|
|
|
PixmapPtr *saved_scanout_pixmap;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
saved_scanout_pixmap = malloc(sizeof(PixmapPtr)*pScrPriv->numCrtcs);
|
|
|
|
if (saved_scanout_pixmap == NULL)
|
|
|
|
return FALSE;
|
2012-06-26 11:00:21 +02:00
|
|
|
|
|
|
|
for (i = 0; i < pScrPriv->numCrtcs; i++) {
|
|
|
|
RRCrtcPtr crtc = pScrPriv->crtcs[i];
|
2014-10-06 11:02:22 +02:00
|
|
|
Bool size_fits;
|
|
|
|
|
|
|
|
saved_scanout_pixmap[i] = crtc->scanout_pixmap;
|
2012-06-26 11:00:21 +02:00
|
|
|
|
|
|
|
if (!crtc->mode && enable)
|
|
|
|
continue;
|
2014-10-06 11:02:22 +02:00
|
|
|
if (!crtc->scanout_pixmap && !enable)
|
|
|
|
continue;
|
2012-06-26 11:00:21 +02:00
|
|
|
|
2016-06-17 05:06:47 +02:00
|
|
|
/* not supported with double buffering, needs ABI change for 2 ppix */
|
|
|
|
if (crtc->scanout_pixmap_back) {
|
|
|
|
ret = FALSE;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2014-10-06 11:02:22 +02:00
|
|
|
size_fits = (crtc->mode &&
|
|
|
|
crtc->x == pDrawable->x &&
|
|
|
|
crtc->y == pDrawable->y &&
|
|
|
|
crtc->mode->mode.width == pDrawable->width &&
|
|
|
|
crtc->mode->mode.height == pDrawable->height);
|
2012-06-26 11:00:21 +02:00
|
|
|
|
|
|
|
/* is the pixmap already set? */
|
|
|
|
if (crtc->scanout_pixmap == pPixmap) {
|
|
|
|
/* if its a disable then don't care about size */
|
|
|
|
if (enable == FALSE) {
|
|
|
|
/* set scanout to NULL */
|
|
|
|
crtc->scanout_pixmap = NULL;
|
2014-10-06 11:02:22 +02:00
|
|
|
}
|
|
|
|
else if (!size_fits) {
|
2012-06-26 11:00:21 +02:00
|
|
|
/* if the size no longer fits then drop off */
|
|
|
|
crtc->scanout_pixmap = NULL;
|
2014-10-06 11:02:22 +02:00
|
|
|
pScrPriv->rrCrtcSetScanoutPixmap(crtc, crtc->scanout_pixmap);
|
|
|
|
|
|
|
|
(*pScrPriv->rrCrtcSet) (pDrawable->pScreen, crtc, crtc->mode, crtc->x, crtc->y,
|
|
|
|
crtc->rotation, crtc->numOutputs, crtc->outputs);
|
|
|
|
saved_scanout_pixmap[i] = crtc->scanout_pixmap;
|
2012-06-26 11:00:21 +02:00
|
|
|
ret = FALSE;
|
|
|
|
}
|
2014-10-06 11:02:22 +02:00
|
|
|
else {
|
|
|
|
/* if the size fits then we are already setup */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2012-06-26 11:00:21 +02:00
|
|
|
if (!size_fits)
|
2014-10-06 11:02:22 +02:00
|
|
|
ret = FALSE;
|
|
|
|
else if (enable)
|
2012-06-26 11:00:21 +02:00
|
|
|
crtc->scanout_pixmap = pPixmap;
|
2014-10-06 11:02:22 +02:00
|
|
|
else
|
|
|
|
/* reject an attempt to disable someone else's scanout_pixmap */
|
|
|
|
ret = FALSE;
|
2012-06-26 11:00:21 +02:00
|
|
|
}
|
2014-10-06 11:02:22 +02:00
|
|
|
}
|
2012-06-26 11:00:21 +02:00
|
|
|
|
2014-10-06 11:02:22 +02:00
|
|
|
for (i = 0; i < pScrPriv->numCrtcs; i++) {
|
|
|
|
RRCrtcPtr crtc = pScrPriv->crtcs[i];
|
|
|
|
|
|
|
|
if (crtc->scanout_pixmap == saved_scanout_pixmap[i])
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (ret) {
|
2012-06-26 11:00:21 +02:00
|
|
|
pScrPriv->rrCrtcSetScanoutPixmap(crtc, crtc->scanout_pixmap);
|
|
|
|
|
|
|
|
(*pScrPriv->rrCrtcSet) (pDrawable->pScreen, crtc, crtc->mode, crtc->x, crtc->y,
|
|
|
|
crtc->rotation, crtc->numOutputs, crtc->outputs);
|
|
|
|
}
|
2014-10-06 11:02:22 +02:00
|
|
|
else
|
|
|
|
crtc->scanout_pixmap = saved_scanout_pixmap[i];
|
2012-06-26 11:00:21 +02:00
|
|
|
}
|
2014-10-06 11:02:22 +02:00
|
|
|
free(saved_scanout_pixmap);
|
|
|
|
|
2012-06-26 11:00:21 +02:00
|
|
|
return ret;
|
|
|
|
}
|