Commit b14e5848 authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Add per-pipe plane identifier

As I told people in [1] we really should not be confusing enum plane
as a per-pipe plane identifier. Looks like that happened nonetheless, so
let's fix it up by splitting the two into two enums.

We'll also want something we just directly pass to various register
offset macros and whatnot on SKL+. So let's make this new thing work for that.
Currently we pass intel_plane->plane for the "sprites" and just a
hardcoded zero for the "primary" planes. We want to get rid of that
hardocoding so that we can share the same code for all planes (apart
from the legacy cursor of course).

[1] https://lists.freedesktop.org/archives/intel-gfx/2015-September/076082.html

Cc: Matt Roper <matthew.d.roper@intel.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: default avatarPaulo Zanoni <paulo.r.zanoni@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1479830524-7882-2-git-send-email-ville.syrjala@linux.intel.com
parent d9348dec
...@@ -180,22 +180,36 @@ static inline bool transcoder_is_dsi(enum transcoder transcoder) ...@@ -180,22 +180,36 @@ static inline bool transcoder_is_dsi(enum transcoder transcoder)
} }
/* /*
* I915_MAX_PLANES in the enum below is the maximum (across all platforms) * Global legacy plane identifier. Valid only for primary/sprite
* number of planes per CRTC. Not all platforms really have this many planes, * planes on pre-g4x, and only for primary planes on g4x+.
* which means some arrays of size I915_MAX_PLANES may have unused entries
* between the topmost sprite plane and the cursor plane.
*/ */
enum plane { enum plane {
PLANE_A = 0, PLANE_A,
PLANE_B, PLANE_B,
PLANE_C, PLANE_C,
PLANE_CURSOR,
I915_MAX_PLANES,
}; };
#define plane_name(p) ((p) + 'A') #define plane_name(p) ((p) + 'A')
#define sprite_name(p, s) ((p) * INTEL_INFO(dev_priv)->num_sprites[(p)] + (s) + 'A') #define sprite_name(p, s) ((p) * INTEL_INFO(dev_priv)->num_sprites[(p)] + (s) + 'A')
/*
* Per-pipe plane identifier.
* I915_MAX_PLANES in the enum below is the maximum (across all platforms)
* number of planes per CRTC. Not all platforms really have this many planes,
* which means some arrays of size I915_MAX_PLANES may have unused entries
* between the topmost sprite plane and the cursor plane.
*
* This is expected to be passed to various register macros
* (eg. PLANE_CTL(), PS_PLANE_SEL(), etc.) so adjust with care.
*/
enum plane_id {
PLANE_PRIMARY,
PLANE_SPRITE0,
PLANE_SPRITE1,
PLANE_CURSOR,
I915_MAX_PLANES,
};
enum port { enum port {
PORT_NONE = -1, PORT_NONE = -1,
PORT_A = 0, PORT_A = 0,
......
...@@ -14988,6 +14988,7 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe) ...@@ -14988,6 +14988,7 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
primary->plane = (enum plane) !pipe; primary->plane = (enum plane) !pipe;
else else
primary->plane = (enum plane) pipe; primary->plane = (enum plane) pipe;
primary->id = PLANE_PRIMARY;
primary->frontbuffer_bit = INTEL_FRONTBUFFER_PRIMARY(pipe); primary->frontbuffer_bit = INTEL_FRONTBUFFER_PRIMARY(pipe);
primary->check_plane = intel_check_primary_plane; primary->check_plane = intel_check_primary_plane;
...@@ -15187,6 +15188,7 @@ intel_cursor_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe) ...@@ -15187,6 +15188,7 @@ intel_cursor_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
cursor->max_downscale = 1; cursor->max_downscale = 1;
cursor->pipe = pipe; cursor->pipe = pipe;
cursor->plane = pipe; cursor->plane = pipe;
cursor->id = PLANE_CURSOR;
cursor->frontbuffer_bit = INTEL_FRONTBUFFER_CURSOR(pipe); cursor->frontbuffer_bit = INTEL_FRONTBUFFER_CURSOR(pipe);
cursor->check_plane = intel_check_cursor_plane; cursor->check_plane = intel_check_cursor_plane;
cursor->update_plane = intel_update_cursor_plane; cursor->update_plane = intel_update_cursor_plane;
......
...@@ -766,7 +766,8 @@ struct intel_plane_wm_parameters { ...@@ -766,7 +766,8 @@ struct intel_plane_wm_parameters {
struct intel_plane { struct intel_plane {
struct drm_plane base; struct drm_plane base;
int plane; u8 plane;
enum plane_id id;
enum pipe pipe; enum pipe pipe;
bool can_scale; bool can_scale;
int max_downscale; int max_downscale;
......
...@@ -1112,6 +1112,7 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv, ...@@ -1112,6 +1112,7 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv,
intel_plane->pipe = pipe; intel_plane->pipe = pipe;
intel_plane->plane = plane; intel_plane->plane = plane;
intel_plane->id = PLANE_SPRITE0 + plane;
intel_plane->frontbuffer_bit = INTEL_FRONTBUFFER_SPRITE(pipe, plane); intel_plane->frontbuffer_bit = INTEL_FRONTBUFFER_SPRITE(pipe, plane);
intel_plane->check_plane = intel_check_sprite_plane; intel_plane->check_plane = intel_check_sprite_plane;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment