[Intel-gfx] [PATCH v3 9/9] drm/i915: Give meaningful names to all the planes
ville.syrjala at linux.intel.com
ville.syrjala at linux.intel.com
Fri Nov 13 08:20:23 PST 2015
From: Ville Syrjälä <ville.syrjala at linux.intel.com>
Let's name our planes in a way that makes sense wrt. the spec:
- skl+ -> "plane 1A", "plane 2A", "plane 1C", "cursor A" etc.
- g4x+ -> "primary A", "primary B", "sprite A", "cursor C" etc.
- pre-g4x -> "plane A", "cursor B" etc.
v2: Rebase on top of the fixed/cleaned error paths
Use a local 'name' variable to make things easier
v3: Pass the name as a function argument to drm_universal_plane_init() (Jani)
Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
drivers/gpu/drm/i915/intel_display.c | 20 ++++++++++++++++++--
drivers/gpu/drm/i915/intel_sprite.c | 11 ++++++++++-
2 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index de1c5fdf..d7c8a0f 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -13804,6 +13804,7 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,
{
struct intel_plane *primary = NULL;
struct intel_plane_state *state = NULL;
+ char name[16];
const uint32_t *intel_primary_formats;
unsigned int num_formats;
int ret;
@@ -13832,6 +13833,17 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,
if (HAS_FBC(dev) && INTEL_INFO(dev)->gen < 4)
primary->plane = !pipe;
+ if (INTEL_INFO(dev)->gen >= 9)
+ ret = snprintf(name, sizeof(name), "plane 1%c",
+ pipe_name(pipe));
+ else if (INTEL_INFO(dev)->gen >= 5 || IS_G4X(dev))
+ ret = snprintf(name, sizeof(name), "primary %c",
+ pipe_name(pipe));
+ else
+ ret = snprintf(name, sizeof(name), "plane %c",
+ plane_name(primary->plane));
+ WARN_ON(ret >= sizeof(name));
+
if (INTEL_INFO(dev)->gen >= 9) {
intel_primary_formats = skl_primary_formats;
num_formats = ARRAY_SIZE(skl_primary_formats);
@@ -13846,7 +13858,7 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,
ret = drm_universal_plane_init(dev, &primary->base, 0,
&intel_plane_funcs,
intel_primary_formats, num_formats,
- DRM_PLANE_TYPE_PRIMARY, "");
+ DRM_PLANE_TYPE_PRIMARY, name);
if (ret)
goto fail;
@@ -13968,6 +13980,7 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,
{
struct intel_plane *cursor = NULL;
struct intel_plane_state *state = NULL;
+ char name[16];
int ret;
cursor = kzalloc(sizeof(*cursor), GFP_KERNEL);
@@ -13988,11 +14001,14 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,
cursor->commit_plane = intel_commit_cursor_plane;
cursor->disable_plane = intel_disable_cursor_plane;
+ ret = snprintf(name, sizeof(name), "cursor %c", pipe_name(pipe));
+ WARN_ON(ret >= sizeof(name));
+
ret = drm_universal_plane_init(dev, &cursor->base, 0,
&intel_plane_funcs,
intel_cursor_formats,
ARRAY_SIZE(intel_cursor_formats),
- DRM_PLANE_TYPE_CURSOR, "");
+ DRM_PLANE_TYPE_CURSOR, name);
if (ret)
goto fail;
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index aa60970..dc2acba 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -1040,6 +1040,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
{
struct intel_plane *intel_plane = NULL;
struct intel_plane_state *state = NULL;
+ char name[16];
unsigned long possible_crtcs;
const uint32_t *plane_formats;
int num_plane_formats;
@@ -1123,12 +1124,20 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
intel_plane->check_plane = intel_check_sprite_plane;
intel_plane->commit_plane = intel_commit_sprite_plane;
+ if (INTEL_INFO(dev)->gen >= 9)
+ ret = snprintf(name, sizeof(name), "plane %d%c",
+ plane + 2, pipe_name(pipe));
+ else
+ ret = snprintf(name, sizeof(name), "sprite %c",
+ sprite_name(pipe, plane));
+ WARN_ON(ret >= sizeof(name));
+
possible_crtcs = (1 << pipe);
ret = drm_universal_plane_init(dev, &intel_plane->base, possible_crtcs,
&intel_plane_funcs,
plane_formats, num_plane_formats,
- DRM_PLANE_TYPE_OVERLAY, "");
+ DRM_PLANE_TYPE_OVERLAY, name);
if (ret)
goto fail;
--
2.4.10
More information about the Intel-gfx
mailing list