[Intel-gfx] [PATCH] drm/i915: Clean up intel_plane->plane usage

Maarten Lankhorst maarten.lankhorst at linux.intel.com
Sun Sep 20 23:17:56 PDT 2015


Op 18-09-15 om 03:55 schreef Matt Roper:
> intel_plane->plane has inconsistent meanings across the driver:
>  * For primary planes, intel_plane->plane is usually the pipe number
>    (except for old platforms where it had to be swapped for FBC
>    reasons).
>  * For sprite planes, intel_plane->plane represents the sprite index for
>    the specific CRTC the sprite belongs to (0, 1, 2, ...)
>  * For cursor planes, intel_plane->plane is again the pipe number,
>    but without the FBC swapping on old platforms.
>
> This overloading of the field can be quite confusing and easily leads to
> bugs due to differences in how the hardware actually gets programmed
> (e.g., SKL code needs to use p->plane + 1 because the hardware expects
> universal plane ID's that include the primary, whereas VLV code needs to
> use just p->plane because hardware expects a sprite index that does not
> include the primary).
>
> Let's try to clean up this situation by giving intel_plane->plane a
> consistent meaning across all plane types, and then update all uses
> across driver code to use macros to interpret it properly.  The
> following macros should be used in the code where we previously accessed
> p->plane and will do additional plane type checking to help prevent
> misuse:
>  * I915_UNIVERSAL_NUM(p) --- Universal plane ID (primary = 0, sprites
>    start from 1); intended for use in gen9+ code.
>  * I915_I915_PRIMARY_NUM(p) --- Primary plane ID for pre-gen9 platforms;
>    determines whether FBC-related swapping is needed or not.
The extra I915_ here should probably be fixed when committing, though it's
not sufficient to require a resend of this patch. :-)
>  * I915_SPRITE_NUM(p) --- Sprite plane ID (first sprite = 0); intended
>    for use in pre-gen9 code.
>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst at intel.com>


More information about the Intel-gfx mailing list