[v2,xserver] modesetting: Fall back to primary crtc for vblank for drawables on slave outputs

Submitted by Hans de Goede on Aug. 25, 2016, 10:44 a.m.

Details

Message ID 20160825104435.9289-1-hdegoede@redhat.com
State Accepted
Commit d8e05c04758cbcd7b5c11362cb28ce017d50098b
Headers show
Series "modesetting: Fall back to primary crtc for vblank for drawables on slave outputs" ( rev: 1 ) in X.org (DEPRECATED - USE GITLAB)

Not browsing as part of any series.

Commit Message

Hans de Goede Aug. 25, 2016, 10:44 a.m.
This fixes glxgears running at 1 fps when fully covering a slave-output
and the modesetting driver is used for the master gpu.

Reported-by: Peter Wu <peter@lekensteyn.nl>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Changes in v2:
-Only fallback to primary crtc if it is in DPMSModeOn
---
 hw/xfree86/drivers/modesetting/vblank.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

Patch hide | download patch | download mbox

diff --git a/hw/xfree86/drivers/modesetting/vblank.c b/hw/xfree86/drivers/modesetting/vblank.c
index ec60ac4..8f66ae8 100644
--- a/hw/xfree86/drivers/modesetting/vblank.c
+++ b/hw/xfree86/drivers/modesetting/vblank.c
@@ -129,6 +129,32 @@  ms_covering_crtc(ScreenPtr pScreen, BoxPtr box, Bool screen_is_ms)
             best_coverage = coverage;
         }
     }
+
+    /* Fallback to primary crtc for drawable's on slave outputs */
+    if (best_crtc == NULL && !pScreen->isGPU) {
+        RROutputPtr primary_output = NULL;
+        ScreenPtr slave;
+
+        if (dixPrivateKeyRegistered(rrPrivKey))
+            primary_output = RRFirstOutput(scrn->pScreen);
+        if (!primary_output || !primary_output->crtc)
+            return NULL;
+
+        crtc = primary_output->crtc->devPrivate;
+        if (!ms_crtc_on(crtc))
+            return NULL;
+
+        xorg_list_for_each_entry(slave, &pScreen->slave_list, slave_head) {
+            if (!slave->is_output_slave)
+                continue;
+
+            if (ms_covering_crtc(slave, box, FALSE)) {
+                /* The drawable is on a slave output, return primary crtc */
+                return crtc;
+            }
+        }
+    }
+
     return best_crtc;
 }
 

Comments

Note subject should include 3/3 as this is a v2 of a patch from my
previous set. git send-email --start-number 3 did not do what I
expected ...

On 25-08-16 12:44, Hans de Goede wrote:
> This fixes glxgears running at 1 fps when fully covering a slave-output
> and the modesetting driver is used for the master gpu.
>
> Reported-by: Peter Wu <peter@lekensteyn.nl>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> Changes in v2:
> -Only fallback to primary crtc if it is in DPMSModeOn
> ---
>  hw/xfree86/drivers/modesetting/vblank.c | 26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
>
> diff --git a/hw/xfree86/drivers/modesetting/vblank.c b/hw/xfree86/drivers/modesetting/vblank.c
> index ec60ac4..8f66ae8 100644
> --- a/hw/xfree86/drivers/modesetting/vblank.c
> +++ b/hw/xfree86/drivers/modesetting/vblank.c
> @@ -129,6 +129,32 @@ ms_covering_crtc(ScreenPtr pScreen, BoxPtr box, Bool screen_is_ms)
>              best_coverage = coverage;
>          }
>      }
> +
> +    /* Fallback to primary crtc for drawable's on slave outputs */
> +    if (best_crtc == NULL && !pScreen->isGPU) {
> +        RROutputPtr primary_output = NULL;
> +        ScreenPtr slave;
> +
> +        if (dixPrivateKeyRegistered(rrPrivKey))
> +            primary_output = RRFirstOutput(scrn->pScreen);
> +        if (!primary_output || !primary_output->crtc)
> +            return NULL;
> +
> +        crtc = primary_output->crtc->devPrivate;
> +        if (!ms_crtc_on(crtc))
> +            return NULL;
> +
> +        xorg_list_for_each_entry(slave, &pScreen->slave_list, slave_head) {
> +            if (!slave->is_output_slave)
> +                continue;
> +
> +            if (ms_covering_crtc(slave, box, FALSE)) {
> +                /* The drawable is on a slave output, return primary crtc */
> +                return crtc;
> +            }
> +        }
> +    }
> +
>      return best_crtc;
>  }
>
>