linux/drivers/gpu/drm/vmwgfx
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
..
Kconfig drm/vmwgfx: allow a kconfig option to choose if fbcon is enabled 2012-09-07 13:24:34 +10:00
Makefile drm/vmwgfx: Break out surface and context management to separate files 2012-11-21 07:47:08 +10:00
svga3d_reg.h vmwgfx: Update register files to latest from vmware-sdk 2011-10-05 10:17:08 +01:00
svga3d_surfacedefs.h drm/vmwgfx: Add and make use of a header for surface size calculation. 2012-11-21 07:47:09 +10:00
svga_escape.h vmwgfx: Update register files to latest from vmware-sdk 2011-10-05 10:17:08 +01:00
svga_overlay.h vmwgfx: Update register files to latest from vmware-sdk 2011-10-05 10:17:08 +01:00
svga_reg.h vmwgfx: Update register files to latest from vmware-sdk 2011-10-05 10:17:08 +01:00
svga_types.h
vmwgfx_buffer.c drm/vmwgfx: Tighten the security around buffer maps 2012-11-28 20:09:08 +10:00
vmwgfx_context.c drm/vmwgfx: Break out surface and context management to separate files 2012-11-21 07:47:08 +10:00
vmwgfx_dmabuf.c drm/ttm: remove no_wait_reserve, v3 2012-12-10 20:21:30 +10:00
vmwgfx_drv.c drm: encapsulate crtc->set_config calls 2013-01-20 15:57:58 +01:00
vmwgfx_drv.h drm/vmwgfx: Tighten the security around buffer maps 2012-11-28 20:09:08 +10:00
vmwgfx_execbuf.c drm/ttm: remove no_wait_reserve, v3 2012-12-10 20:21:30 +10:00
vmwgfx_fb.c Prepared for main script 2012-10-03 13:45:43 -07:00
vmwgfx_fence.c drm/vmwgfx: Free user-space fence objects correctly 2012-11-28 18:36:12 +10:00
vmwgfx_fence.h vmwgfx: Move function declaration to correct header 2012-02-13 12:01:36 +00:00
vmwgfx_fifo.c UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/ 2012-10-02 18:01:07 +01:00
vmwgfx_gmr.c UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/ 2012-10-02 18:01:07 +01:00
vmwgfx_gmrid_manager.c UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/ 2012-10-02 18:01:07 +01:00
vmwgfx_ioctl.c drm: revamp locking around fb creation/destruction 2013-01-20 22:16:58 +01:00
vmwgfx_irq.c UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/ 2012-10-02 18:01:07 +01:00
vmwgfx_kms.c drm: only take the crtc lock for ->cursor_move 2013-01-20 22:16:57 +01:00
vmwgfx_kms.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/ 2012-10-02 18:01:07 +01:00
vmwgfx_ldu.c drm/vmwgfx: drm_connector_property -> drm_object_property 2012-11-30 10:20:11 -06:00
vmwgfx_marker.c vmwgfx: Fix confusion caused by using "fence" in various places 2011-09-06 11:48:40 +01:00
vmwgfx_overlay.c drm/vmwgfx: Make overlay code not require fifo at init time 2012-11-20 16:19:50 +10:00
vmwgfx_reg.h
vmwgfx_resource_priv.h drm/vmwgfx: Break out surface and context management to separate files 2012-11-21 07:47:08 +10:00
vmwgfx_resource.c drm/ttm: remove no_wait_reserve, v3 2012-12-10 20:21:30 +10:00
vmwgfx_scrn.c drm/vmwgfx: drm_connector_property -> drm_object_property 2012-11-30 10:20:11 -06:00
vmwgfx_surface.c drm/vmwgfx: Add and make use of a header for surface size calculation. 2012-11-21 07:47:09 +10:00
vmwgfx_ttm_glue.c UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/ 2012-10-02 18:01:07 +01:00