linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Reichel <sre@kernel.org>
To: Sebastian Reichel <sre@kernel.org>,
	Tony Lindgren <tony@atomide.com>,
	Aaro Koskinen <aaro.koskinen@iki.fi>,
	Tomi Valkeinen <tomi.valkeinen@ti.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: David Airlie <airlied@linux.ie>,
	linux-omap@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org
Subject: [PATCHv2 07/10] drm: omapdrm: plane: update fifo size on atomic update
Date: Sun,  5 Mar 2017 01:43:06 +0100	[thread overview]
Message-ID: <20170305004309.28259-7-sre@kernel.org> (raw)
In-Reply-To: <20170305004309.28259-1-sre@kernel.org>

This is a workaround for a hardware bug occuring on OMAP3
with manually updated panels. Details about the HW bug are
unknown to me, but without this fix the panel refresh does
not work at all on Nokia N950.

Signed-off-By: Sebastian Reichel <sre@kernel.org>
---
 drivers/gpu/drm/omapdrm/dss/dispc.c   |  2 ++
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  4 ++++
 drivers/gpu/drm/omapdrm/omap_drv.h    |  1 +
 drivers/gpu/drm/omapdrm/omap_plane.c  | 23 +++++++++++++++++++++++
 4 files changed, 30 insertions(+)

diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c
index d956e6266368..97240e59b248 100644
--- a/drivers/gpu/drm/omapdrm/dss/dispc.c
+++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
@@ -1321,6 +1321,7 @@ void dispc_ovl_set_fifo_threshold(enum omap_plane plane, u32 low, u32 high)
 			plane != OMAP_DSS_WB)
 		dispc_write_reg(DISPC_OVL_PRELOAD(plane), min(high, 0xfffu));
 }
+EXPORT_SYMBOL(dispc_ovl_set_fifo_threshold);
 
 void dispc_enable_fifomerge(bool enable)
 {
@@ -1379,6 +1380,7 @@ void dispc_ovl_compute_fifo_thresholds(enum omap_plane plane,
 		*fifo_high = total_fifo_size - buf_unit;
 	}
 }
