Skip to content

Commit 0d6abe4

Browse files
cristicc6by9
authored andcommitted
drm/vkms: Support setting custom background color
Commit 0b9eff726d56 upstream Make use of the BACKGROUND_COLOR CRTC property when filling the background during blending. It already defaults to solid black. Since the internal representation of the pixel color in VKMS relies on 16 bits of precision, use the newly introduced DRM_ARGB64_GET{R|G|B}() helpers to access the individual components of the background color property, which is compliant with DRM_FORMAT_ARGB16161616. It's worth noting the alpha component is ignored, hence non-opaque background colors are not supported. Reviewed-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Tested-by: Diederik de Haas <diederik@cknow-tech.com> Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> Link: https://patch.msgid.link/20260303-rk3588-bgcolor-v8-3-fee377037ad1@collabora.com Signed-off-by: Daniel Stone <daniels@collabora.com>
1 parent 1b33eee commit 0d6abe4

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

drivers/gpu/drm/vkms/vkms_composer.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,14 @@ static void blend(struct vkms_writeback_job *wb,
372372
{
373373
struct vkms_plane_state **plane = crtc_state->active_planes;
374374
u32 n_active_planes = crtc_state->num_active_planes;
375-
376-
const struct pixel_argb_u16 background_color = { .a = 0xffff };
375+
u64 bgcolor = crtc_state->base.background_color;
376+
377+
const struct pixel_argb_u16 background_color = {
378+
.a = 0xffff,
379+
.r = DRM_ARGB64_GETR(bgcolor),
380+
.g = DRM_ARGB64_GETG(bgcolor),
381+
.b = DRM_ARGB64_GETB(bgcolor),
382+
};
377383

378384
int crtc_y_limit = crtc_state->base.mode.vdisplay;
379385
int crtc_x_limit = crtc_state->base.mode.hdisplay;

drivers/gpu/drm/vkms/vkms_crtc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#include <drm/drm_atomic.h>
66
#include <drm/drm_atomic_helper.h>
7+
#include <drm/drm_blend.h>
78
#include <drm/drm_managed.h>
89
#include <drm/drm_probe_helper.h>
910
#include <drm/drm_vblank.h>
@@ -296,6 +297,8 @@ struct vkms_output *vkms_crtc_init(struct drm_device *dev, struct drm_plane *pri
296297

297298
drm_crtc_enable_color_mgmt(crtc, 0, false, VKMS_LUT_SIZE);
298299

300+
drm_crtc_attach_background_color_property(crtc);
301+
299302
spin_lock_init(&vkms_out->lock);
300303
spin_lock_init(&vkms_out->composer_lock);
301304

0 commit comments

Comments
 (0)