Subversion Repositories shark

Compare Revisions

Regard whitespace Rev 1313 → Rev 1314

/demos/trunk/mesademo/mesademo.c
16,7 → 16,7
* http://shark.sssup.it
*/
 
#include <drivers/vga.h>
#include <drivers/glib.h>
#include <drivers/keyb.h>
 
#include <GL/osmesa.h>
35,8 → 35,6
#define WIDTH 640
#define HEIGHT 480
#define BYTES_PP 2 //BytesPerPixel
#define INITSTR G640x480x64K //SVGAlib standard mode definitions
#define CARD VESA //Video driver
 
OSMesaContext ctx;
 
257,29 → 255,23
 
}
 
static int screen(int mode)
static int screen()
{
 
vga_modeinfo *minf;
extern DWORD flbaddr;
 
vga_setmode(mode,CARD);
minf = vga_getmodeinfo(mode);
if(! (minf->flags & CAPABLE_LINEAR)){
vga_setmode(TEXT,CARD);
printk(KERN_INFO "The mode %d is not capable of linear\n",mode);
return 1;
/* graphic card Initialization */
if (grx_init() < 1) {
sys_abort(1);
}
vga_setpage(0);
if(vga_setlinearaddressing() == -1) {
vga_setmode(TEXT,CARD);
printk(KERN_INFO "Could not set linear addressing for mode %d\n",mode);
return 1;
if (grx_open(640, 480, 16) < 0) {
cprintf("GRX Err\n");
sys_abort(1);
}
video_buf = vga_getgraphmem();
video_buf = (unsigned char *)flbaddr;
 
grx_setbuffer(rgb_565_buf, WIDTH, HEIGHT); //Init of RGB16 version of grx functions
//created to work with Mesa buffer
return 0;
}
290,7 → 282,7
OSMesaDestroyContext(ctx);
free(rgb_565_buf);
 
vga_setmode(TEXT,CARD);
grx_close();
 
sys_end();
 
308,7 → 300,7
 
while(1) {
 
copy_videomem_16to16(rgb_565_buf, video_buf, VMEMLONG);
memcpy(video_buf, rgb_565_buf, RGB565MEM);
task_endcycle();
 
}
397,7 → 389,7
 
gl_init();
if (screen(INITSTR)) {
if (screen()) {
printk(KERN_INFO "Graphical initialization failed !!\n");
sys_end();
}