提交 9c8a595e 编写于 作者: B bernard.xiong

add double buffer support in driver.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@701 bbd45198-f89e-11dd-88c7-29a3b14d5316
上级 e7fb7e6c
......@@ -111,6 +111,7 @@
#define S3C2410_LCDINT_FRSYNC (1<<1)
volatile rt_uint16_t _rt_framebuffer[RT_HW_LCD_HEIGHT][RT_HW_LCD_WIDTH];
volatile rt_uint16_t _rt_hw_framebuffer[RT_HW_LCD_HEIGHT][RT_HW_LCD_WIDTH];
void lcd_power_enable(int invpwren,int pwren)
......@@ -170,19 +171,34 @@ void LcdBkLtSet(rt_uint32_t HiRatio)
void rt_hw_lcd_update(rtgui_rect_t *rect)
{
/* nothing */
rt_uint16_t *src_ptr, *dst_ptr;
rt_uint32_t pitch, index;
pitch = 2 * (rect->x2 - rect->x1);
/* copy from framebuffer to physical framebuffer */
src_ptr = &_rt_framebuffer[rect->x1][rect->y1];
dst_ptr = &_rt_hw_framebuffer[rect->x1][rect->y1];
for (index = rect->y1; index < rect->y2; index ++)
{
memcpy(dst_ptr, src_ptr, pitch);
src_ptr += (rect->x2 - rect->x1);
dst_ptr += (rect->x2 - rect->x1);
}
}
rt_uint8_t * rt_hw_lcd_get_framebuffer(void)
{
return (rt_uint8_t *)_rt_hw_framebuffer;
return (rt_uint8_t *)_rt_framebuffer;
}
void rt_hw_lcd_set_pixel(rtgui_color_t *c, rt_base_t x, rt_base_t y)
{
if (x < RT_HW_LCD_WIDTH && y < RT_HW_LCD_HEIGHT)
{
_rt_hw_framebuffer[(y)][(x)] = rtgui_color_to_565p(*c);
_rt_framebuffer[(y)][(x)] = rtgui_color_to_565p(*c);
}
}
......@@ -190,7 +206,7 @@ void rt_hw_lcd_get_pixel(rtgui_color_t *c, rt_base_t x, rt_base_t y)
{
if (x < RT_HW_LCD_WIDTH && y < RT_HW_LCD_HEIGHT)
{
*c = rtgui_color_from_565p(_rt_hw_framebuffer[(y)][(x)]);
*c = rtgui_color_from_565p(_rt_framebuffer[(y)][(x)]);
}
return ;
......@@ -206,7 +222,7 @@ void rt_hw_lcd_draw_hline(rtgui_color_t *c, rt_base_t x1, rt_base_t x2, rt_base_
for (idx = x1; idx < x2; idx ++)
{
_rt_hw_framebuffer[y][idx] = color;
_rt_framebuffer[y][idx] = color;
}
}
......@@ -220,13 +236,13 @@ void rt_hw_lcd_draw_vline(rtgui_color_t *c, rt_base_t x, rt_base_t y1, rt_base_t
for (idy = y1; idy < y2; idy ++)
{
_rt_hw_framebuffer[idy][x] = color;
_rt_framebuffer[idy][x] = color;
}
}
void rt_hw_lcd_draw_raw_hline(rt_uint8_t *pixels, rt_base_t x1, rt_base_t x2, rt_base_t y)
{
rt_memcpy((void*)&_rt_hw_framebuffer[y][x1], pixels, (x2 - x1) * 2);
rt_memcpy((void*)&_rt_framebuffer[y][x1], pixels, (x2 - x1) * 2);
}
struct rtgui_graphic_driver _rtgui_lcd_driver =
......
......@@ -111,6 +111,7 @@
#define S3C2410_LCDINT_FRSYNC (1<<1)
volatile rt_uint16_t _rt_framebuffer[RT_HW_LCD_HEIGHT][RT_HW_LCD_WIDTH];
volatile rt_uint16_t _rt_hw_framebuffer[RT_HW_LCD_HEIGHT][RT_HW_LCD_WIDTH];
void lcd_power_enable(int invpwren,int pwren)
......@@ -170,19 +171,34 @@ void LcdBkLtSet(rt_uint32_t HiRatio)
void rt_hw_lcd_update(rtgui_rect_t *rect)
{
/* nothing */
rt_uint16_t *src_ptr, *dst_ptr;
rt_uint32_t pitch, index;
pitch = 2 * (rect->x2 - rect->x1);
/* copy from framebuffer to physical framebuffer */
src_ptr = &_rt_framebuffer[rect->x1][rect->y1];
dst_ptr = &_rt_hw_framebuffer[rect->x1][rect->y1];
for (index = rect->y1; index < rect->y2; index ++)
{
memcpy(dst_ptr, src_ptr, pitch);
src_ptr += (rect->x2 - rect->x1);
dst_ptr += (rect->x2 - rect->x1);
}
}
rt_uint8_t * rt_hw_lcd_get_framebuffer(void)
{
return (rt_uint8_t *)_rt_hw_framebuffer;
return (rt_uint8_t *)_rt_framebuffer;
}
void rt_hw_lcd_set_pixel(rtgui_color_t *c, rt_base_t x, rt_base_t y)
{
if (x < RT_HW_LCD_WIDTH && y < RT_HW_LCD_HEIGHT)
{
_rt_hw_framebuffer[(y)][(x)] = rtgui_color_to_565p(*c);
_rt_framebuffer[(y)][(x)] = rtgui_color_to_565p(*c);
}
}
......@@ -190,7 +206,7 @@ void rt_hw_lcd_get_pixel(rtgui_color_t *c, rt_base_t x, rt_base_t y)
{
if (x < RT_HW_LCD_WIDTH && y < RT_HW_LCD_HEIGHT)
{
*c = rtgui_color_from_565p(_rt_hw_framebuffer[(y)][(x)]);
*c = rtgui_color_from_565p(_rt_framebuffer[(y)][(x)]);
}
return ;
......@@ -206,7 +222,7 @@ void rt_hw_lcd_draw_hline(rtgui_color_t *c, rt_base_t x1, rt_base_t x2, rt_base_
for (idx = x1; idx < x2; idx ++)
{
_rt_hw_framebuffer[y][idx] = color;
_rt_framebuffer[y][idx] = color;
}
}
......@@ -220,13 +236,13 @@ void rt_hw_lcd_draw_vline(rtgui_color_t *c, rt_base_t x, rt_base_t y1, rt_base_t
for (idy = y1; idy < y2; idy ++)
{
_rt_hw_framebuffer[idy][x] = color;
_rt_framebuffer[idy][x] = color;
}
}
void rt_hw_lcd_draw_raw_hline(rt_uint8_t *pixels, rt_base_t x1, rt_base_t x2, rt_base_t y)
{
rt_memcpy((void*)&_rt_hw_framebuffer[y][x1], pixels, (x2 - x1) * 2);
rt_memcpy((void*)&_rt_framebuffer[y][x1], pixels, (x2 - x1) * 2);
}
struct rtgui_graphic_driver _rtgui_lcd_driver =
......
......@@ -111,6 +111,7 @@
#define S3C2410_LCDINT_FRSYNC (1<<1)
volatile rt_uint16_t _rt_framebuffer[RT_HW_LCD_HEIGHT][RT_HW_LCD_WIDTH];
volatile rt_uint16_t _rt_hw_framebuffer[RT_HW_LCD_HEIGHT][RT_HW_LCD_WIDTH];
void lcd_power_enable(int invpwren,int pwren)
......@@ -170,19 +171,34 @@ void LcdBkLtSet(rt_uint32_t HiRatio)
void rt_hw_lcd_update(rtgui_rect_t *rect)
{
/* nothing */
rt_uint16_t *src_ptr, *dst_ptr;
rt_uint32_t pitch, index;
pitch = 2 * (rect->x2 - rect->x1);
/* copy from framebuffer to physical framebuffer */
src_ptr = &_rt_framebuffer[rect->x1][rect->y1];
dst_ptr = &_rt_hw_framebuffer[rect->x1][rect->y1];
for (index = rect->y1; index < rect->y2; index ++)
{
memcpy(dst_ptr, src_ptr, pitch);
src_ptr += (rect->x2 - rect->x1);
dst_ptr += (rect->x2 - rect->x1);
}
}
rt_uint8_t * rt_hw_lcd_get_framebuffer(void)
{
return (rt_uint8_t *)_rt_hw_framebuffer;
return (rt_uint8_t *)_rt_framebuffer;
}
void rt_hw_lcd_set_pixel(rtgui_color_t *c, rt_base_t x, rt_base_t y)
{
if (x < RT_HW_LCD_WIDTH && y < RT_HW_LCD_HEIGHT)
{
_rt_hw_framebuffer[(y)][(x)] = rtgui_color_to_565p(*c);
_rt_framebuffer[(y)][(x)] = rtgui_color_to_565p(*c);
}
}
......@@ -190,7 +206,7 @@ void rt_hw_lcd_get_pixel(rtgui_color_t *c, rt_base_t x, rt_base_t y)
{
if (x < RT_HW_LCD_WIDTH && y < RT_HW_LCD_HEIGHT)
{
*c = rtgui_color_from_565p(_rt_hw_framebuffer[(y)][(x)]);
*c = rtgui_color_from_565p(_rt_framebuffer[(y)][(x)]);
}
return ;
......@@ -206,7 +222,7 @@ void rt_hw_lcd_draw_hline(rtgui_color_t *c, rt_base_t x1, rt_base_t x2, rt_base_
for (idx = x1; idx < x2; idx ++)
{
_rt_hw_framebuffer[y][idx] = color;
_rt_framebuffer[y][idx] = color;
}
}
......@@ -220,13 +236,13 @@ void rt_hw_lcd_draw_vline(rtgui_color_t *c, rt_base_t x, rt_base_t y1, rt_base_t
for (idy = y1; idy < y2; idy ++)
{
_rt_hw_framebuffer[idy][x] = color;
_rt_framebuffer[idy][x] = color;
}
}
void rt_hw_lcd_draw_raw_hline(rt_uint8_t *pixels, rt_base_t x1, rt_base_t x2, rt_base_t y)
{
rt_memcpy((void*)&_rt_hw_framebuffer[y][x1], pixels, (x2 - x1) * 2);
rt_memcpy((void*)&_rt_framebuffer[y][x1], pixels, (x2 - x1) * 2);
}
struct rtgui_graphic_driver _rtgui_lcd_driver =
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册