linux-yocto/include/drm
Thomas Zimmermann 2e2e9b3d70 drm/framebuffer: Acquire internal references on GEM handles
commit f6bfc9afc7 upstream.

Acquire GEM handles in drm_framebuffer_init() and release them in
the corresponding drm_framebuffer_cleanup(). Ties the handle's
lifetime to the framebuffer. Not all GEM buffer objects have GEM
handles. If not set, no refcounting takes place. This is the case
for some fbdev emulation. This is not a problem as these GEM objects
do not use dma-bufs and drivers will not release them while fbdev
emulation is running. Framebuffer flags keep a bit per color plane
of which the framebuffer holds a GEM handle reference.

As all drivers use drm_framebuffer_init(), they will now all hold
dma-buf references as fixed in commit 5307dce878 ("drm/gem: Acquire
references on GEM handles for framebuffers").

In the GEM framebuffer helpers, restore the original ref counting
on buffer objects. As the helpers for handle refcounting are now
no longer called from outside the DRM core, unexport the symbols.

v3:
- don't mix internal flags with mode flags (Christian)
v2:
- track framebuffer handle refs by flag
- drop gma500 cleanup (Christian)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Fixes: 5307dce878 ("drm/gem: Acquire references on GEM handles for framebuffers")
Reported-by: Bert Karwatzki <spasswolf@web.de>
Closes: https://lore.kernel.org/dri-devel/20250703115915.3096-1-spasswolf@web.de/
Tested-by: Bert Karwatzki <spasswolf@web.de>
Tested-by: Mario Limonciello <superm1@kernel.org>
Tested-by: Borislav Petkov (AMD) <bp@alien8.de>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Anusha Srivatsa <asrivats@redhat.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: linux-media@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: linaro-mm-sig@lists.linaro.org
Cc: <stable@vger.kernel.org>
Reviewed-by: Christian König <christian.koenig@amd.com>
Link: https://lore.kernel.org/r/20250707131224.249496-1-tzimmermann@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-07-17 18:35:14 +02:00
..
bridge drm: bridge: samsung-dsim: Fix waiting for empty cmd transfer FIFO on older Exynos 2023-11-20 11:59:08 +01:00
display drm/dp_mst: Fix drm RAD print 2025-04-10 14:37:27 +02:00
i2c
ttm mm, treewide: introduce NR_PAGE_ORDERS 2024-05-02 16:32:41 +02:00
amd_asic_type.h
drm_accel.h accel: Use XArray instead of IDR for minors 2024-09-30 16:25:13 +02:00
drm_aperture.h drm/aperture: Remove primary argument 2023-04-16 14:17:41 +02:00
drm_atomic_helper.h drm/atomic-helpers: Invoke end_fb_access while owning plane state 2023-12-13 18:45:25 +01:00
drm_atomic_state_helper.h
drm_atomic_uapi.h
drm_atomic.h drm/atomic: clarify the rules around drm_atomic_state->allow_modeset 2025-06-04 14:42:15 +02:00
drm_audio_component.h
drm_auth.h
drm_blend.h
drm_bridge_connector.h
drm_bridge.h drm/bridge: add ->edid_read hook and drm_bridge_edid_read() 2024-04-03 15:28:38 +02:00
drm_buddy.h
drm_cache.h
drm_client.h
drm_color_mgmt.h drm: using mul_u32_u32() requires linux/math64.h 2024-02-05 20:14:34 +00:00
drm_connector.h drm/connector: add mutex to protect ELD from concurrent access 2025-02-17 09:40:04 +01:00
drm_crtc_helper.h
drm_crtc.h drm: Remove references to removed transitional helpers 2023-07-29 21:25:16 +02:00
drm_damage_helper.h
drm_debugfs_crc.h
drm_debugfs.h drm: debugfs: provide infrastructure to dump a DRM GPU VA space 2023-07-20 05:16:21 +02:00
drm_device.h
drm_displayid.h drm/edid: Parse topology block for all DispID structure v1.x 2024-06-12 11:12:05 +02:00
drm_drv.h drm: Disable the cursor plane on atomic contexts with virtualized drivers 2024-01-31 16:19:08 -08:00
drm_edid.h Revert "drm/edid: Fix csync detailed mode parsing" 2023-08-17 14:39:12 +03:00
drm_encoder_slave.h
drm_encoder.h
drm_exec.h drm/drm_exec: Work around a WW mutex lockdep oddity 2023-09-07 10:30:12 +02:00
drm_fb_dma_helper.h
drm_fb_helper.h drm/fb-helper: Remove unused inline function drm_fb_helper_defio_init() 2023-07-25 20:38:37 +02:00
drm_fbdev_dma.h
drm_fbdev_generic.h
drm_file.h drm/gem: Fix race in drm_gem_handle_create_tail() 2025-07-17 18:35:13 +02:00
drm_fixed.h drm: Fix drm_fixp2int_round() making it add 0.5 2024-03-26 18:20:10 -04:00
drm_flip_work.h
drm_format_helper.h
drm_fourcc.h
drm_framebuffer.h drm/framebuffer: Acquire internal references on GEM handles 2025-07-17 18:35:14 +02:00
drm_gem_atomic_helper.h
drm_gem_dma_helper.h drm: Clear fd/handle callbacks in struct drm_driver 2023-06-26 11:08:41 +02:00
drm_gem_framebuffer_helper.h
drm_gem_shmem_helper.h drm: Clear fd/handle callbacks in struct drm_driver 2023-06-26 11:08:41 +02:00
drm_gem_ttm_helper.h
drm_gem_vram_helper.h drm: Clear fd/handle callbacks in struct drm_driver 2023-06-26 11:08:41 +02:00
drm_gem.h drm/gem: Internally test import_attach for imported objects 2025-06-04 14:42:21 +02:00
drm_gpuva_mgr.h drm: manager to keep track of GPUs VA mappings 2023-07-20 05:15:53 +02:00
drm_ioctl.h
drm_kunit_helpers.h drm/tests: helpers: Create kunit helper to destroy a drm_display_mode 2025-04-25 10:45:08 +02:00
drm_lease.h
drm_legacy.h
drm_managed.h drm: fix drmm_mutex_init() 2023-05-22 12:23:50 +02:00
drm_mipi_dbi.h
drm_mipi_dsi.h drm/mipi-dsi: Fix theoretical int overflow in mipi_dsi_generic_write_seq() 2024-08-03 08:53:45 +02:00
drm_mm.h
drm_mode_config.h
drm_mode_object.h
drm_modes.h
drm_modeset_helper_vtables.h drm/probe-helper: warn about negative .get_modes() 2024-04-03 15:28:32 +02:00
drm_modeset_helper.h
drm_modeset_lock.h
drm_module.h
drm_of.h
drm_panel.h drm/panel: Fix kernel-doc typo for follower_lock 2023-08-03 10:21:27 +02:00
drm_pciids.h
drm_plane_helper.h
drm_plane.h drm: Allow drivers to indicate the damage helpers to ignore damage clips 2024-01-31 16:19:08 -08:00
drm_prime.h Revert "drm/prime: Unexport helpers for fd/handle conversion" 2024-01-20 11:51:39 +01:00
drm_print.h drm/printer: Allow NULL data in devcoredump printer 2024-10-10 11:57:36 +02:00
drm_privacy_screen_consumer.h
drm_privacy_screen_driver.h
drm_privacy_screen_machine.h
drm_probe_helper.h drm: Add an HPD poll helper to reschedule the poll work 2023-08-23 17:14:37 -04:00
drm_property.h
drm_rect.h
drm_self_refresh_helper.h
drm_simple_kms_helper.h
drm_suballoc.h
drm_syncobj.h drm/syncobj: add IOCTL to register an eventfd 2023-07-20 12:01:03 +02:00
drm_sysfs.h drm/sysfs: rename drm_sysfs_connector_status_event() 2023-06-23 15:54:00 +02:00
drm_util.h
drm_utils.h
drm_vblank_work.h
drm_vblank.h
drm_vma_manager.h
drm_writeback.h
gma_drm.h
gpu_scheduler.h gpu/drm: Eliminate DRM_SCHED_PRIORITY_UNSET 2023-10-17 20:35:38 -04:00
gud.h
i915_component.h drm/i915/mtl: Define GSC Proxy component interface 2023-05-04 02:57:28 -07:00
i915_drm.h drm/i915_drm.h: fix a typo 2023-06-02 20:05:45 +03:00
i915_gsc_proxy_mei_interface.h drm/i915/mtl: Define GSC Proxy component interface 2023-05-04 02:57:28 -07:00
i915_hdcp_interface.h drm/i915/hdcp: Move away from master naming to arbiter 2023-05-31 10:22:13 +05:30
i915_pciids.h
i915_pxp_tee_interface.h
intel_lpe_audio.h
intel-gtt.h
spsc_queue.h drm/sched: Increment job count before swapping tail spsc queue 2025-07-17 18:35:13 +02:00
task_barrier.h drm: Spelling s/randevouz/rendez-vous/ 2023-07-29 21:11:54 +02:00