mirror-linux/Documentation/gpu
Maíra Canal c91acda3a3
drm/gem: Check for valid formats
Currently, drm_gem_fb_create() doesn't check if the pixel format is
supported, which can lead to the acceptance of invalid pixel formats
e.g. the acceptance of invalid modifiers. Therefore, add a check for
valid formats on drm_gem_fb_create().

Note that this check is only valid for atomic drivers, because, for
non-atomic drivers, checking drm_any_plane_has_format() is not
possible since the format list for the primary plane is fake, and we'd
therefore reject valid formats.

Adding this check to drm_gem_fb_create() will guarantee that the
igt@kms_addfb_basic@addfb25-bad-modifier IGT test passes for drivers
using this callback.

This commit is a recapture of a series sent a while ago. Initially,
I sent a patch [1] similar to this one in which I introduced the
format check to drm_gem_fb_create().

Based on the feedback on the patch, I placed the check inside
framebuffer_check() [2] so that it wouldn't be needed to hit any
driver-specific code path when the check fails. Therefore, we could
remove the check from the specific drivers (i915, amdgpu, and vmwgfx).

But, with some new feedback, it was shown that introducing this check
inside framebuffer_check() is problematic for the i915 driver [3].
For the i915 driver, in the legacy case, in which we don't get the
modifier from the userspace, i915's fb_create hook computes the right
modifier, which isn't necessarily linear.  Therefore, if we check the
modifier before that point, we might get wrong answers.

So, I kept the check inside the i915 driver and removed the check from
amdgpu and vmwgfx [4]. But, this yet hasn't solved the i915 problem [5].

As we cannot add the check inside framebuffer_check() without
affecting the i915 behavior, this commit went back to the original
patch. This way we can guarantee a more uniform behavior from the
drivers that use the drm_gem_fb_create() callback.

[1] https://lore.kernel.org/dri-devel/20230103125322.855089-1-mcanal@igalia.com/T/
[2] https://lore.kernel.org/dri-devel/20230109105807.18172-1-mcanal@igalia.com/T/
[3] https://lore.kernel.org/dri-devel/Y8AAdW2y7zN7DCUZ@intel.com/
[4] https://lore.kernel.org/dri-devel/20230113112743.188486-1-mcanal@igalia.com/T/
[5] https://lore.kernel.org/dri-devel/Y8FXWvEhO7GCRKVJ@intel.com/

Signed-off-by: Maíra Canal <mcanal@igalia.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Maíra Canal <mairacanal@riseup.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20230412142923.136707-1-mcanal@igalia.com
2023-04-19 20:19:27 -03:00
..
amdgpu drm/amd/display: add prefix to amdgpu_dm_plane.h functions 2023-03-08 14:04:45 -05:00
bridge
dp-mst
rfc drm/doc/rfc: VM_BIND uapi definition 2022-07-01 16:47:07 -07:00
afbc.rst
backlight.rst doc-rst: Wire-up Backlight kernel-doc documentation 2020-07-20 10:26:22 +01:00
driver-uapi.rst drm/i915: Fix missing docbook chapters for i915 uapi. 2021-07-16 10:52:59 +02:00
drivers.rst Documentation/gpu: Reorganize DC documentation 2021-12-13 16:33:16 -05:00
drm-client.rst
drm-internals.rst drm/doc: Add KUnit documentation 2022-06-27 13:46:03 +02:00
drm-kms-helpers.rst drm/bridge: Document the expected behaviour of DSI host controllers 2022-12-08 09:56:57 +01:00
drm-kms.rst drm/doc: Fix title underline length 2022-12-01 11:12:44 +01:00
drm-mm.rst drm/gem: rename GEM CMA helpers to GEM DMA helpers 2022-08-03 18:31:49 +02:00
drm-uapi.rst drm/doc: make drm-uapi igt-tests more readable 2022-11-23 20:34:46 +01:00
drm-usage-stats.rst Documentation/gpu: Fix section in the wrong scope 2022-11-14 22:51:49 -08:00
i915.rst drm/i915/mtl: Handle wopcm per-GT and limit calculations. 2022-11-14 10:11:47 -08:00
index.rst Docs/subsystem-apis: Remove '[The ]Linux' prefixes from titles of listed documents 2023-01-24 15:27:08 -07:00
introduction.rst drm/doc: Add sections about tiny drivers and external refs to intro page 2022-04-22 13:56:31 +02:00
kms-properties.csv
komeda-kms.rst Documentation: gpu/komeda-kms: eliminate duplicated word 2020-07-13 09:44:06 -06:00
mcde.rst
meson.rst
msm-crash-dump.rst
pl111.rst drm: pl111: Update documentation 2020-07-23 10:06:22 +02:00
tegra.rst
todo.rst drm/gem: Check for valid formats 2023-04-19 20:19:27 -03:00
tve200.rst
v3d.rst
vc4.rst drm/vc4: Improve the KUnit documentation 2022-12-15 08:54:08 +01:00
vga-switcheroo.rst
vgaarbiter.rst PCI/VGA: Move vgaarb to drivers/pci 2022-03-09 18:30:46 -06:00
vkms.rst drm: vkms: Supports to the case where primary plane doesn't match the CRTC 2022-09-05 20:18:42 -01:00
xen-front.rst