On Fri, May 27, 2016 at 08:05:00PM +0100, Chris Wilson wrote:
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
...snip...
@@ -2337,7 +2369,18 @@ extern int drm_plane_init(struct drm_device *dev, const uint32_t *formats, unsigned int format_count, bool is_primary); extern void drm_plane_cleanup(struct drm_plane *plane); -extern unsigned int drm_plane_index(struct drm_plane *plane);
+/**
- drm_plane_index - find the index of a registered plane
- @plane: plane to find index for
- Given a registered plane, return the index of that CRTC within a DRM
"index of that plane"
Otherwise,
Reviewed-by: Matt Roper matthew.d.roper@intel.com
Matt
- device's list of planes.
- */
+static inline unsigned int drm_plane_index(struct drm_plane *plane) +{
- return plane->index;
+} extern struct drm_plane * drm_plane_from_index(struct drm_device *dev, int idx); extern void drm_plane_force_disable(struct drm_plane *plane); extern int drm_plane_check_pixel_format(const struct drm_plane *plane, -- 2.8.1