Skip to contentSkip to conversation

video:cache:fix: Proper buffer alignment for lcd subsystem

PATCH New Lukasz Majewski 3 participants 8 messages Jan 7, 2013 – Jan 8, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 video:cache:fix: Proper buffer alignment for lcd subsystem

This commit makes the video subsystem code cache aware. Memory allocated for decompressed BMP memory is now cache line aligned.

---
 common/cmd_bmp.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
common/cmd_bmp.c +1 -1
index 5a52edd..57f3eb5 100644
@@ -55,7 +55,7 @@ bmp_image_t *gunzip_bmp(unsigned long addr, unsigned long *lenp)
 	 * Decompress bmp image
 	 */
 	len = CONFIG_SYS_VIDEO_LOGO_MAX_SIZE;
-	dst = malloc(CONFIG_SYS_VIDEO_LOGO_MAX_SIZE);
+	dst = memalign(CONFIG_SYS_CACHELINE_SIZE, len);
 	if (dst == NULL) {
 		puts("Error: malloc in gunzip failed!\n");
 		return NULL;
Signature · 1 line
1.7.2.3
#1 lore raw

PATCH 2/2 video:cache:fix:trats: Enable dcache flush for TRATS board's LCD subsystem

lcd_set_flush_dcache(1) function is called from trats configuration file to enable lcd_sync function.

Tested-at: TRATS (Exynos 4210)

---
 board/samsung/trats/trats.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
board/samsung/trats/trats.c +3 -0
index 88d193d..5d0fdd0 100644
@@ -789,5 +789,8 @@ void init_panel_info(vidinfo_t *vid)
 	s6e8ax0_init();
 	exynos_set_dsim_platform_data(&s6e8ax0_platform_data);
 
+	/* Enable flushing after LCD writes if requested */
+	lcd_set_flush_dcache(1);
+
 	setenv("lcdinfo", "lcd=s6e8ax0");
 }
Signature · 1 line
1.7.2.3
#2 lore raw

PATCH 2/2 video:cache:fix:trats: Enable dcache flush for TRATS board's LCD subsystem

Quoted 18 lines · Lukasz Majewski

lcd_set_flush_dcache(1) function is called from trats configuration file to enable lcd_sync function.

Tested-at: TRATS (Exynos 4210)

---
 board/samsung/trats/trats.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
board/samsung/trats/trats.c +0 -0
index 88d193d..5d0fdd0 100644

board/samsung/trats/trats.c void init_panel_info(vidinfo_t *vid) · line 796

Quoted 8 lines
board/samsung/trats/trats.c +3 -0
@@ -789,5 +789,8 @@ void init_panel_info(vidinfo_t *vid)
 	s6e8ax0_init();
 	exynos_set_dsim_platform_data(&s6e8ax0_platform_data);
 
+	/* Enable flushing after LCD writes if requested */
+	lcd_set_flush_dcache(1);
+
 	setenv("lcdinfo", "lcd=s6e8ax0");
 }

---
Thanks,
Minkyu Kang.

#3 lore raw

PATCH 2/2 video:cache:fix:trats: Enable dcache flush for TRATS board's LCD subsystem

In reply to Lukasz Majewski
Quoted 8 lines · Lukasz Majewski

lcd_set_flush_dcache(1) function is called from trats configuration file to enable lcd_sync function.

Tested-at: TRATS (Exynos 4210)

Quoted 20 lines
---
 board/samsung/trats/trats.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
board/samsung/trats/trats.c +3 -1
index 88d193d..5d0fdd0 100644
@@ -789,5 +789,8 @@ void init_panel_info(vidinfo_t *vid)
        s6e8ax0_init();
        exynos_set_dsim_platform_data(&s6e8ax0_platform_data);
 
+       /* Enable flushing after LCD writes if requested */
+       lcd_set_flush_dcache(1);
+
        setenv("lcdinfo", "lcd=s6e8ax0");
 }
--

1.7.2.3

#4 lore raw

PATCH 2/2 video:cache:fix:trats: Enable dcache flush for TRATS board's LCD subsystem

In reply to Lukasz Majewski

Dear Lukasz,

Quoted 17 lines · Lukasz Majewski

lcd_set_flush_dcache(1) function is called from trats configuration file to enable lcd_sync function.

Tested-at: TRATS (Exynos 4210)

---
 board/samsung/trats/trats.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
board/samsung/trats/trats.c +0 -0
index 88d193d..5d0fdd0 100644

board/samsung/trats/trats.c void init_panel_info(vidinfo_t *vid) · line 793

Quoted 5 lines
board/samsung/trats/trats.c +2 -0
@@ -789,5 +789,8 @@ void init_panel_info(vidinfo_t *vid)
 	s6e8ax0_init();
 	exynos_set_dsim_platform_data(&s6e8ax0_platform_data);
 
+	/* Enable flushing after LCD writes if requested */
+	lcd_set_flush_dcache(1);

Please move it into exynos_fb.c (lcd_ctrl_init? or somewhere)

board/samsung/trats/trats.c void init_panel_info(vidinfo_t *vid) · line 796

Quoted 4 lines
board/samsung/trats/trats.c +1 -0
+
 	setenv("lcdinfo", "lcd=s6e8ax0");
 }

Thanks,
Minkyu Kang.

#5 lore raw

