drm: Give crtcs and planes actual names (v2)
Subsystems (3)
v2 cover drm: Give crtcs and planes actual names (v2)
From: Ville Syrjälä <[email protected]>
OK, so another attempt. This time the error handling and cleanup should be more solid.
Previus attempt was at
http://lists.freedesktop.org/archives/dri-devel/2015-November/094331.html
I pushed v2 to:git://github.com/vsyrjala/linux.git crtc_plane_name_2
Ville Syrjälä (8):
drm: Add crtc->name and use it in debug messages
drm: Add plane->name and use it in debug prints drm/i915: Use crtc->name in debug messages
drm/i915: Use plane->name in debug prints
drm/i915: Set crtc->name to "pipe A", "pipe B", etc. drm/i915: Fix plane init failure paths
drm/i915: Don't leak primary/cursor planes on crtc init failure drm/i915: Give meaningful names to all the planes
drivers/gpu/drm/drm_atomic.c | 53 ++++----- drivers/gpu/drm/drm_atomic_helper.c | 60 +++++----- drivers/gpu/drm/drm_crtc.c | 11 +- drivers/gpu/drm/drm_crtc_helper.c | 24 ++-- drivers/gpu/drm/i915/intel_display.c | 218 +++++++++++++++++++++++------------ drivers/gpu/drm/i915/intel_fbdev.c | 5 +- drivers/gpu/drm/i915/intel_sprite.c | 48 +++++--- include/drm/drm_crtc.h | 4 + 8 files changed, 265 insertions(+), 158 deletions(-)
Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 1/8 drm: Add crtc->name and use it in debug messages
From: Ville Syrjälä <[email protected]>
--- drivers/gpu/drm/drm_atomic.c | 41 ++++++++++++++------------- drivers/gpu/drm/drm_atomic_helper.c | 56 +++++++++++++++++++------------------ drivers/gpu/drm/drm_crtc.c | 8 ++++-- drivers/gpu/drm/drm_crtc_helper.c | 24 ++++++++-------- include/drm/drm_crtc.h | 2 ++ 5 files changed, 71 insertions(+), 60 deletions(-)
drivers/gpu/drm/drm_atomic.c +21 -20
@@ -288,8 +288,8 @@ drm_atomic_get_crtc_state(struct drm_atomic_state *state, state->crtcs[index] = crtc; crtc_state->state = state; -DRM_DEBUG_ATOMIC ("Added [CRTC:%d] %p state to %p\n" , - crtc->base.id, crtc_state, state); +DRM_DEBUG_ATOMIC ("Added [CRTC:%d:%s] %p state to %p\n" , + crtc->base.id, crtc->name, crtc_state, state);return crtc_state; }
@@ -480,8 +480,8 @@ static int drm_atomic_crtc_check(struct drm_crtc *crtc,*/ if (state->active && !state->enable) { -DRM_DEBUG_ATOMIC ("[CRTC:%d] active without enabled\n" , - crtc->base.id); +DRM_DEBUG_ATOMIC ("[CRTC:%d:%s] active without enabled\n" , + crtc->base.id, crtc->name);return -EINVAL ; }
@@ -490,15 +490,15 @@ static int drm_atomic_crtc_check(struct drm_crtc *crtc,* be able to trigger. */ if (drm_core_check_feature (crtc->dev,DRIVER_ATOMIC ) &&WARN_ON (state->enable && !state->mode_blob)) { -DRM_DEBUG_ATOMIC ("[CRTC:%d] enabled without mode blob\n" , - crtc->base.id); +DRM_DEBUG_ATOMIC ("[CRTC:%d:%s] enabled without mode blob\n" , + crtc->base.id, crtc->name);return -EINVAL ; }if (drm_core_check_feature (crtc->dev,DRIVER_ATOMIC ) &&WARN_ON (!state->enable && state->mode_blob)) { -DRM_DEBUG_ATOMIC ("[CRTC:%d] disabled with mode blob\n" , - crtc->base.id); +DRM_DEBUG_ATOMIC ("[CRTC:%d:%s] disabled with mode blob\n" , + crtc->base.id, crtc->name);return -EINVAL ; }
@@ -980,8 +980,8 @@ drm_atomic_set_crtc_for_plane(struct drm_plane_state *plane_state, }if (crtc) -DRM_DEBUG_ATOMIC ("Link plane state %p to [CRTC:%d]\n" , - plane_state, crtc->base.id); +DRM_DEBUG_ATOMIC ("Link plane state %p to [CRTC:%d:%s]\n" , + plane_state, crtc->base.id, crtc->name);else DRM_DEBUG_ATOMIC ("Link plane state %p to [NOCRTC]\n" , plane_state);
@@ -1048,8 +1048,8 @@ drm_atomic_set_crtc_for_connector(struct drm_connector_state *conn_state, conn_state->crtc = crtc;if (crtc) -DRM_DEBUG_ATOMIC ("Link connector state %p to [CRTC:%d]\n" , - conn_state, crtc->base.id); +DRM_DEBUG_ATOMIC ("Link connector state %p to [CRTC:%d:%s]\n" , + conn_state, crtc->base.id, crtc->name);else DRM_DEBUG_ATOMIC ("Link connector state %p to [NOCRTC]\n" , conn_state);
@@ -1088,8 +1088,8 @@ drm_atomic_add_affected_connectors(struct drm_atomic_state *state,if (ret)return ret; -DRM_DEBUG_ATOMIC ("Adding all current connectors for [CRTC:%d] to %p\n" , - crtc->base.id, state); +DRM_DEBUG_ATOMIC ("Adding all current connectors for [CRTC:%d:%s] to %p\n" , + crtc->base.id, crtc->name, state);/* * Changed connectors are already in @state, so only need to look at the
@@ -1169,8 +1169,9 @@ drm_atomic_connectors_for_crtc(struct drm_atomic_state *state, num_connected_connectors++; } -DRM_DEBUG_ATOMIC ("State %p has %i connectors for [CRTC:%d]\n" , - state, num_connected_connectors, crtc->base.id); +DRM_DEBUG_ATOMIC ("State %p has %i connectors for [CRTC:%d:%s]\n" , + state, num_connected_connectors, + crtc->base.id, crtc->name);return num_connected_connectors; }
@@ -1237,8 +1238,8 @@ int drm_atomic_check_only(struct drm_atomic_state *state)for_each_crtc_in_state (state, crtc, crtc_state, i) { ret =drm_atomic_crtc_check (crtc, crtc_state);if (ret) { -DRM_DEBUG_ATOMIC ("[CRTC:%d] atomic core check failed\n" , - crtc->base.id); +DRM_DEBUG_ATOMIC ("[CRTC:%d:%s] atomic core check failed\n" , + crtc->base.id, crtc->name);return ret; } }
@@ -1249,8 +1250,8 @@ int drm_atomic_check_only(struct drm_atomic_state *state)if (!state->allow_modeset) {for_each_crtc_in_state (state, crtc, crtc_state, i) {if (drm_atomic_crtc_needs_modeset (crtc_state)) { -DRM_DEBUG_ATOMIC ("[CRTC:%d] requires full modeset\n" , - crtc->base.id); +DRM_DEBUG_ATOMIC ("[CRTC:%d:%s] requires full modeset\n" , + crtc->base.id, crtc->name);return -EINVAL ; } }
drivers/gpu/drm/drm_atomic_helper.c +29 -27
142 lines not on this page · raw message
drivers/gpu/drm/drm_crtc.c +6 -2
@@ -677,6 +677,9 @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc, crtc->dev = dev; crtc->funcs = funcs; +if (!crtc->name) + crtc->name ="" ; +drm_modeset_lock_init (&crtc->mutex); ret =drm_mode_object_get (dev, &crtc->base,DRM_MODE_OBJECT_CRTC );if (ret)
@@ -1801,7 +1804,8 @@ int drm_mode_getresources(struct drm_device *dev, void *data, copied =0 ; crtc_id = (uint32_t __user *)(unsigned long )card_res->crtc_id_ptr;drm_for_each_crtc (crtc, dev) { -DRM_DEBUG_KMS ("[CRTC:%d]\n" , crtc->base.id); +DRM_DEBUG_KMS ("[CRTC:%d:%s]\n" , + crtc->base.id, crtc->name);if (put_user (crtc->base.id, crtc_id + copied)) { ret = -EFAULT ; goto out;
@@ -2646,7 +2650,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data, ret = -ENOENT ; goto out; } -DRM_DEBUG_KMS ("[CRTC:%d]\n" , crtc->base.id); +DRM_DEBUG_KMS ("[CRTC:%d:%s]\n" , crtc->base.id, crtc->name);if (crtc_req->mode_valid) {/* If we have a mode we need a framebuffer. */
drivers/gpu/drm/drm_crtc_helper.c +13 -11
@@ -329,7 +329,7 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,DRM_DEBUG_KMS ("CRTC fixup failed\n" ); goto done; } -DRM_DEBUG_KMS ("[CRTC:%d]\n" , crtc->base.id); +DRM_DEBUG_KMS ("[CRTC:%d:%s]\n" , crtc->base.id, crtc->name); crtc->hwmode = *adjusted_mode;
@@ -484,11 +484,13 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) set->fb =NULL ;if (set->fb) { -DRM_DEBUG_KMS ("[CRTC:%d] [FB:%d] #connectors=%d (x y) (%i %i)\n" , - set->crtc->base.id, set->fb->base.id, - (int )set->num_connectors, set->x, set->y); +DRM_DEBUG_KMS ("[CRTC:%d:%s] [FB:%d] #connectors=%d (x y) (%i %i)\n" , + set->crtc->base.id, set->crtc->name, + set->fb->base.id, + (int )set->num_connectors, set->x, set->y); }else { -DRM_DEBUG_KMS ("[CRTC:%d] [NOFB]\n" , set->crtc->base.id); +DRM_DEBUG_KMS ("[CRTC:%d:%s] [NOFB]\n" , + set->crtc->base.id, set->crtc->name);drm_crtc_helper_disable (set->crtc);return 0 ; }
@@ -628,12 +630,12 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) connector->encoder->crtc = new_crtc; }if (new_crtc) { -DRM_DEBUG_KMS ("[CONNECTOR:%d:%s] to [CRTC:%d]\n" , - connector->base.id, connector->name, - new_crtc->base.id); +DRM_DEBUG_KMS ("[CONNECTOR:%d:%s] to [CRTC:%d:%s]\n" , + connector->base.id, connector->name, + new_crtc->base.id, new_crtc->name); }else {DRM_DEBUG_KMS ("[CONNECTOR:%d:%s] to [NOCRTC]\n" , - connector->base.id, connector->name); + connector->base.id, connector->name); } }
@@ -650,8 +652,8 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)if (!drm_crtc_helper_set_mode (set->crtc, set->mode, set->x, set->y, save_set.fb)) { -DRM_ERROR ("failed to set mode on [CRTC:%d]\n" , - set->crtc->base.id); +DRM_ERROR ("failed to set mode on [CRTC:%d:%s]\n" , + set->crtc->base.id, set->crtc->name); set->crtc->primary->fb = save_set.fb; ret = -EINVAL ; goto fail;
include/drm/drm_crtc.h +2 -0
@@ -426,6 +426,8 @@ struct drm_crtc {struct device_node *port;struct list_head head; +char *name; +/* * crtc mutex *
Signature · 6 lines
2.4.10 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Jani Nikula
maintainerRe: [Intel-gfx] [PATCH 1/8] drm: Add crtc->name and use it in debug messages
drivers/gpu/drm/drm_crtc.c int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc, · line 682
Quoted 11 lines · On Thu, 12 Nov 2015, [email protected] wrote:
drivers/gpu/drm/drm_crtc.c +3
-0@@ -677,6 +677,9 @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc, crtc->dev = dev; crtc->funcs = funcs; +if (!crtc->name) + crtc->name ="" ; +
This, and the cleanup dance you have to do in patch 5/8, are my only gripes with the series. I would prefer it if crtc->name and plane->name were managed dynamically by the init/cleanup functions like connector->name and encoder->name are. However those are easier because the caller doesn't decide the name.
Do you think it would be too ugly to have this here:
crtc->name = kstrdup(crtc->name ? crtc->name : "", GFP_KERNEL);
It would of course be neater if the name was passed in as parameter, but that would generate quite a bit of unnecessary churn.
If you are all "meh" I guess I can live with your approach too.
BR,
Jani.
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [Intel-gfx] [PATCH 1/8] drm: Add crtc->name and use it in debug messages
Quoted 19 lines · Jani Nikula
drivers/gpu/drm/drm_crtc.c int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc, · line 682
Quoted 11 lines · On Thu, 12 Nov 2015, [email protected] wrote:
drivers/gpu/drm/drm_crtc.c +3
-0@@ -677,6 +677,9 @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc, crtc->dev = dev; crtc->funcs = funcs; +if (!crtc->name) + crtc->name ="" ; +This, and the cleanup dance you have to do in patch 5/8, are my only gripes with the series. I would prefer it if
crtc->nameandplane->namewere managed dynamically by the init/cleanup functions likeconnector->nameandencoder->nameare. However those are easier because the caller doesn't decide the name.
Quoted 3 lines
Do you think it would be too ugly to have this here:
crtc->name = kstrdup(crtc->name ? crtc->name : "", GFP_KERNEL);
Hmm. Yeah that might be a decentish alternative. I initialliy tried to do dynamic allocation in both the driver and core, and that made the error handling during init rather nasty. But if it's only the core that does it, it might be OK.
Quoted 3 lines
It would of course be neater if the name was passed in as parameter, but that would generate quite a bit of unnecessary churn.
Yeah, I've been hitting a lot of drivers recently with a bunch of stuff, and was sort of hoping to avoid it this time. But if people prefer a passed in parameter, I could do it as well. Maybe this time I could even get coccinelle to cooperate with me (whether that happens seems to depend on the phase of the moon or something).
Quoted 10 lines
If you are all "meh" I guess I can live with your approach too.
BR,
Jani.Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [Intel-gfx] [PATCH 1/8] drm: Add crtc->name and use it in debug messages
Quoted 30 lines · Ville Syrjälä
Quoted 19 lines · Jani Nikula
drivers/gpu/drm/drm_crtc.c int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc, · line 682
Quoted 11 lines · On Thu, 12 Nov 2015, [email protected] wrote:
drivers/gpu/drm/drm_crtc.c +3
-0@@ -677,6 +677,9 @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc, crtc->dev = dev; crtc->funcs = funcs; +if (!crtc->name) + crtc->name ="" ; +This, and the cleanup dance you have to do in patch 5/8, are my only gripes with the series. I would prefer it if
crtc->nameandplane->namewere managed dynamically by the init/cleanup functions likeconnector->nameandencoder->nameare. However those are easier because the caller doesn't decide the name.Quoted 3 lines
Do you think it would be too ugly to have this here:
crtc->name = kstrdup(crtc->name ? crtc->name : "", GFP_KERNEL);Hmm. Yeah that might be a decentish alternative. I initialliy tried to do dynamic allocation in both the driver and core, and that made the error handling during init rather nasty. But if it's only the core that does it, it might be OK.
Quoted 1 line
Quoted 8 lines
Quoted 2 lines
It would of course be neater if the name was passed in as parameter, but that would generate quite a bit of unnecessary churn.
Yeah, I've been hitting a lot of drivers recently with a bunch of stuff, and was sort of hoping to avoid it this time. But if people prefer a passed in parameter, I could do it as well. Maybe this time I could even get coccinelle to cooperate with me (whether that happens seems to depend on the phase of the moon or something).
See my suggestion to go with idx-%i, drm_plane_index as the default. That's fairly reasonable (especially for any hw with true universal planes shared across all crtc), in which case there's imo not much point in passing it in directly. And for most drivers you want some printf like anyway, so the passed-in argument won't result in cleaner code. -Daniel
Quoted 19 lines
Quoted 11 lines
If you are all "meh" I guess I can live with your approach too.
BR,
Jani.Signature · 1 line
Jani Nikula, Intel Open Source Technology CenterSignature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/8] drm: Add crtc->name and use it in debug messages
Quoted 40 lines · Daniel Vetter
Quoted 30 lines · Ville Syrjälä
Quoted 19 lines · Jani Nikula
drivers/gpu/drm/drm_crtc.c int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc, · line 682
Quoted 11 lines · On Thu, 12 Nov 2015, [email protected] wrote:
drivers/gpu/drm/drm_crtc.c +3
-0@@ -677,6 +677,9 @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc, crtc->dev = dev; crtc->funcs = funcs; +if (!crtc->name) + crtc->name ="" ; +This, and the cleanup dance you have to do in patch 5/8, are my only gripes with the series. I would prefer it if
crtc->nameandplane->namewere managed dynamically by the init/cleanup functions likeconnector->nameandencoder->nameare. However those are easier because the caller doesn't decide the name.Quoted 3 lines
Do you think it would be too ugly to have this here:
crtc->name = kstrdup(crtc->name ? crtc->name : "", GFP_KERNEL);Hmm. Yeah that might be a decentish alternative. I initialliy tried to do dynamic allocation in both the driver and core, and that made the error handling during init rather nasty. But if it's only the core that does it, it might be OK.
Quoted 1 line
Quoted 8 lines
Quoted 2 lines
It would of course be neater if the name was passed in as parameter, but that would generate quite a bit of unnecessary churn.
Yeah, I've been hitting a lot of drivers recently with a bunch of stuff, and was sort of hoping to avoid it this time. But if people prefer a passed in parameter, I could do it as well. Maybe this time I could even get coccinelle to cooperate with me (whether that happens seems to depend on the phase of the moon or something).
Quoted 4 lines
See my suggestion to go with idx-%i,
drm_plane_indexas the default. That's fairly reasonable (especially for any hw with true universal planes shared across all crtc), in which case there's imo not much point in passing it in directly.
I think most hw has some kind of naming scheme for the planes in the spec, so IMO passing it in usually makes sense. So forcing everyone to pass something might encourage people to actually put something sensible there.
Quoted 2 lines
And for most drivers you want some printf like anyway, so the passed-in argument won't result in cleaner code.
It will since the driver doesn't have to remember to kfree() it all over the place, or deal with the malloc error.
As for the printf thing, we could pass a printf style format string
+ va args to the function and just pass those through to kvasprintf().
Quoted 26 lines
-Daniel
Quoted 19 lines
Quoted 11 lines
If you are all "meh" I guess I can live with your approach too.
BR,
Jani.Signature · 1 line
Jani Nikula, Intel Open Source Technology CenterSignature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-develSignature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 2/8 drm: Add plane->name and use it in debug prints
In reply to [email protected]From: Ville Syrjälä <[email protected]>
--- drivers/gpu/drm/drm_atomic.c | 12 ++++++------ drivers/gpu/drm/drm_atomic_helper.c | 4 ++-- drivers/gpu/drm/drm_crtc.c | 3 +++ include/drm/drm_crtc.h | 2 ++ 4 files changed, 13 insertions(+), 8 deletions(-)
drivers/gpu/drm/drm_atomic.c +6 -6
@@ -543,8 +543,8 @@ drm_atomic_get_plane_state(struct drm_atomic_state *state, state->planes[index] = plane; plane_state->state = state; -DRM_DEBUG_ATOMIC ("Added [PLANE:%d] %p state to %p\n" , - plane->base.id, plane_state, state); +DRM_DEBUG_ATOMIC ("Added [PLANE:%d:%s] %p state to %p\n" , + plane->base.id, plane->name, plane_state, state);if (plane_state->crtc) {struct drm_crtc_state *crtc_state;
@@ -755,8 +755,8 @@ static int drm_atomic_plane_check(struct drm_plane *plane, }if (plane_switching_crtc (state->state, plane, state)) { -DRM_DEBUG_ATOMIC ("[PLANE:%d] switching CRTC directly\n" , - plane->base.id); +DRM_DEBUG_ATOMIC ("[PLANE:%d:%s] switching CRTC directly\n" , + plane->base.id, plane->name);return -EINVAL ; }
@@ -1229,8 +1229,8 @@ int drm_atomic_check_only(struct drm_atomic_state *state)for_each_plane_in_state (state, plane, plane_state, i) { ret =drm_atomic_plane_check (plane, plane_state);if (ret) { -DRM_DEBUG_ATOMIC ("[PLANE:%d] atomic core check failed\n" , - plane->base.id); +DRM_DEBUG_ATOMIC ("[PLANE:%d:%s] atomic core check failed\n" , + plane->base.id, plane->name);return ret; } }
drivers/gpu/drm/drm_atomic_helper.c +2 -2
@@ -503,8 +503,8 @@ drm_atomic_helper_check_planes(struct drm_device *dev, ret = funcs->atomic_check (plane, plane_state);if (ret) { -DRM_DEBUG_ATOMIC ("[PLANE:%d] atomic driver check failed\n" , - plane->base.id); +DRM_DEBUG_ATOMIC ("[PLANE:%d:%s] atomic driver check failed\n" , + plane->base.id, plane->name);return ret; } }
drivers/gpu/drm/drm_crtc.c +3 -0
@@ -1174,6 +1174,9 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane,drm_modeset_lock_init (&plane->mutex); +if (!plane->name) + plane->name ="" ; + plane->base.properties = &plane->properties; plane->dev = dev; plane->funcs = funcs;
include/drm/drm_crtc.h +2 -0
@@ -848,6 +848,8 @@ struct drm_plane {struct drm_device *dev;struct list_head head; +char *name; +struct drm_modeset_lock mutex;struct drm_mode_object base;
Signature · 6 lines
2.4.10 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 3/8 drm/i915: Use crtc->name in debug messages
In reply to [email protected]From: Ville Syrjälä <[email protected]>
--- drivers/gpu/drm/i915/intel_display.c | 55 ++++++++++++++++++++---------------- drivers/gpu/drm/i915/intel_fbdev.c | 5 ++-- 2 files changed, 33 insertions(+), 27 deletions(-)
drivers/gpu/drm/i915/intel_display.c +31 -24
@@ -4220,8 +4220,9 @@ struct intel_shared_dpll *intel_get_shared_dpll(struct intel_crtc *crtc, i = (enum intel_dpll_id ) crtc->pipe; pll = &dev_priv->shared_dplls[i]; -DRM_DEBUG_KMS ("CRTC:%d using pre-allocated %s\n" , - crtc->base.base.id, pll->name); +DRM_DEBUG_KMS ("[CRTC:%d:%s] using pre-allocated %s\n" , + crtc->base.base.id, crtc->base.name, + pll->name);WARN_ON (shared_dpll[i].crtc_mask);
@@ -4241,8 +4242,9 @@ struct intel_shared_dpll *intel_get_shared_dpll(struct intel_crtc *crtc,/* 1:1 mapping between ports and PLLs */ i = (enum intel_dpll_id )intel_dig_port->port; pll = &dev_priv->shared_dplls[i]; -DRM_DEBUG_KMS ("CRTC:%d using pre-allocated %s\n" , - crtc->base.base.id, pll->name); +DRM_DEBUG_KMS ("[CRTC:%d:%s] using pre-allocated %s\n" , + crtc->base.base.id, crtc->base.name, + pll->name);WARN_ON (shared_dpll[i].crtc_mask); goto found;
@@ -4258,9 +4260,9 @@ struct intel_shared_dpll *intel_get_shared_dpll(struct intel_crtc *crtc,if (memcmp (&crtc_state->dpll_hw_state, &shared_dpll[i].hw_state,sizeof (crtc_state->dpll_hw_state)) ==0 ) { -DRM_DEBUG_KMS ("CRTC:%d sharing existing %s (crtc mask 0x%08x, ative %d)\n" , - crtc->base.base.id, pll->name, - shared_dpll[i].crtc_mask, +DRM_DEBUG_KMS ("[CRTC:%d:%s] sharing existing %s (crtc mask 0x%08x, ative %d)\n" , + crtc->base.base.id, crtc->base.name, + pll->name, shared_dpll[i].crtc_mask, pll->active); goto found; }
@@ -4270,8 +4272,9 @@ struct intel_shared_dpll *intel_get_shared_dpll(struct intel_crtc *crtc,for (i =0 ; i < dev_priv->num_shared_dpll; i++) { pll = &dev_priv->shared_dplls[i];if (shared_dpll[i].crtc_mask ==0 ) { -DRM_DEBUG_KMS ("CRTC:%d allocated %s\n" , - crtc->base.base.id, pll->name); +DRM_DEBUG_KMS ("[CRTC:%d:%s] allocated %s\n" , + crtc->base.base.id, crtc->base.name, + pll->name); goto found; } }
@@ -4398,8 +4401,9 @@ int skl_update_scaler_crtc(struct intel_crtc_state *state)struct intel_crtc *intel_crtc =to_intel_crtc (state->base.crtc);const struct drm_display_mode *adjusted_mode = &state->base.adjusted_mode; -DRM_DEBUG_KMS ("Updating scaler for [CRTC:%i] scaler_user index %u.%u\n" , - intel_crtc->base.base.id, intel_crtc->pipe,SKL_CRTC_INDEX ); +DRM_DEBUG_KMS ("Updating scaler for [CRTC:%d:%s] scaler_user index %u.%u\n" , + intel_crtc->base.base.id, intel_crtc->base.name, + intel_crtc->pipe,SKL_CRTC_INDEX ); return skl_update_scaler(state, !state->base.active, SKL_CRTC_INDEX, &state->scaler_state.scaler_id, DRM_ROTATE_0,
@@ -11643,13 +11647,13 @@ int intel_plane_atomic_calc_changes(struct drm_crtc_state *crtc_state,struct drm_i915_private *dev_priv = dev->dev_private;struct intel_plane_state *old_plane_state =to_intel_plane_state (plane->state); -int idx = intel_crtc->base.base.id, ret;int i =drm_plane_index (plane);bool mode_changed =needs_modeset (crtc_state);bool was_crtc_enabled = crtc->state->active;bool is_crtc_enabled = crtc_state->active;bool turn_off, turn_on, visible, was_visible;struct drm_framebuffer *fb = plane_state->fb; +int ret;if (crtc_state &&INTEL_INFO (dev)->gen >=9 && plane->type !=DRM_PLANE_TYPE_CURSOR ) {
@@ -11675,7 +11679,9 @@ int intel_plane_atomic_calc_changes(struct drm_crtc_state *crtc_state, turn_off = was_visible && (!visible || mode_changed); turn_on = visible && (!was_visible || mode_changed); -DRM_DEBUG_ATOMIC ("[CRTC:%i] has [PLANE:%i] with fb %i\n" , idx, +DRM_DEBUG_ATOMIC ("[CRTC:%d:%s] has [PLANE:%i] with fb %i\n" , + intel_crtc->base.base.id, + intel_crtc->base.name, plane->base.id, fb ? fb->base.id :-1 ); DRM_DEBUG_ATOMIC("[PLANE:%i] visible %i -> %i, off %i, on %i, ms %i\n",
@@ -11981,7 +11987,8 @@ static void intel_dump_pipe_config(struct intel_crtc *crtc,struct intel_plane_state *state;struct drm_framebuffer *fb; -DRM_DEBUG_KMS ("[CRTC:%d]%s config %p for pipe %c\n" , crtc->base.base.id, +DRM_DEBUG_KMS ("[CRTC:%d:%s]%s config %p for pipe %c\n" , + crtc->base.base.id, crtc->base.name, context, pipe_config,pipe_name (crtc->pipe));DRM_DEBUG_KMS ("cpu_transcoder: %c\n" ,transcoder_name (pipe_config->cpu_transcoder));
@@ -12753,8 +12760,8 @@ check_crtc_state(struct drm_device *dev, struct drm_atomic_state *old_state) pipe_config->base.crtc = crtc; pipe_config->base.state = old_state; -DRM_DEBUG_KMS ("[CRTC:%d]\n" , - crtc->base.id); +DRM_DEBUG_KMS ("[CRTC:%d:%s]\n" , + crtc->base.id, crtc->name); active = dev_priv->display.get_pipe_config (intel_crtc, pipe_config);
@@ -13390,8 +13397,8 @@ void intel_crtc_restore_mode(struct drm_crtc *crtc) state =drm_atomic_state_alloc (dev);if (!state) { -DRM_DEBUG_KMS ("[CRTC:%d] crtc restore failed, out of memory" , - crtc->base.id); +DRM_DEBUG_KMS ("[CRTC:%d:%s] crtc restore failed, out of memory" , + crtc->base.id, crtc->name);return ; }
@@ -15193,8 +15200,8 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc)if (INTEL_INFO (dev)->gen <4 && !intel_check_plane_mapping (crtc)) {bool plane; -DRM_DEBUG_KMS ("[CRTC:%d] wrong plane connection detected!\n" , - crtc->base.base.id); +DRM_DEBUG_KMS ("[CRTC:%d:%s] wrong plane connection detected!\n" , + crtc->base.base.id, crtc->base.name);/* Pipe has the wrong plane attached and the plane is active. * Temporarily change the plane mapping and disable everything
@@ -15227,8 +15234,8 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc)* functions or because of calls to intel_crtc_disable_noatomic, * or because the pipe is force-enabled due to the * pipe A quirk. */ -DRM_DEBUG_KMS ("[CRTC:%d] hw state adjusted, was %s, now %s\n" , - crtc->base.base.id, +DRM_DEBUG_KMS ("[CRTC:%d:%s] hw state adjusted, was %s, now %s\n" , + crtc->base.base.id, crtc->base.name, crtc->base.state->enable ?"enabled" :"disabled" , crtc->active ?"enabled" :"disabled" );
@@ -15390,8 +15397,8 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)readout_plane_state (crtc); -DRM_DEBUG_KMS ("[CRTC:%d] hw state readout: %s\n" , - crtc->base.base.id, +DRM_DEBUG_KMS ("[CRTC:%d:%s] hw state readout: %s\n" , + crtc->base.base.id, crtc->base.name, crtc->active ?"enabled" :"disabled" ); }
drivers/gpu/drm/i915/intel_fbdev.c +2 -3
@@ -472,10 +472,9 @@ retry: } crtcs[i] = new_crtc; -DRM_DEBUG_KMS ("connector %s on pipe %c [CRTC:%d]: %dx%d%s\n" , +DRM_DEBUG_KMS ("connector %s on [CRTC:%d:%s]: %dx%d%s\n" , connector->name, -pipe_name (to_intel_crtc (encoder->crtc)->pipe), - encoder->crtc->base.id, + encoder->crtc->base.id, encoder->crtc->name, modes[i]->hdisplay, modes[i]->vdisplay, modes[i]->flags &DRM_MODE_FLAG_INTERLACE ?"i" :"" );
Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 4/8 drm/i915: Use plane->name in debug prints
In reply to [email protected]From: Ville Syrjälä <[email protected]>
--- drivers/gpu/drm/i915/intel_display.c | 38 +++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/intel_display.c +22 -16
@@ -4433,9 +4433,9 @@ static int skl_update_scaler_plane(struct intel_crtc_state *crtc_state,bool force_detach = !fb || !plane_state->visible; -DRM_DEBUG_KMS ("Updating scaler for [PLANE:%d] scaler_user index %u.%u\n" , - intel_plane->base.base.id, intel_crtc->pipe, -drm_plane_index (&intel_plane->base)); +DRM_DEBUG_KMS ("Updating scaler for [PLANE:%d:%s] scaler_user index %u.%u\n" , + intel_plane->base.base.id, intel_plane->base.name, + intel_crtc->pipe,drm_plane_index (&intel_plane->base)); ret = skl_update_scaler(crtc_state, force_detach, drm_plane_index(&intel_plane->base),
@@ -4451,8 +4451,9 @@ static int skl_update_scaler_plane(struct intel_crtc_state *crtc_state,/* check colorkey */ if (plane_state->ckey.flags !=I915_SET_COLORKEY_NONE ) { -DRM_DEBUG_KMS ("[PLANE:%d] scaling with color key not allowed" , - intel_plane->base.base.id); +DRM_DEBUG_KMS ("[PLANE:%d:%s] scaling with color key not allowed" , + intel_plane->base.base.id, + intel_plane->base.name);return -EINVAL ; }
@@ -4471,8 +4472,9 @@ static int skl_update_scaler_plane(struct intel_crtc_state *crtc_state,case DRM_FORMAT_VYUY :break ;default : -DRM_DEBUG_KMS ("[PLANE:%d] FB:%d unsupported scaling format 0x%x\n" , - intel_plane->base.base.id, fb->base.id, fb->pixel_format); +DRM_DEBUG_KMS ("[PLANE:%d:%s] FB:%d unsupported scaling format 0x%x\n" , + intel_plane->base.base.id, intel_plane->base.name, + fb->base.id, fb->pixel_format);return -EINVAL ; }
@@ -11679,13 +11681,15 @@ int intel_plane_atomic_calc_changes(struct drm_crtc_state *crtc_state, turn_off = was_visible && (!visible || mode_changed); turn_on = visible && (!was_visible || mode_changed); -DRM_DEBUG_ATOMIC ("[CRTC:%d:%s] has [PLANE:%i] with fb %i\n" , +DRM_DEBUG_ATOMIC ("[CRTC:%d:%s] has [PLANE:%d:%s] with fb %i\n" , intel_crtc->base.base.id, intel_crtc->base.name, - plane->base.id, fb ? fb->base.id :-1 ); + plane->base.id, plane->name, + fb ? fb->base.id :-1 ); -DRM_DEBUG_ATOMIC ("[PLANE:%i] visible %i -> %i, off %i, on %i, ms %i\n" , - plane->base.id, was_visible, visible, +DRM_DEBUG_ATOMIC ("[PLANE:%d:%s] visible %i -> %i, off %i, on %i, ms %i\n" , + plane->base.id, plane->name, + was_visible, visible, turn_off, turn_on, mode_changed);if (turn_on) {
@@ -12088,18 +12092,20 @@ static void intel_dump_pipe_config(struct intel_crtc *crtc, state =to_intel_plane_state (plane->state); fb = state->base.fb;if (!fb) { -DRM_DEBUG_KMS ("%s PLANE:%d plane: %u.%u idx: %d " -"disabled, scaler_id = %d\n" , +DRM_DEBUG_KMS ("%s [PLANE:%d:%s] plane: %u.%u idx: %d " +"disabled, scaler_id = %d\n" , plane->type ==DRM_PLANE_TYPE_CURSOR ?"CURSOR" :"STANDARD" , - plane->base.id, intel_plane->pipe, + plane->base.id, plane->name, + intel_plane->pipe, (crtc->base.primary == plane) ?0 : intel_plane->plane +1 ,drm_plane_index (plane), state->scaler_id);continue ; } -DRM_DEBUG_KMS ("%s PLANE:%d plane: %u.%u idx: %d enabled" , +DRM_DEBUG_KMS ("%s [PLANE:%d:%s] plane: %u.%u idx: %d enabled" , plane->type ==DRM_PLANE_TYPE_CURSOR ?"CURSOR" :"STANDARD" , - plane->base.id, intel_plane->pipe, + plane->base.id, plane->name, + intel_plane->pipe, crtc->base.primary == plane ?0 : intel_plane->plane +1 ,drm_plane_index (plane)); DRM_DEBUG_KMS("\tFB:%d, fb = %ux%u format = 0x%x",
Signature · 6 lines
2.4.10 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 5/8 drm/i915: Set crtc->name to "pipe A", "pipe B", etc.
In reply to [email protected]From: Ville Syrjälä <[email protected]>
v2: Fix intel_crtc leak on failure to allocate the name
Use a local 'name' variable to make things easier
--- drivers/gpu/drm/i915/intel_display.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_display.c +17 -4
@@ -10711,6 +10711,7 @@ static void intel_crtc_destroy(struct drm_crtc *crtc)struct intel_crtc *intel_crtc =to_intel_crtc (crtc);struct drm_device *dev = crtc->dev;struct intel_unpin_work *work; +char *name;spin_lock_irq (&dev->event_lock); work = intel_crtc->unpin_work;
@@ -10722,8 +10723,13 @@ static void intel_crtc_destroy(struct drm_crtc *crtc)kfree (work); } +/* +* drm_crtc_cleanup() zeroes the structure, so +* need an extra dance to avoid leaking the name. +*/ + name = crtc->name;drm_crtc_cleanup (crtc); - +kfree (name);kfree (intel_crtc); }
@@ -14026,15 +14032,16 @@ static void skl_init_scalers(struct drm_device *dev, struct intel_crtc *intel_crstatic void intel_crtc_init (struct drm_device *dev,int pipe) {struct drm_i915_private *dev_priv = dev->dev_private; -struct intel_crtc *intel_crtc; +struct intel_crtc *intel_crtc =NULL ;struct intel_crtc_state *crtc_state =NULL ;struct drm_plane *primary =NULL ;struct drm_plane *cursor =NULL ; +char *name =NULL ;int i, ret; intel_crtc =kzalloc (sizeof (*intel_crtc),GFP_KERNEL ); -if (intel_crtc ==NULL ) -return ; +if (!intel_crtc) + goto fail; crtc_state =kzalloc (sizeof (*crtc_state),GFP_KERNEL );if (!crtc_state)
@@ -14043,6 +14050,11 @@ static void intel_crtc_init(struct drm_device *dev, int pipe) intel_crtc->base.state = &crtc_state->base; crtc_state->base.crtc = &intel_crtc->base; + name =kasprintf (GFP_KERNEL ,"pipe %c" ,pipe_name (pipe)); +if (!name) + goto fail; + intel_crtc->base.name = name; +/* initialize shared scalers */ if (INTEL_INFO (dev)->gen >=9 ) {if (pipe ==PIPE_C )
@@ -14105,6 +14117,7 @@ fail:drm_plane_cleanup (primary);if (cursor)drm_plane_cleanup (cursor); +kfree (name);kfree (crtc_state);kfree (intel_crtc); }
Signature · 6 lines
2.4.10 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 6/8 drm/i915: Fix plane init failure paths
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Deal with errors from drm_universal_plane_init() in primary and cursor plane init paths (sprites were already covered). Also make the code neater by using goto for error handling.
--- drivers/gpu/drm/i915/intel_display.c | 64 ++++++++++++++++++++++-------------- drivers/gpu/drm/i915/intel_sprite.c | 34 +++++++++++-------- 2 files changed, 60 insertions(+), 38 deletions(-)
drivers/gpu/drm/i915/intel_display.c +39 -25
@@ -13807,20 +13807,19 @@ const struct drm_plane_funcs intel_plane_funcs = {static struct drm_plane *intel_primary_plane_create (struct drm_device *dev,int pipe) { -struct intel_plane *primary; -struct intel_plane_state *state; +struct intel_plane *primary =NULL ; +struct intel_plane_state *state =NULL ;const uint32_t *intel_primary_formats;unsigned int num_formats; +int ret; primary =kzalloc (sizeof (*primary),GFP_KERNEL ); -if (primary ==NULL ) -return NULL ; +if (!primary) + goto fail; state =intel_create_plane_state (&primary->base); -if (!state) { -kfree (primary); -return NULL ; - } +if (!state) + goto fail; primary->base.state = &state->base; primary->can_scale = false;
@@ -13849,10 +13848,12 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev, num_formats =ARRAY_SIZE (i8xx_primary_formats); } -drm_universal_plane_init (dev, &primary->base,0 , - &intel_plane_funcs, - intel_primary_formats, num_formats, -DRM_PLANE_TYPE_PRIMARY ); + ret =drm_universal_plane_init (dev, &primary->base,0 , + &intel_plane_funcs, + intel_primary_formats, num_formats, +DRM_PLANE_TYPE_PRIMARY ); +if (ret) + goto fail;if (INTEL_INFO (dev)->gen >=4 )intel_create_rotation_property (dev, primary);
@@ -13860,6 +13861,12 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,drm_plane_helper_add (&primary->base, &intel_plane_helper_funcs);return &primary->base; + +fail: +kfree (state); +kfree (primary); + +return NULL ; }void intel_create_rotation_property (struct drm_device *dev,struct intel_plane *plane)
@@ -13964,18 +13971,17 @@ update:static struct drm_plane *intel_cursor_plane_create (struct drm_device *dev,int pipe) { -struct intel_plane *cursor; -struct intel_plane_state *state; +struct intel_plane *cursor =NULL ; +struct intel_plane_state *state =NULL ; +int ret; cursor =kzalloc (sizeof (*cursor),GFP_KERNEL ); -if (cursor ==NULL ) -return NULL ; +if (!cursor) + goto fail; state =intel_create_plane_state (&cursor->base); -if (!state) { -kfree (cursor); -return NULL ; - } +if (!state) + goto fail; cursor->base.state = &state->base; cursor->can_scale = false;
@@ -13987,11 +13993,13 @@ 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; -drm_universal_plane_init (dev, &cursor->base,0 , - &intel_plane_funcs, - intel_cursor_formats, -ARRAY_SIZE (intel_cursor_formats), -DRM_PLANE_TYPE_CURSOR ); + ret =drm_universal_plane_init (dev, &cursor->base,0 , + &intel_plane_funcs, + intel_cursor_formats, +ARRAY_SIZE (intel_cursor_formats), +DRM_PLANE_TYPE_CURSOR ); +if (ret) + goto fail;if (INTEL_INFO (dev)->gen >=4 ) {if (!dev->mode_config.rotation_property)
@@ -14011,6 +14019,12 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,drm_plane_helper_add (&cursor->base, &intel_plane_helper_funcs);return &cursor->base; + +fail: +kfree (state); +kfree (cursor); + +return NULL ; } static void skl_init_scalers(struct drm_device *dev, struct intel_crtc *intel_crtc,
drivers/gpu/drm/i915/intel_sprite.c +21 -13
@@ -1038,8 +1038,8 @@ static uint32_t skl_plane_formats[] = {int intel_plane_init (struct drm_device *dev,enum pipe pipe,int plane) { -struct intel_plane *intel_plane; -struct intel_plane_state *state; +struct intel_plane *intel_plane =NULL ; +struct intel_plane_state *state =NULL ;unsigned long possible_crtcs;const uint32_t *plane_formats;int num_plane_formats;
@@ -1049,13 +1049,15 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)return -ENODEV ; intel_plane =kzalloc (sizeof (*intel_plane),GFP_KERNEL ); -if (!intel_plane) -return -ENOMEM ; +if (!intel_plane) { + ret = -ENOMEM ; + goto fail; + } state =intel_create_plane_state (&intel_plane->base);if (!state) { -kfree (intel_plane); -return -ENOMEM ; + ret = -ENOMEM ; + goto fail; } intel_plane->base.state = &state->base;
@@ -1110,8 +1112,9 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane) num_plane_formats =ARRAY_SIZE (skl_plane_formats);break ;default : -kfree (intel_plane); -return -ENODEV ; +MISSING_CASE (INTEL_INFO (dev)->gen); + ret = -ENODEV ; + goto fail; } intel_plane->pipe = pipe;
@@ -1119,20 +1122,25 @@ 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; + 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 ); -if (ret) { -kfree (intel_plane); - goto out; - } +if (ret) + goto fail;intel_create_rotation_property (dev, intel_plane);drm_plane_helper_add (&intel_plane->base, &intel_plane_helper_funcs); -out: +return 0 ; + +fail: +kfree (state); +kfree (intel_plane); +return ret; }
Signature · 6 lines
2.4.10 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 7/8 drm/i915: Don't leak primary/cursor planes on crtc init failure
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Call intel_plane_destroy() instead of drm_plane_cleanup() so that we also free the plane struct itself when bailing out of the crtc init.
And make intel_plane_destroy() NULL tolerant to avoid having to check for it in the caller.
--- drivers/gpu/drm/i915/intel_display.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_display.c +6 -6
@@ -13787,9 +13787,11 @@ 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); +if (!plane) +return ; +drm_plane_cleanup (plane); -kfree (intel_plane); +kfree (to_intel_plane (plane)); }const struct drm_plane_funcs intel_plane_funcs = {
@@ -14127,10 +14129,8 @@ static void intel_crtc_init(struct drm_device *dev, int pipe)return ; fail: -if (primary) -drm_plane_cleanup (primary); -if (cursor) -drm_plane_cleanup (cursor); +intel_plane_destroy (primary); +intel_plane_destroy (cursor);kfree (name);kfree (crtc_state);kfree (intel_crtc);
Signature · 6 lines
2.4.10 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 8/8 drm/i915: Give meaningful names to all the planes
In reply to [email protected]From: Ville Syrjälä <[email protected]>
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
--- drivers/gpu/drm/i915/intel_display.c | 30 ++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_sprite.c | 14 ++++++++++++++ 2 files changed, 44 insertions(+)
drivers/gpu/drm/i915/intel_display.c +30 -0
@@ -13787,10 +13787,18 @@ static void intel_finish_crtc_commit(struct drm_crtc *crtc,*/ void intel_plane_destroy (struct drm_plane *plane) { +char *name; +if (!plane)return ; +/* +* 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 (to_intel_plane (plane)); }
@@ -13811,6 +13819,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 =NULL ;const uint32_t *intel_primary_formats;unsigned int num_formats;int ret;
@@ -13839,6 +13848,19 @@ 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 ) + name =kasprintf (GFP_KERNEL ,"plane 1%c" , +pipe_name (pipe)); +else if (INTEL_INFO (dev)->gen >=5 ||IS_G4X (dev)) + name =kasprintf (GFP_KERNEL ,"primary %c" , +pipe_name (pipe)); +else + name =kasprintf (GFP_KERNEL ,"plane %c" , +plane_name (primary->plane)); +if (!name) + goto fail; + primary->base.name = name; +if (INTEL_INFO (dev)->gen >=9 ) { intel_primary_formats = skl_primary_formats; num_formats =ARRAY_SIZE (skl_primary_formats);
@@ -13865,6 +13887,7 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,return &primary->base; fail: +kfree (name);kfree (state);kfree (primary);
@@ -13975,6 +13998,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 =NULL ;int ret; cursor =kzalloc (sizeof (*cursor),GFP_KERNEL );
@@ -13995,6 +14019,11 @@ 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; + name =kasprintf (GFP_KERNEL ,"cursor %c" ,pipe_name (pipe)); +if (!name) + goto fail; + cursor->base.name = name; + ret = drm_universal_plane_init(dev, &cursor->base, 0, &intel_plane_funcs, intel_cursor_formats,
@@ -14023,6 +14052,7 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,return &cursor->base; fail: +kfree (name);kfree (state);kfree (cursor);
drivers/gpu/drm/i915/intel_sprite.c +14 -0
@@ -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 =NULL ;unsigned long possible_crtcs;const uint32_t *plane_formats;int num_plane_formats;
@@ -1123,6 +1124,18 @@ 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 ) + name =kasprintf (GFP_KERNEL ,"plane %d%c" , + plane +2 ,pipe_name (pipe)); +else + name =kasprintf (GFP_KERNEL ,"sprite %c" , +sprite_name (pipe, plane)); +if (!name) { + ret = -ENOMEM ; + goto fail; + } + intel_plane->base.name = name; + possible_crtcs = (1 << pipe); ret = drm_universal_plane_init(dev, &intel_plane->base, possible_crtcs,
@@ -1139,6 +1152,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)return 0 ; fail: +kfree (name);kfree (state);kfree (intel_plane);
Signature · 6 lines
2.4.10 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel