drm/virtio: add ARGB8888 support for primary planes
Subsystems (4)
PATCH 1/1 drm/virtio: add ARGB8888 support for primary planes
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.
--- drivers/gpu/drm/virtio/virtgpu_plane.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/virtio/virtgpu_plane.c +1 -0
@@ -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[] = {
Signature · 1 line
2.55.0
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] drm/virtio: missing blend mode property for primary planes with alpha format --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] drm/virtio: missing blend mode property for primary planes with alpha format --
commit 9355c68bd37dd7d0e90b6eec00d769a8fd8ff04f
Author: Dorinda Bassey <[email protected]>
drm/virtio: add ARGB8888 support for primary planes
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.
drivers/gpu/drm/virtio/virtgpu_plane.c line 42
Quoted 10 lines
drivers/gpu/drm/virtio/virtgpu_plane.c +1
-0@@ -38,6 +38,7 @@static const uint32_t virtio_gpu_formats[] = {DRM_FORMAT_HOST_XRGB8888 , +DRM_FORMAT_HOST_ARGB8888 , };
[Severity: Medium]
Does adding ARGB8888 support here also require adding a blend mode property for the primary plane?
Looking at virtio_gpu_plane_init() in drivers/gpu/drm/virtio/virtgpu_plane.c, the blend mode property is currently only created for cursor planes:
if (type == DRM_PLANE_TYPE_PRIMARY) drm_plane_enable_fb_damage_clips(plane); else if (type == DRM_PLANE_TYPE_CURSOR) drm_plane_create_blend_mode_property(plane, BIT(DRM_MODE_BLEND_PREMULTI));
Since the primary plane now exposes a format with an alpha channel (DRM_FORMAT_HOST_ARGB8888), userspace compositors (like Wayland/Mutter) will expect a blend mode property.
When a DRM client queries the properties of the primary plane after the driver exposes this format, the missing blend mode property may prevent userspace from correctly discovering or configuring the blend state. This can potentially lead to incorrect blending or fallback to software composition.
Should the primary plane also be updated to create the blend mode property in virtio_gpu_plane_init()?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Thomas Zimmermann
maintainerHi
Am 30.09.26 um 15:27 schrieb Dorinda Bassey:
Quoted 5 lines
Add
DRM_FORMAT_HOST_ARGB8888to 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
Quoted 22 lines
The
virtio_gpu_translate_format()function already handles ARGB8888 translation toVIRTIO_GPU_FORMAT_B8G8R8A8_UNORM, so this just exposes the existing capability to userspace.Signed-off-by Dorinda Bassey <[email protected]>--- drivers/gpu/drm/virtio/virtgpu_plane.c | 1 + 1 file changed, 1 insertion(+)drivers/gpu/drm/virtio/virtgpu_plane.c +1
-0@@ -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[] = {
Signature · 6 lines
-- 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)
Hi Thomas,
But does the host also support ARGB on the primary plane? We usually
Quoted 1 line
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 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.
Quoted 49 lines · Thomas Zimmermann
Hi
Am 30.09.26 um 15:27 schrieb Dorinda Bassey:
Quoted 5 lines
Add
DRM_FORMAT_HOST_ARGB8888to 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
ThomasReview
Quoted 11 lines
The
virtio_gpu_translate_format()function already handles ARGB8888 translation toVIRTIO_GPU_FORMAT_B8G8R8A8_UNORM, so this just exposes the existing capability to userspace.Signed-off-by Dorinda Bassey <[email protected]>--- drivers/gpu/drm/virtio/virtgpu_plane.c | 1 + 1 file changed, 1 insertion(+)(quoted diff) +0
-0
b/drivers/gpu/drm/virtio/virtgpu_plane.cdrivers/gpu/drm/virtio/virtgpu_plane.c line 43
Quoted 11 lines
index
b422eba42a5f..5f0bc1b1931b100644drivers/gpu/drm/virtio/virtgpu_plane.c +1
-0@@ -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)
Am 30.09.26 um 18:12 schrieb Dorinda Bassey:
Quoted 8 lines
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.
Quoted 69 lines
supports this see qemu's
include/hw/virtio/virtio-gpu-pixman.h:26libkrun's virtio-gpu includesB8G8R8A8_UNORMin its ResourceFormat enum and maps it to display backend formats. Virglrenderer, which vhost-device-gpu also uses, mapsGBM_FORMAT_ARGB8888toVIRGL_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 <[email protected]> wrote:
Hi
Am 30.09.26 um 15:27 schrieb Dorinda Bassey:
> AddDRM_FORMAT_HOST_ARGB8888to 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>
> Thevirtio_gpu_translate_format()function already handles > ARGB8888 translation toVIRTIO_GPU_FORMAT_B8G8R8A8_UNORM, > so this just exposes the existing capability to userspace. >
> Signed-off-by: Dorinda Bassey <[email protected]> > ---
> drivers/gpu/drm/virtio/virtgpu_plane.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --gita/drivers/gpu/drm/virtio/virtgpu_plane.cb/drivers/gpu/drm/virtio/virtgpu_plane.c
> indexb422eba42a5f..5f0bc1b1931b100644
> ---a/drivers/gpu/drm/virtio/virtgpu_plane.c
> +++b/drivers/gpu/drm/virtio/virtgpu_plane.c
> @@ -37,6 +37,7 @@
>
> static constuint32_tvirtio_gpu_formats[] = { > DRM_FORMAT_HOST_XRGB8888,
> + DRM_FORMAT_HOST_ARGB8888,
> };
>
> static constuint32_tvirtio_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)
Signature · 6 lines
-- 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)
Dmitry Osipenko
maintainerQuoted 9 lines · Thomas Zimmermann
Hi
Am 30.09.26 um 15:27 schrieb Dorinda Bassey:
Quoted 5 lines
Add
DRM_FORMAT_HOST_ARGB8888to 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.
Quoted 15 lines
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
ThomasQuoted 9 lines
The
virtio_gpu_translate_format()function already handles ARGB8888 translation toVIRTIO_GPU_FORMAT_B8G8R8A8_UNORM, so this just exposes the existing capability to userspace.Signed-off-by Dorinda Bassey <[email protected]>---
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.
Signature · 2 lines
Best regards, Dmitry
Thomas Zimmermann
maintainerHi
Am 01.10.26 um 12:46 schrieb Dmitry Osipenko:
Quoted 23 lines · Thomas Zimmermann
Quoted 8 lines
Hi
Am 30.09.26 um 15:27 schrieb Dorinda Bassey:
Quoted 5 lines
Add
DRM_FORMAT_HOST_ARGB8888to 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.Quoted 14 lines
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
ThomasQuoted 8 lines
The
virtio_gpu_translate_format()function already handles ARGB8888 translation toVIRTIO_GPU_FORMAT_B8G8R8A8_UNORM, so this just exposes the existing capability to userspace.Signed-off-by Dorinda Bassey <[email protected]>--- drivers/gpu/drm/virtio/virtgpu_plane.c | 1 + 1 file changed, 1 insertion(+)
Quoted 5 lines
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.
Quoted 6 lines
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
Quoted 3 lines
The change looks okay, will apply after testing.
Signature · 6 lines
-- 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)
Quoted 37 lines · Thomas Zimmermann
Hi
Am 01.10.26 um 12:46 schrieb Dmitry Osipenko:
Quoted 23 lines · Thomas Zimmermann
Quoted 8 lines
Hi
Am 30.09.26 um 15:27 schrieb Dorinda Bassey:
Quoted 5 lines
Add
DRM_FORMAT_HOST_ARGB8888to 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.Quoted 14 lines
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
ThomasQuoted 8 lines
The
virtio_gpu_translate_format()function already handles ARGB8888 translation toVIRTIO_GPU_FORMAT_B8G8R8A8_UNORM, so this just exposes the existing capability to userspace.Signed-off-by Dorinda Bassey <[email protected]>---
drivers/gpu/drm/virtio/virtgpu_plane.c| 1 +1 file changed, 1 insertion(+)Quoted 5 lines
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.
Quoted 1 line
Quoted 7 lines
Quoted 5 lines
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.
Chances are low this may ever become necessary. Confirm glmark2-drm now works with this change.
Applied to misc-next
Signature · 2 lines
Best regards, Dmitry