PATCH 1/2 video:cache:fix: Proper buffer alignment for lcd subsystem

In reply to Lukasz Majewski

Hi Lukasz,

Quoted 16 lines · Lukasz Majewski

This commit makes the video subsystem code cache aware. Memory allocated for decompressed BMP memory is now cache line aligned.

---
 common/cmd_bmp.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
common/cmd_bmp.c +0 -0
index 5a52edd..57f3eb5 100644

common/cmd_bmp.c bmp_image_t *gunzip_bmp(unsigned long addr, unsigned long *lenp) · line 61

Quoted 8 lines
common/cmd_bmp.c +1 -1
@@ -55,7 +55,7 @@ bmp_image_t *gunzip_bmp(unsigned long addr, unsigned long *lenp)
         * Decompress bmp image
         */
        len = CONFIG_SYS_VIDEO_LOGO_MAX_SIZE;
-       dst = malloc(CONFIG_SYS_VIDEO_LOGO_MAX_SIZE);
+       dst = memalign(CONFIG_SYS_CACHELINE_SIZE, len);
        if (dst == NULL) {
                puts("Error: malloc in gunzip failed!\n");
                return NULL;

Sorry, I still have a question. Does this 'dst' address get used as the actual LCD frame buffer on your board, or is it just copied to the frame buffer?

Regards,
Simon

Quoted 3 lines

--
1.7.2.3

#6 lore raw

PATCH 1/2 video:cache:fix: Proper buffer alignment for lcd subsystem

Hi Simon,

Quoted 26 lines

Hi Lukasz,

Quoted 22 lines · Lukasz Majewski

This commit makes the video subsystem code cache aware. Memory allocated for decompressed BMP memory is now cache line aligned.

---
 common/cmd_bmp.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
common/cmd_bmp.c +0 -1
index 5a52edd..57f3eb5 100644
@@ -55,7 +55,7 @@ bmp_image_t *gunzip_bmp(unsigned long addr,
 unsigned long *lenp)
         * Decompress bmp image
         */
        len = CONFIG_SYS_VIDEO_LOGO_MAX_SIZE;
-       dst = malloc(CONFIG_SYS_VIDEO_LOGO_MAX_SIZE);
Quoted 9 lines
Quoted 4 lines
common/cmd_bmp.c +1 -0
+       dst = memalign(CONFIG_SYS_CACHELINE_SIZE, len);
        if (dst == NULL) {
                puts("Error: malloc in gunzip failed!\n");
                return NULL;

Sorry, I still have a question. Does this 'dst' address get used as the actual LCD frame buffer on your board, or is it just copied to the frame buffer?

I must admit, that I've misunderstood the LCD code a bit. Reply to this post from Anatolij helped me.
The buffer (dst) is only the "internal" buffer from which we are assigning BMP data to actual frame buffer area. Then only the frame buffer (pointed by fb pointer) area needs cache flush (which is done at lcd_sync()).

To sum up - this patch shall be dropped.
However the second patch -

[PATCH 2/2] video:cache:fix:trats: Enable dcache flush for TRATS board's LCD subsystem

is crucial to fix the BMP image display distortion.

Quoted 6 lines

Regards,
Simon

Quoted 3 lines

--
1.7.2.3

Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Poland (SRPOL) | Linux Platform Group
#7 lore raw

PATCH 1/2 video:cache:fix: Proper buffer alignment for lcd subsystem

Hi Lukasz,

Quoted 38 lines · Lukasz Majewski

Hi Simon,

Quoted 26 lines

Hi Lukasz,

Quoted 22 lines · Lukasz Majewski

This commit makes the video subsystem code cache aware. Memory allocated for decompressed BMP memory is now cache line aligned.

---
 common/cmd_bmp.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
common/cmd_bmp.c +0 -1
index 5a52edd..57f3eb5 100644
@@ -55,7 +55,7 @@ bmp_image_t *gunzip_bmp(unsigned long addr,
 unsigned long *lenp)
         * Decompress bmp image
         */
        len = CONFIG_SYS_VIDEO_LOGO_MAX_SIZE;
-       dst = malloc(CONFIG_SYS_VIDEO_LOGO_MAX_SIZE);
Quoted 9 lines
Quoted 4 lines
common/cmd_bmp.c +1 -0
+       dst = memalign(CONFIG_SYS_CACHELINE_SIZE, len);
        if (dst == NULL) {
                puts("Error: malloc in gunzip failed!\n");
                return NULL;

Sorry, I still have a question. Does this 'dst' address get used as the actual LCD frame buffer on your board, or is it just copied to the frame buffer?

Quoted 6 lines

I must admit, that I've misunderstood the LCD code a bit. Reply to this post from Anatolij helped me.
The buffer (dst) is only the "internal" buffer from which we are assigning BMP data to actual frame buffer area. Then only the frame buffer (pointed by fb pointer) area needs cache flush (which is done at lcd_sync()).

OK that makes sense, thanks.

Quoted 8 lines

To sum up - this patch shall be dropped.
However the second patch -

[PATCH 2/2] video:cache:fix:trats: Enable dcache flush for TRATS board's LCD subsystem

is crucial to fix the BMP image display distortion.

Yes I agree.

Regards,
Simon

Quoted 6 lines

--
Best regards,

Lukasz Majewski

Samsung R&D Poland (SRPOL) | Linux Platform Group