Skip to content

Commit

Permalink
Added skinning support
Browse files Browse the repository at this point in the history
  • Loading branch information
cmwdotme committed Apr 13, 2011
1 parent 2bf44a5 commit 8e78330
Show file tree
Hide file tree
Showing 23 changed files with 3,099 additions and 10 deletions.
11 changes: 9 additions & 2 deletions Makefile.target
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,15 @@ obj-arm-y += syborg_serial.o syborg_timer.o syborg_pointer.o syborg_rtc.o
obj-arm-y += syborg_virtio.o
obj-arm-y += vexpress.o
obj-arm-y += s5l8900.o iphone2g.o pcf50633.o s5l8900_uart.o s5l8900_spi.o pl192.o
obj-arm-y += s5l8900_i2c.o usb_synopsys.o #s5l8900_usb_otg.o

obj-arm-y += s5l8900_i2c.o usb_synopsys.o

#ifdef CONFIG_SKINNING
VPATH+=:$(SRC_PATH)/skin
CFLAGS+=-I$(SRC_PATH)/skin $(PNG_CFLAGS)
LIBS+=$(PNG_LIBS) -lexpat
obj-arm-y += skinning.o skin_config.o skin_image.o skin_button.o
obj-i386-y += skinning.o skin_config.o skin_image.o skin_button.o
#endif # CONFIG_SKINNING

obj-sh4-y = shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
obj-sh4-y += sh_timer.o sh_serial.o sh_intc.o sh_pci.o sm501.o
Expand Down
2 changes: 1 addition & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ make

How to run:

./arm-softmmu/qemu-system-arm -M iphone2g -option-rom iBoot-1.0.2.m68ap.RELEASE -option-rom iphone1-bootrom.bin -pflash nordump.bin -serial stdio
./arm-softmmu/qemu-system-arm -M iphone2g -option-rom iBoot-1.0.2.m68ap.RELEASE -option-rom iphone1-bootrom.bin -pflash nordump.bin -serial stdio -skin ./skin/devices/iphone2g/skin.xml

How do i contribute:

Expand Down
7 changes: 7 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ zero_malloc=""
trace_backend="nop"
trace_file="trace"
spice=""
skinning="no"
rbd=""
smartcard=""
smartcard_nss=""
Expand Down Expand Up @@ -724,6 +725,8 @@ for opt do
;;
--enable-opengl) opengl="yes"
;;
--enable-skinning) skinning="yes"
;;
--*dir)
;;
--disable-rbd) rbd="no"
Expand Down Expand Up @@ -928,6 +931,7 @@ echo " --enable-docs enable documentation build"
echo " --disable-docs disable documentation build"
echo " --disable-vhost-net disable vhost-net acceleration support"
echo " --enable-vhost-net enable vhost-net acceleration support"
echo " --enable-skinning Enabled skinning functionality for Qemu"
echo " --enable-trace-backend=B Set trace backend"
echo " Available backends:" $("$source_path"/scripts/tracetool --list-backends)
echo " --with-trace-file=NAME Full PATH,NAME of file to store traces"
Expand Down Expand Up @@ -2879,6 +2883,9 @@ fi
if test "$fdatasync" = "yes" ; then
echo "CONFIG_FDATASYNC=y" >> $config_host_mak
fi
if test "$skinning" = "yes" ; then
echo "CONFIG_SKINNING=y" >>$config_host_mak
fi
if test "$madvise" = "yes" ; then
echo "CONFIG_MADVISE=y" >> $config_host_mak
fi
Expand Down
17 changes: 16 additions & 1 deletion console.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,21 @@
#define QEMU_RGBA(r, g, b, a) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
#define QEMU_RGB(r, g, b) QEMU_RGBA(r, g, b, 0xff)

#ifdef CONFIG_SKINNING
// Skinning overwrites these functions to put the skin in between
DisplayState *qemu_graphic_console_init(vga_hw_update_ptr update,
vga_hw_invalidate_ptr invalidate,
vga_hw_screen_dump_ptr screen_dump,
vga_hw_text_update_ptr text_update,
void *opaque);
#undef graphic_console_init
#define graphic_console_init qemu_graphic_console_init

void original_qemu_console_resize(DisplayState *ds, int width, int height);
#undef qemu_console_resize
#define qemu_console_resize original_qemu_console_resize
#endif

typedef struct TextAttributes {
uint8_t fgcol:4;
uint8_t bgcol:4;
Expand Down Expand Up @@ -227,7 +242,7 @@ static unsigned int vga_get_color(DisplayState *ds, unsigned int rgba)
return color;
}

