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
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
RESTYPE 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
|
2006-10-14 02:34:53 +02:00
|
|
|
RRCrtcChanged (RRCrtcPtr crtc, Bool layoutChanged)
|
|
|
|
{
|
|
|
|
ScreenPtr pScreen = crtc->pScreen;
|
|
|
|
|
|
|
|
crtc->changed = TRUE;
|
2006-11-09 06:36:35 +01:00
|
|
|
if (pScreen)
|
|
|
|
{
|
|
|
|
rrScrPriv(pScreen);
|
2011-02-23 20:18:08 +01:00
|
|
|
|
2006-11-09 06:36:35 +01:00
|
|
|
pScrPriv->changed = TRUE;
|
|
|
|
/*
|
|
|
|
* Send ConfigureNotify on any layout change
|
|
|
|
*/
|
|
|
|
if (layoutChanged)
|
|
|
|
pScrPriv->layoutChanged = TRUE;
|
|
|
|
}
|
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
|
2007-03-24 07:41:36 +01:00
|
|
|
RRCrtcCreate (ScreenPtr pScreen, void *devPrivate)
|
2006-09-17 08:21:37 +02:00
|
|
|
{
|
2007-03-24 07:41:36 +01:00
|
|
|
RRCrtcPtr crtc;
|
|
|
|
RRCrtcPtr *crtcs;
|
|
|
|
rrScrPrivPtr pScrPriv;
|
|
|
|
|
2006-11-27 04:31:48 +01:00
|
|
|
if (!RRInit())
|
|
|
|
return NULL;
|
2011-02-23 20:18:08 +01:00
|
|
|
|
2007-03-24 07:41:36 +01:00
|
|
|
pScrPriv = rrGetScrPriv(pScreen);
|
|
|
|
|
|
|
|
/* make space for the crtc pointer */
|
|
|
|
if (pScrPriv->numCrtcs)
|
2011-02-23 20:18:08 +01:00
|
|
|
crtcs = realloc(pScrPriv->crtcs,
|
2007-03-24 07:41:36 +01:00
|
|
|
(pScrPriv->numCrtcs + 1) * sizeof (RRCrtcPtr));
|
|
|
|
else
|
2010-05-05 20:44:06 +02:00
|
|
|
crtcs = malloc(sizeof (RRCrtcPtr));
|
2007-03-24 07:41:36 +01:00
|
|
|
if (!crtcs)
|
|
|
|
return FALSE;
|
|
|
|
pScrPriv->crtcs = crtcs;
|
2011-02-23 20:18:08 +01:00
|
|
|
|
2010-05-05 20:44:06 +02:00
|
|
|
crtc = calloc(1, sizeof (RRCrtcRec));
|
2006-09-17 08:21:37 +02:00
|
|
|
if (!crtc)
|
|
|
|
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;
|
2008-03-15 08:36:45 +01:00
|
|
|
RRTransformInit (&crtc->client_pending_transform);
|
|
|
|
RRTransformInit (&crtc->client_current_transform);
|
2008-11-24 22:08:48 +01:00
|
|
|
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
|
|
|
|
|
|
|
if (!AddResource (crtc->id, RRCrtcType, (pointer) crtc))
|
|
|
|
return NULL;
|
|
|
|
|
2007-03-24 07:41:36 +01:00
|
|
|
/* attach the screen and crtc together */
|
|
|
|
crtc->pScreen = pScreen;
|
|
|
|
pScrPriv->crtcs[pScrPriv->numCrtcs++] = crtc;
|
2011-02-23 20:18:08 +01:00
|
|
|
|
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
|
2007-03-24 07:41:36 +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
|
2008-03-19 20:15:39 +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
|
2006-09-17 08:21:37 +02:00
|
|
|
RRCrtcNotify (RRCrtcPtr crtc,
|
|
|
|
RRModePtr mode,
|
|
|
|
int x,
|
|
|
|
int y,
|
|
|
|
Rotation rotation,
|
2008-03-21 10:39:49 +01:00
|
|
|
RRTransformPtr transform,
|
2006-09-17 08:21:37 +02:00
|
|
|
int numOutputs,
|
2011-02-23 20:17:42 +01:00
|
|
|
RROutputPtr *outputs)
|
2006-09-17 08:21:37 +02:00
|
|
|
{
|
|
|
|
int i, j;
|
2011-02-23 20:18:08 +01:00
|
|
|
|
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
|
|
|
|
*/
|
|
|
|
for (i = 0; i < numOutputs; i++)
|
|
|
|
{
|
|
|
|
for (j = 0; j < crtc->numOutputs; j++)
|
|
|
|
if (outputs[i] == crtc->outputs[j])
|
|
|
|
break;
|
|
|
|
if (j == crtc->numOutputs)
|
|
|
|
{
|
2007-07-23 23:27:41 +02:00
|
|
|
outputs[i]->crtc = crtc;
|
2006-12-13 07:59:03 +01:00
|
|
|
RROutputChanged (outputs[i], FALSE);
|
2006-10-14 02:34:53 +02:00
|
|
|
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
|
|
|
|
*/
|
|
|
|
for (j = 0; j < crtc->numOutputs; j++)
|
|
|
|
{
|
|
|
|
for (i = 0; i < numOutputs; i++)
|
|
|
|
if (outputs[i] == crtc->outputs[j])
|
|
|
|
break;
|
|
|
|
if (i == numOutputs)
|
|
|
|
{
|
2007-11-12 15:11:03 +01:00
|
|
|
if (crtc->outputs[j]->crtc == crtc)
|
|
|
|
crtc->outputs[j]->crtc = NULL;
|
2006-12-13 07:59:03 +01:00
|
|
|
RROutputChanged (crtc->outputs[j], FALSE);
|
2006-10-14 02:34:53 +02:00
|
|
|
RRCrtcChanged (crtc, FALSE);
|
2006-10-06 07:31:35 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Reallocate the crtc output array if necessary
|
|
|
|
*/
|
|
|
|
if (numOutputs != crtc->numOutputs)
|
2006-09-17 08:21:37 +02:00
|
|
|
{
|
2006-10-04 06:06:11 +02:00
|
|
|
RROutputPtr *newoutputs;
|
2011-02-23 20:18:08 +01:00
|
|
|
|
2006-09-20 21:05:52 +02:00
|
|
|
if (numOutputs)
|
|
|
|
{
|
|
|
|
if (crtc->numOutputs)
|
2010-05-05 20:44:06 +02:00
|
|
|
newoutputs = realloc(crtc->outputs,
|
2006-09-20 21:05:52 +02:00
|
|
|
numOutputs * sizeof (RROutputPtr));
|
|
|
|
else
|
2010-05-05 20:44:06 +02:00
|
|
|
newoutputs = malloc(numOutputs * sizeof (RROutputPtr));
|
2006-10-04 06:06:11 +02:00
|
|
|
if (!newoutputs)
|
2006-09-20 21:05:52 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
2006-09-17 08:21:37 +02:00
|
|
|
else
|
2006-09-20 21:05:52 +02:00
|
|
|
{
|
2010-06-06 10:28:30 +02:00
|
|
|
free(crtc->outputs);
|
2006-10-04 06:06:11 +02:00
|
|
|
newoutputs = NULL;
|
2006-09-20 21:05:52 +02:00
|
|
|
}
|
2006-10-04 06:06:11 +02:00
|
|
|
crtc->outputs = newoutputs;
|
2006-09-21 07:43:05 +02:00
|
|
|
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
|
|
|
|
*/
|
|
|
|
memcpy (crtc->outputs, outputs, numOutputs * sizeof (RROutputPtr));
|
|
|
|
/*
|
|
|
|
* Update remaining crtc fields
|
|
|
|
*/
|
2006-09-17 08:21:37 +02:00
|
|
|
if (mode != crtc->mode)
|
|
|
|
{
|
|
|
|
if (crtc->mode)
|
|
|
|
RRModeDestroy (crtc->mode);
|
|
|
|
crtc->mode = mode;
|
2006-11-04 01:36:34 +01:00
|
|
|
if (mode != NULL)
|
|
|
|
mode->refcnt++;
|
2006-10-14 02:34:53 +02:00
|
|
|
RRCrtcChanged (crtc, TRUE);
|
2006-09-17 08:21:37 +02:00
|
|
|
}
|
|
|
|
if (x != crtc->x)
|
|
|
|
{
|
|
|
|
crtc->x = x;
|
2006-10-14 02:34:53 +02:00
|
|
|
RRCrtcChanged (crtc, TRUE);
|
2006-09-17 08:21:37 +02:00
|
|
|
}
|
|
|
|
if (y != crtc->y)
|
|
|
|
{
|
|
|
|
crtc->y = y;
|
2006-10-14 02:34:53 +02:00
|
|
|
RRCrtcChanged (crtc, TRUE);
|
2006-09-17 08:21:37 +02:00
|
|
|
}
|
|
|
|
if (rotation != crtc->rotation)
|
|
|
|
{
|
|
|
|
crtc->rotation = rotation;
|
2006-10-14 02:34:53 +02:00
|
|
|
RRCrtcChanged (crtc, TRUE);
|
2006-09-21 07:43:05 +02:00
|
|
|
}
|
2008-03-21 10:39:49 +01:00
|
|
|
if (!RRTransformEqual (transform, &crtc->client_current_transform)) {
|
|
|
|
RRTransformCopy (&crtc->client_current_transform, transform);
|
|
|
|
RRCrtcChanged (crtc, TRUE);
|
|
|
|
}
|
2008-03-31 04:05:07 +02:00
|
|
|
if (crtc->changed && mode)
|
2008-03-27 19:46:39 +01:00
|
|
|
{
|
|
|
|
RRTransformCompute (x, y,
|
|
|
|
mode->mode.width, mode->mode.height,
|
|
|
|
rotation,
|
|
|
|
&crtc->client_current_transform,
|
|
|
|
&crtc->transform, &crtc->f_transform,
|
2011-02-23 20:18:12 +01:00
|
|
|
&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
|
2006-09-18 08:03:23 +02:00
|
|
|
RRDeliverCrtcEvent (ClientPtr client, WindowPtr pWin, RRCrtcPtr crtc)
|
|
|
|
{
|
2006-10-06 07:31:35 +02:00
|
|
|
ScreenPtr pScreen = pWin->drawable.pScreen;
|
|
|
|
rrScrPriv (pScreen);
|
|
|
|
xRRCrtcChangeNotifyEvent ce;
|
|
|
|
RRModePtr mode = crtc->mode;
|
2011-02-23 20:18:08 +01:00
|
|
|
|
2006-10-06 07:31:35 +02:00
|
|
|
ce.type = RRNotify + RREventBase;
|
|
|
|
ce.subCode = RRNotify_CrtcChange;
|
|
|
|
ce.timestamp = pScrPriv->lastSetTime.milliseconds;
|
|
|
|
ce.window = pWin->drawable.id;
|
|
|
|
ce.crtc = crtc->id;
|
|
|
|
ce.rotation = crtc->rotation;
|
|
|
|
if (mode)
|
|
|
|
{
|
|
|
|
ce.mode = mode->mode.id;
|
|
|
|
ce.x = crtc->x;
|
|
|
|
ce.y = crtc->y;
|
|
|
|
ce.width = mode->mode.width;
|
|
|
|
ce.height = mode->mode.height;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ce.mode = None;
|
|
|
|
ce.x = 0;
|
|
|
|
ce.y = 0;
|
|
|
|
ce.width = 0;
|
|
|
|
ce.height = 0;
|
|
|
|
}
|
|
|
|
WriteEventsToClient (client, 1, (xEvent *) &ce);
|
2006-09-18 08:03:23 +02:00
|
|
|
}
|
|
|
|
|
2007-03-24 07:41:36 +01:00
|
|
|
static Bool
|
|
|
|
RRCrtcPendingProperties (RRCrtcPtr crtc)
|
|
|
|
{
|
|
|
|
ScreenPtr pScreen = crtc->pScreen;
|
|
|
|
rrScrPriv(pScreen);
|
|
|
|
int o;
|
|
|
|
|
|
|
|
for (o = 0; o < pScrPriv->numOutputs; o++)
|
|
|
|
{
|
|
|
|
RROutputPtr output = pScrPriv->outputs[o];
|
|
|
|
if (output->crtc == crtc && output->pendingProperties)
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
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:
|
|
|
|
*right = crtc->x + crtc->mode->mode.width;
|
|
|
|
*bottom = crtc->y + crtc->mode->mode.height;
|
|
|
|
return;
|
|
|
|
case RR_Rotate_90:
|
|
|
|
case RR_Rotate_270:
|
|
|
|
*right = crtc->x + crtc->mode->mode.height;
|
|
|
|
*bottom = crtc->y + crtc->mode->mode.width;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 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;
|
|
|
|
int cl, cr, ct, cb; /* the overlap, if any */
|
|
|
|
|
|
|
|
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
|
|
|
|
mark_crtcs (rrScrPrivPtr pScrPriv, int *reachable, int cur)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
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
|
|
|
|
RRComputeContiguity (ScreenPtr pScreen)
|
|
|
|
{
|
|
|
|
rrScrPriv(pScreen);
|
|
|
|
Bool discontiguous = TRUE;
|
|
|
|
int i, n = pScrPriv->numCrtcs;
|
|
|
|
|
|
|
|
int *reachable = calloc(n, sizeof(int));
|
|
|
|
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;
|
|
|
|
|
|
|
|
out:
|
|
|
|
free(reachable);
|
|
|
|
pScrPriv->discontiguous = discontiguous;
|
|
|
|
}
|
|
|
|
|
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
|
2006-09-17 08:21:37 +02:00
|
|
|
RRCrtcSet (RRCrtcPtr crtc,
|
|
|
|
RRModePtr mode,
|
|
|
|
int x,
|
|
|
|
int y,
|
|
|
|
Rotation rotation,
|
|
|
|
int numOutputs,
|
2011-02-23 20:17:42 +01:00
|
|
|
RROutputPtr *outputs)
|
2006-09-17 08:21:37 +02:00
|
|
|
{
|
|
|
|
ScreenPtr pScreen = crtc->pScreen;
|
2007-03-23 09:03:40 +01:00
|
|
|
Bool ret = FALSE;
|
2010-11-15 20:29:14 +01:00
|
|
|
Bool recompute = TRUE;
|
2007-03-23 09:03:40 +01:00
|
|
|
rrScrPriv(pScreen);
|
2006-09-17 08:21:37 +02:00
|
|
|
|
2006-09-18 21:18:22 +02:00
|
|
|
/* See if nothing changed */
|
|
|
|
if (crtc->mode == mode &&
|
|
|
|
crtc->x == x &&
|
|
|
|
crtc->y == y &&
|
|
|
|
crtc->rotation == rotation &&
|
|
|
|
crtc->numOutputs == numOutputs &&
|
2007-03-24 07:41:36 +01:00
|
|
|
!memcmp (crtc->outputs, outputs, numOutputs * sizeof (RROutputPtr)) &&
|
2008-03-14 05:31:12 +01:00
|
|
|
!RRCrtcPendingProperties (crtc) &&
|
2011-02-23 20:17:42 +01:00
|
|
|
!RRCrtcPendingTransform (crtc))
|
2006-09-18 21:18:22 +02:00
|
|
|
{
|
2010-11-15 20:29:14 +01:00
|
|
|
recompute = FALSE;
|
2007-03-23 09:03:40 +01:00
|
|
|
ret = TRUE;
|
2006-09-18 21:18:22 +02:00
|
|
|
}
|
2007-03-23 09:03:40 +01:00
|
|
|
else
|
2006-09-17 08:21:37 +02:00
|
|
|
{
|
2006-11-09 06:36:35 +01:00
|
|
|
#if RANDR_12_INTERFACE
|
|
|
|
if (pScrPriv->rrCrtcSet)
|
2006-11-01 09:29:46 +01:00
|
|
|
{
|
2011-02-23 20:18:08 +01:00
|
|
|
ret = (*pScrPriv->rrCrtcSet) (pScreen, crtc, mode, x, y,
|
2011-02-23 20:17:42 +01:00
|
|
|
rotation, numOutputs, outputs);
|
2006-11-01 09:29:46 +01:00
|
|
|
}
|
2007-03-23 09:03:40 +01:00
|
|
|
else
|
2006-11-09 06:36:35 +01:00
|
|
|
#endif
|
2006-11-01 09:29:46 +01:00
|
|
|
{
|
2007-03-23 09:03:40 +01:00
|
|
|
#if RANDR_10_INTERFACE
|
|
|
|
if (pScrPriv->rrSetConfig)
|
2007-03-01 01:09:11 +01:00
|
|
|
{
|
2007-03-23 09:03:40 +01:00
|
|
|
RRScreenSize size;
|
|
|
|
RRScreenRate rate;
|
|
|
|
|
|
|
|
if (!mode)
|
|
|
|
{
|
2011-02-23 20:17:42 +01:00
|
|
|
RRCrtcNotify (crtc, NULL, x, y, rotation, NULL, 0, NULL);
|
2007-03-23 09:03:40 +01:00
|
|
|
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)
|
|
|
|
{
|
2011-02-23 20:17:42 +01:00
|
|
|
RRCrtcNotify (crtc, mode, x, y, rotation, NULL, 1, outputs);
|
2007-03-23 09:03:40 +01:00
|
|
|
RRScreenSizeNotify (pScreen);
|
|
|
|
}
|
|
|
|
}
|
2007-03-01 01:09:11 +01:00
|
|
|
}
|
2006-09-17 08:21:37 +02:00
|
|
|
#endif
|
2007-03-23 09:03:40 +01:00
|
|
|
}
|
|
|
|
if (ret)
|
2007-03-24 07:41:36 +01:00
|
|
|
{
|
|
|
|
int o;
|
2007-03-23 09:03:40 +01:00
|
|
|
RRTellChanged (pScreen);
|
2007-03-24 07:41:36 +01:00
|
|
|
|
|
|
|
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)
|
|
|
|
RRComputeContiguity(pScreen);
|
|
|
|
|
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
|
2008-03-15 08:36:45 +01:00
|
|
|
RRCrtcGetTransform (RRCrtcPtr crtc)
|
2008-03-13 22:26:01 +01:00
|
|
|
{
|
2008-03-15 08:36:45 +01:00
|
|
|
RRTransformPtr transform = &crtc->client_pending_transform;
|
|
|
|
|
2008-11-24 22:08:48 +01:00
|
|
|
if (pixman_transform_is_identity (&transform->transform))
|
2008-03-15 08:36:45 +01:00
|
|
|
return NULL;
|
|
|
|
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
|
2008-03-14 05:31:12 +01:00
|
|
|
RRCrtcPendingTransform (RRCrtcPtr crtc)
|
|
|
|
{
|
2008-03-15 08:36:45 +01:00
|
|
|
return memcmp (&crtc->client_current_transform.transform,
|
|
|
|
&crtc->client_pending_transform.transform,
|
2008-03-14 05:31:12 +01:00
|
|
|
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
|
2006-09-17 08:21:37 +02:00
|
|
|
RRCrtcDestroy (RRCrtcPtr crtc)
|
|
|
|
{
|
|
|
|
FreeResource (crtc->id, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
RRCrtcDestroyResource (pointer value, XID pid)
|
|
|
|
{
|
|
|
|
RRCrtcPtr crtc = (RRCrtcPtr) value;
|
|
|
|
ScreenPtr pScreen = crtc->pScreen;
|
|
|
|
|
2006-11-09 06:36:35 +01:00
|
|
|
if (pScreen)
|
2006-09-17 08:21:37 +02:00
|
|
|
{
|
2006-11-09 06:36:35 +01:00
|
|
|
rrScrPriv(pScreen);
|
|
|
|
int i;
|
2011-02-23 20:18:08 +01:00
|
|
|
|
2006-11-09 06:36:35 +01:00
|
|
|
for (i = 0; i < pScrPriv->numCrtcs; i++)
|
2006-09-17 08:21:37 +02:00
|
|
|
{
|
2006-11-09 06:36:35 +01:00
|
|
|
if (pScrPriv->crtcs[i] == crtc)
|
|
|
|
{
|
|
|
|
memmove (pScrPriv->crtcs + i, pScrPriv->crtcs + i + 1,
|
2006-11-28 06:40:24 +01:00
|
|
|
(pScrPriv->numCrtcs - (i + 1)) * sizeof (RRCrtcPtr));
|
2006-11-09 06:36:35 +01:00
|
|
|
--pScrPriv->numCrtcs;
|
|
|
|
break;
|
|
|
|
}
|
2006-09-17 08:21:37 +02:00
|
|
|
}
|
|
|
|
}
|
2010-06-06 10:28:30 +02:00
|
|
|
free(crtc->gammaRed);
|
2007-03-16 04:26:07 +01:00
|
|
|
if (crtc->mode)
|
|
|
|
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
|
2006-09-20 07:48:54 +02:00
|
|
|
RRCrtcGammaSet (RRCrtcPtr crtc,
|
|
|
|
CARD16 *red,
|
|
|
|
CARD16 *green,
|
|
|
|
CARD16 *blue)
|
|
|
|
{
|
|
|
|
Bool ret = TRUE;
|
|
|
|
#if RANDR_12_INTERFACE
|
|
|
|
ScreenPtr pScreen = crtc->pScreen;
|
|
|
|
#endif
|
2011-02-23 20:18:08 +01:00
|
|
|
|
2006-09-20 07:48:54 +02: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));
|
|
|
|
#if RANDR_12_INTERFACE
|
2006-11-09 06:36:35 +01:00
|
|
|
if (pScreen)
|
|
|
|
{
|
|
|
|
rrScrPriv(pScreen);
|
|
|
|
if (pScrPriv->rrCrtcSetGamma)
|
|
|
|
ret = (*pScrPriv->rrCrtcSetGamma) (pScreen, crtc);
|
|
|
|
}
|
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;
|
|
|
|
#if RANDR_12_INTERFACE
|
|
|
|
ScreenPtr pScreen = crtc->pScreen;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if RANDR_12_INTERFACE
|
|
|
|
if (pScreen)
|
|
|
|
{
|
|
|
|
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
|
2006-09-20 07:48:54 +02:00
|
|
|
RRCrtcGammaNotify (RRCrtcPtr crtc)
|
|
|
|
{
|
|
|
|
return TRUE; /* not much going on here */
|
|
|
|
}
|
|
|
|
|
2011-02-23 20:17:42 +01:00
|
|
|
static void
|
2011-02-23 20:18:12 +01:00
|
|
|
RRModeGetScanoutSize (RRModePtr mode, PictTransformPtr transform,
|
2008-03-17 21:57:47 +01:00
|
|
|
int *width, int *height)
|
2007-01-24 17:29:20 +01:00
|
|
|
{
|
2008-03-17 21:57:47 +01:00
|
|
|
BoxRec box;
|
|
|
|
|
|
|
|
if (mode == NULL) {
|
2007-01-24 17:29:20 +01:00
|
|
|
*width = 0;
|
|
|
|
*height = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-03-17 21:57:47 +01:00
|
|
|
box.x1 = 0;
|
|
|
|
box.y1 = 0;
|
|
|
|
box.x2 = mode->mode.width;
|
|
|
|
box.y2 = mode->mode.height;
|
|
|
|
|
2011-02-23 20:18:12 +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)
|
|
|
|
{
|
2011-06-06 16:53:41 +02: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
|
2006-09-20 07:48:54 +02:00
|
|
|
RRCrtcGammaSetSize (RRCrtcPtr crtc,
|
|
|
|
int size)
|
|
|
|
{
|
|
|
|
CARD16 *gamma;
|
|
|
|
|
|
|
|
if (size == crtc->gammaSize)
|
|
|
|
return TRUE;
|
2006-09-20 21:05:52 +02:00
|
|
|
if (size)
|
|
|
|
{
|
2010-05-05 20:44:06 +02:00
|
|
|
gamma = malloc(size * 3 * sizeof (CARD16));
|
2006-09-20 21:05:52 +02:00
|
|
|
if (!gamma)
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
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;
|
|
|
|
crtc->gammaBlue = gamma + size*2;
|
|
|
|
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
|
2008-03-14 05:31:12 +01:00
|
|
|
RRCrtcTransformSet (RRCrtcPtr crtc,
|
|
|
|
PictTransformPtr transform,
|
2008-11-24 22:08:48 +01:00
|
|
|
struct pixman_f_transform *f_transform,
|
|
|
|
struct pixman_f_transform *f_inverse,
|
2008-03-15 08:36:45 +01:00
|
|
|
char *filter_name,
|
|
|
|
int filter_len,
|
|
|
|
xFixed *params,
|
|
|
|
int nparams)
|
2008-03-14 05:31:12 +01:00
|
|
|
{
|
2008-03-15 08:36:45 +01:00
|
|
|
PictFilterPtr filter = NULL;
|
2008-03-17 23:20:52 +01:00
|
|
|
int width = 0, height = 0;
|
2008-03-15 08:36:45 +01:00
|
|
|
|
2008-03-18 23:35:44 +01:00
|
|
|
if (!crtc->transforms)
|
|
|
|
return BadValue;
|
|
|
|
|
2008-03-15 08:36:45 +01:00
|
|
|
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,
|
2008-03-17 23:20:52 +01:00
|
|
|
params, nparams, &width, &height))
|
2008-03-15 08:36:45 +01:00
|
|
|
return BadMatch;
|
|
|
|
}
|
2008-03-17 23:20:52 +01:00
|
|
|
else {
|
|
|
|
width = filter->width;
|
|
|
|
height = filter->height;
|
|
|
|
}
|
2008-03-15 08:36:45 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (nparams)
|
|
|
|
return BadMatch;
|
|
|
|
}
|
|
|
|
if (!RRTransformSetFilter (&crtc->client_pending_transform,
|
2008-03-17 23:20:52 +01:00
|
|
|
filter, params, nparams, width, height))
|
2008-03-15 08:36:45 +01:00
|
|
|
return BadAlloc;
|
|
|
|
|
|
|
|
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
|
2006-09-17 08:21:37 +02:00
|
|
|
RRCrtcInit (void)
|
|
|
|
{
|
2009-12-03 02:43:01 +01:00
|
|
|
RRCrtcType = CreateNewResourceType (RRCrtcDestroyResource, "CRTC");
|
2006-09-18 08:03:23 +02:00
|
|
|
if (!RRCrtcType)
|
2006-09-17 08:21:37 +02:00
|
|
|
return FALSE;
|
2011-02-23 20:18:08 +01:00
|
|
|
|
2006-09-17 08:21:37 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
2006-09-20 07:48:54 +02:00
|
|
|
|
2010-09-29 22:51:48 +02:00
|
|
|
/*
|
|
|
|
* Initialize 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
|
2006-09-20 07:48:54 +02:00
|
|
|
ProcRRGetCrtcInfo (ClientPtr client)
|
|
|
|
{
|
2007-03-06 00:31:44 +01:00
|
|
|
REQUEST(xRRGetCrtcInfoReq);
|
2006-09-20 07:48:54 +02:00
|
|
|
xRRGetCrtcInfoReply rep;
|
|
|
|
RRCrtcPtr crtc;
|
|
|
|
CARD8 *extra;
|
|
|
|
unsigned long extraLen;
|
|
|
|
ScreenPtr pScreen;
|
|
|
|
rrScrPrivPtr pScrPriv;
|
|
|
|
RRModePtr mode;
|
|
|
|
RROutput *outputs;
|
|
|
|
RROutput *possible;
|
|
|
|
int i, j, k, n;
|
2007-04-16 03:59:19 +02:00
|
|
|
int width, height;
|
2009-01-31 00:43:04 +01:00
|
|
|
BoxRec panned_area;
|
2011-02-23 20:18:08 +01:00
|
|
|
|
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;
|
2011-02-23 20:18:08 +01:00
|
|
|
|
2006-09-20 07:48:54 +02:00
|
|
|
rep.type = X_Reply;
|
|
|
|
rep.status = RRSetConfigSuccess;
|
|
|
|
rep.sequenceNumber = client->sequence;
|
|
|
|
rep.length = 0;
|
|
|
|
rep.timestamp = pScrPriv->lastSetTime.milliseconds;
|
2009-01-31 00:43:04 +01:00
|
|
|
if (pScrPriv->rrGetPanning &&
|
|
|
|
pScrPriv->rrGetPanning (pScreen, crtc, &panned_area, NULL, NULL) &&
|
|
|
|
(panned_area.x2 > panned_area.x1) && (panned_area.y2 > panned_area.y1))
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
RRCrtcGetScanoutSize (crtc, &width, &height);
|
|
|
|
rep.x = crtc->x;
|
|
|
|
rep.y = crtc->y;
|
|
|
|
rep.width = width;
|
|
|
|
rep.height = height;
|
|
|
|
}
|
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++)
|
|
|
|
for (j = 0; j < pScrPriv->outputs[i]->numCrtcs; j++)
|
|
|
|
if (pScrPriv->outputs[i]->crtcs[j] == crtc)
|
|
|
|
k++;
|
|
|
|
rep.nPossibleOutput = k;
|
2011-02-23 20:18:08 +01:00
|
|
|
|
2006-09-20 07:48:54 +02:00
|
|
|
rep.length = rep.nOutput + rep.nPossibleOutput;
|
|
|
|
|
|
|
|
extraLen = rep.length << 2;
|
2006-09-20 21:05:52 +02:00
|
|
|
if (extraLen)
|
|
|
|
{
|
2010-05-05 20:44:06 +02:00
|
|
|
extra = malloc(extraLen);
|
2006-09-20 21:05:52 +02:00
|
|
|
if (!extra)
|
|
|
|
return BadAlloc;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
extra = NULL;
|
2006-09-20 07:48:54 +02:00
|
|
|
|
|
|
|
outputs = (RROutput *) extra;
|
|
|
|
possible = (RROutput *) (outputs + rep.nOutput);
|
2011-02-23 20:18:08 +01:00
|
|
|
|
2006-09-20 07:48:54 +02:00
|
|
|
for (i = 0; i < crtc->numOutputs; i++)
|
|
|
|
{
|
|
|
|
outputs[i] = crtc->outputs[i]->id;
|
|
|
|
if (client->swapped)
|
|
|
|
swapl (&outputs[i], n);
|
|
|
|
}
|
|
|
|
k = 0;
|
|
|
|
for (i = 0; i < pScrPriv->numOutputs; i++)
|
|
|
|
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], n);
|
|
|
|
k++;
|
|
|
|
}
|
2011-02-23 20:18:08 +01:00
|
|
|
|
2006-09-20 07:48:54 +02:00
|
|
|
if (client->swapped) {
|
|
|
|
swaps(&rep.sequenceNumber, n);
|
|
|
|
swapl(&rep.length, n);
|
|
|
|
swapl(&rep.timestamp, n);
|
|
|
|
swaps(&rep.x, n);
|
|
|
|
swaps(&rep.y, n);
|
|
|
|
swaps(&rep.width, n);
|
|
|
|
swaps(&rep.height, n);
|
|
|
|
swapl(&rep.mode, n);
|
|
|
|
swaps(&rep.rotation, n);
|
|
|
|
swaps(&rep.rotations, n);
|
|
|
|
swaps(&rep.nOutput, n);
|
|
|
|
swaps(&rep.nPossibleOutput, n);
|
|
|
|
}
|
|
|
|
WriteToClient(client, sizeof(xRRGetCrtcInfoReply), (char *)&rep);
|
|
|
|
if (extraLen)
|
|
|
|
{
|
|
|
|
WriteToClient (client, extraLen, (char *) extra);
|
2010-05-05 20:44:06 +02:00
|
|
|
free(extra);
|
2006-09-20 07:48:54 +02:00
|
|
|
}
|
2011-02-23 20:18:08 +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
|
2006-09-20 07:48:54 +02:00
|
|
|
ProcRRSetCrtcConfig (ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xRRSetCrtcConfigReq);
|
|
|
|
xRRSetCrtcConfigReply rep;
|
|
|
|
ScreenPtr pScreen;
|
|
|
|
rrScrPrivPtr pScrPriv;
|
|
|
|
RRCrtcPtr crtc;
|
|
|
|
RRModePtr mode;
|
|
|
|
int numOutputs;
|
2006-11-16 18:48:33 +01:00
|
|
|
RROutputPtr *outputs = NULL;
|
|
|
|
RROutput *outputIds;
|
2006-09-20 07:48:54 +02:00
|
|
|
TimeStamp configTime;
|
|
|
|
TimeStamp time;
|
|
|
|
Rotation rotation;
|
2009-04-29 07:04:37 +02:00
|
|
|
int rc, i, j;
|
2011-02-23 20:18:08 +01:00
|
|
|
|
2006-09-20 07:48:54 +02:00
|
|
|
REQUEST_AT_LEAST_SIZE(xRRSetCrtcConfigReq);
|
2009-07-06 04:24:27 +02:00
|
|
|
numOutputs = (stuff->length - bytes_to_int32(SIZEOF (xRRSetCrtcConfigReq)));
|
2011-02-23 20:18:08 +01:00
|
|
|
|
2009-04-29 07:04:37 +02:00
|
|
|
VERIFY_RR_CRTC(stuff->crtc, crtc, DixSetAttrAccess);
|
|
|
|
|
2006-09-20 07:48:54 +02:00
|
|
|
if (stuff->mode == None)
|
|
|
|
{
|
|
|
|
mode = NULL;
|
|
|
|
if (numOutputs > 0)
|
|
|
|
return BadMatch;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-04-29 07:04:37 +02:00
|
|
|
VERIFY_RR_MODE(stuff->mode, mode, DixSetAttrAccess);
|
2006-09-20 07:48:54 +02:00
|
|
|
if (numOutputs == 0)
|
|
|
|
return BadMatch;
|
|
|
|
}
|
2006-09-20 21:05:52 +02:00
|
|
|
if (numOutputs)
|
|
|
|
{
|
2010-05-05 20:44:06 +02:00
|
|
|
outputs = malloc(numOutputs * sizeof (RROutputPtr));
|
2006-09-20 21:05:52 +02:00
|
|
|
if (!outputs)
|
|
|
|
return BadAlloc;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
outputs = NULL;
|
2011-02-23 20:18:08 +01:00
|
|
|
|
2006-11-16 18:48:33 +01:00
|
|
|
outputIds = (RROutput *) (stuff + 1);
|
2006-09-20 07:48:54 +02:00
|
|
|
for (i = 0; i < numOutputs; i++)
|
|
|
|
{
|
2009-04-29 07:04:37 +02:00
|
|
|
rc = dixLookupResourceByType((pointer *)(outputs + i), outputIds[i],
|
|
|
|
RROutputType, client, DixSetAttrAccess);
|
|
|
|
if (rc != Success)
|
2006-09-20 07:48:54 +02:00
|
|
|
{
|
2010-06-06 10:28:30 +02:00
|
|
|
free(outputs);
|
2010-04-25 08:56:36 +02:00
|
|
|
return rc;
|
2006-09-20 07:48:54 +02:00
|
|
|
}
|
|
|
|
/* validate crtc for this output */
|
2006-11-16 18:48:33 +01:00
|
|
|
for (j = 0; j < outputs[i]->numCrtcs; j++)
|
|
|
|
if (outputs[i]->crtcs[j] == crtc)
|
2006-09-20 07:48:54 +02:00
|
|
|
break;
|
2006-11-16 18:48:33 +01:00
|
|
|
if (j == outputs[i]->numCrtcs)
|
2006-09-20 07:48:54 +02:00
|
|
|
{
|
2010-06-06 10:28:30 +02:00
|
|
|
free(outputs);
|
2006-09-20 07:48:54 +02:00
|
|
|
return BadMatch;
|
|
|
|
}
|
|
|
|
/* validate mode for this output */
|
2007-02-19 08:49:38 +01:00
|
|
|
for (j = 0; j < outputs[i]->numModes + outputs[i]->numUserModes; j++)
|
|
|
|
{
|
2011-02-23 20:18:08 +01:00
|
|
|
RRModePtr m = (j < outputs[i]->numModes ?
|
2007-02-19 08:49:38 +01:00
|
|
|
outputs[i]->modes[j] :
|
|
|
|
outputs[i]->userModes[j - outputs[i]->numModes]);
|
|
|
|
if (m == mode)
|
2006-09-20 07:48:54 +02:00
|
|
|
break;
|
2007-02-19 08:49:38 +01:00
|
|
|
}
|
|
|
|
if (j == outputs[i]->numModes + outputs[i]->numUserModes)
|
2006-09-20 07:48:54 +02:00
|
|
|
{
|
2010-06-06 10:28:30 +02:00
|
|
|
free(outputs);
|
2006-09-20 07:48:54 +02:00
|
|
|
return BadMatch;
|
|
|
|
}
|
|
|
|
}
|
2007-02-27 02:45:40 +01:00
|
|
|
/* validate clones */
|
|
|
|
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)
|
|
|
|
{
|
2010-06-06 10:28:30 +02:00
|
|
|
free(outputs);
|
2007-02-27 02:45:40 +01:00
|
|
|
return BadMatch;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-09-20 07:48:54 +02:00
|
|
|
|
|
|
|
pScreen = crtc->pScreen;
|
|
|
|
pScrPriv = rrGetScrPriv(pScreen);
|
2011-02-23 20:18:08 +01:00
|
|
|
|
2006-09-20 07:48:54 +02:00
|
|
|
time = ClientTimeToServerTime(stuff->timestamp);
|
|
|
|
configTime = ClientTimeToServerTime(stuff->configTimestamp);
|
2011-02-23 20:18:08 +01:00
|
|
|
|
2006-09-20 07:48:54 +02:00
|
|
|
if (!pScrPriv)
|
|
|
|
{
|
|
|
|
time = currentTime;
|
|
|
|
rep.status = RRSetConfigFailed;
|
|
|
|
goto sendReply;
|
|
|
|
}
|
2011-02-23 20:18:08 +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:
|
|
|
|
break;
|
|
|
|
default:
|
2006-09-20 07:48:54 +02:00
|
|
|
/*
|
2006-10-06 07:31:35 +02:00
|
|
|
* Invalid rotation
|
2006-09-20 07:48:54 +02:00
|
|
|
*/
|
2006-10-06 07:31:35 +02:00
|
|
|
client->errorValue = stuff->rotation;
|
2010-06-06 10:28:30 +02:00
|
|
|
free(outputs);
|
2006-10-06 07:31:35 +02:00
|
|
|
return BadValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mode)
|
|
|
|
{
|
2006-09-21 18:52:04 +02:00
|
|
|
if ((~crtc->rotations) & rotation)
|
2006-09-20 07:48:54 +02:00
|
|
|
{
|
2006-09-21 18:52:04 +02:00
|
|
|
/*
|
|
|
|
* requested rotation or reflection not supported by screen
|
|
|
|
*/
|
|
|
|
client->errorValue = stuff->rotation;
|
2010-06-06 10:28:30 +02:00
|
|
|
free(outputs);
|
2006-09-21 18:52:04 +02:00
|
|
|
return BadMatch;
|
|
|
|
}
|
2011-02-23 20:18:08 +01:00
|
|
|
|
2006-09-21 18:52:04 +02:00
|
|
|
#ifdef RANDR_12_INTERFACE
|
|
|
|
/*
|
|
|
|
* Check screen size bounds if the DDX provides a 1.2 interface
|
|
|
|
* for setting screen size. Else, assume the CrtcSet sets
|
2008-03-19 20:15:39 +01:00
|
|
|
* 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.
|
2006-09-21 18:52:04 +02:00
|
|
|
*/
|
2008-03-19 20:15:39 +01:00
|
|
|
if (pScrPriv->rrScreenSetSize && !crtc->transforms)
|
2006-09-21 18:52:04 +02:00
|
|
|
{
|
2008-03-17 21:57:47 +01:00
|
|
|
int source_width;
|
|
|
|
int source_height;
|
2008-03-19 20:15:39 +01:00
|
|
|
PictTransform transform;
|
2008-11-24 22:08:48 +01:00
|
|
|
struct pixman_f_transform f_transform, f_inverse;
|
2008-03-17 21:57:47 +01:00
|
|
|
|
2008-03-21 10:39:49 +01:00
|
|
|
RRTransformCompute (stuff->x, stuff->y,
|
2008-03-19 20:15:39 +01:00
|
|
|
mode->mode.width, mode->mode.height,
|
|
|
|
rotation,
|
|
|
|
&crtc->client_pending_transform,
|
2011-02-23 20:18:12 +01:00
|
|
|
&transform, &f_transform, &f_inverse);
|
2006-12-13 10:21:32 +01:00
|
|
|
|
2011-02-23 20:18:12 +01:00
|
|
|
RRModeGetScanoutSize (mode, &transform, &source_width, &source_height);
|
2006-12-13 10:21:32 +01:00
|
|
|
if (stuff->x + source_width > pScreen->width)
|
2006-09-21 18:52:04 +02:00
|
|
|
{
|
|
|
|
client->errorValue = stuff->x;
|
2010-06-06 10:28:30 +02:00
|
|
|
free(outputs);
|
2006-09-21 18:52:04 +02:00
|
|
|
return BadValue;
|
|
|
|
}
|
2011-02-23 20:18:08 +01:00
|
|
|
|
2006-12-13 10:21:32 +01:00
|
|
|
if (stuff->y + source_height > pScreen->height)
|
2006-09-21 18:52:04 +02:00
|
|
|
{
|
|
|
|
client->errorValue = stuff->y;
|
2010-06-06 10:28:30 +02:00
|
|
|
free(outputs);
|
2006-09-21 18:52:04 +02:00
|
|
|
return BadValue;
|
|
|
|
}
|
2006-09-20 07:48:54 +02:00
|
|
|
}
|
|
|
|
#endif
|
2006-09-21 18:52:04 +02:00
|
|
|
}
|
2011-02-23 20:18:08 +01:00
|
|
|
|
2006-09-21 04:42:34 +02:00
|
|
|
if (!RRCrtcSet (crtc, mode, stuff->x, stuff->y,
|
2011-02-23 20:17:42 +01:00
|
|
|
rotation, numOutputs, outputs))
|
2006-09-21 04:42:34 +02:00
|
|
|
{
|
|
|
|
rep.status = RRSetConfigFailed;
|
|
|
|
goto sendReply;
|
|
|
|
}
|
|
|
|
rep.status = RRSetConfigSuccess;
|
2009-05-28 23:43:27 +02:00
|
|
|
pScrPriv->lastSetTime = time;
|
2011-02-23 20:18:08 +01:00
|
|
|
|
2006-09-20 07:48:54 +02:00
|
|
|
sendReply:
|
2010-06-06 10:28:30 +02:00
|
|
|
free(outputs);
|
2011-02-23 20:18:08 +01:00
|
|
|
|
2006-09-20 07:48:54 +02:00
|
|
|
rep.type = X_Reply;
|
|
|
|
/* rep.status has already been filled in */
|
|
|
|
rep.length = 0;
|
|
|
|
rep.sequenceNumber = client->sequence;
|
2009-05-28 23:43:27 +02:00
|
|
|
rep.newTimestamp = pScrPriv->lastSetTime.milliseconds;
|
2006-09-20 07:48:54 +02:00
|
|
|
|
2011-02-23 20:18:08 +01:00
|
|
|
if (client->swapped)
|
2006-09-20 07:48:54 +02:00
|
|
|
{
|
|
|
|
int n;
|
|
|
|
swaps(&rep.sequenceNumber, n);
|
|
|
|
swapl(&rep.length, n);
|
|
|
|
swapl(&rep.newTimestamp, n);
|
|
|
|
}
|
|
|
|
WriteToClient(client, sizeof(xRRSetCrtcConfigReply), (char *)&rep);
|
2011-02-23 20:18:08 +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
|
|
|
|
ProcRRGetPanning (ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xRRGetPanningReq);
|
|
|
|
xRRGetPanningReply rep;
|
|
|
|
RRCrtcPtr crtc;
|
|
|
|
ScreenPtr pScreen;
|
|
|
|
rrScrPrivPtr pScrPriv;
|
|
|
|
BoxRec total;
|
|
|
|
BoxRec tracking;
|
|
|
|
INT16 border[4];
|
|
|
|
int n;
|
2011-02-23 20:18:08 +01:00
|
|
|
|
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)
|
2008-11-28 17:51:20 +01:00
|
|
|
return RRErrorBase + BadRRCrtc;
|
|
|
|
|
2009-02-17 18:59:16 +01:00
|
|
|
memset(&rep, 0, sizeof(rep));
|
2008-11-28 17:51:20 +01:00
|
|
|
rep.type = X_Reply;
|
|
|
|
rep.status = RRSetConfigSuccess;
|
|
|
|
rep.sequenceNumber = client->sequence;
|
|
|
|
rep.length = 1;
|
|
|
|
rep.timestamp = pScrPriv->lastSetTime.milliseconds;
|
|
|
|
|
2009-02-17 18:59:16 +01:00
|
|
|
if (pScrPriv->rrGetPanning &&
|
|
|
|
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];
|
|
|
|
}
|
2008-11-28 17:51:20 +01:00
|
|
|
|
|
|
|
if (client->swapped) {
|
|
|
|
swaps(&rep.sequenceNumber, n);
|
|
|
|
swapl(&rep.length, n);
|
|
|
|
swaps(&rep.timestamp, n);
|
|
|
|
swaps(&rep.left, n);
|
|
|
|
swaps(&rep.top, n);
|
|
|
|
swaps(&rep.width, n);
|
|
|
|
swaps(&rep.height, n);
|
|
|
|
swaps(&rep.track_left, n);
|
|
|
|
swaps(&rep.track_top, n);
|
|
|
|
swaps(&rep.track_width, n);
|
|
|
|
swaps(&rep.track_height, n);
|
|
|
|
swaps(&rep.border_left, n);
|
|
|
|
swaps(&rep.border_top, n);
|
|
|
|
swaps(&rep.border_right, n);
|
|
|
|
swaps(&rep.border_bottom, n);
|
|
|
|
}
|
|
|
|
WriteToClient(client, sizeof(xRRGetPanningReply), (char *)&rep);
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2008-11-28 17:51:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
ProcRRSetPanning (ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xRRSetPanningReq);
|
|
|
|
xRRSetPanningReply rep;
|
|
|
|
RRCrtcPtr crtc;
|
|
|
|
ScreenPtr pScreen;
|
|
|
|
rrScrPrivPtr pScrPriv;
|
|
|
|
TimeStamp time;
|
|
|
|
BoxRec total;
|
|
|
|
BoxRec tracking;
|
|
|
|
INT16 border[4];
|
|
|
|
int n;
|
2011-02-23 20:18:08 +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) {
|
|
|
|
time = currentTime;
|
|
|
|
rep.status = RRSetConfigFailed;
|
|
|
|
goto sendReply;
|
|
|
|
}
|
2011-02-23 20:18:08 +01:00
|
|
|
|
2008-11-28 17:51:20 +01:00
|
|
|
time = ClientTimeToServerTime(stuff->timestamp);
|
2011-02-23 20:18:08 +01:00
|
|
|
|
2008-11-28 17:51:20 +01:00
|
|
|
if (!pScrPriv->rrGetPanning)
|
|
|
|
return RRErrorBase + BadRRCrtc;
|
|
|
|
|
|
|
|
total.x1 = stuff->left;
|
|
|
|
total.y1 = stuff->top;
|
2008-12-11 17:51:20 +01:00
|
|
|
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;
|
2008-11-28 17:51:20 +01:00
|
|
|
border[0] = stuff->border_left;
|
|
|
|
border[1] = stuff->border_top;
|
|
|
|
border[2] = stuff->border_right;
|
|
|
|
border[3] = stuff->border_bottom;
|
|
|
|
|
|
|
|
if (! pScrPriv->rrSetPanning (pScreen, crtc, &total, &tracking, border))
|
|
|
|
return BadMatch;
|
|
|
|
|
2009-05-28 23:43:27 +02:00
|
|
|
pScrPriv->lastSetTime = time;
|
|
|
|
|
2008-11-28 17:51:20 +01:00
|
|
|
rep.status = RRSetConfigSuccess;
|
|
|
|
|
|
|
|
sendReply:
|
|
|
|
rep.type = X_Reply;
|
|
|
|
rep.sequenceNumber = client->sequence;
|
|
|
|
rep.length = 0;
|
|
|
|
rep.newTimestamp = pScrPriv->lastSetTime.milliseconds;
|
|
|
|
|
|
|
|
if (client->swapped) {
|
|
|
|
swaps(&rep.sequenceNumber, n);
|
|
|
|
swapl(&rep.length, n);
|
|
|
|
swaps(&rep.newTimestamp, n);
|
|
|
|
}
|
|
|
|
WriteToClient(client, sizeof(xRRSetPanningReply), (char *)&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
|
2006-09-20 07:48:54 +02:00
|
|
|
ProcRRGetCrtcGammaSize (ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xRRGetCrtcGammaSizeReq);
|
|
|
|
xRRGetCrtcGammaSizeReply reply;
|
|
|
|
RRCrtcPtr crtc;
|
|
|
|
int n;
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
2006-09-20 07:48:54 +02:00
|
|
|
reply.type = X_Reply;
|
|
|
|
reply.sequenceNumber = client->sequence;
|
|
|
|
reply.length = 0;
|
|
|
|
reply.size = crtc->gammaSize;
|
|
|
|
if (client->swapped) {
|
|
|
|
swaps (&reply.sequenceNumber, n);
|
|
|
|
swapl (&reply.length, n);
|
|
|
|
swaps (&reply.size, n);
|
|
|
|
}
|
|
|
|
WriteToClient (client, sizeof (xRRGetCrtcGammaSizeReply), (char *) &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
|
2006-09-20 07:48:54 +02:00
|
|
|
ProcRRGetCrtcGamma (ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xRRGetCrtcGammaReq);
|
|
|
|
xRRGetCrtcGammaReply reply;
|
|
|
|
RRCrtcPtr crtc;
|
|
|
|
int n;
|
|
|
|
unsigned long len;
|
2008-11-24 22:08:48 +01:00
|
|
|
char *extra = NULL;
|
2011-02-23 20:18:08 +01:00
|
|
|
|
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;
|
2011-02-23 20:18:08 +01:00
|
|
|
|
2008-08-21 01:32:03 +02:00
|
|
|
if (crtc->gammaSize) {
|
2010-05-05 20:44:06 +02:00
|
|
|
extra = malloc(len);
|
2008-08-21 01:32:03 +02:00
|
|
|
if (!extra)
|
|
|
|
return BadAlloc;
|
|
|
|
}
|
|
|
|
|
2006-09-20 07:48:54 +02:00
|
|
|
reply.type = X_Reply;
|
|
|
|
reply.sequenceNumber = client->sequence;
|
2009-07-06 04:24:27 +02:00
|
|
|
reply.length = bytes_to_int32(len);
|
2006-09-20 07:48:54 +02:00
|
|
|
reply.size = crtc->gammaSize;
|
|
|
|
if (client->swapped) {
|
|
|
|
swaps (&reply.sequenceNumber, n);
|
|
|
|
swapl (&reply.length, n);
|
|
|
|
swaps (&reply.size, n);
|
|
|
|
}
|
|
|
|
WriteToClient (client, sizeof (xRRGetCrtcGammaReply), (char *) &reply);
|
|
|
|
if (crtc->gammaSize)
|
|
|
|
{
|
2008-08-21 01:32:03 +02:00
|
|
|
memcpy(extra, crtc->gammaRed, len);
|
2006-09-20 07:48:54 +02:00
|
|
|
client->pSwapReplyFunc = (ReplySwapPtr)CopySwap16Write;
|
2008-08-21 01:32:03 +02:00
|
|
|
WriteSwappedDataToClient (client, len, extra);
|
2010-05-05 20:44:06 +02:00
|
|
|
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
|
2006-09-20 07:48:54 +02:00
|
|
|
ProcRRSetCrtcGamma (ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xRRSetCrtcGammaReq);
|
|
|
|
RRCrtcPtr crtc;
|
|
|
|
unsigned long len;
|
|
|
|
CARD16 *red, *green, *blue;
|
2011-02-23 20:18:08 +01:00
|
|
|
|
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);
|
2011-02-23 20:18:08 +01:00
|
|
|
|
2009-07-06 04:24:27 +02: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)
|
|
|
|
return BadLength;
|
|
|
|
|
|
|
|
if (stuff->size != crtc->gammaSize)
|
|
|
|
return BadMatch;
|
2011-02-23 20:18:08 +01:00
|
|
|
|
2006-09-20 07:48:54 +02:00
|
|
|
red = (CARD16 *) (stuff + 1);
|
|
|
|
green = red + crtc->gammaSize;
|
|
|
|
blue = green + crtc->gammaSize;
|
2011-02-23 20:18:08 +01:00
|
|
|
|
2006-09-20 07:48:54 +02:00
|
|
|
RRCrtcGammaSet (crtc, red, green, blue);
|
|
|
|
|
|
|
|
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
|
2008-03-14 05:31:12 +01:00
|
|
|
ProcRRSetCrtcTransform (ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xRRSetCrtcTransformReq);
|
|
|
|
RRCrtcPtr crtc;
|
2008-03-19 08:46:35 +01:00
|
|
|
PictTransform transform;
|
2008-11-24 22:08:48 +01:00
|
|
|
struct pixman_f_transform f_transform, f_inverse;
|
2008-03-15 08:36:45 +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
|
|
|
|
|
|
|
PictTransform_from_xRenderTransform (&transform, &stuff->transform);
|
2008-11-24 22:08:48 +01:00
|
|
|
pixman_f_transform_from_pixman_transform (&f_transform, &transform);
|
|
|
|
if (!pixman_f_transform_invert (&f_inverse, &f_transform))
|
2008-03-18 07:04:49 +01:00
|
|
|
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)
|
|
|
|
return BadLength;
|
|
|
|
|
2008-03-19 08:46:35 +01:00
|
|
|
return RRCrtcTransformSet (crtc, &transform, &f_transform, &f_inverse,
|
2008-03-15 08:36:45 +01:00
|
|
|
filter, nbytes, params, nparams);
|
2008-03-14 05:31:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#define CrtcTransformExtra (SIZEOF(xRRGetCrtcTransformReply) - 32)
|
2011-02-23 20:18:08 +01:00
|
|
|
|
2008-03-15 08:36:45 +01:00
|
|
|
static int
|
|
|
|
transform_filter_length (RRTransformPtr transform)
|
|
|
|
{
|
|
|
|
int nbytes, nparams;
|
|
|
|
|
|
|
|
if (transform->filter == NULL)
|
|
|
|
return 0;
|
|
|
|
nbytes = strlen (transform->filter->name);
|
|
|
|
nparams = transform->nparams;
|
2009-07-06 04:24:27 +02:00
|
|
|
return pad_to_int32(nbytes) + (nparams * sizeof (xFixed));
|
2008-03-15 08:36:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
transform_filter_encode (ClientPtr client, char *output,
|
|
|
|
CARD16 *nbytesFilter,
|
|
|
|
CARD16 *nparamsFilter,
|
|
|
|
RRTransformPtr transform)
|
|
|
|
{
|
|
|
|
int nbytes, nparams;
|
|
|
|
int n;
|
|
|
|
|
|
|
|
if (transform->filter == NULL) {
|
|
|
|
*nbytesFilter = 0;
|
|
|
|
*nparamsFilter = 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
nbytes = strlen (transform->filter->name);
|
|
|
|
nparams = transform->nparams;
|
|
|
|
*nbytesFilter = nbytes;
|
|
|
|
*nparamsFilter = nparams;
|
|
|
|
memcpy (output, transform->filter->name, nbytes);
|
|
|
|
while ((nbytes & 3) != 0)
|
2008-03-17 21:57:47 +01:00
|
|
|
output[nbytes++] = 0;
|
|
|
|
memcpy (output + nbytes, transform->params, nparams * sizeof (xFixed));
|
2008-03-15 08:36:45 +01:00
|
|
|
if (client->swapped) {
|
|
|
|
swaps (nbytesFilter, n);
|
|
|
|
swaps (nparamsFilter, n);
|
2008-11-26 21:19:55 +01:00
|
|
|
SwapLongs ((CARD32 *) (output + nbytes), nparams);
|
2008-03-15 08:36:45 +01:00
|
|
|
}
|
2008-03-17 21:57:47 +01:00
|
|
|
nbytes += nparams * sizeof (xFixed);
|
|
|
|
return nbytes;
|
2008-03-15 08:36:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
transform_encode (ClientPtr client, xRenderTransform *wire, PictTransform *pict)
|
|
|
|
{
|
|
|
|
xRenderTransform_from_PictTransform (wire, pict);
|
|
|
|
if (client->swapped)
|
2009-07-06 04:24:27 +02: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
|
2008-03-14 05:31:12 +01:00
|
|
|
ProcRRGetCrtcTransform (ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xRRGetCrtcTransformReq);
|
2008-03-15 08:36:45 +01:00
|
|
|
xRRGetCrtcTransformReply *reply;
|
2008-03-14 05:31:12 +01:00
|
|
|
RRCrtcPtr crtc;
|
2008-03-15 08:36:45 +01:00
|
|
|
int n, nextra;
|
|
|
|
RRTransformPtr current, pending;
|
|
|
|
char *extra;
|
2008-03-14 05:31:12 +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;
|
|
|
|
|
|
|
|
nextra = (transform_filter_length (pending) +
|
|
|
|
transform_filter_length (current));
|
|
|
|
|
2010-05-05 20:44:06 +02:00
|
|
|
reply = malloc(sizeof (xRRGetCrtcTransformReply) + nextra);
|
2008-03-15 08:36:45 +01:00
|
|
|
if (!reply)
|
|
|
|
return BadAlloc;
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
transform_encode (client, &reply->pendingTransform, &pending->transform);
|
|
|
|
extra += transform_filter_encode (client, extra,
|
|
|
|
&reply->pendingNbytesFilter,
|
|
|
|
&reply->pendingNparamsFilter,
|
|
|
|
pending);
|
|
|
|
|
|
|
|
transform_encode (client, &reply->currentTransform, ¤t->transform);
|
|
|
|
extra += transform_filter_encode (client, extra,
|
|
|
|
&reply->currentNbytesFilter,
|
|
|
|
&reply->currentNparamsFilter,
|
|
|
|
current);
|
|
|
|
|
2008-03-14 05:31:12 +01:00
|
|
|
if (client->swapped) {
|
2008-03-15 08:36:45 +01:00
|
|
|
swaps (&reply->sequenceNumber, n);
|
|
|
|
swapl (&reply->length, n);
|
2008-03-14 05:31:12 +01:00
|
|
|
}
|
2008-03-15 08:36:45 +01:00
|
|
|
WriteToClient (client, sizeof (xRRGetCrtcTransformReply) + nextra, (char *) 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
|
|
|
|
|
|
|
void
|
|
|
|
RRConstrainCursorHarder(DeviceIntPtr pDev, ScreenPtr pScreen, int mode, int *x, int *y)
|
|
|
|
{
|
|
|
|
rrScrPriv (pScreen);
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/* intentional dead space -> let it float */
|
|
|
|
if (pScrPriv->discontiguous)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* if we're moving inside a crtc, we're fine */
|
|
|
|
for (i = 0; i < pScrPriv->numCrtcs; i++) {
|
|
|
|
RRCrtcPtr crtc = pScrPriv->crtcs[i];
|
|
|
|
|
|
|
|
int left, right, top, bottom;
|
|
|
|
|
|
|
|
if (!crtc->mode)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
crtc_bounds(crtc, &left, &right, &top, &bottom);
|
|
|
|
|
|
|
|
if ((*x >= left) && (*x <= right) && (*y >= top) && (*y <= bottom))
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if we're trying to escape, clamp to the CRTC we're coming from */
|
|
|
|
for (i = 0; i < pScrPriv->numCrtcs; i++) {
|
|
|
|
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 >= right)) {
|
|
|
|
int dx = *x - nx;
|
|
|
|
|
|
|
|
if (dx > 0)
|
|
|
|
*x = right;
|
|
|
|
else if (dx < 0)
|
|
|
|
*x = left;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((*y <= top) || (*y >= bottom)) {
|
|
|
|
int dy = *y - ny;
|
|
|
|
|
|
|
|
if (dy > 0)
|
|
|
|
*y = bottom;
|
|
|
|
else if (dy < 0)
|
|
|
|
*y = top;
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|