[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freedesktop-xorg
Subject:    modesetting: HWCursor and rotation
From:       Carsten Behling <carsten.behling () googlemail ! com>
Date:       2018-07-06 14:23:38
Message-ID: CAPuGWB940mGUzpdcgpKV8vd_y435RLRiX-VF4CvH_u6uhAb9bA () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi,

I ran into a problem with the modesetting driver if using HWCursor with
rotation.

The PreInit function retrieves initially the default cursor height/width:

    ret = drmGetCap(ms->fd, DRM_CAP_CURSOR_WIDTH, &value);
    if (!ret) {
        ms->cursor_width = value;
    }
    ret = drmGetCap(ms->fd, DRM_CAP_CURSOR_HEIGHT, &value);
    if (!ret) {
        ms->cursor_height = value;
    }



DRM returns 64/64 from Freedreno driver which is later used as

cursor_info->MaxWidth and cursor_info->MaxHeight in upper left corner
calculation

if rotation is set with xrandr.


As a result I get e.g. negative cursor postion in x/y if the HW cursor buffer

is moved in display rotation of 180 degrees towards the lower/right corner.

The cursor move is ignored in this case:


static void
drmmode_set_cursor_position(xf86CrtcPtr crtc, int x, int y)
{
    drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
    drmmode_ptr drmmode = drmmode_crtc->drmmode;

    drmModeMoveCursor(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, x, y);
}


So the upper left corner of the default cursor arrow never pointed to lower

right positions that are beyond screen positions 64/64

(Note: on 180 degree rotation we are on the upper left corner of the

framebuffer).


So my question is :


Where should that be fixed?:


a) Should my DRM driver allow to move the HW cursor buffer partially
outside the frambuffer?

   Without rotation it does (towards higher addresses of the
framebuffer). With rotation

   it would go beyond the frambuffer start address (I think this is
the reason why the cursor

   move is ignored). I don't know if GPU should composite and cut off
the HWCursor buffer borders

   that fall out of the frambuffer borders.

b) Should the HW cursor buffer be resized if that positions are
reached? I don't know if DRM/GPU

   allows it and there is no code in modesetting driver that wrapes such a call.

c) Anywhere else?


Best regards

-Carsten

[Attachment #5 (text/html)]

<div dir="ltr">Hi,<div><br></div><div>I ran into a problem with the modesetting \
driver if using HWCursor with rotation.</div><div><br></div><div>The PreInit function \
retrieves initially the default cursor height/width:</div><div><br></div><div>

<pre style="padding:0px;margin:0px;color:rgb(0,0,0);font-size:13.3333px;background-col \
or:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><code> \
ret = drmGetCap(ms-&gt;fd, DRM_CAP_CURSOR_WIDTH, &amp;value);  if (!ret) {
        ms-&gt;cursor_width = value;
    }
    ret = drmGetCap(ms-&gt;fd, DRM_CAP_CURSOR_HEIGHT, &amp;value);
    if (!ret) {
        ms-&gt;cursor_height = value;
    }</code></pre>

<br></div><div><br></div><div>DRM returns 64/64 from Freedreno driver which is later \
used as  

