drm: Tighten locking in drm_mode_getconnector

- Modeset state needs mode_config->connection mutex, that covers
  figuring out the encoder, and reading properties (since in the
  atomic case those need to look at connector->state).

- Don't hold any locks for stuff that's invariant (i.e. possible
  connectors).

- Same for connector lookup and unref, those don't need any locks.

- And finally the probe stuff is only protected by mode_config->mutex.

While at it updated the kerneldoc for these fields in drm_connector
and add docs explaining what's protected by which locks.

Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20161213230814.19598-10-daniel.vetter@ffwll.ch
此提交包含在:
Daniel Vetter
2016-12-14 00:08:10 +01:00
父節點 e73ab00e9a
當前提交 91eefc05f0
共有 2 個檔案被更改,包括 72 行新增61 行删除

查看文件

@@ -563,9 +563,6 @@ struct drm_cmdline_mode {
* @interlace_allowed: can this connector handle interlaced modes?
* @doublescan_allowed: can this connector handle doublescan?
* @stereo_allowed: can this connector handle stereo modes?
* @modes: modes available on this connector (from fill_modes() + user)
* @status: one of the drm_connector_status enums (connected, not, or unknown)
* @probed_modes: list of modes derived directly from the display
* @funcs: connector control functions
* @edid_blob_ptr: DRM property containing EDID if present
* @properties: property tracking for this connector
@@ -635,11 +632,27 @@ struct drm_connector {
* Protected by @mutex.
*/
bool registered;
/**
* @modes:
* Modes available on this connector (from fill_modes() + user).
* Protected by dev->mode_config.mutex.
*/
struct list_head modes; /* list of modes on this connector */
/**
* @status:
* One of the drm_connector_status enums (connected, not, or unknown).
* Protected by dev->mode_config.mutex.
*/
enum drm_connector_status status;
/* these are modes added by probing with DDC or the BIOS */
/**
* @probed_modes:
* These are modes added by probing with DDC or the BIOS, before
* filtering is applied. Used by the probe helpers.Protected by
* dev->mode_config.mutex.
*/
struct list_head probed_modes;
/**
@@ -648,6 +661,8 @@ struct drm_connector {
* flat panels in embedded systems, the driver should initialize the
* display_info.width_mm and display_info.height_mm fields with the
* physical size of the display.
*
* Protected by dev->mode_config.mutex.
*/
struct drm_display_info display_info;
const struct drm_connector_funcs *funcs;