summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDhaval Patel <pdhaval@quicinc.com>2016-10-10 10:21:10 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2016-10-10 10:21:10 -0700
commit994ee36996ec682c9e56ac2a4a076d86abfbbc92 (patch)
treea60edfb8f2d965c053913b3c4291b25dc21dacdb
parent9fb1de36a153477009acf684356d97c279d0d81a (diff)
parentdd329652395aba5251c8d9856b96b231e705fcbf (diff)
Merge "drm/msm/sde: avoid programming same plane source address" into dev/msm-4.4-drm_kms
-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);
}