mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/virtio: add ARGB8888 support for primary planes
@ 2026-09-30 13:27 Dorinda Bassey
  2026-09-30 15:03 ` Thomas Zimmermann
  0 siblings, 1 reply; 5+ messages in thread
From: Dorinda Bassey @ 2026-09-30 13:27 UTC (permalink / raw)
  To: dri-devel, virtualization
  Cc: kraxel, airlied, dmitry.osipenko, slp, mhrica, gurchetansingh,
	mripard, tzimmermann, simona, linux-kernel, Dorinda Bassey

Add DRM_FORMAT_HOST_ARGB8888 to the list of supported formats for
virtio-gpu primary planes. Without this, glmark2-drm fails at
startup because it selects ARGB visual configs by default, which
don't match the XRGB-only plane capabilities. This causes
drmModeSetCrtc to fail with EINVAL.

The virtio_gpu_translate_format() function already handles
ARGB8888 translation to VIRTIO_GPU_FORMAT_B8G8R8A8_UNORM,
so this just exposes the existing capability to userspace.

Signed-off-by: Dorinda Bassey <dbassey@redhat.com>
---
 drivers/gpu/drm/virtio/virtgpu_plane.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c
index b422eba42a5f..5f0bc1b1931b 100644
--- a/drivers/gpu/drm/virtio/virtgpu_plane.c
+++ b/drivers/gpu/drm/virtio/virtgpu_plane.c
@@ -37,6 +37,7 @@
 
 static const uint32_t virtio_gpu_formats[] = {
 	DRM_FORMAT_HOST_XRGB8888,
+	DRM_FORMAT_HOST_ARGB8888,
 };
 
 static const uint32_t virtio_gpu_cursor_formats[] = {
-- 
2.55.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/virtio: add ARGB8888 support for primary planes
  2026-09-30 13:27 [PATCH] drm/virtio: add ARGB8888 support for primary planes Dorinda Bassey
@ 2026-09-30 15:03 ` Thomas Zimmermann
  2026-10-01 10:46   ` Dmitry Osipenko
       [not found]   ` <CACzuRywG=AcFkXp6vw4ExzBz1Z2SA=mr7oJBEKB3_zTnTMsh0w@mail.gmail.com>
  0 siblings, 2 replies; 5+ messages in thread
From: Thomas Zimmermann @ 2026-09-30 15:03 UTC (permalink / raw)
  To: Dorinda Bassey, dri-devel, virtualization
  Cc: kraxel, airlied, dmitry.osipenko, slp, mhrica, gurchetansingh,
	mripard, simona, linux-kernel

Hi

Am 30.09.26 um 15:27 schrieb Dorinda Bassey:
> Add DRM_FORMAT_HOST_ARGB8888 to the list of supported formats for
> virtio-gpu primary planes. Without this, glmark2-drm fails at
> startup because it selects ARGB visual configs by default, which
> don't match the XRGB-only plane capabilities. This causes
> drmModeSetCrtc to fail with EINVAL.

But does the host also support ARGB on the primary plane? We usually 
don't export formats that are not available in (virtual) hardware.

Best regards
Thomas

