BigW Consortium Gitlab

Commit 2a1cea91 by Shikai Chen

Performance improvements and bug fixs:

1. greatly improve the screen fps via RLE compression algorithm (for FW>=1.04) 2. fixed a dirty rect logic bug 3. fixed a urb transmission bug
parent d79255bb
/*
* RoboPeak Project
* Copyright 2009 - 2013
*
* RP USB Display
* Protocol Def
*
* Initial Version by Shikai Chen
*/
#pragma once
#define RPUSBDISP_DISP_CHANNEL_MAX_SIZE 64 //64bytes
#define RPUSBDISP_STATUS_CHANNEL_MAX_SIZE 32 //32bytes
// -- Display Packets
#define RPUSBDISP_DISPCMD_NOPE 0
#define RPUSBDISP_DISPCMD_FILL 1
#define RPUSBDISP_DISPCMD_BITBLT 2
#define RPUSBDISP_DISPCMD_RECT 3
#define RPUSBDISP_DISPCMD_COPY_AREA 4
#define RPUSBDISP_OPERATION_COPY 0
#define RPUSBDISP_OPERATION_XOR 1
#define RPUSBDISP_OPERATION_OR 2
#define RPUSBDISP_OPERATION_AND 3
#if defined(_WIN32) || defined(__ICCARM__)
#pragma pack(1)
#endif
#define RPUSBDISP_CMD_MASK (0x3F)
#define RPUSBDISP_CMD_FLAG_CLEARDITY (0x1<<6)
#define RPUSBDISP_CMD_FLAG_START (0x1<<7)
typedef struct _rpusbdisp_disp_packet_header_t {
#if 0
_u8 cmd:6;
_u8 cleardirty:1;
_u8 start:1;
#else
_u8 cmd_flag;
#endif
} __attribute__((packed)) rpusbdisp_disp_packet_header_t;
typedef struct _rpusbdisp_disp_fill_packet_t {
rpusbdisp_disp_packet_header_t header;
_u16 color_565;
} __attribute__((packed)) rpusbdisp_disp_fill_packet_t;
typedef struct _rpusbdisp_disp_bitblt_packet_t {
rpusbdisp_disp_packet_header_t header;
_u16 x;
_u16 y;
_u16 width;
_u16 height;
_u8 operation;
} __attribute__((packed)) rpusbdisp_disp_bitblt_packet_t;
typedef struct _rpusbdisp_disp_fillrect_packet_t {
rpusbdisp_disp_packet_header_t header;
_u16 left;
_u16 top;
_u16 right;
_u16 bottom;
_u16 color_565;
_u8 operation;
} __attribute__((packed)) rpusbdisp_disp_fillrect_packet_t;
typedef struct _rpusbdisp_disp_copyarea_packet_t {
rpusbdisp_disp_packet_header_t header;
_u16 sx;
_u16 sy;
_u16 dx;
_u16 dy;
_u16 width;
_u16 height;
} __attribute__((packed)) rpusbdisp_disp_copyarea_packet_t;
#if defined(_WIN32) || defined(__ICCARM__)
#pragma pack()
#endif
// -- Status Packets
#define RPUSBDISP_STATUS_TYPE_NORMAL 0
#define RPUSBDISP_DISPLAY_STATUS_DIRTY_FLAG 0x80 //a full screen transfer is required
#define RPUSBDISP_TOUCH_STATUS_NO_TOUCH 0
#define RPUSBDISP_TOUCH_STATUS_PRESSED 1
#if defined(_WIN32) || defined(__ICCARM__)
#pragma pack(1)
#endif
typedef struct _rpusbdisp_status_packet_header_t {
_u8 packet_type;
} __attribute__((packed)) rpusbdisp_status_packet_header_t;
typedef struct _rpusbdisp_status_normal_packet_t {
rpusbdisp_status_packet_header_t header;
_u8 display_status;
_u8 touch_status;
int touch_x;
int touch_y;
} __attribute__((packed)) rpusbdisp_status_normal_packet_t;
#if defined(_WIN32) || defined(__ICCARM__)
#pragma pack()
#endif
/*
* RoboPeak Project
* Copyright 2009 - 2013
*
* RP USB Display
* Protocol Def
*
* Initial Version by Shikai Chen
*/
#pragma once
#define RPUSBDISP_DISP_CHANNEL_MAX_SIZE 64 //64bytes
#define RPUSBDISP_STATUS_CHANNEL_MAX_SIZE 32 //32bytes
// -- Display Packets
#define RPUSBDISP_DISPCMD_NOPE 0
#define RPUSBDISP_DISPCMD_FILL 1
#define RPUSBDISP_DISPCMD_BITBLT 2
#define RPUSBDISP_DISPCMD_RECT 3
#define RPUSBDISP_DISPCMD_COPY_AREA 4
#define RPUSBDISP_DISPCMD_BITBLT_RLE 5
#define RPUSBDISP_OPERATION_COPY 0
#define RPUSBDISP_OPERATION_XOR 1
#define RPUSBDISP_OPERATION_OR 2
#define RPUSBDISP_OPERATION_AND 3
#if defined(_WIN32) || defined(__ICCARM__)
#pragma pack(1)
#endif
#define RPUSBDISP_CMD_MASK (0x3F)
#define RPUSBDISP_CMD_FLAG_CLEARDITY (0x1<<6)
#define RPUSBDISP_CMD_FLAG_START (0x1<<7)
typedef struct _rpusbdisp_disp_packet_header_t {
#if 0
_u8 cmd:6;
_u8 cleardirty:1;
_u8 start:1;
#else
_u8 cmd_flag;
#endif
} __attribute__((packed)) rpusbdisp_disp_packet_header_t;
typedef struct _rpusbdisp_disp_fill_packet_t {
rpusbdisp_disp_packet_header_t header;
_u16 color_565;
} __attribute__((packed)) rpusbdisp_disp_fill_packet_t;
typedef struct _rpusbdisp_disp_bitblt_packet_t {
rpusbdisp_disp_packet_header_t header;
_u16 x;
_u16 y;
_u16 width;
_u16 height;
_u8 operation;
} __attribute__((packed)) rpusbdisp_disp_bitblt_packet_t;
typedef struct _rpusbdisp_disp_fillrect_packet_t {
rpusbdisp_disp_packet_header_t header;
_u16 left;
_u16 top;
_u16 right;
_u16 bottom;
_u16 color_565;
_u8 operation;
} __attribute__((packed)) rpusbdisp_disp_fillrect_packet_t;
typedef struct _rpusbdisp_disp_copyarea_packet_t {
rpusbdisp_disp_packet_header_t header;
_u16 sx;
_u16 sy;
_u16 dx;
_u16 dy;
_u16 width;
_u16 height;
} __attribute__((packed)) rpusbdisp_disp_copyarea_packet_t;
#if defined(_WIN32) || defined(__ICCARM__)
#pragma pack()
#endif
// RLE Packet Define
#define RPUSBDISP_RLE_BLOCKFLAG_COMMON_BIT 0x80
#define RPUSBDISP_RLE_BLOCKFLAG_SIZE_BIT 0x7f
// -- Status Packets
#define RPUSBDISP_STATUS_TYPE_NORMAL 0
#define RPUSBDISP_DISPLAY_STATUS_DIRTY_FLAG 0x80 //a full screen transfer is required
#define RPUSBDISP_TOUCH_STATUS_NO_TOUCH 0
#define RPUSBDISP_TOUCH_STATUS_PRESSED 1
#if defined(_WIN32) || defined(__ICCARM__)
#pragma pack(1)
#endif
typedef struct _rpusbdisp_status_packet_header_t {
_u8 packet_type;
} __attribute__((packed)) rpusbdisp_status_packet_header_t;
typedef struct _rpusbdisp_status_normal_packet_t {
rpusbdisp_status_packet_header_t header;
_u8 display_status;
_u8 touch_status;
_s32 touch_x;
_s32 touch_y;
} __attribute__((packed)) rpusbdisp_status_normal_packet_t;
#if defined(_WIN32) || defined(__ICCARM__)
#pragma pack()
#endif
......@@ -123,6 +123,7 @@ static void _display_update( struct fb_info *p, int x, int y, int width, int he
clear_dirty = 1;
} else {
if (pa->dirty_rect.top > y) pa->dirty_rect.top = y;
if (pa->dirty_rect.bottom < height+y-1) pa->dirty_rect.bottom = height+y-1;
if (pa->dirty_rect.left > x) pa->dirty_rect.left = x;
......@@ -130,9 +131,9 @@ static void _display_update( struct fb_info *p, int x, int y, int width, int he
}
if (pa->dirty_rect.top > pa->dirty_rect.bottom || pa->dirty_rect.left > pa->dirty_rect.right)
if (pa->dirty_rect.top > pa->dirty_rect.bottom || pa->dirty_rect.left > pa->dirty_rect.right) {
goto final;
}
atomic_set(&pa->dirty_rect.dirty_flag, 1);
// 2. try to send it
......@@ -167,14 +168,13 @@ static void _display_update( struct fb_info *p, int x, int y, int width, int he
}
break;
default:
if (rpusbdisp_usb_try_send_image(pa->binded_usbdev, (const pixel_type_t *)p->fix.smem_start,
pa->dirty_rect.left, pa->dirty_rect.top, pa->dirty_rect.right, pa->dirty_rect.bottom, p->fix.line_length/(RP_DISP_DEFAULT_PIXEL_BITS/8),
clear_dirty)) {
// data sent, rect the dirty rect
_clear_dirty_rect(&pa->dirty_rect);
}
}
}
}
......@@ -193,12 +193,14 @@ static void _display_fillrect ( struct fb_info * p, const struct fb_fillrect *
static void _display_imageblit ( struct fb_info * p, const struct fb_image * image)
{
sys_imageblit (p, image);
_display_update(p, image->dx, image->dy, image->width, image->height, DISPLAY_UPDATE_HINT_BITBLT, image);
}
static void _display_copyarea ( struct fb_info * p, const struct fb_copyarea * area)
{
sys_copyarea (p, area);
_display_update(p, area->dx, area->dy, area->width, area->height, DISPLAY_UPDATE_HINT_COPYAREA, area);
}
......@@ -208,6 +210,7 @@ static ssize_t _display_write ( struct fb_info * p, const char * buf __user,
{
int retval;
retval = fb_sys_write (p, buf, count, ppos);
_display_update(p, 0, 0, p->var.width, p->var.height, DISPLAY_UPDATE_HINT_NONE, NULL);
return retval;
}
......@@ -279,6 +282,7 @@ static void _display_defio_handler(struct fb_info *info,
}
if (bottom >= RP_DISP_DEFAULT_HEIGHT) bottom = RP_DISP_DEFAULT_HEIGHT - 1;
_display_update(info, 0, top, info->var.width, bottom - top + 1, DISPLAY_UPDATE_HINT_NONE, NULL);
}
......@@ -477,8 +481,8 @@ void fbhandler_on_all_transfer_done(struct rpusbdisp_dev * dev)
fb_pri = _get_fb_private(fb);
if (atomic_read(&fb_pri->dirty_rect.dirty_flag) || atomic_read(&fb_pri->unsync_flag)) {
_display_update(fb, RP_DISP_DEFAULT_WIDTH, RP_DISP_DEFAULT_HEIGHT, 0, 0, DISPLAY_UPDATE_HINT_NONE, NULL);
if (atomic_read(&fb_pri->dirty_rect.dirty_flag) || atomic_read(&fb_pri->unsync_flag)==1) {
_display_update(fb, 0, 0, RP_DISP_DEFAULT_WIDTH, RP_DISP_DEFAULT_HEIGHT, DISPLAY_UPDATE_HINT_NONE, NULL);
}
}
......
......@@ -25,4 +25,7 @@
#define RP_DISP_DEFAULT_PIXEL_BITS 16
typedef _u16 pixel_type_t;
#define RP_DISP_FEATURE_RLE_FWVERSION 0x0104
#endif
......@@ -17,7 +17,7 @@
#define DRIVER_LICENSE_INFO "GPL"
#define DRIVER_VERSION "RoboPeak USB Display Driver Version 0.01"
#define DRIVER_VERSION "RoboPeak USB Display Driver Version 1.00"
#define RPUSBDISP_MINOR 300
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment