drm/i915: Fix broken mst get_hw_state.
Subsystems (2)
PATCH 1/1 drm/i915: Fix broken mst get_hw_state.
connector->encoder is initialized as NULL. Fix this by setting it in during pre enable. MST connectors are not read out during initial hw readout, and have no fixed encoder mappings. So it's harmless to return false when the connector has never been assigned to an encoder.
---
drivers/gpu/drm/i915/intel_display.c +4 -4
@@ -6283,7 +6283,7 @@ static void intel_connector_check_state(struct intel_connector *connector) connector->base.name);if (connector->get_hw_state (connector)) { -struct drm_encoder *encoder = &connector->encoder->base; +struct intel_encoder *encoder = connector->encoder;struct drm_connector_state *conn_state = connector->base.state; I915_STATE_WARN(!crtc,
@@ -6295,13 +6295,13 @@ static void intel_connector_check_state(struct intel_connector *connector)I915_STATE_WARN (!crtc->state->active,"connector is active, but attached crtc isn't\n" ); -if (!encoder) +if (!encoder || encoder->type ==INTEL_OUTPUT_DP_MST )return ; -I915_STATE_WARN (conn_state->best_encoder != encoder, +I915_STATE_WARN (conn_state->best_encoder != &encoder->base,"atomic encoder doesn't match attached encoder\n" ); -I915_STATE_WARN (conn_state->crtc != encoder->crtc, +I915_STATE_WARN (conn_state->crtc != encoder->base.crtc,"attached encoder crtc differs from connector crtc\n" ); }else { I915_STATE_WARN(crtc && crtc->state->active,
drivers/gpu/drm/i915/intel_dp_mst.c +6 -1
@@ -159,6 +159,11 @@ static void intel_mst_pre_enable_dp(struct intel_encoder *encoder)return ; } +/* MST encoders are bound to a crtc, not to a connector, +* force the mapping here for get_hw_state. +*/ + found->encoder = encoder; +DRM_DEBUG_KMS ("%d\n" , intel_dp->active_mst_links); intel_mst->port = found->port;
@@ -392,7 +397,7 @@ static const struct drm_encoder_funcs intel_dp_mst_enc_funcs = {static bool intel_dp_mst_get_hw_state (struct intel_connector *connector) { -if (connector->encoder) { +if (connector->encoder && connector->base.state->crtc) {enum pipe pipe;if (!connector->encoder->get_hw_state (connector->encoder, &pipe))return false;
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Task id: 7270 -------------------------------------Summary-------------------------------------
Platform Delta drm-intel-nightly Series Applied
ILK 253/253 253/253 SNB 248/248 248/248 IVB 281/281 281/281 BYT 234/234 234/234 HSW 317/317 317/317
-------------------------------------Detailed-------------------------------------
Platform Test drm-intel-nightly Series Applied
Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 54 lines · Maarten Lankhorst
connector->encoderis initialized as NULL. Fix this by setting it in during pre enable. MST connectors are not read out during initial hw readout, and have no fixed encoder mappings. So it's harmless to return false when the connector has never been assigned to an encoder.Signed-off-by Maarten Lankhorst <[email protected]>---
drivers/gpu/drm/i915/intel_display.c +4
-4@@ -6283,7 +6283,7 @@ static void intel_connector_check_state(struct intel_connector *connector) connector->base.name);if (connector->get_hw_state (connector)) { -struct drm_encoder *encoder = &connector->encoder->base; +struct intel_encoder *encoder = connector->encoder;struct drm_connector_state *conn_state = connector->base.state; I915_STATE_WARN(!crtc,@@ -6295,13 +6295,13 @@ static void intel_connector_check_state(struct intel_connector *connector)I915_STATE_WARN (!crtc->state->active,"connector is active, but attached crtc isn't\n" ); -if (!encoder) +if (!encoder || encoder->type ==INTEL_OUTPUT_DP_MST )return ; -I915_STATE_WARN (conn_state->best_encoder != encoder, +I915_STATE_WARN (conn_state->best_encoder != &encoder->base,"atomic encoder doesn't match attached encoder\n" ); -I915_STATE_WARN (conn_state->crtc != encoder->crtc, +I915_STATE_WARN (conn_state->crtc != encoder->base.crtc,"attached encoder crtc differs from connector crtc\n" ); }else { I915_STATE_WARN(crtc && crtc->state->active,drivers/gpu/drm/i915/intel_dp_mst.c +5
-0@@ -159,6 +159,11 @@ static void intel_mst_pre_enable_dp(struct intel_encoder *encoder)return ; } +/* MST encoders are bound to a crtc, not to a connector, +* force the mapping here for get_hw_state. +*/ + found->encoder = encoder; +DRM_DEBUG_KMS ("%d\n" , intel_dp->active_mst_links); intel_mst->port = found->port;
drivers/gpu/drm/i915/intel_dp_mst.c static const struct drm_encoder_funcs intel_dp_mst_enc_funcs = { · line 400
Quoted 5 lines
drivers/gpu/drm/i915/intel_dp_mst.c +1
-1@@ -392,7 +397,7 @@ static const struct drm_encoder_funcs intel_dp_mst_enc_funcs = {static bool intel_dp_mst_get_hw_state (struct intel_connector *connector) { -if (connector->encoder) { +if (connector->encoder && connector->base.state->crtc) {
Is this here to cover the case where we disable this connector and assign the encoder to a different connector? I guess this should work since if we disable the connector than crtc will be null, and we'll assign a proper encoder when re-enabling. But now I'm wondering if it would make sense to set connector->encoder back to NULL in post_disable.
Ander
Quoted 8 lines
drivers/gpu/drm/i915/intel_dp_mst.c +0
-0enum pipe pipe;if (!connector->encoder->get_hw_state (connector->encoder, &pipe))return false;_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Op 02-09-15 om 16:07 schreef Ander Conselvan De Oliveira:
Quoted 56 lines · Maarten Lankhorst
Quoted 55 lines
connector->encoderis initialized as NULL. Fix this by setting it in during pre enable. MST connectors are not read out during initial hw readout, and have no fixed encoder mappings. So it's harmless to return false when the connector has never been assigned to an encoder.Signed-off-by Maarten Lankhorst <[email protected]>---
drivers/gpu/drm/i915/intel_display.c +4
-4@@ -6283,7 +6283,7 @@ static void intel_connector_check_state(struct intel_connector *connector) connector->base.name);if (connector->get_hw_state (connector)) { -struct drm_encoder *encoder = &connector->encoder->base; +struct intel_encoder *encoder = connector->encoder;struct drm_connector_state *conn_state = connector->base.state; I915_STATE_WARN(!crtc,@@ -6295,13 +6295,13 @@ static void intel_connector_check_state(struct intel_connector *connector)I915_STATE_WARN (!crtc->state->active,"connector is active, but attached crtc isn't\n" ); -if (!encoder) +if (!encoder || encoder->type ==INTEL_OUTPUT_DP_MST )return ; -I915_STATE_WARN (conn_state->best_encoder != encoder, +I915_STATE_WARN (conn_state->best_encoder != &encoder->base,"atomic encoder doesn't match attached encoder\n" ); -I915_STATE_WARN (conn_state->crtc != encoder->crtc, +I915_STATE_WARN (conn_state->crtc != encoder->base.crtc,"attached encoder crtc differs from connector crtc\n" ); }else { I915_STATE_WARN(crtc && crtc->state->active,drivers/gpu/drm/i915/intel_dp_mst.c +5
-0@@ -159,6 +159,11 @@ static void intel_mst_pre_enable_dp(struct intel_encoder *encoder)return ; } +/* MST encoders are bound to a crtc, not to a connector, +* force the mapping here for get_hw_state. +*/ + found->encoder = encoder; +DRM_DEBUG_KMS ("%d\n" , intel_dp->active_mst_links); intel_mst->port = found->port;@@ -392,7 +397,7 @@ static const struct drm_encoder_funcs intel_dp_mst_enc_funcs = {
Quoted 9 lines
drivers/gpu/drm/i915/intel_dp_mst.c static const struct drm_encoder_funcs intel_dp_mst_enc_funcs = { · line 400
Quoted 4 lines
drivers/gpu/drm/i915/intel_dp_mst.c +1
-1static bool intel_dp_mst_get_hw_state (struct intel_connector *connector) { -if (connector->encoder) { +if (connector->encoder && connector->base.state->crtc) {Is this here to cover the case where we disable this connector and assign the encoder to a different connector? I guess this should work since if we disable the connector than crtc will be null, and we'll assign a proper encoder when re-enabling. But now I'm wondering if it would make sense to set
connector->encoderback to NULL inpost_disable.
Yes, it's harmless to keep it non-null if conn_state->crtc is checked though. Saves another pointless loop.
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 66 lines · Maarten Lankhorst
Op 02-09-15 om 16:07 schreef Ander Conselvan De Oliveira:
Quoted 56 lines · Maarten Lankhorst
Quoted 55 lines
connector->encoderis initialized as NULL. Fix this by setting it in during pre enable. MST connectors are not read out during initial hw readout, and have no fixed encoder mappings. So it's harmless to return false when the connector has never been assigned to an encoder.Signed-off-by Maarten Lankhorst <[email protected]>---
drivers/gpu/drm/i915/intel_display.c +4
-4@@ -6283,7 +6283,7 @@ static void intel_connector_check_state(struct intel_connector *connector) connector->base.name);if (connector->get_hw_state (connector)) { -struct drm_encoder *encoder = &connector->encoder->base; +struct intel_encoder *encoder = connector->encoder;struct drm_connector_state *conn_state = connector->base.state; I915_STATE_WARN(!crtc,@@ -6295,13 +6295,13 @@ static void intel_connector_check_state(struct intel_connector *connector)I915_STATE_WARN (!crtc->state->active,"connector is active, but attached crtc isn't\n" ); -if (!encoder) +if (!encoder || encoder->type ==INTEL_OUTPUT_DP_MST )return ; -I915_STATE_WARN (conn_state->best_encoder != encoder, +I915_STATE_WARN (conn_state->best_encoder != &encoder->base,"atomic encoder doesn't match attached encoder\n" ); -I915_STATE_WARN (conn_state->crtc != encoder->crtc, +I915_STATE_WARN (conn_state->crtc != encoder->base.crtc,"attached encoder crtc differs from connector crtc\n" ); }else { I915_STATE_WARN(crtc && crtc->state->active,drivers/gpu/drm/i915/intel_dp_mst.c +5
-0@@ -159,6 +159,11 @@ static void intel_mst_pre_enable_dp(struct intel_encoder *encoder)return ; } +/* MST encoders are bound to a crtc, not to a connector, +* force the mapping here for get_hw_state. +*/ + found->encoder = encoder; +DRM_DEBUG_KMS ("%d\n" , intel_dp->active_mst_links); intel_mst->port = found->port;@@ -392,7 +397,7 @@ static const struct drm_encoder_funcs intel_dp_mst_enc_funcs = {Quoted 9 lines
drivers/gpu/drm/i915/intel_dp_mst.c static const struct drm_encoder_funcs intel_dp_mst_enc_funcs = { · line 400
Quoted 4 lines
drivers/gpu/drm/i915/intel_dp_mst.c +1
-1static bool intel_dp_mst_get_hw_state (struct intel_connector *connector) { -if (connector->encoder) { +if (connector->encoder && connector->base.state->crtc) {Is this here to cover the case where we disable this connector and assign the encoder to a different connector? I guess this should work since if we disable the connector than crtc will be null, and we'll assign a proper encoder when re-enabling. But now I'm wondering if it would make sense to set
connector->encoderback to NULL inpost_disable.
Quoted 1 line
Yes, it's harmless to keep it non-null if
conn_state->crtcis checked though. Saves another pointless loop.
Hm in get_hw_state functions we really shouldn't look at state pointers like connector->encoder or state->crtc at all. It /should/ be all free-standing for fastboot to actually work.
But I guess that's a lot more than just one patch ;-) -Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Ander Conselvan De Oliveira
Reviewed-byQuoted 71 lines · Maarten Lankhorst
Op 02-09-15 om 16:07 schreef Ander Conselvan De Oliveira:
Quoted 58 lines · Maarten Lankhorst
Quoted 57 lines
connector->encoderis initialized as NULL. Fix this by setting it in during pre enable. MST connectors are not read out during initial hw readout, and have no fixed encoder mappings. So it's harmless to return false when the connector has never been assigned to an encoder.Signed-off-by Maarten Lankhorst <[email protected]>---
drivers/gpu/drm/i915/intel_display.c +1
-1@@ -6283,7 +6283,7 @@ static void intel_connector_check_state(struct intel_connector *connector) connector->base.name);if (connector->get_hw_state (connector)) { -struct drm_encoder *encoder = &connector->encoder->base; +struct intel_encoder *encoder = connector->encoder;struct drm_connector_state *conn_state = connector->base.state;drivers/gpu/drm/i915/intel_display.c +3
-3I915_STATE_WARN(!crtc,@@ -6295,13 +6295,13 @@ static void intel_connector_check_state(struct intel_connector *connector)I915_STATE_WARN (!crtc->state->active,"connector is active, but attached crtc isn't\n" ); -if (!encoder) +if (!encoder || encoder->type ==INTEL_OUTPUT_DP_MST )return ; -I915_STATE_WARN (conn_state->best_encoder != encoder, +I915_STATE_WARN (conn_state->best_encoder != &encoder->base,"atomic encoder doesn't match attached encoder\n" ); -I915_STATE_WARN (conn_state->crtc != encoder->crtc, +I915_STATE_WARN (conn_state->crtc != encoder->base.crtc,"attached encoder crtc differs from connector crtc\n" ); }else {drivers/gpu/drm/i915/intel_display.c +0
-0I915_STATE_WARN(crtc && crtc->state->active,drivers/gpu/drm/i915/intel_dp_mst.c +5
-0@@ -159,6 +159,11 @@ static void intel_mst_pre_enable_dp(struct intel_encoder *encoder)return ; } +/* MST encoders are bound to a crtc, not to a connector, +* force the mapping here for get_hw_state. +*/ + found->encoder = encoder; +DRM_DEBUG_KMS ("%d\n" , intel_dp->active_mst_links); intel_mst->port = found->port;@@ -392,7 +397,7 @@ static const struct drm_encoder_funcs intel_dp_mst_enc_funcs = {Quoted 12 lines
drivers/gpu/drm/i915/intel_dp_mst.c static const struct drm_encoder_funcs intel_dp_mst_enc_funcs = { · line 400
Quoted 4 lines
drivers/gpu/drm/i915/intel_dp_mst.c +1
-1static bool intel_dp_mst_get_hw_state (struct intel_connector *connector) { -if (connector->encoder) { +if (connector->encoder && connector->base.state->crtc) {Is this here to cover the case where we disable this connector and assign the encoder to a different
connector? I guess this should work since if we disable the connector than crtc will be null, and
we'll assign a proper encoder when re-enabling. But now I'm wondering if it would make sense to setconnector->encoderback to NULL inpost_disable.
Quoted 2 lines
Yes, it's harmless to keep it non-null if
conn_state->crtcis checked though. Saves another pointless loop.
Fair enough.
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 72 lines · Ander Conselvan De Oliveira
Quoted 71 lines · Maarten Lankhorst
Op 02-09-15 om 16:07 schreef Ander Conselvan De Oliveira:
Quoted 70 lines · Maarten Lankhorst
Quoted 56 lines
connector->encoderis initialized as NULL. Fix this by setting it in during pre enable. MST connectors are not read out during initial hw readout, and have no fixed encoder mappings. So it's harmless to return false when the connector has never been assigned to an encoder.Signed-off-by Maarten Lankhorst <[email protected]>---
drivers/gpu/drm/i915/intel_display.c +1
-1@@ -6283,7 +6283,7 @@ static void intel_connector_check_state(struct intel_connector *connector) connector->base.name);if (connector->get_hw_state (connector)) { -struct drm_encoder *encoder = &connector->encoder->base; +struct intel_encoder *encoder = connector->encoder;struct drm_connector_state *conn_state = connector->base.state;drivers/gpu/drm/i915/intel_display.c +3
-3I915_STATE_WARN(!crtc,@@ -6295,13 +6295,13 @@ static void intel_connector_check_state(struct intel_connector *connector)I915_STATE_WARN (!crtc->state->active,"connector is active, but attached crtc isn't\n" ); -if (!encoder) +if (!encoder || encoder->type ==INTEL_OUTPUT_DP_MST )return ; -I915_STATE_WARN (conn_state->best_encoder != encoder, +I915_STATE_WARN (conn_state->best_encoder != &encoder->base,"atomic encoder doesn't match attached encoder\n" ); -I915_STATE_WARN (conn_state->crtc != encoder->crtc, +I915_STATE_WARN (conn_state->crtc != encoder->base.crtc,"attached encoder crtc differs from connector crtc\n" ); }else {drivers/gpu/drm/i915/intel_display.c +0
-0I915_STATE_WARN(crtc && crtc->state->active,drivers/gpu/drm/i915/intel_dp_mst.c +5
-0@@ -159,6 +159,11 @@ static void intel_mst_pre_enable_dp(struct intel_encoder *encoder)return ; } +/* MST encoders are bound to a crtc, not to a connector, +* force the mapping here for get_hw_state. +*/ + found->encoder = encoder; +DRM_DEBUG_KMS ("%d\n" , intel_dp->active_mst_links); intel_mst->port = found->port;drivers/gpu/drm/i915/intel_dp_mst.c static const struct drm_encoder_funcs intel_dp_mst_enc_funcs = { · line 400
Quoted 5 lines
drivers/gpu/drm/i915/intel_dp_mst.c +1
-1@@ -392,7 +397,7 @@ static const struct drm_encoder_funcs intel_dp_mst_enc_funcs = {static bool intel_dp_mst_get_hw_state (struct intel_connector *connector) { -if (connector->encoder) { +if (connector->encoder && connector->base.state->crtc) {Is this here to cover the case where we disable this connector and assign the encoder to a different
connector? I guess this should work since if we disable the connector than crtc will be null, and
we'll assign a proper encoder when re-enabling. But now I'm wondering if it would make sense to setconnector->encoderback to NULL inpost_disable.
Quoted 6 lines
Quoted 2 lines
Yes, it's harmless to keep it non-null if
conn_state->crtcis checked though. Saves another pointless loop.Fair enough.
Reviewed-by Ander Conselvan de Oliveira <[email protected]>
Pushed to drm-intel-next-fixes, thanks for the patch and review.
BR,
Jani.
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 6 lines · Maarten Lankhorst
connector->encoderis initialized as NULL. Fix this by setting it in during pre enable. MST connectors are not read out during initial hw readout, and have no fixed encoder mappings. So it's harmless to return false when the connector has never been assigned to an encoder.Signed-off-by Maarten Lankhorst <[email protected]>
Commit message fails to explain what exactly goes boom here. And without that I can't decided whether this is for dinq or -fixes.
Also I'd like a few FIXMEs sprinkled since get_hw_state really shouldn't look at software state at all.
-Daniel
Quoted 61 lines
---
drivers/gpu/drm/i915/intel_display.c +4
-4@@ -6283,7 +6283,7 @@ static void intel_connector_check_state(struct intel_connector *connector) connector->base.name);if (connector->get_hw_state (connector)) { -struct drm_encoder *encoder = &connector->encoder->base; +struct intel_encoder *encoder = connector->encoder;struct drm_connector_state *conn_state = connector->base.state; I915_STATE_WARN(!crtc,@@ -6295,13 +6295,13 @@ static void intel_connector_check_state(struct intel_connector *connector)I915_STATE_WARN (!crtc->state->active,"connector is active, but attached crtc isn't\n" ); -if (!encoder) +if (!encoder || encoder->type ==INTEL_OUTPUT_DP_MST )return ; -I915_STATE_WARN (conn_state->best_encoder != encoder, +I915_STATE_WARN (conn_state->best_encoder != &encoder->base,"atomic encoder doesn't match attached encoder\n" ); -I915_STATE_WARN (conn_state->crtc != encoder->crtc, +I915_STATE_WARN (conn_state->crtc != encoder->base.crtc,"attached encoder crtc differs from connector crtc\n" ); }else { I915_STATE_WARN(crtc && crtc->state->active,drivers/gpu/drm/i915/intel_dp_mst.c +6
-1@@ -159,6 +159,11 @@ static void intel_mst_pre_enable_dp(struct intel_encoder *encoder)return ; } +/* MST encoders are bound to a crtc, not to a connector, +* force the mapping here for get_hw_state. +*/ + found->encoder = encoder; +DRM_DEBUG_KMS ("%d\n" , intel_dp->active_mst_links); intel_mst->port = found->port;@@ -392,7 +397,7 @@ static const struct drm_encoder_funcs intel_dp_mst_enc_funcs = {static bool intel_dp_mst_get_hw_state (struct intel_connector *connector) { -if (connector->encoder) { +if (connector->encoder && connector->base.state->crtc) {enum pipe pipe;if (!connector->encoder->get_hw_state (connector->encoder, &pipe))return false;_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx