comparison libvo/vo_svga.c @ 9046:13b7ad16f278

This patch should fix the display problem with 4bpp and 8bpp modes. The problem was that the new drawing method assumes a linear framebuffer, which is not available in those modes. This can be worked around by using the old drawing method, which is what this patch does. The old method can be forced, by using the "old" driver option. This patch also enables linear addressing, since it improves write speed to video memory considerably. The mentioned problem: "it is not compatable with vga_draw* for some cards" Is a bug in svgalib, which I think should be fixed in recent svgalib versions. If someone sees this problem, please report to svgalib maintainer (that's me). patch by Matan Ziv-Av. matan@svgalib.org
author arpi
date Mon, 20 Jan 2003 21:33:11 +0000
parents 4c0882ee0f4d
children 247e9304a831
comparison
equal deleted inserted replaced
9045:417a20a4fc75 9046:13b7ad16f278
455 printf("vo_svga: vga_setmode(%d) failed.\n",vid_mode); 455 printf("vo_svga: vga_setmode(%d) failed.\n",vid_mode);
456 uninit(); 456 uninit();
457 return(1); // error 457 return(1); // error
458 } 458 }
459 459
460 if(vid_mode<10 || vid_mode==145) {
461 oldmethod=1;
462 }
460 /* set 332 palette for 8 bpp */ 463 /* set 332 palette for 8 bpp */
461 if(bpp==8){ 464 if(bpp==8){
462 int i; 465 int i;
463 for(i=0; i<256; i++) 466 for(i=0; i<256; i++)
464 vga_setpalette(i, ((i>>5)&7)*9, ((i>>2)&7)*9, (i&3)*21); 467 vga_setpalette(i, ((i>>5)&7)*9, ((i>>2)&7)*9, (i&3)*21);
471 } 474 }
472 475
473 WIDTH=vga_getxdim(); 476 WIDTH=vga_getxdim();
474 HEIGHT=vga_getydim(); 477 HEIGHT=vga_getydim();
475 BYTESPERPIXEL=(bpp+4)>>3; 478 BYTESPERPIXEL=(bpp+4)>>3;
476 if(bpp==1)
477 LINEWIDTH=(WIDTH+7)/8;
478 else
479 LINEWIDTH=vga_getmodeinfo(vid_mode)->linewidth; 479 LINEWIDTH=vga_getmodeinfo(vid_mode)->linewidth;
480 480
481 // vga_setlinearaddressing(); //it is not compatable with vga_draw* for "some" cards 481 if(oldmethod && (bpp==8 || bpp==4)) LINEWIDTH*=8;
482
483 if(!oldmethod || (bpp>8))vga_setlinearaddressing();
482 if(oldmethod) { 484 if(oldmethod) {
483 buffer=malloc(HEIGHT*LINEWIDTH); 485 buffer=malloc(HEIGHT*LINEWIDTH);
484 maxframes=0; 486 maxframes=0;
485 } else if ((vga_getmodeinfo(vid_mode)->flags&IS_LINEAR)) { 487 } else if ((vga_getmodeinfo(vid_mode)->flags&IS_LINEAR)) {
486 directrender=1; 488 directrender=1;