diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2026-11-20 20:43:06 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2026-11-20 20:43:06 -0800 |
| commit | c44104f3642da720164042623e4832836aefdd8e (patch) | |
| tree | 76fc4494b40b186831ee690b8a335a0cb6b87480 /drivers/gpu/drm/vc4/vc4_crtc.c | |
| parent | aa31d5f8b151b786b748c6bfc9a8c4f1855c8adc (diff) | |
| parent | ce29b8f9fb606f87014c2d05483a3fef05a11f38 (diff) | |
Pull drm fixes from Dave Airlie:
"Weekly fixes, around the usual size, though it looks like vmwgfx got
hit with a lot of analysis and has a bunch of validation fixes.
nouveau fixes for a 7.3 regression.
I know of one open i915 7.3 regressions that hopefully a fix will land
next week. Otherwise amdgpu and xe have the most with a scattering for
others.
core:
- syncobj: Limit allocations
- vblank: Resolve deadlock in timer
amdgpu:
- GPUVM fixes
- SMU 8 fix
- PCO quirk
- ATPX lifetime fix
- Unwinding fix for module loading failure
- UserQ fix
- HDMI fixes
- DML2 fix
- DC DRAM config fixes
- DCN 4.2 fixes
- DC pre-OS clock handling fixes
- DPMS fix
- Cleaner shader fixes for multi-XCC parts
- Vblank fix for GPU resets
- Properly handle firmware with different trust athorities
- Freesync/VRR fixes
- Backlight fix
- Display warning fixes
- PSR fixes
amdkfd:
- SVM fixes
radeon:
- Bounds checks in vbios parsing
- ATPX lifetime fix
xe:
- hwmon error handling fixes
- Treat CT-disabled TLB invalidation as cancelled
- Validate BOs on export to charge the exporter
- Always free requested IRQs on uninstall
- Reset TLB invalidation state in submit fini
- Use ordered clock reads for engine cycles cpu_delta
- Treat non-fatal PCIe errors as recovered
i915:
- Regression fix for GitLab #16595 and #17423: 4K displays
corrupt/black on CML/KBL
- DSB programming fix for GOSUB
imagination:
- Use correct function for polling non-iomem
ivpu:
- Fix race condition in recovery
nouveau:
- Fix instmem io_mapping faults and slowdowns
omap:
- dss: Fix handling deferrals
qaic:
- Harden ioctl checks
rocket:
- iommu fixes
- lifetime and validation fixes
- clock request fix
- devicetre core count fix
tilcdc:
- Fix drvdata in suspend/resume
vc4:
- async flip fixes
- off by one shader record
- object lifetime fixes
- two dsi fixes
vmwgfx:
- bounds checking fixes
- validation fixes"
* tag 'drm-fixes-2026-11-21' of https://gitlab.freedesktop.org/drm/kernel: (111 commits)
drm/vc4: Clear the slice caches before resetting a stalled GPU
drm/vc4: Start shader code at varying offsets in its BO
drm/vc4: Check for a validated shader before reading its thread mode
drm/vc4: Fix off-by-one in the shader record BO handle check
MAINTAINERS: Add Dmitry Baryshkov as bridge maintainer
MAINTAINERS: Remove myself for VC4 DRM driver
MAINTAINERS: Remove Andrzej Hajda from bridge maintainers
MAINTAINERS: Remove Jonas Karlman from bridge reviewers
MAINTAINERS: Move Tegra DRM under drm-misc
MAINTAINERS: Move Keem Bay DRM under drm-misc
MAINTAINERS: Move armada DRM under drm-misc
drm/xe/hwmon: Propagate all hardware read errors
drm/xe/hwmon: Report errors using structured xe_log API
drm/xe/log: Add VRAM, PAT, and HWMON DRIVER_HARDWARE components
drm/xe/guc: Treat CT-disabled TLB invalidation as cancelled
drm/xe/dma-buf: Validate BOs on export to charge the exporter
drm/xe/irq: Always free requested IRQs on uninstall
drm/xe/guc: Reset TLB invalidation state in submit fini
drm/xe/query: Use ordered clock reads for engine cycles cpu_delta
drm/xe/ras: Treat non-fatal PCIe errors as recovered
...
Diffstat (limited to 'drivers/gpu/drm/vc4/vc4_crtc.c')
| -rw-r--r-- | drivers/gpu/drm/vc4/vc4_crtc.c | 126 |
1 files changed, 59 insertions, 67 deletions
diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c index f42cd5353230..4b6d4a5f7bc9 100644 --- a/drivers/gpu/drm/vc4/vc4_crtc.c +++ b/drivers/gpu/drm/vc4/vc4_crtc.c @@ -884,17 +884,21 @@ struct vc4_async_flip_state { struct drm_framebuffer *fb; struct drm_framebuffer *old_fb; struct drm_pending_vblank_event *event; + struct dma_fence *fence; struct dma_fence_cb cb; + struct work_struct work; }; -/* Called when the V3D execution for the BO being flipped to is done, so that - * we can actually update the plane's address to point to it. +/* Executed when the V3D execution for the BO being flipped to is done, so + * that we can actually update the plane's address to point to it. */ -static void -vc4_async_page_flip_complete(struct vc4_async_flip_state *flip_state) +static void vc4_async_page_flip_work(struct work_struct *work) { + struct vc4_async_flip_state *flip_state = + container_of(work, struct vc4_async_flip_state, work); struct drm_crtc *crtc = flip_state->crtc; struct drm_device *dev = crtc->dev; + struct vc4_dev *vc4 = to_vc4_dev(dev); struct drm_plane *plane = crtc->primary; vc4_plane_async_set_fb(plane, flip_state->fb); @@ -909,82 +913,57 @@ vc4_async_page_flip_complete(struct vc4_async_flip_state *flip_state) drm_crtc_vblank_put(crtc); drm_framebuffer_put(flip_state->fb); - if (flip_state->old_fb) - drm_framebuffer_put(flip_state->old_fb); - - kfree(flip_state); -} + if (flip_state->old_fb) { + /* + * Decrement the BO usecnt in order to keep the inc/dec + * calls balanced when the planes are updated through + * the async update path. + * + * FIXME: we should move to generic async-page-flip when + * it's available, so that we can get rid of this + * hand-made cleanup_fb() logic. + */ + if (vc4->gen == VC4_GEN_4) { + struct drm_gem_dma_object *dma_bo = + drm_fb_dma_get_gem_obj(flip_state->old_fb, 0); -static void vc4_async_page_flip_complete_with_cleanup(struct dma_fence *fence, - struct dma_fence_cb *cb) -{ - struct vc4_async_flip_state *flip_state = - container_of(cb, struct vc4_async_flip_state, cb); - struct vc4_bo *bo = NULL; + vc4_bo_dec_usecnt(to_vc4_bo(&dma_bo->base)); + } - if (flip_state->old_fb) { - struct drm_gem_dma_object *dma_bo = - drm_fb_dma_get_gem_obj(flip_state->old_fb, 0); - bo = to_vc4_bo(&dma_bo->base); + drm_framebuffer_put(flip_state->old_fb); } - vc4_async_page_flip_complete(flip_state); - dma_fence_put(fence); - - /* - * Decrement the BO usecnt in order to keep the inc/dec - * calls balanced when the planes are updated through - * the async update path. - * - * FIXME: we should move to generic async-page-flip when - * it's available, so that we can get rid of this - * hand-made cleanup_fb() logic. - */ - if (bo) - vc4_bo_dec_usecnt(bo); + dma_fence_put(flip_state->fence); + kfree(flip_state); } -static void vc4_async_page_flip_fence_complete(struct dma_fence *fence, - struct dma_fence_cb *cb) +static void vc4_async_page_flip_fence_cb(struct dma_fence *fence, + struct dma_fence_cb *cb) { struct vc4_async_flip_state *flip_state = container_of(cb, struct vc4_async_flip_state, cb); + struct vc4_crtc *vc4_crtc = to_vc4_crtc(flip_state->crtc); - vc4_async_page_flip_complete(flip_state); - dma_fence_put(fence); + /* Completing the flip may sleep, so defer it to a worker. */ + queue_work(vc4_crtc->async_flip_wq, &flip_state->work); } -static int vc4_async_set_fence_cb(struct drm_device *dev, - struct vc4_async_flip_state *flip_state) +static void vc4_async_set_fence_cb(struct vc4_async_flip_state *flip_state) { - struct drm_framebuffer *fb = flip_state->fb; - struct drm_gem_dma_object *dma_bo = drm_fb_dma_get_gem_obj(fb, 0); - dma_fence_func_t async_page_flip_complete_function; - struct vc4_dev *vc4 = to_vc4_dev(dev); - struct dma_fence *fence; - int ret; + struct vc4_crtc *vc4_crtc = to_vc4_crtc(flip_state->crtc); - if (vc4->gen == VC4_GEN_4) - async_page_flip_complete_function = vc4_async_page_flip_complete_with_cleanup; - else - async_page_flip_complete_function = vc4_async_page_flip_fence_complete; - - ret = dma_resv_get_singleton(dma_bo->base.resv, DMA_RESV_USAGE_READ, &fence); - if (ret) - return ret; - - /* If there's no fence, complete the page flip immediately */ - if (!fence) { - async_page_flip_complete_function(fence, &flip_state->cb); - return 0; - } + INIT_WORK(&flip_state->work, vc4_async_page_flip_work); - /* If the fence has already been completed, complete the page flip */ - if (dma_fence_add_callback(fence, &flip_state->cb, - async_page_flip_complete_function)) - async_page_flip_complete_function(fence, &flip_state->cb); + if (flip_state->fence && + !dma_fence_add_callback(flip_state->fence, &flip_state->cb, + vc4_async_page_flip_fence_cb)) + return; - return 0; + /* No fence or the fence has already signaled. Complete the flip + * immediately, after earlier queued flips. + */ + flush_workqueue(vc4_crtc->async_flip_wq); + vc4_async_page_flip_work(&flip_state->work); } static int @@ -993,14 +972,22 @@ vc4_async_page_flip_common(struct drm_crtc *crtc, struct drm_pending_vblank_event *event, uint32_t flags) { - struct drm_device *dev = crtc->dev; + struct drm_gem_dma_object *dma_bo = drm_fb_dma_get_gem_obj(fb, 0); struct drm_plane *plane = crtc->primary; struct vc4_async_flip_state *flip_state; + int ret; flip_state = kzalloc_obj(*flip_state); if (!flip_state) return -ENOMEM; + ret = dma_resv_get_singleton(dma_bo->base.resv, DMA_RESV_USAGE_READ, + &flip_state->fence); + if (ret) { + kfree(flip_state); + return ret; + } + drm_framebuffer_get(fb); flip_state->fb = fb; flip_state->crtc = crtc; @@ -1008,7 +995,7 @@ vc4_async_page_flip_common(struct drm_crtc *crtc, /* Save the current FB before it's replaced by the new one in * drm_atomic_set_fb_for_plane(). We'll need the old FB in - * vc4_async_page_flip_complete() to decrement the BO usecnt and keep + * vc4_async_page_flip_work() to decrement the BO usecnt and keep * it consistent. * FIXME: we should move to generic async-page-flip when it's * available, so that we can get rid of this hand-made cleanup_fb() @@ -1026,7 +1013,7 @@ vc4_async_page_flip_common(struct drm_crtc *crtc, */ drm_atomic_set_fb_for_plane(plane->state, fb); - vc4_async_set_fence_cb(dev, flip_state); + vc4_async_set_fence_cb(flip_state); /* Driver takes ownership of state on successful async commit. */ return 0; @@ -1413,6 +1400,11 @@ int __vc4_crtc_init(struct drm_device *drm, drm_crtc_helper_add(crtc, crtc_helper_funcs); + vc4_crtc->async_flip_wq = drmm_alloc_ordered_workqueue(drm, "%s-async-flip", + 0, crtc->name); + if (IS_ERR(vc4_crtc->async_flip_wq)) + return PTR_ERR(vc4_crtc->async_flip_wq); + if (vc4->gen == VC4_GEN_4) { drm_mode_crtc_set_gamma_size(crtc, ARRAY_SIZE(vc4_crtc->lut_r)); drm_crtc_enable_color_mgmt(crtc, 0, false, crtc->gamma_size); |
