drm/msm/mdp5: negative x/y in cursor move

Carsten Behling carsten.behling at googlemail.com
Tue Jul 10 10:11:02 UTC 2018


Hi,

modesetting X11 driver may provide negative x/y cordinates in
mdp5_crtc_cursor_move(...) call when rotation is enabled.

Because of

static int mdp5_crtc_cursor_move(struct drm_crtc *crtc, int x, int y)
{
...
mdp5_crtc->cursor.x = x = max(x, 0);
mdp5_crtc->cursor.y = y = max(y, 0);
...
}

x/y is calmped to 0/0 in those cases resulting that the cursor does not
move anymore beyond mdp5_crtc->cursor.width, mdp5_crtc->cursor.height.

For e.g rotation of 180 degree that means that the upper left cursor point
stays never reaches the region (0/0) to  (
mdp5_crtc->cursor.width/mdp5_crtc->cursor.height).

I already asked the X men if this should be fixed in modesetting driver or
in the kernel CRT
functions:

https://www.spinics.net/lists/xorg/msg58969.html

They told me to fix this in the kernel.

So, I suppose:

1.) cursor x should be rather clamped instead to

static int mdp5_crtc_cursor_move(struct drm_crtc *crtc, int x, int y) {
...
mdp5_crtc->cursor.x = x = max(x, -mdp5_crtc->cursor.width);
mdp5_crtc->cursor.y = y = max(y, -mdp5_crtc->cursor.height);
...
}

 2.) The ROI calculation must be extendet to:

static void get_roi(struct drm_crtc *crtc, uint32_t *roi_w, uint32_t *roi_h)
{
...
if (x>=0)
        *roi_w = min(mdp5_crtc->cursor.width, xres -
        mdp5_crtc->cursor.x);
else
        *roi_w = mdp5_crtc->cursor.width - abs(mdp5_crtc->cursor.x);
if (y>=0)
        *roi_h = min(mdp5_crtc->cursor.height, yres -
        mdp5_crtc->cursor.y);
else
        *roi_h = mdp5_crtc->cursor.height - abs(mdp5_crtc->cursor.y);
...
}

3.) There has to be some kind of hotspot setup
in mdp5_crtc_restore_cursor(...)

Since I have no MDP5 documentation, I don't know how to setup the hotspot
and I can't
implement 3.)

Please help!

Best regards
-Carsten
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20180710/54833bc7/attachment-0001.html>


More information about the dri-devel mailing list