[PATCH xserver] Account for panning/scaling when bounding RR cursor
Chris Bagwell
chris at cnpbagwell.com
Wed Mar 28 17:36:20 PDT 2012
On Sat, Mar 24, 2012 at 10:37 PM, <chris at cnpbagwell.com> wrote:
> From: Chris Bagwell <chris at cnpbagwell.com>
>
> See Bug #39949.
>
> Commit 56c90e29f04727c903bd0f084d23bf44eb1a0a11 caused xrandr
> scaling and panning options to have cursor issues. For scaling,
> there could be a dead area of screen when scaling larger than size
> of mode. For panning, you couldn't pan bigger than mode.
>
> When returning bounds, account for panning and scaling.
Any comments on this patch? To see the issue for yourself, its as simple as:
xrandr --output XXX --scale 1.0x1.28
On my 1024x600 display and Xserver 1.11 or 1.12, that scales to
1024x768 but there is a invisible wall that blocks moving cursor
between 600 and 768.
The bug in code is obvious but this patch is untested with multiple
monitors (which patch that broke scaling/panning was addressing) and
it seems expensive to recompute output width/height every movement.
I do not have good enough understanding of all places I'd need to add
hooks to compute width/height a single time but willing to learn if
you guys think that is right direction.
Chris
>
> Signed-off-by: Chris Bagwell <chris at cnpbagwell.com>
> ---
>
> This is an RFC for Bug #39949. It does fix the issue but
> there may be better ways to solve.
>
> randr/rrcrtc.c | 24 ++++++++++++++++++++----
> 1 files changed, 20 insertions(+), 4 deletions(-)
>
> diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
> index 36caa58..d3df98a 100644
> --- a/randr/rrcrtc.c
> +++ b/randr/rrcrtc.c
> @@ -282,20 +282,36 @@ RRCrtcPendingProperties(RRCrtcPtr crtc)
> static void
> crtc_bounds(RRCrtcPtr crtc, int *left, int *right, int *top, int *bottom)
> {
> + int width, height;
> + BoxRec panned_area;
> + ScreenPtr pScreen = crtc->pScreen;
> + rrScrPrivPtr pScrPriv = rrGetScrPriv(pScreen);
> +
> *left = crtc->x;
> *top = crtc->y;
>
> + if (pScrPriv->rrGetPanning &&
> + pScrPriv->rrGetPanning(pScreen, crtc, &panned_area, NULL, NULL) &&
> + (panned_area.x2 > panned_area.x1) && (panned_area.y2 > panned_area.y1))
> + {
> + width = panned_area.x2 - panned_area.x1;
> + height = panned_area.y2 - panned_area.y1;
> + }
> + else {
> + RRCrtcGetScanoutSize(crtc, &width, &height);
> + }
> +
> 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;
> + *right = crtc->x + width;
> + *bottom = crtc->y + height;
> return;
> case RR_Rotate_90:
> case RR_Rotate_270:
> - *right = crtc->x + crtc->mode->mode.height;
> - *bottom = crtc->y + crtc->mode->mode.width;
> + *right = crtc->x + height;
> + *bottom = crtc->y + width;
> return;
> }
> }
> --
> 1.7.7.6
>
More information about the xorg-devel
mailing list