drm/msm/sde: populate display topology in atomic check
DRM client may read topology data after atomic commit even in
asynchronous mode. But kernel cannot promise real time update
of topology as the mode_set is executed in the commit thread.
This change identifies the topology for the given mode of the
display in the atomic_check and updates the topology property
of the connector.
Change-Id: I1bcdaa239f23d9636a83b9b33fa9b130bcbe97bd
Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
diff --git a/drivers/gpu/drm/msm/sde/sde_rm.c b/drivers/gpu/drm/msm/sde/sde_rm.c
index 2d03fd0..21fbcb5 100644
--- a/drivers/gpu/drm/msm/sde/sde_rm.c
+++ b/drivers/gpu/drm/msm/sde/sde_rm.c
@@ -1168,6 +1168,33 @@
return NULL;
}
+int sde_rm_update_topology(struct drm_connector_state *conn_state,
+ struct msm_display_topology *topology)
+{
+ int i, ret = 0;
+ struct msm_display_topology top;
+ enum sde_rm_topology_name top_name = SDE_RM_TOPOLOGY_NONE;
+
+ if (!conn_state)
+ return -EINVAL;
+
+ if (topology) {
+ top = *topology;
+ for (i = 0; i < SDE_RM_TOPOLOGY_MAX; i++)
+ if (RM_IS_TOPOLOGY_MATCH(g_top_table[i], top)) {
+ top_name = g_top_table[i].top_name;
+ break;
+ }
+ }
+
+ ret = msm_property_set_property(
+ sde_connector_get_propinfo(conn_state->connector),
+ sde_connector_get_property_state(conn_state),
+ CONNECTOR_PROP_TOPOLOGY_NAME, top_name);
+
+ return ret;
+}
+
/**
* _sde_rm_release_rsvp - release resources and release a reservation
* @rm: KMS handle
@@ -1249,12 +1276,6 @@
SDE_DEBUG("release rsvp[s%de%d]\n", rsvp->seq,
rsvp->enc_id);
_sde_rm_release_rsvp(rm, rsvp, conn);
-
- (void) msm_property_set_property(
- sde_connector_get_propinfo(conn),
- sde_connector_get_property_state(conn->state),
- CONNECTOR_PROP_TOPOLOGY_NAME,
- SDE_RM_TOPOLOGY_NONE);
}
end:
@@ -1270,18 +1291,6 @@
enum sde_hw_blk_type type;
int ret = 0;
- ret = msm_property_set_property(
- sde_connector_get_propinfo(conn_state->connector),
- sde_connector_get_property_state(conn_state),
- CONNECTOR_PROP_TOPOLOGY_NAME,
- rsvp->topology);
- if (ret) {
- SDE_ERROR("failed to set topology name property, ret %d\n",
- ret);
- _sde_rm_release_rsvp(rm, rsvp, conn_state->connector);
- return ret;
- }
-
/* Swap next rsvp to be the active */
for (type = 0; type < SDE_HW_BLK_MAX; type++) {
list_for_each_entry(blk, &rm->hw_blks[type], list) {
@@ -1366,12 +1375,6 @@
_sde_rm_release_rsvp(rm, rsvp_cur, conn_state->connector);
rsvp_cur = NULL;
_sde_rm_print_rsvps(rm, SDE_RM_STAGE_AFTER_CLEAR);
- (void) msm_property_set_property(
- sde_connector_get_propinfo(
- conn_state->connector),
- sde_connector_get_property_state(conn_state),
- CONNECTOR_PROP_TOPOLOGY_NAME,
- SDE_RM_TOPOLOGY_NONE);
}
/* Check the proposed reservation, store it in hw's "next" field */