modesetting: prefer primary crtc when picking over nothing

Hans de Goede hdegoede at redhat.com
Wed Aug 24 13:29:43 UTC 2016


Hi,

On 03-08-16 02:24, Dave Airlie wrote:
> So we had a bug report that epiphany was rendering slow on
> modesetting + DRI3, that I tracked down to the fact it was
> rendering offscreen to a single buffer. However due to this
> rendering being offscreen we were getting the fake crtc
> chosen by the X server as the window didn't overlap any
> active CRTCs.
>
> This didn't happen on amdgpu and I ported this patch across,
> but I believe this only fixed this problem by accident,
> it always picks the primary crtc when it needs one.
>
> But this fixes it here for me, the question is whether
> we should do better at picking the fake crtc and whether
> we should be throttling things.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=85064
> Signed-off-by: Dave Airlie <airlied at redhat.com>

Bumping this up again, I've been working on a related problem
today, where glxgears runs at 1 fps when it has 0 cover
of any master outputs, because it is displayed soleley on
a slaveoutput and the modesetting driver is used for the master
gpu.

This is more or less the same problem as this patch fixes
(and I can confirm this patch fixes it).

Since Keith seems to beleive that this patch is the wrong
solution, I've written a new patch-set where the fallback
to the primary crtc only happens if the drawable (partially)
covers at least one enabled output-slave crtc.

But I've checked and all 3 of intel, ati and nouveau have
this fallback to primary crtc if none is found behavior
epiphany seems to depend on, so it might be better
to just go with this patch instead.

I'll post my patch-set for this DRI3 on slave-output problem,
right after this mail.

Regards,

Hans





> ---
>  hw/xfree86/drivers/modesetting/vblank.c | 17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/hw/xfree86/drivers/modesetting/vblank.c b/hw/xfree86/drivers/modesetting/vblank.c
> index 77e0848..0f28f9d 100644
> --- a/hw/xfree86/drivers/modesetting/vblank.c
> +++ b/hw/xfree86/drivers/modesetting/vblank.c
> @@ -102,17 +102,26 @@ ms_covering_crtc(ScrnInfoPtr scrn,
>                   BoxPtr box, xf86CrtcPtr desired, BoxPtr crtc_box_ret)
>  {
>      xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
> -    xf86CrtcPtr crtc, best_crtc;
> +    xf86CrtcPtr crtc, best_crtc = NULL, primary_crtc = NULL;
>      int coverage, best_coverage;
>      int c;
>      BoxRec crtc_box, cover_box;
> +    RROutputPtr primary_output = NULL;
>
> -    best_crtc = NULL;
>      best_coverage = 0;
>      crtc_box_ret->x1 = 0;
>      crtc_box_ret->x2 = 0;
>      crtc_box_ret->y1 = 0;
>      crtc_box_ret->y2 = 0;
> +
> +    /* Prefer the CRTC of the primary output */
> +    if (dixPrivateKeyRegistered(rrPrivKey))
> +    {
> +        primary_output = RRFirstOutput(scrn->pScreen);
> +    }
> +    if (primary_output && primary_output->crtc)
> +        primary_crtc = primary_output->crtc->devPrivate;
> +
>      for (c = 0; c < xf86_config->num_crtc; c++) {
>          crtc = xf86_config->crtc[c];
>
> @@ -127,7 +136,9 @@ ms_covering_crtc(ScrnInfoPtr scrn,
>              *crtc_box_ret = crtc_box;
>              return crtc;
>          }
> -        if (coverage > best_coverage) {
> +        if (coverage > best_coverage ||
> +            (coverage == best_coverage &&
> +             crtc == primary_crtc)) {
>              *crtc_box_ret = crtc_box;
>              best_crtc = crtc;
>              best_coverage = coverage;
>


More information about the xorg-devel mailing list