+EXPORT_SYMBOL(dispc_ovl_compute_fifo_thresholds);
 
 static void dispc_ovl_set_mflag(enum omap_plane plane, bool enable)
 {
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 5666ecbe4b80..65c3530a3b53 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -878,6 +878,10 @@ void dispc_ovl_set_channel_out(enum omap_plane plane,
 		enum omap_channel channel);
 int dispc_ovl_setup(enum omap_plane plane, const struct omap_overlay_info *oi,
 		bool replication, const struct videomode *vm, bool mem_to_mem);
+void dispc_ovl_compute_fifo_thresholds(enum omap_plane plane,
+		u32 *fifo_low, u32 *fifo_high, bool use_fifomerge,
+		bool manual_update);
+void dispc_ovl_set_fifo_threshold(enum omap_plane plane, u32 low, u32 high);
 
 enum omap_dss_output_id dispc_mgr_get_supported_outputs(enum omap_channel channel);
 
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h
index ee8901dc0381..71b5c5e25ee4 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.h
+++ b/drivers/gpu/drm/omapdrm/omap_drv.h
@@ -146,6 +146,7 @@ struct drm_plane *omap_plane_init(struct drm_device *dev,
 		u32 possible_crtcs);
 void omap_plane_install_properties(struct drm_plane *plane,
 		struct drm_mode_object *obj);
+void omap_plane_update_fifo(struct drm_plane *plane);
 
 struct drm_encoder *omap_encoder_init(struct drm_device *dev,
 		struct omap_dss_device *dssdev);
diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c
index 386d90af70f7..8d290cfe8925 100644
--- a/drivers/gpu/drm/omapdrm/omap_plane.c
+++ b/drivers/gpu/drm/omapdrm/omap_plane.c
@@ -73,6 +73,28 @@ static void omap_plane_cleanup_fb(struct drm_plane *plane,
 		omap_framebuffer_unpin(old_state->fb);
 }
 
+void omap_plane_update_fifo(struct drm_plane *plane)
+{
+	struct omap_plane *omap_plane = to_omap_plane(plane);
+	struct drm_plane_state *state = plane->state;
+	struct drm_device *dev = plane->dev;
+	bool use_fifo_merge = false;
+	u32 fifo_low, fifo_high;
+	bool use_manual_update;
+
+	if (!dispc_ovl_enabled(omap_plane->id))
+		return;
+
+	use_manual_update = omap_crtc_is_manual_updated(state->crtc);
+
+	dispc_ovl_compute_fifo_thresholds(omap_plane->id, &fifo_low, &fifo_high,
+			use_fifo_merge, use_manual_update);
+
+	dev_dbg(dev->dev, "update fifo: %d %d", fifo_low, fifo_high);
+
+	dispc_ovl_set_fifo_threshold(omap_plane->id, fifo_low, fifo_high);
+}
+
 static void omap_plane_atomic_update(struct drm_plane *plane,
 				     struct drm_plane_state *old_state)
 {
@@ -137,6 +159,7 @@ static void omap_plane_atomic_update(struct drm_plane *plane,
 	}
 
 	dispc_ovl_enable(omap_plane->id, true);
+	omap_plane_update_fifo(plane);
 }
 
 static void omap_plane_atomic_disable(struct drm_plane *plane,
-- 
2.11.0

  parent reply	other threads:[~2017-03-05  0:44 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-04 23:50 [PATCHv2 00/10] Nokia N950 basic display support Sebastian Reichel
2017-03-05  0:43 ` [PATCHv2 01/10] drm: omapdrm: panel-dsi-cm: Fix probe for device tree Sebastian Reichel
2017-03-05  0:43   ` [PATCHv2 02/10] drm: omapdrm: panel-dsi-cm: add regulator support Sebastian Reichel
2017-03-05  5:40     ` Tony Lindgren
2017-03-17 15:26     ` Pavel Machek
2017-03-05  0:43   ` [PATCHv2 03/10] Revert "drm: omapdrm: Remove manual update display support" Sebastian Reichel
2017-03-20 11:07     ` Tomi Valkeinen
2017-03-20 16:14       ` Tony Lindgren
2017-03-20 16:35         ` Tomi Valkeinen
2017-03-20 16:43           ` Tony Lindgren
2017-03-05  0:43   ` [PATCHv2 04/10] drm: omapdrm: crtc: save framedone callback from dss Sebastian Reichel
2017-03-05  5:41     ` Tony Lindgren
2017-03-05  0:43   ` [PATCHv2 05/10] drm: omapdrm: crtc: detect manually updated displays Sebastian Reichel
2017-03-05  5:42     ` Tony Lindgren
2017-03-05  0:43   ` [PATCHv2 06/10] drm: omapdrm: crtc: add support for manual " Sebastian Reichel
2017-03-05  0:43   ` Sebastian Reichel [this message]
2017-03-05  0:43   ` [PATCHv2 08/10] drm: omapdrm: crtc: handle framedone directly Sebastian Reichel
2017-03-17 15:26     ` Pavel Machek
2017-03-05  0:43   ` [PATCHv2 09/10] drm: omapdrm: crtc: get manual mode displays working Sebastian Reichel
2017-03-05  5:39     ` Tony Lindgren
2017-03-20 11:19     ` Tomi Valkeinen
2017-03-05  0:43   ` [PATCHv2 10/10] ARM: dts: n950: add display support Sebastian Reichel
2017-03-24 14:29     ` Tony Lindgren
2017-03-24 14:58       ` Tomi Valkeinen
2017-03-24 15:12         ` Tony Lindgren
2017-03-24 15:20           ` Tomi Valkeinen
2017-03-24 15:44             ` Tony Lindgren
2017-03-17 15:26   ` [PATCHv2 01/10] drm: omapdrm: panel-dsi-cm: Fix probe for device tree Pavel Machek
2017-03-20 11:29 ` [PATCHv2 00/10] Nokia N950 basic display support Tomi Valkeinen
2017-03-21  9:38   ` Tomi Valkeinen
2017-03-21  9:54     ` Tomi Valkeinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170305004309.28259-7-sre@kernel.org \
    --to=sre@kernel.org \
    --cc=aaro.koskinen@iki.fi \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=tomi.valkeinen@ti.com \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).