~ubuntu-branches/ubuntu/edgy/qemu/edgy

« back to all changes in this revision

Viewing changes to hw/vga_template.h

  • Committer: Bazaar Package Importer
  • Author(s): Rodrigo Parra Novo
  • Date: 2006-08-04 22:50:15 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20060804225015-g0tvbozshau6e1oo
Tags: 0.8.2-0ubuntu1
* Merged with Debian unstable
* New Upstream release
* Dropped debian/patches/12_signal_powerpc_support.patch (broken for qemu
  0.8.2)
* Redid debian/patches/21_net_sockopt.patch
* Redid debian/patches/35_syscall_sockaddr.patch
* Redid debian/patches/42_arm_tls.patch
* Dropped debian/patches/50_missing_keycodes.patch (applied upstream)
* Redid debian/patches/61_safe_64bit_int.patch
* Dropped debian/patches/63_sparc_build.patch (applied upstream)
* Added new patch 65_no-linux_types_h.patch (unnecessary kernel header
  breaking compilation of linux-user/syscall.c)
* Added new patch 66_no-linux_compiler_h.patch (unnecessary kernel header
  breaking compilation of linux-usb.c)

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
#error unsupport depth
36
36
#endif
37
37
 
38
 
#if DEPTH != 15
 
38
#ifdef BGR_FORMAT
 
39
#define PIXEL_NAME glue(DEPTH, bgr)
 
40
#else
 
41
#define PIXEL_NAME DEPTH
 
42
#endif /* BGR_FORMAT */
 
43
 
 
44
#if DEPTH != 15 && !defined(BGR_FORMAT)
39
45
 
40
46
static inline void glue(vga_draw_glyph_line_, DEPTH)(uint8_t *d, 
41
47
                                                     uint32_t font_data,
334
340
    }
335
341
}
336
342
 
337
 
#endif /* DEPTH != 15 */
338
 
 
339
 
 
340
 
/* XXX: optimize */
341
 
 
342
 
/* 
343
 
 * 15 bit color
344
 
 */
345
 
static void glue(vga_draw_line15_, DEPTH)(VGAState *s1, uint8_t *d, 
346
 
                                          const uint8_t *s, int width)
347
 
{
348
 
#if DEPTH == 15 && defined(WORDS_BIGENDIAN) == defined(TARGET_WORDS_BIGENDIAN)
349
 
    memcpy(d, s, width * 2);
350
 
#else
351
 
    int w;
352
 
    uint32_t v, r, g, b;
353
 
 
354
 
    w = width;
355
 
    do {
356
 
        v = lduw_raw((void *)s);
357
 
        r = (v >> 7) & 0xf8;
358
 
        g = (v >> 2) & 0xf8;
359
 
        b = (v << 3) & 0xf8;
360
 
        ((PIXEL_TYPE *)d)[0] = glue(rgb_to_pixel, DEPTH)(r, g, b);
361
 
        s += 2;
362
 
        d += BPP;
363
 
    } while (--w != 0);
364
 
#endif    
365
 
}
366
 
 
367
 
/* 
368
 
 * 16 bit color
369
 
 */
370
 
static void glue(vga_draw_line16_, DEPTH)(VGAState *s1, uint8_t *d, 
371
 
                                          const uint8_t *s, int width)
372
 
{
373
 
#if DEPTH == 16 && defined(WORDS_BIGENDIAN) == defined(TARGET_WORDS_BIGENDIAN)
374
 
    memcpy(d, s, width * 2);
375
 
#else
376
 
    int w;
377
 
    uint32_t v, r, g, b;
378
 
 
379
 
    w = width;
380
 
    do {
381
 
        v = lduw_raw((void *)s);
382
 
        r = (v >> 8) & 0xf8;
383
 
        g = (v >> 3) & 0xfc;
384
 
        b = (v << 3) & 0xf8;
385
 
        ((PIXEL_TYPE *)d)[0] = glue(rgb_to_pixel, DEPTH)(r, g, b);
386
 
        s += 2;
387
 
        d += BPP;
388
 
    } while (--w != 0);
389
 
#endif    
390
 
}
391
 
 
392
 
/* 
393
 
 * 24 bit color
394
 
 */
395
 
static void glue(vga_draw_line24_, DEPTH)(VGAState *s1, uint8_t *d, 
396
 
                                          const uint8_t *s, int width)
397
 
{
398
 
    int w;
399
 
    uint32_t r, g, b;
400
 
 
401
 
    w = width;
402
 
    do {
403
 
#if defined(TARGET_WORDS_BIGENDIAN)
404
 
        r = s[0];
405
 
        g = s[1];
406
 
        b = s[2];
407
 
#else
408
 
        b = s[0];
409
 
        g = s[1];
410
 
        r = s[2];
411
 
#endif
412
 
        ((PIXEL_TYPE *)d)[0] = glue(rgb_to_pixel, DEPTH)(r, g, b);
413
 
        s += 3;
414
 
        d += BPP;
415
 
    } while (--w != 0);
416
 
}
417
 
 
418
 
/* 
419
 
 * 32 bit color
420
 
 */
421
 
static void glue(vga_draw_line32_, DEPTH)(VGAState *s1, uint8_t *d, 
422
 
                                          const uint8_t *s, int width)
423
 