<pre style="padding:0px;margin:0px;color:rgb(0,0,0);font-size:13.3333px;background-col \
or:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><code>cursor_info-&gt;MaxWidth \
and cursor_info-&gt;MaxHeight in upper left corner calculation</code></pre><pre \
style="padding:0px;margin:0px;color:rgb(0,0,0);font-size:13.3333px;background-color:rg \
b(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><code>if \
rotation is set with xrandr.</code></pre><pre \
style="padding:0px;margin:0px;color:rgb(0,0,0);font-size:13.3333px;background-color:rg \
b(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><code><br></code></pre><pre \
style="padding:0px;margin:0px;color:rgb(0,0,0);font-size:13.3333px;background-color:rg \
b(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><code>As \
a result I get e.g. negative cursor postion in x/y if the HW cursor \
buffer</code></pre><pre \
style="padding:0px;margin:0px;color:rgb(0,0,0);font-size:13.3333px;background-color:rg \
b(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><code>is \
moved in display rotation of 180 degrees towards the lower/right \
corner.</code></pre><pre \
style="padding:0px;margin:0px;color:rgb(0,0,0);font-size:13.3333px;background-color:rg \
b(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><code>The \
cursor move is ignored in this case:</code></pre><pre \
style="padding:0px;margin:0px;color:rgb(0,0,0);font-size:13.3333px;background-color:rg \
b(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><code><br></code></pre><pre \
style="padding:0px;margin:0px;color:rgb(0,0,0);font-size:13.3333px;background-color:rg \
b(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><code><pre \
style="padding:0px;margin:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><code>static \
void drmmode_set_cursor_position(xf86CrtcPtr crtc, int x, int y)
{
    drmmode_crtc_private_ptr drmmode_crtc = crtc-&gt;driver_private;
    drmmode_ptr drmmode = drmmode_crtc-&gt;drmmode;

    drmModeMoveCursor(drmmode-&gt;fd, drmmode_crtc-&gt;mode_crtc-&gt;crtc_id, x, y);
}
</code></pre><pre style="padding:0px;margin:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><br></pre><pre \
style="padding:0px;margin:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">So \
the upper left corner of the default cursor arrow never pointed to lower</pre><pre \
style="padding:0px;margin:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">right \
positions that are beyond screen positions 64/64</pre><pre \
style="padding:0px;margin:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">(Note: \
on 180 degree rotation we are on the upper left corner of the</pre><pre \
style="padding:0px;margin:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">framebuffer).</pre><pre \
style="padding:0px;margin:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><br></pre><pre \
style="padding:0px;margin:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">So \
my question is :</pre><pre \
style="padding:0px;margin:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><br></pre><pre \
style="padding:0px;margin:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">Where \
should that be fixed?:</pre><pre \
style="padding:0px;margin:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><br></pre><pre \
style="padding:0px;margin:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">a) \
Should my DRM driver allow to move the HW cursor buffer partially outside the \
frambuffer?</pre><pre \
style="padding:0px;margin:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"> \
Without rotation it does (towards higher addresses of the framebuffer). With \
rotation</pre><pre style="padding:0px;margin:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"> \
it would go beyond the frambuffer start address (I think this is the reason why the \
cursor</pre><pre style="padding:0px;margin:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"> \
move is ignored). I don&#39;t know if GPU should composite and cut off the HWCursor \
buffer borders</pre><pre \
style="padding:0px;margin:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"> \
that fall out of the frambuffer borders.</pre><pre \
style="padding:0px;margin:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">b) \
Should the HW cursor buffer be resized if that positions are reached? I don&#39;t \
know if DRM/GPU</pre><pre \
style="padding:0px;margin:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"> \
allows it and there is no code in modesetting driver that wrapes such a \
call.</pre><pre style="padding:0px;margin:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">c) \
Anywhere else?</pre><pre \
style="padding:0px;margin:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><br></pre><pre \
style="padding:0px;margin:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">Best \
regards</pre><pre style="padding:0px;margin:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">-Carsten \
</pre><pre style="padding:0px;margin:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><br></pre><pre \
style="padding:0px;margin:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"> \
</pre><pre style="padding:0px;margin:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><code><br></code></pre><pre \
style="padding:0px;margin:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><code><br></code></pre><pre \
style="padding:0px;margin:0px;color:rgb(0,0,0);font-size:13.3333px;background-color:rg \
b(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><code><br></code></pre><br \
class="gmail-Apple-interchange-newline">

<br></code></pre><pre \
style="padding:0px;margin:0px;color:rgb(0,0,0);font-size:13.3333px;background-color:rg \
b(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><code><br></code></pre><pre \
style="padding:0px;margin:0px;color:rgb(0,0,0);font-size:13.3333px;background-color:rg \
b(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><code> \
</code></pre><pre style="padding:0px;margin:0px;color:rgb(0,0,0);font-size:13.3333px;b \
ackground-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><code><br></code></pre><pre \
style="padding:0px;margin:0px;color:rgb(0,0,0);font-size:13.3333px;background-color:rg \
b(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><code><br></code></pre>


</div><div><br></div><div><br></div><div><br></div></div>


[Attachment #6 (text/plain)]

_______________________________________________
xorg@lists.x.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: https://lists.x.org/mailman/listinfo/xorg
Your subscription address: %(user_address)s

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic