drm: Store the plane's index
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 27 May 2016 19:05:00 +0000 (20:05 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 2 Jun 2016 22:02:23 +0000 (00:02 +0200)
commit490d3d1b91201fd3d3d01d64e11df4eac1d92bd4
tree77e6dfde9d3cf61330c91af848de7327e41fce63
parent1b47aaf9a93a69a61f8cc5219fd9c758b8588a59
drm: Store the plane's index

Currently the plane's index is determined by walking the list of all
planes in the mode and finding the position of that plane in the list. A
linear walk, especially a linear walk within a linear walk as frequently
conceived by i915.ko [O(N^2)] quickly comes to dominate profiles.

The plane's index is constant for as long as no earlier planes are
removed from the list. For all drivers, planes are static, determined
at boot and then untouched until shutdown. In fact, there is no locking
provided to allow for dynamic removal of planes/encoders/crtcs.

v2: Convert drm_crtc_index() and drm_encoder_index() as well.
v3: Stop adjusting the indices upon removal; consider the list
construct-only.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Matt Roper <matthew.d.roper@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
[danvet: Fixup typo in kerneldoc that Matt spotted.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1464375900-2542-1-git-send-email-chris@chris-wilson.co.uk
drivers/gpu/drm/drm_crtc.c
include/drm/drm_crtc.h