{
424
 
#if DEPTH == 32 && defined(WORDS_BIGENDIAN) == defined(TARGET_WORDS_BIGENDIAN)
425
 
    memcpy(d, s, width * 4);
426
 
#else
427
 
    int w;
428
 
    uint32_t r, g, b;
429
 
 
430
 
    w = width;
431
 
    do {
432
 
#if defined(TARGET_WORDS_BIGENDIAN)
433
 
        r = s[1];
434
 
        g = s[2];
435
 
        b = s[3];
436
 
#else
437
 
        b = s[0];
438
 
        g = s[1];
439
 
        r = s[2];
440
 
#endif
441
 
        ((PIXEL_TYPE *)d)[0] = glue(rgb_to_pixel, DEPTH)(r, g, b);
442
 
        s += 4;
443
 
        d += BPP;
444
 
    } while (--w != 0);
445
 
#endif
446
 
}
447
 
 
448
 
#if DEPTH != 15
449
343
void glue(vga_draw_cursor_line_, DEPTH)(uint8_t *d1, 
450
344
                                        const uint8_t *src1, 
451
345
                                        int poffset, int w,
511
405
        d += BPP;
512
406
    }
513
407
}
514
 
#endif
 
408
 
 
409
#endif /* DEPTH != 15 */
 
410
 
 
411
 
 
412
/* XXX: optimize */
 
413
 
 
414
/* 
 
415
 * 15 bit color
 
416
 */
 
417
static void glue(vga_draw_line15_, PIXEL_NAME)(VGAState *s1, uint8_t *d, 
 
418
                                          const uint8_t *s, int width)
 
419
{
 
420
#if DEPTH == 15 && defined(WORDS_BIGENDIAN) == defined(TARGET_WORDS_BIGENDIAN)
 
421
    memcpy(d, s, width * 2);
 
422
#else
 
423
    int w;
 
424
    uint32_t v, r, g, b;
 
425
 
 
426
    w = width;
 
427
    do {
 
428
        v = lduw_raw((void *)s);
 
429
        r = (v >> 7) & 0xf8;
 
430
        g = (v >> 2) & 0xf8;
 
431
        b = (v << 3) & 0xf8;
 
432
        ((PIXEL_TYPE *)d)[0] = glue(rgb_to_pixel, PIXEL_NAME)(r, g, b);
 
433
        s += 2;
 
434
        d += BPP;
 
435
    } while (--w != 0);
 
436
#endif    
 
437
}
 
438
 
 
439
/* 
 
440
 * 16 bit color
 
441
 */
 
442
static void glue(vga_draw_line16_, PIXEL_NAME)(VGAState *s1, uint8_t *d, 
 
443
                                          const uint8_t *s, int width)
 
444
{
 
445
#if DEPTH == 16 && defined(WORDS_BIGENDIAN) == defined(TARGET_WORDS_BIGENDIAN)
 
446
    memcpy(d, s, width * 2);
 
447
#else
 
448
    int w;
 
449
    uint32_t v, r, g, b;
 
450
 
 
451
    w = width;
 
452
    do {
 
453
        v = lduw_raw((void *)s);
 
454
        r = (v >> 8) & 0xf8;
 
455
        g = (v >> 3) & 0xfc;
 
456
        b = (v << 3) & 0xf8;
 
457
        ((PIXEL_TYPE *)d)[0] = glue(rgb_to_pixel, PIXEL_NAME)(r, g, b);
 
458
        s += 2;
 
459
        d += BPP;
 
460
    } while (--w != 0);
 
461
#endif    
 
462
}
 
463
 
 
464
/* 
 
465
 * 24 bit color
 
466
 */
 
467
static void glue(vga_draw_line24_, PIXEL_NAME)(VGAState *s1, uint8_t *d, 
 
468
                                          const uint8_t *s, int width)
 
469
{
 
470
    int w;
 
471
    uint32_t r, g, b;
 
472
 
 
473
    w = width;
 
474
    do {
 
475
#if defined(TARGET_WORDS_BIGENDIAN)
 
476
        r = s[0];
 
477
        g = s[1];
 
478
        b = s[2];
 
479
#else
 
480
        b = s[0];
 
481
        g = s[1];
 
482
        r = s[2];
 
483
#endif
 
484
        ((PIXEL_TYPE *)d)[0] = glue(rgb_to_pixel, PIXEL_NAME)(r, g, b);
 
485
        s += 3;
 
486
        d += BPP;
 
487
    } while (--w != 0);
 
488
}
 
489
 
 
490
/* 
 
491
 * 32 bit color
 
492
 */
 
493
static void glue(vga_draw_line32_, PIXEL_NAME)(VGAState *s1, uint8_t *d, 
 
494
                                          const uint8_t *s, int width)
 
495
{
 
496
#if DEPTH == 32 && defined(WORDS_BIGENDIAN) == defined(TARGET_WORDS_BIGENDIAN) && !defined(BGR_FORMAT)
 
497
    memcpy(d, s, width * 4);
 
498
#else
 
499
    int w;
 
500
    uint32_t r, g, b;
 
501
 
 
502
    w = width;
 
503
    do {
 
504
#if defined(TARGET_WORDS_BIGENDIAN)
 
505
        r = s[1];
 
506
        g = s[2];
 
507
        b = s[3];
 
508
#else
 
509
        b = s[0];
 
510
        g = s[1];
 
511
        r = s[2];
 
512
#endif
 
513
        ((PIXEL_TYPE *)d)[0] = glue(rgb_to_pixel, PIXEL_NAME)(r, g, b);
 
514
        s += 4;
 
515
        d += BPP;
 
516
    } while (--w != 0);
 
517
#endif
 
518
}
515
519
 
516
520
#undef PUT_PIXEL2
517
521
#undef DEPTH
518
522
#undef BPP
519
523
#undef PIXEL_TYPE
 
524
#undef PIXEL_NAME
 
525
#undef BGR_FORMAT