twx-linux/drivers
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
..
accel accel/habanalabs: add missing error flow in hl_sysfs_init() 2023-04-08 10:44:23 +03:00
accessibility
acpi Thermal control fixes for 6.3-rc4 2023-03-24 13:45:58 -07:00
amba
android
ata ata: pata_parport: fix memory leaks 2023-03-16 16:54:38 +09:00
atm atm: idt77252: fix kmemleak when rmmod idt77252 2023-03-21 20:19:28 -07:00
auxdisplay
base
bcma
block block/io_uring: pass in issue_flags for uring_cmd task_work handling 2023-03-20 20:01:25 -06:00
bluetooth Bluetooth: btsdio: fix use after free bug in btsdio_remove due to unfinished work 2023-03-23 13:09:38 -07:00
bus bus: imx-weim: fix branch condition evaluates to a garbage value 2023-03-14 11:43:51 +08:00
cdrom
char tpm: disable hwrng for fTPM on some AMD designs 2023-03-12 23:28:10 +02:00
clk
clocksource
comedi
connector
counter
cpufreq
cpuidle
crypto
cxl
dax
dca
devfreq
dio
dma
dma-buf dma-buf/dma-resv.c: fix a typo 2023-04-17 08:24:31 +02:00
edac
eisa
extcon
firewire
firmware ARM: SoC fixes for 6.3, part 2 2023-03-24 15:38:13 -07:00
fpga
fsi
gnss
gpio
gpu drm/gem: Check for valid formats 2023-04-19 20:19:27 -03:00
greybus
hid
hsi
hte
hv
hwmon hwmon (it87): Fix voltage scaling for chips with 10.9mV ADCs 2023-03-21 19:14:55 -07:00
hwspinlock
hwtracing
i2c i2c: xgene-slimpro: Fix out-of-bounds bug in xgene_slimpro_i2c_xfer() 2023-03-16 21:15:43 +01:00
i3c
idle
iio
infiniband
input
interconnect interconnect: exynos: drop redundant link destroy 2023-03-13 21:13:48 +02:00
iommu
ipack
irqchip
isdn
leds
macintosh
mailbox
mcb
md - Fix DM thin to work as a swap device by using 'limit_swap_bios' DM 2023-03-24 14:20:48 -07:00
media media: m5mols: fix off-by-one loop termination error 2023-03-18 11:07:15 -07:00
memory memory: tegra30-emc: fix interconnect registration race 2023-03-13 21:13:49 +02:00
memstick
message
mfd
misc Core Changes: 2023-03-24 20:22:03 +01:00
mmc
most
mtd * regression fix for the notifier handling of the I2C core 2023-03-11 09:24:05 -08:00
mux
net bpf-for-netdev 2023-03-23 16:03:33 -07:00
nfc nfc: st-nci: Fix use after free bug in ndlc_remove due to race condition 2023-03-15 00:28:23 -07:00
ntb
nubus
nvdimm
nvme nvme: send Identify with CNS 06h only to I/O controllers 2023-03-22 09:17:52 +01:00
nvmem
of
opp
parisc
parport
pci PCI: s390: Fix use-after-free of PCI resources with per-function hotplug 2023-03-13 09:15:11 +01:00
pcmcia
peci
perf
phy
pinctrl
platform chrome-platform fixes for v6.3-rc4 2023-03-24 09:05:25 -07:00
pnp
power power: supply: da9150: Fix use after free bug in da9150_charger_remove due to race condition 2023-03-12 23:28:04 +01:00
powercap
pps
ps3
ptp
pwm
rapidio
ras
regulator
remoteproc
reset
rpmsg
rtc
s390
sbus
scsi SCSI fixes on 20230323 2023-03-24 08:27:13 -07:00
sh
siox
slimbus
soc
soundwire
spi
spmi
ssb
staging drm/tegra: Changes for v6.4-rc1 2023-04-06 15:02:17 +02:00
target
tc
tee AMDTEE fix race condition in amdtee_open_session() 2023-03-17 15:30:31 +01:00
thermal Merge branch 'thermal-acpi' 2023-03-24 17:11:27 +01:00
thunderbolt thunderbolt: Rename shadowed variables bit to interrupt_bit and auto_clear_bit 2023-03-20 19:00:58 +02:00
tty xen: branch for v6.3-rc4 2023-03-24 09:44:43 -07:00
ufs
uio
usb usb: dwc2: fix a race, don't power off/on phy for dual-role mode 2023-03-23 19:13:16 +01:00
vdpa vdpa_sim: set last_used_idx as last_avail_idx in vdpasim_queue_ready 2023-03-13 02:29:12 -04:00
vfio vfio/mlx5: Fix the report of dirty_bytes upon pre-copy 2023-03-13 12:50:59 -06:00
vhost vhost-vdpa: free iommu domain after last use during cleanup 2023-03-13 02:29:11 -04:00
video video/aperture: Provide a VGA helper for gma500 and internal use 2023-04-16 14:18:10 +02:00
virt virt/coco/sev-guest: Add throttling awareness 2023-03-13 13:29:27 +01:00
virtio
vlynq
w1
watchdog
xen xen: branch for v6.3-rc3 2023-03-17 10:45:49 -07:00
zorro
Kconfig
Makefile