mbox series

[00/11] drm: Only try to set formats supported by the hardware

Message ID cover.1710698386.git.frej.drejhammar@gmail.com
Headers show
Series drm: Only try to set formats supported by the hardware | expand

Message

Frej Drejhammar March 17, 2024, 6:01 p.m. UTC
When userland uses DRM_IOCTL_MODE_ADDFB to add a framebuffer, the DRM
subsystem tries to find a pixel format from the supplied depth and
bpp-values. It does this by calling drm_driver_legacy_fb_format().
Unfortunately drm_driver_legacy_fb_format() can return formats not
supported by the underlying hardware. This series of patches remedies
this problem in patch 1.

In order to use the same logic for determining the pixel format, when
a fbdev adds a framebuffer as userland does, patches 2 to 11 migrates
fbdev users of drm_mode_legacy_fb_format() to
drm_driver_legacy_fb_format().

This series has been tested with the nouveau and modesetting drivers
on a NVIDIA NV96, the modesetting driver on Beagleboard Black, and
with the Intel and modesetting drivers on an Intel HD Graphics 4000
chipset.

This is an evolved version of the changes proposed in "drm: Don't
return unsupported formats in drm_mode_legacy_fb_format" [1] following
the suggestions of Thomas Zimmermann.

Cc: Abhinav Kumar <quic_abhinavk@quicinc.com>
Cc: Alim Akhtar <alim.akhtar@samsung.com>
Cc: amd-gfx@lists.freedesktop.org
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: David Airlie <airlied@gmail.com>
Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: dri-devel@lists.freedesktop.org
Cc: freedreno@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Cc: intel-xe@lists.freedesktop.org
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-arm-msm@vger.kernel.org
Cc: linux-samsung-soc@vger.kernel.org
Cc: linux-tegra@vger.kernel.org
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: "Maíra Canal" <mcanal@igalia.com>
Cc: Marijn Suijten <marijn.suijten@somainline.org>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Sean Paul <sean@poorly.run>
Cc: stable@vger.kernel.org
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Cc: "Ville Syrjälä" <ville.syrjala@linux.intel.com>

[1] https://lore.kernel.org/all/20240310152803.3315-1-frej.drejhammar@gmail.com/

Frej Drejhammar (11):
  drm: Only return supported formats from drm_driver_legacy_fb_format
  drm/fbdev_generic: Use drm_driver_legacy_fb_format() for fbdev
  drm/armada: Use drm_driver_legacy_fb_format() for fbdev
  drm/exynos: Use drm_driver_legacy_fb_format() for fbdev
  drm/gma500: Use drm_driver_legacy_fb_format() for fbdev
  drm/i915: Use drm_driver_legacy_fb_format() for fbdev
  drm/msm: Use drm_driver_legacy_fb_format() for fbdev
  drm/omapdrm: Use drm_driver_legacy_fb_format() for fbdev
  drm/radeon: Use drm_driver_legacy_fb_format() for fbdev
  drm/tegra: Use drm_driver_legacy_fb_format() for fbdev
  drm/xe: Use drm_driver_legacy_fb_format() for fbdev

 drivers/gpu/drm/armada/armada_fbdev.c         |  5 +-
 drivers/gpu/drm/drm_fb_helper.c               |  2 +-
 drivers/gpu/drm/drm_fbdev_dma.c               |  4 +-
 drivers/gpu/drm/drm_fbdev_generic.c           |  4 +-
 drivers/gpu/drm/drm_fourcc.c                  | 83 +++++++++++++++++++
 drivers/gpu/drm/exynos/exynos_drm_fbdev.c     |  6 +-
 drivers/gpu/drm/gma500/fbdev.c                |  2 +-
 drivers/gpu/drm/i915/display/intel_fbdev_fb.c |  6 +-
 drivers/gpu/drm/msm/msm_fbdev.c               |  4 +-
 drivers/gpu/drm/omapdrm/omap_fbdev.c          |  6 +-
 drivers/gpu/drm/radeon/radeon_fbdev.c         |  6 +-
 drivers/gpu/drm/tegra/fbdev.c                 |  5 +-
 drivers/gpu/drm/xe/display/intel_fbdev_fb.c   |  5 +-
 13 files changed, 119 insertions(+), 19 deletions(-)


base-commit: 119b225f01e4d3ce974cd3b4d982c76a380c796d