Benno Fünfstück <[email protected]> writes:

> Hi Marc-André,
>
> On Mon, 13 Apr 2026 at 15:23, Marc-André Lureau <[email protected]> 
> wrote:
>
>  Arguably, this is a bug in virgl vrend_renderer_get_cursor_content(),
>  since the function doesn't return y0_top it should always return the
>  data in the correct orientation.
>
>  We may have a temporary workaround in qemu though for older virgl, but
>  I think it should be solved there too.
>
> Thanks, I didn't know about this. I submitted a MR to virglrenderer now as 
> well to fix it there:
> https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/1611

I see this is merged now. Do we want to version gate the fix or just
drop it and wait for things to be backported?

>
> How should I change the patch to make it a temporary fix? Some kind of 
> version gate (but not sure yet in which version of
> virglrenderer the fix will end up being release)?
>  
>  
>  > ---
>  >  hw/display/virtio-gpu-gl.c | 20 +++++++++++++++++++-
>  >  1 file changed, 19 insertions(+), 1 deletion(-)
>  >
>  > diff --git a/hw/display/virtio-gpu-gl.c b/hw/display/virtio-gpu-gl.c
>  > index 2b7a41c466..4562d3405e 100644
>  > --- a/hw/display/virtio-gpu-gl.c
>  > +++ b/hw/display/virtio-gpu-gl.c
>  > @@ -33,6 +33,9 @@ static void virtio_gpu_gl_update_cursor_data(VirtIOGPU 
> *g,
>  >      VirtIOGPUGL *gl = VIRTIO_GPU_GL(g);
>  >      uint32_t width, height;
>  >      uint32_t pixels, *data;
>  > +    bool y_0_top = true;
>  > +    int ret;
>  > +    struct virgl_renderer_resource_info info;
>  >
>  >      if (gl->renderer_state != RS_INITED) {
>  >          return;
>  > @@ -49,8 +52,23 @@ static void virtio_gpu_gl_update_cursor_data(VirtIOGPU 
> *g,
>  >          return;
>  >      }
>  >
>  > +    memset(&info, 0, sizeof(info));
>  > +    ret = virgl_renderer_resource_get_info(resource_id, &info);
>  > +    if (ret == 0) {
>  > +        y_0_top = info.flags & VIRTIO_GPU_RESOURCE_FLAG_Y_0_TOP;
>  > +    }
>  > +
>  >      pixels = s->current_cursor->width * s->current_cursor->height;
>  > -    memcpy(s->current_cursor->data, data, pixels * sizeof(uint32_t));
>  > +    if (y_0_top) {
>  > +        memcpy(s->current_cursor->data, data, pixels * sizeof(uint32_t));
>  > +    } else {
>  > +        uint32_t *dst = s->current_cursor->data;
>  > +        for (uint32_t y = 0; y < height; y++) {
>  > +            memcpy(dst + y * width,
>  > +                   data + (height - 1 - y) * width,
>  > +                   width * sizeof(uint32_t));
>  > +        }
>  > +    }
>  >      free(data);
>  >  }
>  >
>  > --
>  > 2.50.1 (Apple Git-155)
>  >
>  >
>  > --
>  > Neodyme AG
>  > Sitz der Gesellschaft / Address: Dirnismaning 55 | Halle 13 |
>  > 85748 Garching b.München
>  > Postanschrift: Rosenthaler Straße 72a | 10119
>  > Berlin
>  >
>  > Registergericht / Registry court: München, HRB 269168
>  > Vorstand /
>  > Management Board: Thomas Lambertz | Tobias Madl
>  > Aufsichtsratsvorsitzender /
>  > Chairman of the Supervisory Board: Hendrik Hofstadt
>  >
>  >
>  >
>  >
>  >
>
>  -- 
>  Marc-André Lureau
>
> Neodyme AG
>
> Sitz der Gesellschaft / Address: Dirnismaning 55 | Halle 13 | 85748 Garching 
> b.München
> Postanschrift: ​Rosenthaler Straße 72a | ​10119 Berlin
> Registergericht / Registry court: München, HRB 269168
> Vorstand / Management Board: Thomas Lambertz | Tobias Madl
> Aufsichtsratsvorsitzender / Chairman of the Supervisory Board: Hendrik 
> Hofstadt

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro

Reply via email to