Re: [PATCH 2/2] drm: xlnx: zynqmp_kms: set preferred_depth to 16 bpp

Thomas Zimmermann
2026-01-06T07:38:03Z

Hi

Am 05.12.25 um 13:37 schrieb Mikko Rapeli:
> Xorg fails to start with defaults on AMD KV260, /var/log/Xorg.0.log:
>
> [ 23.491] (II) Loading /usr/lib/xorg/modules/drivers/fbdev_drv.so
> [ 23.491] (II) Module fbdev: vendor="X.Org Foundation"
> [ 23.491] compiled for 1.21.1.18, module version = 0.5.1
> [ 23.491] Module class: X.Org Video Driver
> [ 23.491] ABI class: X.Org Video Driver, version 25.2
> [ 23.491] (II) modesetting: Driver for Modesetting Kernel Drivers:
> kms
> [ 23.491] (II) FBDEV: driver for framebuffer: fbdev
> [ 23.510] (II) modeset(0): using drv /dev/dri/card1
> [ 23.511] (WW) Falling back to old probe method for fbdev
> [ 23.511] (II) Loading sub module "fbdevhw"
> [ 23.511] (II) LoadModule: "fbdevhw"
> [ 23.511] (II) Loading /usr/lib/xorg/modules/libfbdevhw.so
> [ 23.511] (II) Module fbdevhw: vendor="X.Org Foundation"
> [ 23.511] compiled for 1.21.1.18, module version = 0.0.2
> [ 23.511] ABI class: X.Org Video Driver, version 25.2
> [ 23.512] (II) modeset(0): Creating default Display subsection in
> Screen section
> "Default Screen Section" for depth/fbbpp 24/32
> [ 23.512] (==) modeset(0): Depth 24, (==) framebuffer bpp 32
> [ 23.512] (==) modeset(0): RGB weight 888
> [ 23.512] (==) modeset(0): Default visual is TrueColor
> ...
> [ 23.911] (II) Loading sub module "fb"
> [ 23.911] (II) LoadModule: "fb"
> [ 23.911] (II) Module "fb" already built-in
> [ 23.911] (II) UnloadModule: "fbdev"
> [ 23.911] (II) Unloading fbdev
> [ 23.912] (II) UnloadSubModule: "fbdevhw"
> [ 23.912] (II) Unloading fbdevhw
> [ 24.238] (==) modeset(0): Backing store enabled
> [ 24.238] (==) modeset(0): Silken mouse enabled
> [ 24.249] (II) modeset(0): Initializing kms color map for depth 24, 8
> bpc.
> [ 24.250] (==) modeset(0): DPMS enabled
> [ 24.250] (II) modeset(0): [DRI2] Setup complete
> [ 24.250] (II) modeset(0): [DRI2] DRI driver: kms_swrast
> [ 24.250] (II) modeset(0): [DRI2] VDPAU driver: kms_swrast
> ...
> [ 24.770] (II) modeset(0): Disabling kernel dirty updates, not
> required.
> [ 24.770] (EE) modeset(0): failed to set mode: Invalid argument
>
> xorg tries to use 24 and 32 bpp which pass on the fb API but which
> don't actually work on AMD KV260 when Xorg starts. As a workaround
> Xorg config can set color depth to 16 using /etc/X11/xorg.conf snippet:
>
> Section "Screen"
> Identifier "Default Screen"
> Monitor "Configured Monitor"
> Device "Configured Video Device"
> DefaultDepth 16
> EndSection
>
> But this is cumbersome on images meant for multiple different arm64
> devices and boards. So instead set 16 bpp as preferred depth
> in zynqmp_kms fb driver which is used by Xorg in the logic to find
> out a working depth.
>
> Now Xorg startup and bpp query using fb API works and HDMI display
> shows graphics. /var/log/Xorg.0.log shows:
>
> [ 23.219] (II) LoadModule: "fbdev"
> [ 23.219] (II) Loading /usr/lib/xorg/modules/drivers/fbdev_drv.so
> [ 23.219] (II) Module fbdev: vendor="X.Org Foundation"
> [ 23.219] compiled for 1.21.1.18, module version = 0.5.1
> [ 23.219] Module class: X.Org Video Driver
> [ 23.219] ABI class: X.Org Video Driver, version 25.2
> [ 23.219] (II) modesetting: Driver for Modesetting Kernel Drivers:
> kms
> [ 23.219] (II) FBDEV: driver for framebuffer: fbdev
> [ 23.238] (II) modeset(0): using drv /dev/dri/card1
> [ 23.238] (WW) Falling back to old probe method for fbdev
> [ 23.238] (II) Loading sub module "fbdevhw"
> [ 23.238] (II) LoadModule: "fbdevhw"
> [ 23.239] (II) Loading /usr/lib/xorg/modules/libfbdevhw.so
> [ 23.239] (II) Module fbdevhw: vendor="X.Org Foundation"
> [ 23.239] compiled for 1.21.1.18, module version = 0.0.2
> [ 23.239] ABI class: X.Org Video Driver, version 25.2
> [ 23.240] (II) modeset(0): Creating default Display subsection in Screen section
> "Default Screen Section" for depth/fbbpp 16/16
> [ 23.240] (==) modeset(0): Depth 16, (==) framebuffer bpp 16
> [ 23.240] (==) modeset(0): RGB weight 565
> [ 23.240] (==) modeset(0): Default visual is TrueColor
> ...
> [ 24.015] (==) modeset(0): Backing store enabled
> [ 24.015] (==) modeset(0): Silken mouse enabled
> [ 24.027] (II) modeset(0): Initializing kms color map for depth 16, 6 bpc.
> [ 24.028] (==) modeset(0): DPMS enabled
> [ 24.028] (II) modeset(0): [DRI2] Setup complete
> [ 24.028] (II) modeset(0): [DRI2] DRI driver: kms_swrast
> [ 24.028] (II) modeset(0): [DRI2] VDPAU driver: kms_swrast
>
> Cc: Bill Mills <bill.mills@linaro.org>
> Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> Cc: Anatoliy Klymenko <anatoliy.klymenko@amd.com>
> Cc: stable@vger.kernel.org
> Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>

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

> ---
> drivers/gpu/drm/xlnx/zynqmp_kms.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/xlnx/zynqmp_kms.c b/drivers/gpu/drm/xlnx/zynqmp_kms.c
> index ccc35cacd10cb..a42192c827af0 100644
> --- a/drivers/gpu/drm/xlnx/zynqmp_kms.c
> +++ b/drivers/gpu/drm/xlnx/zynqmp_kms.c
> @@ -506,6 +506,7 @@ int zynqmp_dpsub_drm_init(struct zynqmp_dpsub *dpsub)
> drm->mode_config.min_height = 0;
> drm->mode_config.max_width = ZYNQMP_DISP_MAX_WIDTH;
> drm->mode_config.max_height = ZYNQMP_DISP_MAX_HEIGHT;
> + drm->mode_config.preferred_depth = 16;

There is another discussion on-going about rearranging planes. But to
make user space work correctly, preferred_depth should be set no matter
what.

Best regards
Thomas

>
> ret = drm_vblank_init(drm, 1);
> if (ret)

--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)