<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-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><code>    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;
    }</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-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><code>cursor_info->MaxWidth and cursor_info->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:rgb(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: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:rgb(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:rgb(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:rgb(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: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:rgb(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->driver_private;
    drmmode_ptr drmmode = drmmode_crtc->drmmode;

    drmModeMoveCursor(drmmode->fd, drmmode_crtc->mode_crtc->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'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'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:rgb(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: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:rgb(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;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:rgb(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>