>
> The virtio_gpu_translate_format() function already handles
> ARGB8888 translation to VIRTIO_GPU_FORMAT_B8G8R8A8_UNORM,
> so this just exposes the existing capability to userspace.
>
> Signed-off-by: Dorinda Bassey <dbassey@redhat.com>
> ---
>   drivers/gpu/drm/virtio/virtgpu_plane.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c
> index b422eba42a5f..5f0bc1b1931b 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_plane.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_plane.c
> @@ -37,6 +37,7 @@
>   
>   static const uint32_t virtio_gpu_formats[] = {
>   	DRM_FORMAT_HOST_XRGB8888,
> +	DRM_FORMAT_HOST_ARGB8888,
>   };
>   
>   static const uint32_t virtio_gpu_cursor_formats[] = {

-- 
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Stefan Gaiser, Jochen Jaser, Abhinav Puri, (HRB 36809, AG Nürnberg)



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/virtio: add ARGB8888 support for primary planes
  2026-09-30 15:03 ` Thomas Zimmermann
@ 2026-10-01 10:46   ` Dmitry Osipenko
  2026-10-01 13:31     ` Thomas Zimmermann
       [not found]   ` <CACzuRywG=AcFkXp6vw4ExzBz1Z2SA=mr7oJBEKB3_zTnTMsh0w@mail.gmail.com>
  1 sibling, 1 reply; 5+ messages in thread
From: Dmitry Osipenko @ 2026-10-01 10:46 UTC (permalink / raw)
  To: Thomas Zimmermann, Dorinda Bassey, dri-devel, virtualization
  Cc: kraxel, airlied, slp, mhrica, gurchetansingh, mripard, simona,
	linux-kernel

On 9/30/26 18:03, Thomas Zimmermann wrote:
> Hi
> 
> Am 30.09.26 um 15:27 schrieb Dorinda Bassey:
>> Add DRM_FORMAT_HOST_ARGB8888 to the list of supported formats for
>> virtio-gpu primary planes. Without this, glmark2-drm fails at
>> startup because it selects ARGB visual configs by default, which
>> don't match the XRGB-only plane capabilities. This causes
>> drmModeSetCrtc to fail with EINVAL.
> 
> But does the host also support ARGB on the primary plane? We usually
> don't export formats that are not available in (virtual) hardware.
> 
> Best regards
> Thomas
> 
>>
>> The virtio_gpu_translate_format() function already handles
>> ARGB8888 translation to VIRTIO_GPU_FORMAT_B8G8R8A8_UNORM,
>> so this just exposes the existing capability to userspace.
>>
>> Signed-off-by: Dorinda Bassey <dbassey@redhat.com>
>> ---
>>   drivers/gpu/drm/virtio/virtgpu_plane.c | 1 +
>>   1 file changed, 1 insertion(+)

For primary plane, alpha channel often doesn't matter as primary has
fixed z=0 order and a usual alpha blending mode would account only
overlay's alpha channel. Many real hw drivers expose alpha-channel
formats for primary plane for compatibility with userspace, even though
for them the alpha has no meaning for the primary plane.

QEMU is most popular VMM using virtio-gpu, but there are others. For a
stricter compatibility we can translate B8G8R8A8 to X8R8G8B8 for the
primary plane in the driver code, but I assume in practice it's very
unlike this will be necessary and we can always do it later on if will
be needed.

The change looks okay, will apply after testing.

-- 
Best regards,
Dmitry

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/virtio: add ARGB8888 support for primary planes
       [not found]   ` <CACzuRywG=AcFkXp6vw4ExzBz1Z2SA=mr7oJBEKB3_zTnTMsh0w@mail.gmail.com>
@ 2026-10-01 13:28     ` Thomas Zimmermann
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Zimmermann @ 2026-10-01 13:28 UTC (permalink / raw)
  To: Dorinda Bassey
  Cc: dri-devel, virtualization, kraxel, airlied, dmitry.osipenko, slp,
	mhrica, gurchetansingh, mripard, simona, linux-kernel



Am 30.09.26 um 18:12 schrieb Dorinda Bassey:
> Hi Thomas,
>
>     But does the host also support ARGB on the primary plane? We usually
>     don't export formats that are not available in (virtual) hardware.
>
>
> If you're asking about the hypervisor side providing the Virtual GPU,
> Yes the host supports ARGB on primary plane. QEMU's virtio-gpu

Ok, thanks.

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>


> supports this see qemu's include/hw/virtio/virtio-gpu-pixman.h:26
> libkrun's virtio-gpu includes `B8G8R8A8_UNORM` in its
> ResourceFormat enum and maps it to display backend formats.
> Virglrenderer, which vhost-device-gpu also uses, maps
> `GBM_FORMAT_ARGB8888` to `VIRGL_FORMAT_B8G8R8A8_UNORM`.
> Other VMMs I've tested also support this format.
>
> Also I see the cursor plane in the virtio-gpu driver already exposes
> `DRM_FORMAT_HOST_ARGB8888`, confirming existing ARGB support
> in backends. I tested this with the vhost-user-gpu backend from -
> https://github.com/rust-vmm/vhost-device/tree/main/vhost-device-gpu
> and the libkrun guest, glmark2-drm renders correctly with it.
>
> BR,
> Dorinda.
>
>
> On Wed, Sep 30, 2026 at 5:04 PM Thomas Zimmermann 
> <tzimmermann@suse.de> wrote:
>
>     Hi
>
>     Am 30.09.26 um 15:27 schrieb Dorinda Bassey:
>     > Add DRM_FORMAT_HOST_ARGB8888 to the list of supported formats for
>     > virtio-gpu primary planes. Without this, glmark2-drm fails at
>     > startup because it selects ARGB visual configs by default, which
>     > don't match the XRGB-only plane capabilities. This causes
>     > drmModeSetCrtc to fail with EINVAL.
>
>     But does the host also support ARGB on the primary plane? We usually
>     don't export formats that are not available in (virtual) hardware.
>
>     Best regards
>     Thomas
>
>     >
>     > The virtio_gpu_translate_format() function already handles
>     > ARGB8888 translation to VIRTIO_GPU_FORMAT_B8G8R8A8_UNORM,
>     > so this just exposes the existing capability to userspace.
>     >
>     > Signed-off-by: Dorinda Bassey <dbassey@redhat.com>
>     > ---
>     >   drivers/gpu/drm/virtio/virtgpu_plane.c | 1 +
>     >   1 file changed, 1 insertion(+)
>     >
>     > diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c
>     b/drivers/gpu/drm/virtio/virtgpu_plane.c
>     > index b422eba42a5f..5f0bc1b1931b 100644
>     > --- a/drivers/gpu/drm/virtio/virtgpu_plane.c
>     > +++ b/drivers/gpu/drm/virtio/virtgpu_plane.c
>     > @@ -37,6 +37,7 @@
>     >
>     >   static const uint32_t virtio_gpu_formats[] = {
>     >       DRM_FORMAT_HOST_XRGB8888,
>     > +     DRM_FORMAT_HOST_ARGB8888,
>     >   };
>     >
>     >   static const uint32_t virtio_gpu_cursor_formats[] = {
>
>     -- 
>     --
>     Thomas Zimmermann
>     Graphics Driver Developer
>     SUSE Software Solutions Germany GmbH
>     Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
>     <http://www.suse.com>
>     GF: Stefan Gaiser, Jochen Jaser, Abhinav Puri, (HRB 36809, AG
>     Nürnberg)
>
>

-- 
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Stefan Gaiser, Jochen Jaser, Abhinav Puri, (HRB 36809, AG Nürnberg)



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/virtio: add ARGB8888 support for primary planes
  2026-10-01 10:46   ` Dmitry Osipenko
@ 2026-10-01 13:31     ` Thomas Zimmermann
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Zimmermann @ 2026-10-01 13:31 UTC (permalink / raw)
  To: Dmitry Osipenko, Dorinda Bassey, dri-devel, virtualization
  Cc: kraxel, airlied, slp, mhrica, gurchetansingh, mripard, simona,
	linux-kernel

Hi

Am 01.10.26 um 12:46 schrieb Dmitry Osipenko:
> On 9/30/26 18:03, Thomas Zimmermann wrote:
>> Hi
>>
>> Am 30.09.26 um 15:27 schrieb Dorinda Bassey:
>>> Add DRM_FORMAT_HOST_ARGB8888 to the list of supported formats for
>>> virtio-gpu primary planes. Without this, glmark2-drm fails at
>>> startup because it selects ARGB visual configs by default, which
>>> don't match the XRGB-only plane capabilities. This causes
>>> drmModeSetCrtc to fail with EINVAL.
>> But does the host also support ARGB on the primary plane? We usually
>> don't export formats that are not available in (virtual) hardware.
>>
>> Best regards
>> Thomas
>>
>>> The virtio_gpu_translate_format() function already handles
>>> ARGB8888 translation to VIRTIO_GPU_FORMAT_B8G8R8A8_UNORM,
>>> so this just exposes the existing capability to userspace.
>>>
>>> Signed-off-by: Dorinda Bassey <dbassey@redhat.com>
>>> ---
>>>    drivers/gpu/drm/virtio/virtgpu_plane.c | 1 +
>>>    1 file changed, 1 insertion(+)
> For primary plane, alpha channel often doesn't matter as primary has
> fixed z=0 order and a usual alpha blending mode would account only
> overlay's alpha channel. Many real hw drivers expose alpha-channel
> formats for primary plane for compatibility with userspace, even though
> for them the alpha has no meaning for the primary plane.

We decidedly do not offer formats that are not native to the hardware; 
except for adding XRGB888.


>
> QEMU is most popular VMM using virtio-gpu, but there are others. For a
> stricter compatibility we can translate B8G8R8A8 to X8R8G8B8 for the
> primary plane in the driver code, but I assume in practice it's very
> unlike this will be necessary and we can always do it later on if will
> be needed.

No in-kernel format conversion please; again except for adding XRGB8888.

Best regards
Thomas


>
> The change looks okay, will apply after testing.
>

-- 
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Stefan Gaiser, Jochen Jaser, Abhinav Puri, (HRB 36809, AG Nürnberg)



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-10-01 13:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-30 13:27 [PATCH] drm/virtio: add ARGB8888 support for primary planes Dorinda Bassey
2026-09-30 15:03 ` Thomas Zimmermann
2026-10-01 10:46   ` Dmitry Osipenko
2026-10-01 13:31     ` Thomas Zimmermann
     [not found]   ` <CACzuRywG=AcFkXp6vw4ExzBz1Z2SA=mr7oJBEKB3_zTnTMsh0w@mail.gmail.com>
2026-10-01 13:28     ` Thomas Zimmermann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®