linux/drivers/gpu/drm/i915
Daniel Vetter 4b096ac10d drm: revamp locking around fb creation/destruction
Well, at least step 1. The goal here is that framebuffer objects can
survive outside of the mode_config lock, with just a reference held
as protection. The first step to get there is to introduce a special
fb_lock which protects fb lookup, creation and destruction, to make
them appear atomic.

This new fb_lock can nest within the mode_config lock. But the idea is
(once the reference counting part is completed) that we only quickly
take that fb_lock to lookup a framebuffer and grab a reference,
without any other locks involved.

vmwgfx is the only driver which does framebuffer lookups itself, also
wrap those calls to drm_mode_object_find with the new lock.

Also protect the fb_list walking in i915 and omapdrm with the new lock.

As a slight complication there's also the list of user-created fbs
attached to the file private. The problem now is that at fclose() time
we need to walk that list, eventually do a modeset call to remove the
fb from active usage (and are required to be able to take the
mode_config lock), but in the end we need to grab the new fb_lock to
remove the fb from the list. The easiest solution is to add another
mutex to protect this per-file list.

Currently that new fbs_lock nests within the modeset locks and so
appears redudant. But later patches will switch around this sequence
so that taking the modeset locks in the fb destruction path is
optional in the fastpath. Ultimately the goal is that addfb and rmfb
do not require the mode_config lock, since otherwise they have the
potential to introduce stalls in the pageflip sequence of a compositor
(if the compositor e.g. switches to a fullscreen client or if it
enables a plane). But that requires a few more steps and hoops to jump
through.

Note that framebuffer creation/destruction is now double-protected -
once by the fb_lock and in parts by the idr_lock. The later would be
unnecessariy if framebuffers would have their own idr allocator. But
that's material for another patch (series).

v2: Properly initialize the fb->filp_head list in _init, otherwise the
newly added WARN to check whether the fb isn't on a fpriv list any
more will fail for driver-private objects.

v3: Fixup two error-case unlock bugs spotted by Richard Wilbur.

