comparison src/video/fbcon/SDL_fbvideo.c @ 2735:204be4fc2726

Final merge of Google Summer of Code 2008 work... Port SDL 1.3 to the Nintendo DS by Darren Alton, mentored by Sam Lantinga
author Sam Lantinga <slouken@libsdl.org>
date Wed, 27 Aug 2008 15:10:03 +0000
parents 2c835d58faad
children 99210400e8b9
comparison
equal deleted inserted replaced
2734:dd25eabe441c 2735:204be4fc2726
80 {0, 0, 640, 400}, /* 8 bpp: 0x100, or 256 */ 80 {0, 0, 640, 400}, /* 8 bpp: 0x100, or 256 */
81 {0, 0, 512, 384}, 81 {0, 0, 512, 384},
82 {0, 0, 320, 240}, 82 {0, 0, 320, 240},
83 {0, 0, 320, 200} 83 {0, 0, 320, 200}
84 }; 84 };
85
85 static const struct 86 static const struct
86 { 87 {
87 int xres; 88 int xres;
88 int yres; 89 int yres;
89 int pixclock; 90 int pixclock;
321 322
322 if ((*c == '\n') || (*c == '#') || (*c == 0)) 323 if ((*c == '\n') || (*c == '#') || (*c == 0))
323 blank = 1; 324 blank = 1;
324 else 325 else
325 blank = 0; 326 blank = 0;
326 } 327 } while (blank);
327 while (blank);
328 /* remove whitespace at the begining of the string */ 328 /* remove whitespace at the begining of the string */
329 i = 0; 329 i = 0;
330 do { 330 do {
331 line[i] = c[i]; 331 line[i] = c[i];
332 i++; 332 i++;
333 } 333 } while (c[i] != 0);
334 while (c[i] != 0);
335 return 1; 334 return 1;
336 } 335 }
337 336
338 static int 337 static int
339 read_fbmodes_mode(FILE * f, struct fb_var_screeninfo *vinfo) 338 read_fbmodes_mode(FILE * f, struct fb_var_screeninfo *vinfo)
345 do { 344 do {
346 if (read_fbmodes_line(f, line, sizeof(line)) == 0) 345 if (read_fbmodes_line(f, line, sizeof(line)) == 0)
347 return 0; 346 return 0;
348 if (SDL_strncmp(line, "geometry", 8) == 0) 347 if (SDL_strncmp(line, "geometry", 8) == 0)
349 break; 348 break;
350 } 349 } while (1);
351 while (1);
352 350
353 SDL_sscanf(line, "geometry %d %d %d %d %d", &vinfo->xres, &vinfo->yres, 351 SDL_sscanf(line, "geometry %d %d %d %d %d", &vinfo->xres, &vinfo->yres,
354 &vinfo->xres_virtual, &vinfo->yres_virtual, 352 &vinfo->xres_virtual, &vinfo->yres_virtual,
355 &vinfo->bits_per_pixel); 353 &vinfo->bits_per_pixel);
356 if (read_fbmodes_line(f, line, sizeof(line)) == 0) 354 if (read_fbmodes_line(f, line, sizeof(line)) == 0)
392 } else if (SDL_strncmp(line, "double", 6) == 0) { 390 } else if (SDL_strncmp(line, "double", 6) == 0) {
393 SDL_sscanf(line, "double %s", option); 391 SDL_sscanf(line, "double %s", option);
394 if (SDL_strncmp(option, "true", 4) == 0) 392 if (SDL_strncmp(option, "true", 4) == 0)
395 vinfo->vmode |= FB_VMODE_DOUBLE; 393 vinfo->vmode |= FB_VMODE_DOUBLE;
396 } 394 }
397 } 395 } while (SDL_strncmp(line, "endmode", 7) != 0);
398 while (SDL_strncmp(line, "endmode", 7) != 0);
399 396
400 return 1; 397 return 1;
401 } 398 }
402 399
403 static int 400 static int
824 fprintf(stderr, "\tblue: %d/%d\n", vinfo->blue.length, 821 fprintf(stderr, "\tblue: %d/%d\n", vinfo->blue.length,
825 vinfo->blue.offset); 822 vinfo->blue.offset);
826 fprintf(stderr, "\talpha: %d/%d\n", vinfo->transp.length, 823 fprintf(stderr, "\talpha: %d/%d\n", vinfo->transp.length,
827 vinfo->transp.offset); 824 vinfo->transp.offset);
828 } 825 }
826
829 static void 827 static void
830 print_finfo(struct fb_fix_screeninfo *finfo) 828 print_finfo(struct fb_fix_screeninfo *finfo)
831 { 829 {
832 fprintf(stderr, "Printing finfo:\n"); 830 fprintf(stderr, "Printing finfo:\n");
833 fprintf(stderr, "\tsmem_start = %p\n", (char *) finfo->smem_start); 831 fprintf(stderr, "\tsmem_start = %p\n", (char *) finfo->smem_start);
1191 surfaces.size = (unsigned int) ((long) base - (long) surfaces.base); 1189 surfaces.size = (unsigned int) ((long) base - (long) surfaces.base);
1192 surfaces.next = bucket; 1190 surfaces.next = bucket;
1193 screen->hwdata = (struct private_hwdata *) &surfaces; 1191 screen->hwdata = (struct private_hwdata *) &surfaces;
1194 return (0); 1192 return (0);
1195 } 1193 }
1194
1196 static void 1195 static void
1197 FB_FreeHWSurfaces(_THIS) 1196 FB_FreeHWSurfaces(_THIS)
1198 { 1197 {
1199 vidmem_bucket *bucket, *freeable; 1198 vidmem_bucket *bucket, *freeable;
1200 1199
1281 surface->flags |= SDL_HWSURFACE; 1280 surface->flags |= SDL_HWSURFACE;
1282 surface->pixels = bucket->base; 1281 surface->pixels = bucket->base;
1283 surface->hwdata = (struct private_hwdata *) bucket; 1282 surface->hwdata = (struct private_hwdata *) bucket;
1284 return (0); 1283 return (0);
1285 } 1284 }
1285
1286 static void 1286 static void
1287 FB_FreeHWSurface(_THIS, SDL_Surface * surface) 1287 FB_FreeHWSurface(_THIS, SDL_Surface * surface)
1288 { 1288 {
1289 vidmem_bucket *bucket, *freeable; 1289 vidmem_bucket *bucket, *freeable;
1290 1290
1350 FB_WaitBusySurfaces(this); 1350 FB_WaitBusySurfaces(this);
1351 } 1351 }
1352 } 1352 }
1353 return (0); 1353 return (0);
1354 } 1354 }
1355
1355 static void 1356 static void
1356 FB_UnlockHWSurface(_THIS, SDL_Surface * surface) 1357 FB_UnlockHWSurface(_THIS, SDL_Surface * surface)
1357 { 1358 {
1358 if (surface == this->screen) { 1359 if (surface == this->screen) {
1359 SDL_mutexV(hw_lock); 1360 SDL_mutexV(hw_lock);