drm/fb-helper: Add top-level lock
Introduce a new top-level lock for the FB helper code. This will allow better locking granularity and avoid the need to abuse modeset locking for this purpose instead. This patch just adds the new lock everywhere we currently grab mode_config->mutex (explicitly, or through drm_modeset_lock_all). Follow-up patches will push the kms locking down into only the places that need it. v2: - use lockdep_assert_held - use drm_fb_helper_for_each_connector where possible - use the new top-level lock consistently, i.e. in all the places we're currently acquiring mode_config.mutex. - small polish to the kerneldoc Tested-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Thierry Reding <treding@nvidia.com> (v1) Reviewed-by: Maarten Lankhorst <maarten.lankhorst@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/20170704151833.17304-4-daniel.vetter@ffwll.ch
This commit is contained in:

committed by
Daniel Vetter

parent
666b7cdc69
commit
e9827d8ea2
@@ -169,7 +169,6 @@ struct drm_fb_helper_connector {
|
||||
* @crtc_info: per-CRTC helper state (mode, x/y offset, etc)
|
||||
* @connector_count: number of connected connectors
|
||||
* @connector_info_alloc_count: size of connector_info
|
||||
* @connector_info: array of per-connector information
|
||||
* @funcs: driver callbacks for fb helper
|
||||
* @fbdev: emulated fbdev device info struct
|
||||
* @pseudo_palette: fake palette of 16 colors
|
||||
@@ -191,6 +190,12 @@ struct drm_fb_helper {
|
||||
struct drm_fb_helper_crtc *crtc_info;
|
||||
int connector_count;
|
||||
int connector_info_alloc_count;
|
||||
/**
|
||||
* @connector_info:
|
||||
*
|
||||
* Array of per-connector information. Do not iterate directly, but use
|
||||
* drm_fb_helper_for_each_connector.
|
||||
*/
|
||||
struct drm_fb_helper_connector **connector_info;
|
||||
const struct drm_fb_helper_funcs *funcs;
|
||||
struct fb_info *fbdev;
|
||||
@@ -200,6 +205,18 @@ struct drm_fb_helper {
|
||||
struct work_struct dirty_work;
|
||||
struct work_struct resume_work;
|
||||
|
||||
/**
|
||||
* @lock:
|
||||
*
|
||||
* Top-level FBDEV helper lock. This protects all internal data
|
||||
* structures and lists, such as @connector_info and @crtc_info.
|
||||
*
|
||||
* FIXME: fbdev emulation locking is a mess and long term we want to
|
||||
* protect all helper internal state with this lock as well as reduce
|
||||
* core KMS locking as much as possible.
|
||||
*/
|
||||
struct mutex lock;
|
||||
|
||||
/**
|
||||
* @kernel_fb_list:
|
||||
*
|
||||
|
Reference in New Issue
Block a user