Reviewed-by: Rob Clark <rob@ti.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-01-20 22:16:58 +01:00
..
Makefile drm/i915: Support for ns2501-DVO 2012-07-25 18:23:48 +02:00
dvo.h Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux 2012-10-03 23:29:23 -07:00
dvo_ch7xxx.c drm/i915/dvo-ch7xxx: fix get_hw_state 2012-10-12 10:59:11 +02:00
dvo_ch7017.c drm/i915/dvo: implement get_hw_state 2012-09-06 07:58:52 +02:00
dvo_ivch.c drm/i915/dvo: implement get_hw_state 2012-09-06 07:58:52 +02:00
dvo_ns2501.c drm/i915/dvo: implement get_hw_state 2012-09-06 07:58:52 +02:00
dvo_sil164.c drm/i915/dvo: implement get_hw_state 2012-09-06 07:58:52 +02:00
dvo_tfp410.c drm/i915/dvo: implement get_hw_state 2012-09-06 07:58:52 +02:00
i915_debugfs.c drm: revamp locking around fb creation/destruction 2013-01-20 22:16:58 +01:00
i915_dma.c drm/i915: Implement workaround for broken CS tlb on i830/845 2012-12-17 17:27:02 +01:00
i915_drv.c Drivers: gpu: remove __dev* attributes. 2013-01-03 15:57:15 -08:00
i915_drv.h drm/i915: optionally disable shrinker lock stealing 2012-12-20 14:56:04 +01:00
i915_gem.c drm/i915: Revert shrinker changes from "Track unbound pages" 2013-01-10 18:02:44 +01:00
i915_gem_context.c drm/i915: Preallocate next seqno before touching the ring 2012-11-29 11:43:52 +01:00
i915_gem_debug.c UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/ 2012-10-02 18:01:07 +01:00
i915_gem_dmabuf.c drm/prime: drop reference on imported dma-buf come from gem 2013-01-08 14:41:53 +10:00
i915_gem_evict.c Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux 2012-10-03 23:29:23 -07:00
i915_gem_execbuffer.c drm/i915: Implement workaround for broken CS tlb on i830/845 2012-12-17 17:27:02 +01:00
i915_gem_gtt.c drm/i915: Fix missed needs_dmar setting 2012-12-13 21:40:24 +01:00
i915_gem_stolen.c UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/ 2012-10-02 18:01:07 +01:00
i915_gem_tiling.c Merge branch 'drm-intel-fixes' of git://people.freedesktop.org/~danvet/drm-intel into drm-next 2012-10-07 21:13:54 +10:00
i915_ioc32.c UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/ 2012-10-02 18:01:07 +01:00
i915_irq.c drm/i915: Implement workaround for broken CS tlb on i830/845 2012-12-17 17:27:02 +01:00
i915_reg.h drm/i915: Implement WaSetupGtModeTdRowDispatch 2012-12-17 17:22:25 +01:00
i915_suspend.c drm/i915: Remove save/restore of physical HWS_PGA register 2012-11-21 17:45:02 +01:00
i915_sysfs.c drm/i915: fixup l3 parity sysfs access check 2012-12-05 19:10:20 +01:00
i915_trace.h drm/i915: Allow DRM_ROOT_ONLY|DRM_MASTER to submit privileged batchbuffers 2012-10-17 21:06:59 +02:00
i915_trace_points.c drm/i915: [sparse] trivial sparse fixes 2012-04-18 10:34:49 +02:00
intel_acpi.c UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/ 2012-10-02 18:01:07 +01:00
intel_bios.c Merge branch 'drm-next-3.8' of git://people.freedesktop.org/~agd5f/linux into drm-next 2012-12-10 20:03:58 +10:00
intel_bios.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/ 2012-10-02 18:01:07 +01:00
intel_crt.c Merge branch 'drm-intel-fixes' of git://people.freedesktop.org/~danvet/drm-intel into drm-next 2012-12-16 06:05:03 +00:00
intel_ddi.c drm/i915: set the LPT FDI RX polarity reversal bit when needed 2012-12-10 11:14:29 +01:00
intel_display.c drm/<drivers>: reorder framebuffer init sequence 2013-01-20 15:29:24 +01:00
intel_dp.c drm/i915: use drm_modeset_lock_all 2013-01-20 22:16:47 +01:00
intel_drv.h drm/i915: reject modes the LPT FDI receiver can't handle 2012-12-08 14:00:35 +01:00
intel_dvo.c Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux 2012-10-03 23:29:23 -07:00
intel_fb.c drm/i915: use drm_modeset_lock_all 2013-01-20 22:16:47 +01:00
intel_hdmi.c drm/i915: set the VIC of the mode on the AVI InfoFrame 2012-11-29 11:42:38 +01:00
intel_i2c.c drm/i915/i2c: Track users of GMBUS force-bit 2012-11-13 16:10:04 +01:00
intel_lvds.c drm/i915: use drm_modeset_lock_all 2013-01-20 22:16:47 +01:00
intel_modes.c drm/i915: drm_connector_property -> drm_object_property 2012-11-21 22:12:26 +01:00
intel_opregion.c Linux 3.7-rc2 2012-10-22 14:34:51 +02:00
intel_overlay.c drm/i915: use drm_modeset_lock_all 2013-01-20 22:16:47 +01:00
intel_panel.c drm/i915: do not access BLC_PWM_CTL2 on pre-gen4 hardware 2012-12-04 22:30:25 +01:00
intel_pm.c drm/i915: Treat crtc->mode.clock == 0 as disabled 2013-01-07 17:40:19 +01:00
intel_ringbuffer.c drm/i915: Implement workaround for broken CS tlb on i830/845 2012-12-17 17:27:02 +01:00
intel_ringbuffer.h drm/i915: Implement workaround for broken CS tlb on i830/845 2012-12-17 17:27:02 +01:00
intel_sdvo.c Merge branch 'drm-intel-fixes' of git://people.freedesktop.org/~danvet/drm-intel into drm-next 2012-12-16 06:05:03 +00:00
intel_sdvo_regs.h drm/i915: clear the entire sdvo infoframe buffer 2012-10-24 15:12:48 +02:00
intel_sprite.c drm/i915: use drm_modeset_lock_all 2013-01-20 22:16:47 +01:00
intel_tv.c drm/i915: drm_connector_property -> drm_object_property 2012-11-21 22:12:26 +01:00