[PATCH xserver] modesetting: Fix page flipping under DRI 3.2.

Mario Kleiner mario.kleiner.de at gmail.com
Tue Apr 3 14:44:52 UTC 2018


Those are fine according to my testing, they fix mode-setting under
both depth24 and 30.

However as testing shows, still not sufficient for pageflipping if the
kms driver doesn't support full atomic (as tested on radeon-kms, and
as well under nouveau-kms without the nouveau.atomic=1 kernel boot
parameter). Even with atomic (nouveau.atomic=1, or intel-kms)
pageflipping doesn't get used when it should be if the driver exposes
num_modifiers==0, e.g., Intel Ivybridge under Linux 4.13 (whereas
Linux 4.15-something was fine under Intel).

The following snippet made pageflipping work on radeon-kms, intel-kms
(Tested Linux 4.13 and some slightly outdated drm-next), nouveau-kms
with/without nouveau.atomic=1 module parameter. I can turn it into a
proper patch later today:

diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c
b/hw/xfree86/drivers/modesetting/drmmode_display.c
index cb0ee7cbf..f1cb35d24 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -86,11 +86,13 @@ get_opaque_format(uint32_t format)
 Bool
 drmmode_is_format_supported(ScrnInfoPtr scrn, uint32_t format,
uint64_t modifier)
 {
+    modesettingPtr ms = modesettingPTR(scrn);
     xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
     int c, i, j;

     /* BO are imported as opaque surface, so let's pretend there is no alpha */
     format = get_opaque_format(format);
+    xf86DrvMsg(0, X_ERROR, "CHECK [atomic=%d]\n", ms->atomic_modeset);

     for (c = 0; c < xf86_config->num_crtc; c++) {
         xf86CrtcPtr crtc = xf86_config->crtc[c];
@@ -100,18 +102,30 @@ drmmode_is_format_supported(ScrnInfoPtr scrn,
uint32_t format, uint64_t modifier
         if (!crtc->enabled)
             continue;

+        if (drmmode_crtc->num_formats == 0) {
+            xf86DrvMsg(0, X_ERROR, "SKIPTEST\n");
+            continue;
+        }
+
         for (i = 0; i < drmmode_crtc->num_formats; i++) {
             drmmode_format_ptr iter = &drmmode_crtc->formats[i];

+            xf86DrvMsg(0, X_ERROR, "TEST\n");
             if (iter->format != format)
                 continue;
+            xf86DrvMsg(0, X_ERROR, "FORMAT\n");

-            if (modifier == DRM_FORMAT_MOD_INVALID) {
-                found = TRUE;
+            if (modifier == DRM_FORMAT_MOD_INVALID ||
+                iter->num_modifiers == 0) {
+               xf86DrvMsg(0, X_ERROR, "MODACCEPT %ld [count %d]\n",
modifier, iter->num_modifiers);
+               found = TRUE;
                 break;
             }

+            xf86DrvMsg(0, X_ERROR, "MODSTEST %d against %ld\n",
iter->num_modifiers, modifier);
             for (j = 0; j < iter->num_modifiers; j++) {
+               xf86DrvMsg(0, X_ERROR, "MODIFIER %ld - %ld\n",
iter->modifiers[j], modifier);
+
                 if (iter->modifiers[j] == modifier) {
                     found = TRUE;
                     break;
@@ -124,7 +138,7 @@ drmmode_is_format_supported(ScrnInfoPtr scrn,
uint32_t format, uint64_t modifier
         if (!found)
             return FALSE;
     }
-
+xf86DrvMsg(0, X_ERROR, "CANFLIP\n");
     return TRUE;
 }


-mario



On Thu, Mar 29, 2018 at 9:49 AM, Olivier Fourdan <ofourdan at redhat.com> wrote:
> Hi Mario,
>
> On Wed, Mar 28, 2018 at 7:42 PM, Mario Kleiner <mario.kleiner.de at gmail.com>
> wrote:
>>
>> The approach in the patch looks good to me, same as we use in weston.
>> I'll test in a few hours and let you know.
>
>
> Can you try with Luis-Francis's series (2 patches):
>
> https://patchwork.freedesktop.org/series/40855/
>
> Plus this one on top:
>
> https://patchwork.freedesktop.org/series/40860/
>
> That fixes the issue for me...
>
> Cheers,
> Olivier


More information about the xorg-devel mailing list