xfree86/modes: Disambiguate driverIsPerformingTransform

The driver can now specify exactly which aspects of the transform it
wants to handle via XF86DriverTransform* flags.

Since the driver can now choose whether it wants to receive transformed
or untransformed cursor coordinates, xf86CrtcTransformCursorPos no
longer needs to be available to drivers, so make it static.

Reviewed-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
Michel Dänzer 2016-02-01 16:07:22 +09:00 committed by Michel Dänzer
parent aad96f8500
commit a991b1ec30
3 changed files with 29 additions and 24 deletions

View File

@ -70,6 +70,14 @@ typedef enum _xf86OutputStatus {
XF86OutputStatusUnknown
} xf86OutputStatus;
typedef enum _xf86DriverTransforms {
XF86DriverTransformNone = 0,
XF86DriverTransformOutput = 1 << 0,
XF86DriverTransformCursorImage = 1 << 1,
XF86DriverTransformCursorPosition = 1 << 2,
} xf86DriverTransforms;
struct xf86CrtcTileInfo {
uint32_t group_id;
uint32_t flags;
@ -237,7 +245,7 @@ typedef struct _xf86CrtcFuncs {
} xf86CrtcFuncsRec, *xf86CrtcFuncsPtr;
#define XF86_CRTC_VERSION 6
#define XF86_CRTC_VERSION 7
struct _xf86Crtc {
/**
@ -377,17 +385,22 @@ struct _xf86Crtc {
Bool shadowClear;
/**
* Indicates that the driver is handling the transform, so the shadow
* surface should be disabled. The driver writes this field before calling
* xf86CrtcRotate to indicate that it is handling the transform (including
* rotation and reflection).
* Indicates that the driver is handling some or all transforms:
*
* Setting this flag also causes the server to stop adjusting the cursor
* image and position.
* XF86DriverTransformOutput: The driver handles the output transform, so
* the shadow surface should be disabled. The driver writes this field
* before calling xf86CrtcRotate to indicate that it is handling the
* transform (including rotation and reflection).
*
* Added in ABI version 4
* XF86DriverTransformCursorImage: Setting this flag causes the server to
* pass the untransformed cursor image to the driver hook.
*
* XF86DriverTransformCursorPosition: Setting this flag causes the server
* to pass the untransformed cursor position to the driver hook.
*
* Added in ABI version 4, changed to xf86DriverTransforms in ABI version 7
*/
Bool driverIsPerformingTransform;
xf86DriverTransforms driverIsPerformingTransform;
/* Added in ABI version 5
*/
@ -991,14 +1004,6 @@ extern _X_EXPORT void
extern _X_EXPORT void
xf86_cursors_fini(ScreenPtr screen);
/**
* Transform the cursor's coordinates based on the crtc transform. Normally
* this is done by the server, but if crtc->driverIsPerformingTransform is TRUE,
* then the server does not transform the cursor position automatically.
*/
extern _X_EXPORT void
xf86CrtcTransformCursorPos(xf86CrtcPtr crtc, int *x, int *y);
#ifdef XV
/*
* For overlay video, compute the relevant CRTC and

View File

@ -54,7 +54,7 @@
static Rotation
xf86_crtc_cursor_rotation(xf86CrtcPtr crtc)
{
if (crtc->driverIsPerformingTransform)
if (crtc->driverIsPerformingTransform & XF86DriverTransformCursorImage)
return RR_Rotate_0;
return crtc->rotation;
}
@ -357,8 +357,8 @@ xf86_show_cursors(ScrnInfoPtr scrn)
}
}
void
xf86CrtcTransformCursorPos(xf86CrtcPtr crtc, int *x, int *y)
static void
xf86_crtc_transform_cursor_position(xf86CrtcPtr crtc, int *x, int *y)
{
ScrnInfoPtr scrn = crtc->scrn;
ScreenPtr screen = scrn->pScreen;
@ -401,7 +401,7 @@ xf86_crtc_set_cursor_position(xf86CrtcPtr crtc, int x, int y)
* Transform position of cursor on screen
*/
if (crtc->transform_in_use)
xf86CrtcTransformCursorPos(crtc, &crtc_x, &crtc_y);
xf86_crtc_transform_cursor_position(crtc, &crtc_x, &crtc_y);
else {
crtc_x -= crtc->x;
crtc_y -= crtc->y;
@ -421,7 +421,7 @@ xf86_crtc_set_cursor_position(xf86CrtcPtr crtc, int x, int y)
crtc->cursor_in_range = in_range;
if (in_range) {
if (crtc->driverIsPerformingTransform)
if (crtc->driverIsPerformingTransform & XF86DriverTransformCursorPosition)
crtc->funcs->set_cursor_position(crtc, x, y);
else
crtc->funcs->set_cursor_position(crtc, crtc_x, crtc_y);

View File

@ -57,7 +57,7 @@ xf86RotateCrtcRedisplay(xf86CrtcPtr crtc, RegionPtr region)
BoxPtr b = RegionRects(region);
XID include_inferiors = IncludeInferiors;
if (crtc->driverIsPerformingTransform)
if (crtc->driverIsPerformingTransform & XF86DriverTransformOutput)
return;
src = CreatePicture(None,
@ -387,7 +387,7 @@ xf86CrtcRotate(xf86CrtcPtr crtc)
new_height = 0;
}
else {
if (crtc->driverIsPerformingTransform) {
if (crtc->driverIsPerformingTransform & XF86DriverTransformOutput) {
xf86RotateDestroy(crtc);
}
else {