summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClarence Ip <cip@codeaurora.org>2016-09-08 16:18:13 -0400
committerClarence Ip <cip@codeaurora.org>2016-10-05 10:54:03 -0400
commitdd329652395aba5251c8d9856b96b231e705fcbf (patch)
tree38a20efeb601e2e92fa54e5b34f1339f414c5077
parent4f6a7fef75dcd49ad84e344690362d91b4b732bb (diff)
drm/msm/sde: avoid programming same plane source address
This change adds a check to the plane's pipe programming to avoid writing the source address registers if the new values are the same as what was written before. This avoids clutter on the register logs and reduces the register programming traffic slightly for those situations. Change-Id: If9c17f14d68e3e82ea37edaf4bb5d7c8cf4eb46e Signed-off-by: Clarence Ip <cip@codeaurora.org>
-rw-r--r--drivers/gpu/drm/msm/sde/sde_formats.c10
-rw-r--r--drivers/gpu/drm/msm/sde/sde_formats.h3
-rw-r--r--drivers/gpu/drm/msm/sde/sde_plane.c13
3 files changed, 19 insertions, 7 deletions
diff --git a/drivers/gpu/drm/msm/sde/sde_formats.c b/drivers/gpu/drm/msm/sde/sde_formats.c
index 7a60643be634..34e710da0c26 100644
--- a/drivers/gpu/drm/msm/sde/sde_formats.c
+++ b/drivers/gpu/drm/msm/sde/sde_formats.c
@@ -675,7 +675,8 @@ int sde_format_populate_layout(
struct drm_framebuffer *fb,
struct sde_hw_fmt_layout *layout)
{
- int ret;
+ uint32_t plane_addr[SDE_MAX_PLANES];
+ int i, ret;
if (!fb || !layout) {
DRM_ERROR("invalid arguments\n");
@@ -696,12 +697,19 @@ int sde_format_populate_layout(
if (ret)
return ret;
+ for (i = 0; i < SDE_MAX_PLANES; ++i)
+ plane_addr[i] = layout->plane_addr[i];
+
/* Populate the addresses given the fb */
if (SDE_FORMAT_IS_UBWC(layout->format))
ret = _sde_format_populate_addrs_ubwc(mmu_id, fb, layout);
else
ret = _sde_format_populate_addrs_linear(mmu_id, fb, layout);
+ /* check if anything changed */
+ if (!ret && !memcmp(plane_addr, layout->plane_addr, sizeof(plane_addr)))
+ ret = -EAGAIN;
+
return ret;
}
diff --git a/drivers/gpu/drm/msm/sde/sde_formats.h b/drivers/gpu/drm/msm/sde/sde_formats.h
index db2a4d3d8b26..5dcdfbb653ed 100644
--- a/drivers/gpu/drm/msm/sde/sde_formats.h
+++ b/drivers/gpu/drm/msm/sde/sde_formats.h
@@ -80,7 +80,8 @@ int sde_format_check_modified_format(
* @fb: framebuffer pointer
* @fmtl: format layout structure to populate
*
- * Return: error code on failure, 0 on success
+ * Return: error code on failure, -EAGAIN if success but the addresses
+ * are the same as before or 0 if new addresses were populated
*/
int sde_format_populate_layout(
int mmu_id,
diff --git a/drivers/gpu/drm/msm/sde/sde_plane.c b/drivers/gpu/drm/msm/sde/sde_plane.c
index 621484e74edc..77be4b59a77c 100644
--- a/drivers/gpu/drm/msm/sde/sde_plane.c
+++ b/drivers/gpu/drm/msm/sde/sde_plane.c
@@ -550,14 +550,17 @@ static inline void _sde_plane_set_scanout(struct drm_plane *plane,
}
psde = to_sde_plane(plane);
-
- ret = sde_format_populate_layout(psde->mmu_id, fb, &pipe_cfg->layout);
- if (ret) {
- SDE_ERROR_PLANE(psde, "failed to get format layout, %d\n", ret);
+ if (!psde->pipe_hw) {
+ SDE_ERROR_PLANE(psde, "invalid pipe_hw\n");
return;
}
- if (psde->pipe_hw && psde->pipe_hw->ops.setup_sourceaddress)
+ ret = sde_format_populate_layout(psde->mmu_id, fb, &pipe_cfg->layout);
+ if (ret == -EAGAIN)
+ SDE_DEBUG_PLANE(psde, "not updating same src addrs\n");
+ else if (ret)
+ SDE_ERROR_PLANE(psde, "failed to get format layout, %d\n", ret);
+ else if (psde->pipe_hw->ops.setup_sourceaddress)
psde->pipe_hw->ops.setup_sourceaddress(psde->pipe_hw, pipe_cfg);
}