mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2025-12-13 23:56:47 +08:00
use multiple concurrently updaters in Shadow engine if multi_updater=yes
This commit is contained in:
@@ -123,10 +123,6 @@ extern void refresh_hflip_msb_right (ShadowFBHeader* shadowfb_header, RealFBInfo
|
||||
|
||||
extern void refresh_vflip_msb_right (ShadowFBHeader* shadowfb_header, RealFBInfo* realfb_info, void* update);
|
||||
|
||||
extern int refresh_init(int pitch);
|
||||
|
||||
extern void refresh_destroy(void);
|
||||
|
||||
/* Initialization/Query functions */
|
||||
static int SHADOW_VideoInit (_THIS, GAL_PixelFormat *vformat);
|
||||
static int RealEngine_SetPalette(RealFBInfo *realfb_info, int firstcolor, int ncolors, void *color);
|
||||
@@ -135,6 +131,7 @@ static GAL_Surface *SHADOW_SetVideoMode (_THIS, GAL_Surface *current, int width,
|
||||
static int SHADOW_SetColors (_THIS, int firstcolor, int ncolors, GAL_Color *colors);
|
||||
static void SHADOW_VideoQuit (_THIS);
|
||||
static BOOL SHADOW_SyncUpdate (_THIS);
|
||||
static BOOL SHADOW_SyncUpdateConcurrently (_THIS);
|
||||
|
||||
/* Hardware surface functions */
|
||||
static int SHADOW_AllocHWSurface (_THIS, GAL_Surface *surface);
|
||||
@@ -176,7 +173,6 @@ static void SHADOW_DeleteDevice(GAL_VideoDevice *device)
|
||||
{
|
||||
free (device->hidden);
|
||||
free (device);
|
||||
refresh_destroy();
|
||||
}
|
||||
|
||||
static void SHADOW_UpdateRects (_THIS, int numrects, GAL_Rect *rects)
|
||||
@@ -270,8 +266,8 @@ static ShadowFBOps shadow_fb_ops;
|
||||
static int RealEngine_GetInfo (RealFBInfo * realfb_info)
|
||||
{
|
||||
GAL_PixelFormat real_vformat;
|
||||
char engine[LEN_ENGINE_NAME + 1], mode[LEN_MODE+1],
|
||||
rotate_screen[LEN_MODE+1];
|
||||
char engine[LEN_ENGINE_NAME + 1], mode[LEN_MODE+1];
|
||||
char rotate_screen[LEN_MODE+1];
|
||||
int w, h, depth, pitch_size;
|
||||
GAL_VideoDevice* real_device;
|
||||
|
||||
@@ -365,8 +361,6 @@ static int RealEngine_GetInfo (RealFBInfo * realfb_info)
|
||||
shadow_fb_ops.refresh = refresh_normal_msb_right;
|
||||
}
|
||||
|
||||
refresh_init (pitch_size);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -416,6 +410,161 @@ static int RealEngine_Init(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct update_thd_args {
|
||||
_THIS;
|
||||
int number;
|
||||
};
|
||||
|
||||
static void* task_do_update(void* data)
|
||||
{
|
||||
struct update_thd_args args;
|
||||
args = *(struct update_thd_args *)data;
|
||||
|
||||
if (pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL))
|
||||
return NULL;
|
||||
|
||||
sem_post(&args.this->hidden->sync_sem);
|
||||
|
||||
do {
|
||||
sem_wait(&args.this->hidden->update_sems[args.number]);
|
||||
|
||||
pthread_testcancel();
|
||||
|
||||
RECT *dirty_rc = args.this->hidden->dirty_rcs + args.number;
|
||||
|
||||
shadow_fb_ops.refresh(_shadowfbheader,
|
||||
args.this->hidden->realfb_info, dirty_rc);
|
||||
|
||||
/* notify main thread for done of update */
|
||||
sem_post(&args.this->hidden->sync_sem);
|
||||
} while (1);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void schedule_updaters(_THIS, RECT *dirty_rc)
|
||||
{
|
||||
int w = RECTWP(dirty_rc);
|
||||
int h = RECTHP(dirty_rc);
|
||||
|
||||
if (w < 4 || h < 4 || (w * h) < MIN_PIXELS_MULTI_UPDATER) {
|
||||
shadow_fb_ops.refresh(_shadowfbheader,
|
||||
this->hidden->realfb_info, dirty_rc);
|
||||
return;
|
||||
}
|
||||
|
||||
// partition the dirty rectangle
|
||||
this->hidden->dirty_rcs[0].left = dirty_rc->left;
|
||||
this->hidden->dirty_rcs[0].top = dirty_rc->top;
|
||||
this->hidden->dirty_rcs[0].right = (dirty_rc->left + dirty_rc->right) / 2;
|
||||
this->hidden->dirty_rcs[0].bottom = (dirty_rc->top + dirty_rc->bottom) / 2;
|
||||
|
||||
this->hidden->dirty_rcs[1].left = this->hidden->dirty_rcs[0].right;
|
||||
this->hidden->dirty_rcs[1].top = dirty_rc->top;
|
||||
this->hidden->dirty_rcs[1].right = dirty_rc->right;
|
||||
this->hidden->dirty_rcs[1].bottom = this->hidden->dirty_rcs[0].bottom;
|
||||
|
||||
this->hidden->dirty_rcs[2].left = dirty_rc->left;
|
||||
this->hidden->dirty_rcs[2].top = this->hidden->dirty_rcs[0].bottom;
|
||||
this->hidden->dirty_rcs[2].right = this->hidden->dirty_rcs[0].right;
|
||||
this->hidden->dirty_rcs[2].bottom = dirty_rc->bottom;
|
||||
|
||||
this->hidden->dirty_rcs[3].left = this->hidden->dirty_rcs[0].right;
|
||||
this->hidden->dirty_rcs[3].top = this->hidden->dirty_rcs[0].bottom;
|
||||
this->hidden->dirty_rcs[3].right = dirty_rc->right;
|
||||
this->hidden->dirty_rcs[3].bottom = dirty_rc->bottom;
|
||||
|
||||
for (int i = 0; i < NR_CONC_UPDATERS; i++) {
|
||||
sem_post(&this->hidden->update_sems[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < NR_CONC_UPDATERS; i++) {
|
||||
sem_wait(&this->hidden->sync_sem);
|
||||
}
|
||||
}
|
||||
|
||||
static BOOL SHADOW_SyncUpdateConcurrently (_THIS)
|
||||
{
|
||||
RECT dirty_rect;
|
||||
GAL_Rect update_rect;
|
||||
|
||||
SetRect(&dirty_rect, 0, 0, _shadowfbheader->width, _shadowfbheader->height);
|
||||
|
||||
if (_shadowfbheader->dirty || _shadowfbheader->palette_changed) {
|
||||
GAL_VideoDevice *real_device;
|
||||
real_device = this->hidden->realfb_info->real_device;
|
||||
assert(real_device);
|
||||
|
||||
if (_shadowfbheader->palette_changed) {
|
||||
real_device->SetColors (real_device, _shadowfbheader->firstcolor,
|
||||
_shadowfbheader->ncolors,
|
||||
(GAL_Color*)((char*)_shadowfbheader + _shadowfbheader->palette_offset));
|
||||
SetRect (&_shadowfbheader->dirty_rect, 0, 0,
|
||||
_shadowfbheader->width, _shadowfbheader->height);
|
||||
}
|
||||
|
||||
schedule_updaters(this, &_shadowfbheader->dirty_rect);
|
||||
|
||||
if (this->hidden->realfb_info->flags & _ROT_DIR_CW) {
|
||||
_get_dst_rect_cw (&dirty_rect, &(_shadowfbheader->dirty_rect),
|
||||
this->hidden->realfb_info);
|
||||
}
|
||||
else if (this->hidden->realfb_info->flags & _ROT_DIR_CCW) {
|
||||
_get_dst_rect_ccw (&dirty_rect, &(_shadowfbheader->dirty_rect),
|
||||
this->hidden->realfb_info);
|
||||
}
|
||||
else if (this->hidden->realfb_info->flags & _ROT_DIR_HFLIP) {
|
||||
dirty_rect = _shadowfbheader->dirty_rect;
|
||||
_get_dst_rect_hflip (&dirty_rect, this->hidden->realfb_info);
|
||||
}
|
||||
else if (this->hidden->realfb_info->flags & _ROT_DIR_VFLIP) {
|
||||
dirty_rect = _shadowfbheader->dirty_rect;
|
||||
_get_dst_rect_vflip (&dirty_rect, this->hidden->realfb_info);
|
||||
}
|
||||
else {
|
||||
dirty_rect = _shadowfbheader->dirty_rect;
|
||||
}
|
||||
|
||||
update_rect.x = dirty_rect.left;
|
||||
update_rect.y = dirty_rect.top;
|
||||
update_rect.w = dirty_rect.right - dirty_rect.left;
|
||||
update_rect.h = dirty_rect.bottom - dirty_rect.top;
|
||||
|
||||
if (real_device->UpdateRects)
|
||||
real_device->UpdateRects(real_device, 1, &update_rect);
|
||||
if (real_device->SyncUpdate)
|
||||
real_device->SyncUpdate(real_device);
|
||||
|
||||
SetRect (&_shadowfbheader->dirty_rect, 0, 0, 0, 0);
|
||||
_shadowfbheader->dirty = FALSE;
|
||||
_shadowfbheader->palette_changed = FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int create_multiple_updaters(_THIS)
|
||||
{
|
||||
if (sem_init(&this->hidden->sync_sem, 0, 0))
|
||||
return -1;
|
||||
|
||||
struct update_thd_args args = { this, 0 };
|
||||
|
||||
for (int i = 0; i < NR_CONC_UPDATERS; i++) {
|
||||
if (sem_init(&this->hidden->update_sems[i], 0, 0))
|
||||
return -1;
|
||||
|
||||
args.number = i;
|
||||
if (pthread_create(&this->hidden->update_thds[i], NULL,
|
||||
task_do_update, &args))
|
||||
return -1;
|
||||
|
||||
sem_wait(&this->hidden->sync_sem);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int SHADOW_VideoInit (_THIS, GAL_PixelFormat *vformat)
|
||||
{
|
||||
#ifdef _MGRM_PROCESSES
|
||||
@@ -448,6 +597,21 @@ static int SHADOW_VideoInit (_THIS, GAL_PixelFormat *vformat)
|
||||
}
|
||||
#endif
|
||||
|
||||
char multi_updater[LEN_MODE+1] = "no";
|
||||
if (GetMgEtcValue ("shadow", "multi_updater",
|
||||
multi_updater, LEN_MODE) < 0) {
|
||||
// keep default
|
||||
}
|
||||
|
||||
if (strcmp (multi_updater, "yes") == 0 ||
|
||||
strcmp (multi_updater, "true") == 0) {
|
||||
if (create_multiple_updaters (this)) {
|
||||
perror ("NEWGAL>SHADOW: create_updaters");
|
||||
return -1;
|
||||
}
|
||||
this->hidden->multi_updater = 1;
|
||||
}
|
||||
|
||||
/* We're done! */
|
||||
return 0;
|
||||
}
|
||||
@@ -649,12 +813,27 @@ static GAL_Surface *SHADOW_SetVideoMode(_THIS, GAL_Surface *current,
|
||||
current->pitch = _shadowfbheader->pitch;
|
||||
current->pixels = (char *)_shadowfbheader + _shadowfbheader->fb_offset;
|
||||
|
||||
if (this->hidden->multi_updater) {
|
||||
this->SyncUpdate = SHADOW_SyncUpdateConcurrently;
|
||||
}
|
||||
|
||||
/* We're done */
|
||||
return (current);
|
||||
}
|
||||
|
||||
static void SHADOW_VideoQuit (_THIS)
|
||||
{
|
||||
if (this->hidden->multi_updater) {
|
||||
for (int i = 0; i < NR_CONC_UPDATERS; i++) {
|
||||
pthread_cancel(this->hidden->update_thds[i]);
|
||||
sem_post(&this->hidden->update_sems[i]);
|
||||
pthread_join(this->hidden->update_thds[i], NULL);
|
||||
sem_destroy(&this->hidden->update_sems[i]);
|
||||
}
|
||||
|
||||
sem_destroy(&this->hidden->sync_sem);
|
||||
}
|
||||
|
||||
if (_shadowfbheader) {
|
||||
_shadowfbheader->dirty = FALSE;
|
||||
free(_shadowfbheader);
|
||||
|
||||
@@ -47,6 +47,9 @@
|
||||
#ifndef _GAL_SHADOW_H
|
||||
#define _GAL_SHADOW_H
|
||||
|
||||
#include <pthread.h>
|
||||
#include <semaphore.h>
|
||||
|
||||
//#include "sysvideo.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -56,23 +59,31 @@ extern "C" {
|
||||
/* Hidden "this" pointer for the video functions */
|
||||
#define _THIS GAL_VideoDevice *this
|
||||
|
||||
#define NR_CONC_UPDATERS 4
|
||||
#define MIN_PIXELS_MULTI_UPDATER 4096
|
||||
|
||||
typedef struct _ShadowFBHeader {
|
||||
unsigned int info_size;
|
||||
int width;
|
||||
int height;
|
||||
int depth;
|
||||
int pitch;
|
||||
int dirty; /* true for dirty, and should reset to false after refreshing the dirty area */
|
||||
|
||||
int dirty:1;
|
||||
int palette_changed:1;
|
||||
|
||||
RECT dirty_rect;
|
||||
int palette_changed; /* true for changed, and should reset to false after reflecting the change */
|
||||
|
||||
int palette_offset;
|
||||
int firstcolor;
|
||||
int ncolors;
|
||||
int fb_offset;
|
||||
|
||||
Uint32 Rmask;
|
||||
Uint32 Gmask;
|
||||
Uint32 Bmask;
|
||||
Uint32 Amask;
|
||||
int firstcolor;
|
||||
int ncolors;
|
||||
|
||||
} ShadowFBHeader;
|
||||
|
||||
#define FLAG_REALFB_PREALLOC 0x01
|
||||
@@ -82,8 +93,8 @@ typedef struct _RealFBInfo {
|
||||
int height, width;
|
||||
int depth;
|
||||
int pitch;
|
||||
void* fb;
|
||||
void * real_device;
|
||||
void *fb;
|
||||
void *real_device;
|
||||
} RealFBInfo;
|
||||
|
||||
/* Private display data */
|
||||
@@ -93,6 +104,15 @@ struct GAL_PrivateVideoData {
|
||||
#ifdef _MGRM_PROCESSES
|
||||
int semid;
|
||||
#endif
|
||||
|
||||
int multi_updater:1;
|
||||
|
||||
/* only valid when using multiple updaters */
|
||||
RECT dirty_rcs[NR_CONC_UPDATERS];
|
||||
sem_t update_sems[NR_CONC_UPDATERS];
|
||||
pthread_t update_thds[NR_CONC_UPDATERS];
|
||||
|
||||
sem_t sync_sem;
|
||||
};
|
||||
|
||||
typedef struct _ShadowFBOps {
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
#include "error.h"
|
||||
#include "shadow.h"
|
||||
|
||||
extern gal_uint8* __gal_a_line;
|
||||
extern gal_uint8* line_pixels;
|
||||
extern void round_rect (int depth, PRECT update_rect);
|
||||
|
||||
extern void _get_dst_rect_cw (RECT* dst_rect, const RECT* src_rect,
|
||||
@@ -230,6 +230,7 @@ void refresh_cw_msb_left (ShadowFBHeader *shadowfb_header, RealFBInfo *realfb_in
|
||||
BYTE* dst_line;
|
||||
int dst_width, dst_height;
|
||||
int x, y;
|
||||
BYTE line_pixels[shadowfb_header->pitch];
|
||||
|
||||
_get_dst_rect_cw (&dst_update, &src_update, realfb_info);
|
||||
|
||||
@@ -255,7 +256,7 @@ void refresh_cw_msb_left (ShadowFBHeader *shadowfb_header, RealFBInfo *realfb_in
|
||||
/* Copy the bits from vertical line to horizontal line */
|
||||
const BYTE* ver_bits = src_bits;
|
||||
|
||||
BYTE* hor_bits = __gal_a_line;
|
||||
BYTE* hor_bits = line_pixels;
|
||||
|
||||
switch (realfb_info->depth) {
|
||||
case 32:
|
||||
@@ -296,25 +297,25 @@ void refresh_cw_msb_left (ShadowFBHeader *shadowfb_header, RealFBInfo *realfb_in
|
||||
|
||||
switch (realfb_info->depth) {
|
||||
case 1:
|
||||
put_one_line_1bpp (__gal_a_line, dst_line, dst_update.left, dst_width);
|
||||
put_one_line_1bpp (line_pixels, dst_line, dst_update.left, dst_width);
|
||||
src_bits += 1;
|
||||
dst_line += realfb_info->pitch;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
put_one_line_2bpp (__gal_a_line, dst_line, dst_update.left, dst_width);
|
||||
put_one_line_2bpp (line_pixels, dst_line, dst_update.left, dst_width);
|
||||
src_bits +=1;
|
||||
dst_line += realfb_info->pitch;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
put_one_line_4bpp (__gal_a_line, dst_line, dst_update.left, dst_width);
|
||||
put_one_line_4bpp (line_pixels, dst_line, dst_update.left, dst_width);
|
||||
src_bits +=1;
|
||||
dst_line += realfb_info->pitch;
|
||||
break;
|
||||
|
||||
default:
|
||||
put_one_line_8bpp (__gal_a_line, dst_line, dst_update.left, dst_width, realfb_info);
|
||||
put_one_line_8bpp (line_pixels, dst_line, dst_update.left, dst_width, realfb_info);
|
||||
src_bits += realfb_info->depth/8;
|
||||
dst_line += realfb_info->pitch;
|
||||
break;
|
||||
@@ -329,9 +330,9 @@ void refresh_ccw_msb_left (ShadowFBHeader* shadowfb_header, RealFBInfo* realfb_i
|
||||
RECT dst_update;
|
||||
const BYTE* src_bits;
|
||||
BYTE* dst_line;
|
||||
|
||||
int dst_width, dst_height;
|
||||
int x, y;
|
||||
BYTE line_pixels[shadowfb_header->pitch];
|
||||
|
||||
_get_dst_rect_ccw (&dst_update, &src_update, realfb_info);
|
||||
|
||||
@@ -356,7 +357,7 @@ void refresh_ccw_msb_left (ShadowFBHeader* shadowfb_header, RealFBInfo* realfb_i
|
||||
for (x = 0; x < dst_height; x++) {
|
||||
/* Copy the bits from vertical line to horizontal line */
|
||||
const BYTE* ver_bits = src_bits;
|
||||
BYTE* hor_bits = __gal_a_line;
|
||||
BYTE* hor_bits = line_pixels;
|
||||
|
||||
switch (realfb_info->depth) {
|
||||
case 32:
|
||||
@@ -398,25 +399,25 @@ void refresh_ccw_msb_left (ShadowFBHeader* shadowfb_header, RealFBInfo* realfb_i
|
||||
|
||||
switch (realfb_info->depth) {
|
||||
case 1:
|
||||
put_one_line_1bpp (__gal_a_line, dst_line, dst_update.left, dst_width);
|
||||
put_one_line_1bpp (line_pixels, dst_line, dst_update.left, dst_width);
|
||||
src_bits += 1;
|
||||
dst_line -= realfb_info->pitch;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
put_one_line_2bpp (__gal_a_line, dst_line, dst_update.left, dst_width);
|
||||
put_one_line_2bpp (line_pixels, dst_line, dst_update.left, dst_width);
|
||||
src_bits += 1;
|
||||
dst_line -= realfb_info->pitch;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
put_one_line_4bpp (__gal_a_line, dst_line, dst_update.left, dst_width);
|
||||
put_one_line_4bpp (line_pixels, dst_line, dst_update.left, dst_width);
|
||||
src_bits += 1;
|
||||
dst_line -= realfb_info->pitch;
|
||||
break;
|
||||
|
||||
default:
|
||||
put_one_line_8bpp (__gal_a_line, dst_line, dst_update.left, dst_width,\
|
||||
put_one_line_8bpp (line_pixels, dst_line, dst_update.left, dst_width,\
|
||||
realfb_info);
|
||||
src_bits += realfb_info->depth/8;
|
||||
dst_line -= realfb_info->pitch;
|
||||
@@ -432,6 +433,7 @@ void refresh_hflip_msb_left (ShadowFBHeader* shadowfb_header, RealFBInfo* realfb
|
||||
BYTE* dst_line;
|
||||
int src_width, src_height;
|
||||
int x, y;
|
||||
BYTE line_pixels[shadowfb_header->pitch];
|
||||
|
||||
/* Round the update rectangle. */
|
||||
round_rect(realfb_info->depth, &src_update);
|
||||
@@ -450,7 +452,7 @@ void refresh_hflip_msb_left (ShadowFBHeader* shadowfb_header, RealFBInfo* realfb
|
||||
for (x = 0; x < src_height; x++) {
|
||||
/* Copy the bits from vertical line to horizontal line */
|
||||
const BYTE* ver_bits = src_bits;
|
||||
BYTE* hor_bits = __gal_a_line;
|
||||
BYTE* hor_bits = line_pixels;
|
||||
|
||||
switch (realfb_info->depth) {
|
||||
case 32:
|
||||
@@ -491,25 +493,25 @@ void refresh_hflip_msb_left (ShadowFBHeader* shadowfb_header, RealFBInfo* realfb
|
||||
}
|
||||
switch (realfb_info->depth) {
|
||||
case 1:
|
||||
put_one_line_1bpp (__gal_a_line, dst_line, realfb_info->width - src_update.right, src_width);
|
||||
put_one_line_1bpp (line_pixels, dst_line, realfb_info->width - src_update.right, src_width);
|
||||
src_bits += shadowfb_header->pitch;
|
||||
dst_line += realfb_info->pitch;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
put_one_line_2bpp (__gal_a_line, dst_line, realfb_info->width - src_update.right, src_width);
|
||||
put_one_line_2bpp (line_pixels, dst_line, realfb_info->width - src_update.right, src_width);
|
||||
src_bits += shadowfb_header->pitch;
|
||||
dst_line += realfb_info->pitch;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
put_one_line_4bpp (__gal_a_line, dst_line, realfb_info->width - src_update.right, src_width);
|
||||
put_one_line_4bpp (line_pixels, dst_line, realfb_info->width - src_update.right, src_width);
|
||||
src_bits += shadowfb_header->pitch;/* realfb_info->depth;*/
|
||||
dst_line += realfb_info->pitch;
|
||||
break;
|
||||
|
||||
default:
|
||||
put_one_line_8bpp (__gal_a_line, dst_line, realfb_info->width - src_update.right,
|
||||
put_one_line_8bpp (line_pixels, dst_line, realfb_info->width - src_update.right,
|
||||
src_width, realfb_info);
|
||||
src_bits += realfb_info->pitch;
|
||||
dst_line += realfb_info->pitch;
|
||||
@@ -525,6 +527,7 @@ void refresh_vflip_msb_left (ShadowFBHeader* shadowfb_header, RealFBInfo* realfb
|
||||
BYTE* dst_line;
|
||||
int src_width, src_height;
|
||||
int x, y;
|
||||
BYTE line_pixels[shadowfb_header->pitch];
|
||||
|
||||
/* Round the update rectangle. */
|
||||
round_rect (realfb_info->depth, &src_update);
|
||||
@@ -543,7 +546,7 @@ void refresh_vflip_msb_left (ShadowFBHeader* shadowfb_header, RealFBInfo* realfb
|
||||
for (x = 0; x < src_height; x++) {
|
||||
/* Copy the bits from vertical line to horizontal line */
|
||||
const BYTE* ver_bits = src_bits;
|
||||
BYTE* hor_bits = __gal_a_line;
|
||||
BYTE* hor_bits = line_pixels;
|
||||
|
||||
switch (realfb_info->depth) {
|
||||
case 32:
|
||||
@@ -585,25 +588,29 @@ void refresh_vflip_msb_left (ShadowFBHeader* shadowfb_header, RealFBInfo* realfb
|
||||
|
||||
switch (realfb_info->depth) {
|
||||
case 1:
|
||||
put_one_line_1bpp (__gal_a_line, dst_line, src_update.left, src_width);
|
||||
put_one_line_1bpp(line_pixels, dst_line, src_update.left,
|
||||
src_width);
|
||||
src_bits -= shadowfb_header->pitch;
|
||||
dst_line += realfb_info->pitch;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
put_one_line_2bpp (__gal_a_line, dst_line, src_update.left, src_width);
|
||||
put_one_line_2bpp(line_pixels, dst_line, src_update.left,
|
||||
src_width);
|
||||
src_bits -= shadowfb_header->pitch;
|
||||
dst_line += realfb_info->pitch;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
put_one_line_4bpp (__gal_a_line, dst_line, src_update.left, src_width);
|
||||
put_one_line_4bpp(line_pixels, dst_line, src_update.left,
|
||||
src_width);
|
||||
src_bits -= shadowfb_header->pitch;/* realfb_info->depth;*/
|
||||
dst_line += realfb_info->pitch;
|
||||
break;
|
||||
|
||||
default:
|
||||
put_one_line_8bpp (__gal_a_line, dst_line, src_update.left, src_width, realfb_info);
|
||||
put_one_line_8bpp(line_pixels, dst_line, src_update.left,
|
||||
src_width, realfb_info);
|
||||
src_bits -= realfb_info->pitch;
|
||||
dst_line += realfb_info->pitch;
|
||||
break;
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
#include "error.h"
|
||||
#include "shadow.h"
|
||||
|
||||
#if 0 /* use in-stack buffer since 5.0.14 */
|
||||
gal_uint8* __gal_a_line;
|
||||
|
||||
int refresh_init (int pitch)
|
||||
@@ -72,6 +73,7 @@ void refresh_destroy (void)
|
||||
if (__gal_a_line != NULL)
|
||||
free(__gal_a_line);
|
||||
}
|
||||
#endif
|
||||
|
||||
static unsigned char pixel_bit [] = {0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
|
||||
|
||||
@@ -275,7 +277,8 @@ void _get_src_rect_ccw (const RECT* dst_rect, RECT* src_rect, RealFBInfo *realfb
|
||||
src_rect->bottom = dst_rect->right;
|
||||
}
|
||||
|
||||
void refresh_cw_msb_right (ShadowFBHeader *shadowfb_header, RealFBInfo *realfb_info, void* update)
|
||||
void refresh_cw_msb_right (ShadowFBHeader *shadowfb_header,
|
||||
RealFBInfo *realfb_info, void* update)
|
||||
{
|
||||
RECT src_update = *(RECT*)update;
|
||||
RECT dst_update;
|
||||
@@ -283,6 +286,7 @@ void refresh_cw_msb_right (ShadowFBHeader *shadowfb_header, RealFBInfo *realfb_i
|
||||
BYTE* dst_line;
|
||||
int dst_width, dst_height;
|
||||
int x, y;
|
||||
BYTE line_pixels[shadowfb_header->pitch];
|
||||
|
||||
_get_dst_rect_cw (&dst_update, &src_update, realfb_info);
|
||||
|
||||
@@ -308,7 +312,7 @@ void refresh_cw_msb_right (ShadowFBHeader *shadowfb_header, RealFBInfo *realfb_i
|
||||
/* Copy the bits from vertical line to horizontal line */
|
||||
const BYTE* ver_bits = src_bits;
|
||||
|
||||
BYTE* hor_bits = __gal_a_line;
|
||||
BYTE* hor_bits = line_pixels;
|
||||
|
||||
switch (realfb_info->depth) {
|
||||
case 32:
|
||||
@@ -349,25 +353,25 @@ void refresh_cw_msb_right (ShadowFBHeader *shadowfb_header, RealFBInfo *realfb_i
|
||||
|
||||
switch (realfb_info->depth) {
|
||||
case 1:
|
||||
put_one_line_1bpp (__gal_a_line, dst_line, dst_update.left, dst_width);
|
||||
put_one_line_1bpp (line_pixels, dst_line, dst_update.left, dst_width);
|
||||
src_bits += 1;
|
||||
dst_line += realfb_info->pitch;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
put_one_line_2bpp (__gal_a_line, dst_line, dst_update.left, dst_width);
|
||||
put_one_line_2bpp (line_pixels, dst_line, dst_update.left, dst_width);
|
||||
src_bits +=1;
|
||||
dst_line += realfb_info->pitch;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
put_one_line_4bpp (__gal_a_line, dst_line, dst_update.left, dst_width);
|
||||
put_one_line_4bpp (line_pixels, dst_line, dst_update.left, dst_width);
|
||||
src_bits +=1;
|
||||
dst_line += realfb_info->pitch;
|
||||
break;
|
||||
|
||||
default:
|
||||
put_one_line_8bpp (__gal_a_line, dst_line, dst_update.left, dst_width, realfb_info);
|
||||
put_one_line_8bpp (line_pixels, dst_line, dst_update.left, dst_width, realfb_info);
|
||||
src_bits += realfb_info->depth/8;
|
||||
dst_line += realfb_info->pitch;
|
||||
break;
|
||||
@@ -376,12 +380,14 @@ void refresh_cw_msb_right (ShadowFBHeader *shadowfb_header, RealFBInfo *realfb_i
|
||||
}
|
||||
}
|
||||
|
||||
void refresh_ccw_msb_right (ShadowFBHeader* shadowfb_header, RealFBInfo* realfb_info, void* update)
|
||||
void refresh_ccw_msb_right(ShadowFBHeader* shadowfb_header,
|
||||
RealFBInfo* realfb_info, void* update)
|
||||
{
|
||||
RECT src_update = *(RECT*)update;
|
||||
RECT dst_update;
|
||||
const BYTE* src_bits;
|
||||
BYTE* dst_line;
|
||||
BYTE line_pixels[shadowfb_header->pitch];
|
||||
|
||||
int dst_width, dst_height;
|
||||
int x, y;
|
||||
@@ -409,7 +415,7 @@ void refresh_ccw_msb_right (ShadowFBHeader* shadowfb_header, RealFBInfo* realfb_
|
||||
for (x = 0; x < dst_height; x++) {
|
||||
/* Copy the bits from vertical line to horizontal line */
|
||||
const BYTE* ver_bits = src_bits;
|
||||
BYTE* hor_bits = __gal_a_line;
|
||||
BYTE* hor_bits = line_pixels;
|
||||
|
||||
switch (realfb_info->depth) {
|
||||
case 32:
|
||||
@@ -451,25 +457,25 @@ void refresh_ccw_msb_right (ShadowFBHeader* shadowfb_header, RealFBInfo* realfb_
|
||||
|
||||
switch (realfb_info->depth) {
|
||||
case 1:
|
||||
put_one_line_1bpp (__gal_a_line, dst_line, dst_update.left, dst_width);
|
||||
put_one_line_1bpp (line_pixels, dst_line, dst_update.left, dst_width);
|
||||
src_bits += 1;
|
||||
dst_line -= realfb_info->pitch;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
put_one_line_2bpp (__gal_a_line, dst_line, dst_update.left, dst_width);
|
||||
put_one_line_2bpp (line_pixels, dst_line, dst_update.left, dst_width);
|
||||
src_bits += 1;
|
||||
dst_line -= realfb_info->pitch;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
put_one_line_4bpp (__gal_a_line, dst_line, dst_update.left, dst_width);
|
||||
put_one_line_4bpp (line_pixels, dst_line, dst_update.left, dst_width);
|
||||
src_bits += 1;
|
||||
dst_line -= realfb_info->pitch;
|
||||
break;
|
||||
|
||||
default:
|
||||
put_one_line_8bpp (__gal_a_line, dst_line, dst_update.left, dst_width,\
|
||||
put_one_line_8bpp (line_pixels, dst_line, dst_update.left, dst_width,\
|
||||
realfb_info);
|
||||
src_bits += realfb_info->depth/8;
|
||||
dst_line -= realfb_info->pitch;
|
||||
@@ -494,6 +500,7 @@ void refresh_hflip_msb_right (ShadowFBHeader* shadowfb_header, RealFBInfo* realf
|
||||
BYTE* dst_line;
|
||||
int src_width, src_height;
|
||||
int x, y;
|
||||
BYTE line_pixels[shadowfb_header->pitch];
|
||||
|
||||
/* Round the update rectangle. */
|
||||
round_rect(realfb_info->depth, &src_update);
|
||||
@@ -512,7 +519,7 @@ void refresh_hflip_msb_right (ShadowFBHeader* shadowfb_header, RealFBInfo* realf
|
||||
for (x = 0; x < src_height; x++) {
|
||||
/* Copy the bits from vertical line to horizontal line */
|
||||
const BYTE* ver_bits = src_bits;
|
||||
BYTE* hor_bits = __gal_a_line;
|
||||
BYTE* hor_bits = line_pixels;
|
||||
|
||||
switch (realfb_info->depth) {
|
||||
case 32:
|
||||
@@ -553,25 +560,25 @@ void refresh_hflip_msb_right (ShadowFBHeader* shadowfb_header, RealFBInfo* realf
|
||||
}
|
||||
switch (realfb_info->depth) {
|
||||
case 1:
|
||||
put_one_line_1bpp (__gal_a_line, dst_line, realfb_info->width - src_update.right, src_width);
|
||||
put_one_line_1bpp (line_pixels, dst_line, realfb_info->width - src_update.right, src_width);
|
||||
src_bits += shadowfb_header->pitch;
|
||||
dst_line += realfb_info->pitch;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
put_one_line_2bpp (__gal_a_line, dst_line, realfb_info->width - src_update.right, src_width);
|
||||
put_one_line_2bpp (line_pixels, dst_line, realfb_info->width - src_update.right, src_width);
|
||||
src_bits += shadowfb_header->pitch;
|
||||
dst_line += realfb_info->pitch;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
put_one_line_4bpp (__gal_a_line, dst_line, realfb_info->width - src_update.right, src_width);
|
||||
put_one_line_4bpp (line_pixels, dst_line, realfb_info->width - src_update.right, src_width);
|
||||
src_bits += shadowfb_header->pitch;/* realfb_info->depth;*/
|
||||
dst_line += realfb_info->pitch;
|
||||
break;
|
||||
|
||||
default:
|
||||
put_one_line_8bpp (__gal_a_line, dst_line, realfb_info->width - src_update.right,
|
||||
put_one_line_8bpp (line_pixels, dst_line, realfb_info->width - src_update.right,
|
||||
src_width, realfb_info);
|
||||
src_bits += realfb_info->pitch;
|
||||
dst_line += realfb_info->pitch;
|
||||
@@ -596,6 +603,7 @@ void refresh_vflip_msb_right (ShadowFBHeader* shadowfb_header, RealFBInfo* realf
|
||||
BYTE* dst_line;
|
||||
int src_width, src_height;
|
||||
int x, y;
|
||||
BYTE line_pixels[shadowfb_header->pitch];
|
||||
|
||||
/* Round the update rectangle. */
|
||||
round_rect (realfb_info->depth, &src_update);
|
||||
@@ -614,7 +622,7 @@ void refresh_vflip_msb_right (ShadowFBHeader* shadowfb_header, RealFBInfo* realf
|
||||
for (x = 0; x < src_height; x++) {
|
||||
/* Copy the bits from vertical line to horizontal line */
|
||||
const BYTE* ver_bits = src_bits;
|
||||
BYTE* hor_bits = __gal_a_line;
|
||||
BYTE* hor_bits = line_pixels;
|
||||
|
||||
switch (realfb_info->depth) {
|
||||
case 32:
|
||||
@@ -656,25 +664,29 @@ void refresh_vflip_msb_right (ShadowFBHeader* shadowfb_header, RealFBInfo* realf
|
||||
|
||||
switch (realfb_info->depth) {
|
||||
case 1:
|
||||
put_one_line_1bpp (__gal_a_line, dst_line, src_update.left, src_width);
|
||||
put_one_line_1bpp(line_pixels, dst_line, src_update.left,
|
||||
src_width);
|
||||
src_bits -= shadowfb_header->pitch;
|
||||
dst_line += realfb_info->pitch;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
put_one_line_2bpp (__gal_a_line, dst_line, src_update.left, src_width);
|
||||
put_one_line_2bpp(line_pixels, dst_line, src_update.left,
|
||||
src_width);
|
||||
src_bits -= shadowfb_header->pitch;
|
||||
dst_line += realfb_info->pitch;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
put_one_line_4bpp (__gal_a_line, dst_line, src_update.left, src_width);
|
||||
put_one_line_4bpp(line_pixels, dst_line, src_update.left,
|
||||
src_width);
|
||||
src_bits -= shadowfb_header->pitch;/* realfb_info->depth;*/
|
||||
dst_line += realfb_info->pitch;
|
||||
break;
|
||||
|
||||
default:
|
||||
put_one_line_8bpp (__gal_a_line, dst_line, src_update.left, src_width, realfb_info);
|
||||
put_one_line_8bpp(line_pixels, dst_line, src_update.left,
|
||||
src_width, realfb_info);
|
||||
src_bits -= realfb_info->pitch;
|
||||
dst_line += realfb_info->pitch;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user