static void vga_fill_rect (DisplayState *ds,
void vga_fill_rect (DisplayState *ds,
int posx, int posy, int width, int height, uint32_t color)
{
uint8_t *d, *d1;
Expand Down
28 changes: 27 additions & 1 deletion console.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,10 @@ struct DisplayChangeListener {
void (*dpy_fill)(struct DisplayState *s, int x, int y,
int w, int h, uint32_t c);
void (*dpy_text_cursor)(struct DisplayState *s, int x, int y);

#ifdef CONFIG_SKINNING
void (*dpy_enablezoom)(struct DisplayState *s, int width, int height);
void (*dpy_getresolution)(int *width, int *height);
#endif
struct DisplayChangeListener *next;
};

Expand Down Expand Up @@ -298,6 +301,26 @@ static inline void dpy_cursor(struct DisplayState *s, int x, int y) {
}
}

#ifdef CONFIG_SKINNING
static inline void dpy_enablezoom(struct DisplayState *s, int width, int height)
{
struct DisplayChangeListener *dcl = s->listeners;
while (dcl != NULL) {
if (dcl->dpy_enablezoom) dcl->dpy_enablezoom(s, width, height);
dcl = dcl->next;
}
}

static inline void dpy_getresolution(struct DisplayState *s, int *width, int *height)
{
struct DisplayChangeListener *dcl = s->listeners;
while (dcl != NULL) {
if (dcl->dpy_getresolution) dcl->dpy_getresolution(width, height);
dcl = dcl->next;
}
}
#endif

static inline int ds_get_linesize(DisplayState *ds)
{
return ds->surface->linesize;
Expand Down Expand Up @@ -362,6 +385,9 @@ void qemu_console_resize(DisplayState *ds, int width, int height);
void qemu_console_copy(DisplayState *ds, int src_x, int src_y,
int dst_x, int dst_y, int w, int h);

void vga_fill_rect (DisplayState *ds,
int posx, int posy, int width, int height, uint32_t color);

/* sdl.c */
void sdl_display_init(DisplayState *ds, int full_screen, int no_frame);

Expand Down
4 changes: 1 addition & 3 deletions hw/iphone2g.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ static void iphone2g_lcd_update_display(void *opaque)

(void)draw_line_table12; // Unused var.

if (!lcd || !ds_get_bits_per_pixel(lcd->ds))
if (!lcd || !lcd->ds || !ds_get_bits_per_pixel(lcd->ds) || !frame_base)
return;

switch (ds_get_bits_per_pixel(lcd->ds)) {
Expand Down Expand Up @@ -236,8 +236,6 @@ static iphone2g_lcd_s * iphone2g_lcd_init(target_phys_addr_t base)
lcd->ds = graphic_console_init(iphone2g_lcd_update_display,
iphone2g_lcd_invalidate_display,
iphone2g_lcd_screen_dump, NULL, lcd);
qemu_console_resize(lcd->ds, LCD_WIDTH, LCD_HEIGHT);

return lcd;
}

Expand Down
8 changes: 8 additions & 0 deletions input.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@
#include "console.h"
#include "qjson.h"

#ifdef CONFIG_SKINNING
QEMUPutMouseEntry *original_qemu_add_mouse_event_handler(QEMUPutMouseEvent *func,
void *opaque, int absolute,
const char *name);
#undef qemu_add_mouse_event_handler
#define qemu_add_mouse_event_handler original_qemu_add_mouse_event_handler
#endif

static QEMUPutKBDEvent *qemu_put_kbd_event;
static void *qemu_put_kbd_event_opaque;
static QTAILQ_HEAD(, QEMUPutLEDEntry) led_handlers = QTAILQ_HEAD_INITIALIZER(led_handlers);
Expand Down
28 changes: 28 additions & 0 deletions qemu-options.hx
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,16 @@ STEXI
Rotate graphical output 90 deg left (only PXA LCD).
ETEXI
DEF("landscape", 0, QEMU_OPTION_landscape,
"-landscape rotate graphical output 90 deg right\n",
QEMU_ARCH_ALL)
STEXI
@item -portrait
@findex -portrait
Rotate graphical output 90 deg right
ETEXI
DEF("vga", HAS_ARG, QEMU_OPTION_vga,
"-vga [std|cirrus|vmware|qxl|xenfb|none]\n"
" select video card type\n", QEMU_ARCH_ALL)
Expand Down Expand Up @@ -808,6 +818,24 @@ STEXI
Start in full screen.
ETEXI
#if defined(CONFIG_SKINNING)
DEF("skin", HAS_ARG, QEMU_OPTION_skin,
"-skin file Skin qemu using provided skin configuration file\n", QEMU_ARCH_ALL)
STEXI
@item -skin @var{file}
Skin qemu using definitions from @var{file}
ETEXI
#endif
#if defined(CONFIG_SKINNING)
DEF("rctport", HAS_ARG, QEMU_OPTION_rctport,
"-rctport port Allow remote control of the skin through specified port\n", QEMU_ARCH_ALL)
STEXI
@item -rctport @var{d}
Allow remote control of the skin through port @var{d}
ETEXI
#endif
DEF("g", 1, QEMU_OPTION_g ,
"-g WxH[xDEPTH] Set the initial graphical resolution and depth\n",
QEMU_ARCH_PPC | QEMU_ARCH_SPARC)
Expand Down
Binary file added skin/devices/iphone2g/iphone2g-landscape.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added skin/devices/iphone2g/iphone2g-portrait.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions skin/devices/iphone2g/skin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<root>
<portrait>
<skin width="392" height="732"/>
<bgcolor red="255" blue="255" green="255"/>
<background image="iphone2g-portrait.png" posx="0" posy="0"/>
<screen width="320" height="480" posx="36" posy="120"/>
</portrait>
<landscape>
<skin width="723" height="392"/>
<bgcolor red="255" blue="255" green="255"/>
<background image="iphone2g-landscape.png" posx="0" posy="0"/>
<screen width="320" height="480" posx="282" posy="36"/>
</landscape>
</root>
Loading

0 comments on commit 8e78330

Please sign in to comment.