[PATCH xserver] cursor: add hw cursor support for prime

Hans de Goede hdegoede at redhat.com
Tue Sep 6 10:37:41 UTC 2016


Hi,

On 06-09-16 03:30, Michel Dänzer wrote:
> On 05/09/16 10:42 PM, Hans de Goede wrote:
>> Hi,
>>
>> Subject should have contained v4, resending so that we've
>> the right version in patchwork. Sorry.
>
> Hmm, for some reason I'm not receiving your recent patches from the
> mailing list, though I can see them in the list archives and in patchwork.
>
>
> Does v4 work correctly with e.g. rotated slave outputs? AFAIR an earlier
> revision didn't when I tested it.

Good one, just tested this (at the beginning of this morning)
and you're right it does not work. So I've been
spend the rest of my morning fixing this. v5 of
this patch (which will be a patch-set) will include
a fix for this.

>>> Changes in v2:
>>> -hotplugging causes the driver to try and register
>>>  the cursor private, however we can't register
>>>  these at runtime yet, we need to add support for
>>>  reallocation of cursor screen privates. However
>>>  all hotplugged devices currently don't support
>>>  HW cursors, so punt for now. This means GPUs
>>>  already in the system will get hw cursors
>>>  and USB ones won't which is all we care about
>>>  presently.
>
> Note that this isn't strictly true, see e.g.
> https://bugs.freedesktop.org/show_bug.cgi?id=97313 for a (failed)
> attempt to hotplug a GPU screen which could support HW cursors.

I realize that, but adding support for hw
cursors on hot plugged GPUs is non trivial due to
how the Xserver manages screen privates.

Fixing that really falls outside of the scope of
this patch, also see my reply to Keith's question
about this.

Note I've been testing with hot-plugged USB GPUs
to make sure that this does work and propreperly
falls back to a sw cursor.

Fixing this in a separate patch (fixing the
privates code) should be doable without having
to redo any of the work done in this patch
(it really is an orthogonal problem).

>>> diff --git a/dix/privates.c b/dix/privates.c
>>> index 969d014..478f52c 100644
>>> --- a/dix/privates.c
>>> +++ b/dix/privates.c
>>> @@ -783,3 +783,12 @@ dixResetPrivates(void)
>>>          global_keys[t].allocated = 0;
>>>      }
>>>  }
>>> +
>>> +Bool
>>> +dixPrivatesCreated(DevPrivateType type)
>>> +{
>>> +    if (global_keys[type].created)
>>> +        return TRUE;
>>> +    else
>>> +        return FALSE;
>>> +}
>
> This should probably be a separate patch.
>
>
>>> diff --git a/hw/xfree86/ramdac/xf86Cursor.c
>>> b/hw/xfree86/ramdac/xf86Cursor.c
>>> index dda4349..afcce53 100644
>>> --- a/hw/xfree86/ramdac/xf86Cursor.c
>>> +++ b/hw/xfree86/ramdac/xf86Cursor.c
>>> @@ -337,16 +337,9 @@ xf86CursorSetCursor(DeviceIntPtr pDev, ScreenPtr
>>> pScreen, CursorPtr pCurs,
>>>              return;
>>>          }
>>>
>>> -        if (infoPtr->pScrn->vtSema &&
>>> xorg_list_is_empty(&pScreen->pixmap_dirty_list) &&
>>> +        if (infoPtr->pScrn->vtSema &&
>>>              (ScreenPriv->ForceHWCursorCount ||
>>> -             ((
>>> -               cursor->bits->argb &&
>>> -               infoPtr->UseHWCursorARGB &&
>>> -               (*infoPtr->UseHWCursorARGB)(pScreen, cursor)) ||
>>> -              (cursor->bits->argb == 0 &&
>>> -               (cursor->bits->height <= infoPtr->MaxHeight) &&
>>> -               (cursor->bits->width <= infoPtr->MaxWidth) &&
>>> -               (!infoPtr->UseHWCursor || (*infoPtr->UseHWCursor)
>>> (pScreen, cursor)))))) {
>>> +             xf86CheckHWCursor(pScreen, cursor, infoPtr))) {
>>>
>>>              if (ScreenPriv->SWCursor)   /* remove the SW cursor */
>>>                  (*ScreenPriv->spriteFuncs->SetCursor) (pDev, pScreen,
>
> At least the initial refactoring of xf86CheckHWCursor should also be a
> separate patch, for easier review of this patch and better bisectability.

Ok, I'll split out all the helpers this patch adds into separate
patches for v5.

Regards,

Hans


More information about the xorg-devel mailing list