Revision ee6847d1 hw/syborg_fb.c
b/hw/syborg_fb.c | ||
---|---|---|
76 | 76 |
|
77 | 77 |
uint32_t base; |
78 | 78 |
uint32_t pitch; |
79 |
int rows;
|
|
80 |
int cols;
|
|
79 |
uint32_t rows;
|
|
80 |
uint32_t cols;
|
|
81 | 81 |
int blank; |
82 | 82 |
int bpp; |
83 | 83 |
int rgb; /* 0 = BGR, 1 = RGB */ |
... | ... | |
507 | 507 |
{ |
508 | 508 |
SyborgFBState *s = FROM_SYSBUS(SyborgFBState, dev); |
509 | 509 |
int iomemtype; |
510 |
int width; |
|
511 |
int height; |
|
512 | 510 |
|
513 | 511 |
sysbus_init_irq(dev, &s->irq); |
514 | 512 |
iomemtype = cpu_register_io_memory(syborg_fb_readfn, |
515 | 513 |
syborg_fb_writefn, s); |
516 | 514 |
sysbus_init_mmio(dev, 0x1000, iomemtype); |
517 | 515 |
|
518 |
width = qdev_get_prop_int(&dev->qdev, "width", 0); |
|
519 |
height = qdev_get_prop_int(&dev->qdev, "height", 0); |
|
520 |
|
|
521 | 516 |
s->ds = graphic_console_init(syborg_fb_update_display, |
522 | 517 |
syborg_fb_invalidate_display, |
523 | 518 |
NULL, NULL, s); |
524 | 519 |
|
525 |
if (width != 0 && height != 0) {
|
|
526 |
qemu_console_resize(s->ds, width, height);
|
|
520 |
if (s->cols != 0 && s->rows != 0) {
|
|
521 |
qemu_console_resize(s->ds, s->cols, s->rows);
|
|
527 | 522 |
} |
528 | 523 |
|
529 |
if (!width) |
|
530 |
width = ds_get_width(s->ds); |
|
531 |
if (!height) |
|
532 |
height = ds_get_height(s->ds); |
|
533 |
|
|
534 |
s->cols = width; |
|
535 |
s->rows = height; |
|
524 |
if (!s->cols) |
|
525 |
s->cols = ds_get_width(s->ds); |
|
526 |
if (!s->rows) |
|
527 |
s->rows = ds_get_height(s->ds); |
|
536 | 528 |
|
537 | 529 |
register_savevm("syborg_framebuffer", -1, 1, |
538 | 530 |
syborg_fb_save, syborg_fb_load, s); |
539 | 531 |
} |
540 | 532 |
|
533 |
static SysBusDeviceInfo syborg_fb_info = { |
|
534 |
.init = syborg_fb_init, |
|
535 |
.qdev.name = "syborg,framebuffer", |
|
536 |
.qdev.size = sizeof(SyborgFBState), |
|
537 |
.qdev.props = (Property[]) { |
|
538 |
{ |
|
539 |
.name = "width", |
|
540 |
.info = &qdev_prop_uint32, |
|
541 |
.offset = offsetof(SyborgFBState, cols), |
|
542 |
},{ |
|
543 |
.name = "height", |
|
544 |
.info = &qdev_prop_uint32, |
|
545 |
.offset = offsetof(SyborgFBState, rows), |
|
546 |
}, |
|
547 |
{/* end of list */} |
|
548 |
} |
|
549 |
}; |
|
550 |
|
|
541 | 551 |
static void syborg_fb_register_devices(void) |
542 | 552 |
{ |
543 |
sysbus_register_dev("syborg,framebuffer", sizeof(SyborgFBState), |
|
544 |
syborg_fb_init); |
|
553 |
sysbus_register_withprop(&syborg_fb_info); |
|
545 | 554 |
} |
546 | 555 |
|
547 | 556 |
device_init(syborg_fb_register_devices) |
Also available in: Unified diff