From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> 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. Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> --- drivers/gpu/drm/i915/intel_display.c | 35 +++++++++++++++++++++++++++++++++-- drivers/gpu/drm/i915/intel_sprite.c | 14 ++++++++++++++ 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 2b5e81a..82b2f58 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -13788,7 +13788,15 @@ static void intel_finish_crtc_commit(struct drm_crtc *crtc, void intel_plane_destroy(struct drm_plane *plane) { struct intel_plane *intel_plane = to_intel_plane(plane); + char *name; + + /* + * drm_plane_cleanup() zeroes the structure, so + * need an extra dance to avoid leaking the name. + */ + name = plane->name; drm_plane_cleanup(plane); + kfree(name); kfree(intel_plane); } @@ -13838,6 +13846,21 @@ 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) + primary->base.name = kasprintf(GFP_KERNEL, "plane 1%c", + pipe_name(pipe)); + else if (INTEL_INFO(dev)->gen >= 5 || IS_G4X(dev)) + primary->base.name = kasprintf(GFP_KERNEL, "primary %c", + pipe_name(pipe)); + else + primary->base.name = kasprintf(GFP_KERNEL, "plane %c", + plane_name(primary->plane)); + if (!primary->base.name) { + kfree(state); + kfree(primary); + return NULL; + } + if (INTEL_INFO(dev)->gen >= 9) { intel_primary_formats = skl_primary_formats; num_formats = ARRAY_SIZE(skl_primary_formats); @@ -13987,6 +14010,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; + cursor->base.name = kasprintf(GFP_KERNEL, "cursor %c", + pipe_name(pipe)); + if (!cursor->base.name) { + kfree(state); + kfree(cursor); + return NULL; + } + drm_universal_plane_init(dev, &cursor->base, 0, &intel_plane_funcs, intel_cursor_formats, @@ -14113,9 +14144,9 @@ static void intel_crtc_init(struct drm_device *dev, int pipe) fail: if (primary) - drm_plane_cleanup(primary); + intel_plane_destroy(primary); if (cursor) - drm_plane_cleanup(cursor); + intel_plane_destroy(cursor); kfree(crtc_state); kfree(intel_crtc->base.name); kfree(intel_crtc); diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c index a2c15f8..b1520f1 100644 --- a/drivers/gpu/drm/i915/intel_sprite.c +++ b/drivers/gpu/drm/i915/intel_sprite.c @@ -1119,7 +1119,21 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane) intel_plane->frontbuffer_bit = INTEL_FRONTBUFFER_SPRITE(pipe, plane); intel_plane->check_plane = intel_check_sprite_plane; intel_plane->commit_plane = intel_commit_sprite_plane; + + if (INTEL_INFO(dev)->gen >= 9) + intel_plane->base.name = kasprintf(GFP_KERNEL, "plane %d%c", + plane + 2, pipe_name(pipe)); + else + intel_plane->base.name = kasprintf(GFP_KERNEL, "sprite %c", + sprite_name(pipe, plane)); + if (!intel_plane->base.name) { + kfree(state); + kfree(intel_plane); + return -ENOMEM; + } + possible_crtcs = (1 << pipe); + ret = drm_universal_plane_init(dev, &intel_plane->base, possible_crtcs, &intel_plane_funcs, plane_formats, num_plane_formats, -- 2.4.10 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx