mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-11-08 22:45:43 +00:00
97 lines
2.9 KiB
Diff
97 lines
2.9 KiB
Diff
From 9c2332f1376f5fb7c87f16dff77e9270eb7c91c8 Mon Sep 17 00:00:00 2001
|
|
From: Matt Porter <mporter@ti.com>
|
|
Date: Tue, 22 Nov 2011 10:48:32 -0500
|
|
Subject: [PATCH 3/3] st7735fb: Make FB native endian on little endian platforms
|
|
|
|
This is a quick unoptimized implementation of a shadow swap buffer
|
|
which is engaged on little endian platforms. It's not DMA safe
|
|
at this point nor is it particularly optimized during updates.
|
|
This is ok atm since the point is to be compatible with all the
|
|
user space code out there that assumes that all FBdevs are native
|
|
endian.
|
|
|
|
Now things like "cat foo.rgb565 > /dev/fb0" work as well as standard
|
|
apps like fbv with no byte swapping mods.
|
|
|
|
Signed-off-by: Matt Porter <mporter@ti.com>
|
|
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
|
|
---
|
|
drivers/video/st7735fb.c | 26 ++++++++++++++++++++------
|
|
include/video/st7735fb.h | 1 +
|
|
2 files changed, 21 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/drivers/video/st7735fb.c b/drivers/video/st7735fb.c
|
|
index 500cc88..69ad3d0 100644
|
|
--- drivers.old/video/st7735fb.c
|
|
+++ drivers/video/st7735fb.c
|
|
@@ -244,7 +244,14 @@ static void st7735fb_update_display(struct st7735fb_par *par)
|
|
{
|
|
int ret = 0;
|
|
u8 *vmem = par->info->screen_base;
|
|
+#ifdef __LITTLE_ENDIAN
|
|
+ int i;
|
|
+ u16 *vmem16 = (u16 *)vmem;
|
|
+ u16 *ssbuf = par->ssbuf;
|
|
|
|
+ for (i=0; i<WIDTH*HEIGHT*BPP/8/2; i++)
|
|
+ ssbuf[i] = swab16(vmem16[i]);
|
|
+#endif
|
|
/*
|
|
TODO:
|
|
Allow a subset of pages to be passed in
|
|
@@ -261,7 +268,11 @@ static void st7735fb_update_display(struct st7735fb_par *par)
|
|
st7735_write_cmd(par, ST7735_RAMWR);
|
|
|
|
/* Blast framebuffer to ST7735 internal display RAM */
|
|
+#ifdef __LITTLE_ENDIAN
|
|
+ ret = st7735_write_data_buf(par, (u8 *)ssbuf, WIDTH*HEIGHT*BPP/8);
|
|
+#else
|
|
ret = st7735_write_data_buf(par, vmem, WIDTH*HEIGHT*BPP/8);
|
|
+#endif
|
|
if (ret < 0)
|
|
pr_err("%s: spi_write failed to update display buffer\n",
|
|
par->info->fix.id);
|
|
@@ -417,12 +428,7 @@ static int __devinit st7735fb_probe (struct spi_device *spi)
|
|
info->var.blue.length = 5;
|
|
info->var.transp.offset = 0;
|
|
info->var.transp.length = 0;
|
|
- info->flags = FBINFO_FLAG_DEFAULT |
|
|
-#ifdef __LITTLE_ENDIAN
|
|
- FBINFO_FOREIGN_ENDIAN |
|
|
-#endif
|
|
- FBINFO_VIRTFB;
|
|
-
|
|
+ info->flags = FBINFO_FLAG_DEFAULT | FBINFO_VIRTFB;
|
|
info->fbdefio = &st7735fb_defio;
|
|
fb_deferred_io_init(info);
|
|
|
|
@@ -432,6 +438,14 @@ static int __devinit st7735fb_probe (struct spi_device *spi)
|
|
par->rst = pdata->rst_gpio;
|
|
par->dc = pdata->dc_gpio;
|
|
|
|
+#ifdef __LITTLE_ENDIAN
|
|
+ /* Allocate swapped shadow buffer */
|
|
+ vmem = vzalloc(vmem_size);
|
|
+ if (!vmem)
|
|
+ return retval;
|
|
+ par->ssbuf = vmem;
|
|
+#endif
|
|
+
|
|
retval = register_framebuffer(info);
|
|
if (retval < 0)
|
|
goto fbreg_fail;
|
|
diff --git a/include/video/st7735fb.h b/include/video/st7735fb.h
|
|
index 250f036..52f5182 100644
|
|
--- include.orig/video/st7735fb.h
|
|
+++ include/video/st7735fb.h
|
|
@@ -34,6 +34,7 @@ enum st7735_cmd {
|
|
struct st7735fb_par {
|
|
struct spi_device *spi;
|
|
struct fb_info *info;
|
|
+ u16 *ssbuf;
|
|
int rst;
|
|
int dc;
|
|
};
|
|
--
|
|
1.7.2.5
|
|
|