mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>,
	Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 2/2] video: remap framebuffer as writecombine if possible
Date: Wed, 30 Jul 2025 14:31:26 +0200	[thread overview]
Message-ID: <20250730123126.1062875-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20250730123126.1062875-1-a.fatoum@pengutronix.de>

We do not do cache maintenance for framebuffers and expect that memory
is mapped suitably, either writecombine or uncached (coherent).

The simplefb-client was first added to barebox for a cache-coherent
platform and did not observe this requirement.

To enable its use on ARM as well without graphic artifacts, let's remap
the range as writecombine, which will fall back to uncached if
unsupported.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/video/simplefb-client.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/video/simplefb-client.c b/drivers/video/simplefb-client.c
index dafec6178fe6..1c0ee3e7d426 100644
--- a/drivers/video/simplefb-client.c
+++ b/drivers/video/simplefb-client.c
@@ -18,6 +18,7 @@
 #include <linux/platform_data/simplefb.h>
 #include <driver.h>
 #include <of.h>
+#include <mmu.h>
 
 static struct fb_ops simplefb_ops;
 
@@ -119,6 +120,11 @@ static int simplefb_probe(struct device *dev)
 	info->screen_base = (void *)mem->start;
 	info->screen_size = resource_size(mem);
 
+	/*
+	 * Best effort: Some platforms don't need this and those that do,
+	 * will at worst have some graphic artifacts on lack of remap_range.
+	 */
+	(void)remap_range(info->screen_base, info->screen_size, MAP_WRITECOMBINE);
 
 	info->fbops = &simplefb_ops;
 
-- 
2.39.5




  reply	other threads:[~2025-07-30 12:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-30 12:31 [PATCH 1/2] mmu: define MAP_WRITECOMBINE for all architectures Ahmad Fatoum
2025-07-30 12:31 ` Ahmad Fatoum [this message]
2025-08-05  5:19 ` Sascha Hauer

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=20250730123126.1062875-2-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=ivo.ivanov.ivanov1@gmail.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