[PATCH 25/36] randr: fixup constrain to work with slave screens.

Chris Bagwell chris at cnpbagwell.com
Tue Jul 3 07:33:56 PDT 2012


On Mon, Jul 2, 2012 at 5:13 AM, Dave Airlie <airlied at gmail.com> wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> Current code constrains the cursor to the crtcs on the master
> device, for slave outputs to work we have to include their crtcs
> in the constrain calculations.
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
>  randr/rrcrtc.c |   57 +++++++++++++++++++++++++++++++++++++++++++++-----------
>  1 file changed, 46 insertions(+), 11 deletions(-)
>
> diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
> index 29b02a9..e5fe059 100644
> --- a/randr/rrcrtc.c
> +++ b/randr/rrcrtc.c
> @@ -1544,18 +1544,10 @@ ProcRRGetCrtcTransform(ClientPtr client)
>      return Success;
>  }
>
> -void
> -RRConstrainCursorHarder(DeviceIntPtr pDev, ScreenPtr pScreen, int mode, int *x,
> -                        int *y)
> +static Bool check_all_screen_crtcs(ScreenPtr pScreen, 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];
>
> @@ -1567,8 +1559,15 @@ RRConstrainCursorHarder(DeviceIntPtr pDev, ScreenPtr pScreen, int mode, int *x,
>          crtc_bounds(crtc, &left, &right, &top, &bottom);
>
>          if ((*x >= left) && (*x < right) && (*y >= top) && (*y < bottom))
> -            return;
> +            return TRUE;
>      }
> +    return FALSE;
> +}
> +

I'm hoping I can take advantage of this section being reviewed as its
related to bug #39949.

This new check_all_screen_crtcs()'s is still calling unmodified
crtc_bounds().  That function computes bounds using
crtc->mode->mode.height/width.

If you are scaling display to greater than real size or using panning
then the bounds check causes cursor to get stuck to the smaller
portion of original screen size.

There is a proposed patch in bug report but perhaps this patch series
allows a better interface?  But probably not since I guess its
concerned more with interfaces to those original screen sizes being
hot plugged.

Chris


More information about the xorg-devel mailing list