static int get_mode_info(int mode, struct vbe_mode_info *mi);
static int conv_vbeinfo(int mode, struct vid_modeinfo *mi, struct vbe_mode_info *vbemi);
static unsigned int calc_mask(int nbits, int pos);
+static void print_mode_info(int mode, struct vid_modeinfo *mi);
static void pack(uint32_t *pix, int r, int g, int b);
static void unpack(uint32_t pix, int *r, int *g, int *b);
} else {
minf->ops.blitfb = blitfb_banked;
}
+
+ print_mode_info(mode, minf);
return 0;
}
return mask << pos;
}
+static void print_mode_info(int mode, struct vid_modeinfo *mi)
+{
+ infomsg("VBE mode %04x\n", mode);
+ infomsg(" %dx%d %d bpp (%d colors)\n", mi->width, mi->height,
+ mi->bpp, mi->ncolors);
+ infomsg(" pitch: %d bytes, %d vmem pages\n", mi->pitch, mi->pages);
+
+ if(mi->bpp > 8) {
+ infomsg(" RGB mask %06x %06x %06x (pos: %d %d %d)\n", (unsigned int)mi->rmask,
+ (unsigned int)mi->gmask, (unsigned int)mi->bmask, mi->rshift,
+ mi->gshift, mi->bshift);
+ }
+
+ if(mode & VBE_MODE_LFB) {
+ infomsg(" LFB address %xh, size: %d\n", (unsigned int)mi->vmem_addr,
+ (int)mi->vmem_size);
+ } else {
+ infomsg(" banked window %d kb, granularity: %d kb, step: %d\n", mi->win_size,
+ mi->win_gran, mi->win_step);
+ }
+}
+
static void pack(uint32_t *pix, int r, int g, int b)
{
void vid_blitfb32(uint32_t *src, int pitch)
{
- int i, j, winpos, winleft;
+ int i, j, winpos, winleft, endskip;
unsigned char *dest;
uint16_t *dest16;
if(vid_islinear()) {
winleft = INT_MAX;
} else {
- winleft = 65536;/*cur_mode->win_size << 10;*/
+ winleft = cur_mode->win_size << 10;
winpos = 0;
vid_setwin(0, 0);
}
case 24:
dest = vid_vmem;
+ endskip = cur_mode->pitch - cur_mode->width * 3;
+
for(i=0; i<cur_mode->height; i++) {
for(j=0; j<cur_mode->width; j++) {
uint32_t pixel = src[j];
if(winleft <= 0) {
winpos += cur_mode->win_step;
vid_setwin(0, winpos);
- winleft = 65536;/*cur_mode->win_size << 10;*/
+ winleft = cur_mode->win_size << 10;
dest = vid_vmem;
}
- dest[0] = (pixel >> 16) & 0xff;
+ dest[0] = pixel & 0xff;
dest[1] = (pixel >> 8) & 0xff;
- dest[2] = pixel & 0xff;
+ dest[2] = (pixel >> 16) & 0xff;
dest += 3;
winleft -= 3;
}
src = (uint32_t*)((char*)src + pitch);
+ dest += endskip;
+ winleft -= endskip;
}
break;