From d7098135d4baac8141b2e76f2daa8a7f61599c72 Mon Sep 17 00:00:00 2001 From: Luiz Capitulino Date: Mon, 21 May 2012 16:41:37 -0300 Subject: console: vga_hw_screen_dump_ptr: take Error argument All devices that register a screen dump callback via graphic_console_init() are updated. The new argument is not used in this commit. Error handling will be added to each device individually later. This change is a preparation to convert the screendump command to the QAPI. Signed-off-by: Luiz Capitulino --- hw/omap_lcdc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'hw/omap_lcdc.c') diff --git a/hw/omap_lcdc.c b/hw/omap_lcdc.c index 4a08e9d..39b78cd 100644 --- a/hw/omap_lcdc.c +++ b/hw/omap_lcdc.c @@ -264,7 +264,8 @@ static int ppm_save(const char *filename, uint8_t *data, return 0; } -static void omap_screen_dump(void *opaque, const char *filename, bool cswitch) +static void omap_screen_dump(void *opaque, const char *filename, bool cswitch, + Error **errp) { struct omap_lcd_panel_s *omap_lcd = opaque; -- cgit v1.1 From 8dc4cc7bb57d3f0d6a1d8ba372d9eda1494bcc64 Mon Sep 17 00:00:00 2001 From: Luiz Capitulino Date: Mon, 21 May 2012 15:18:58 -0300 Subject: omap_lcdc: rename ppm_save() to omap_ppm_save() Avoids confusion with the global ppm_save() defined in hw/vga.c. Signed-off-by: Luiz Capitulino Reviewed-by: Peter Maydell --- hw/omap_lcdc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'hw/omap_lcdc.c') diff --git a/hw/omap_lcdc.c b/hw/omap_lcdc.c index 39b78cd..3d6328f 100644 --- a/hw/omap_lcdc.c +++ b/hw/omap_lcdc.c @@ -224,8 +224,8 @@ static void omap_update_display(void *opaque) omap_lcd->invalidate = 0; } -static int ppm_save(const char *filename, uint8_t *data, - int w, int h, int linesize) +static int omap_ppm_save(const char *filename, uint8_t *data, + int w, int h, int linesize) { FILE *f; uint8_t *d, *d1; @@ -271,9 +271,9 @@ static void omap_screen_dump(void *opaque, const char *filename, bool cswitch, omap_update_display(opaque); if (omap_lcd && ds_get_data(omap_lcd->state)) - ppm_save(filename, ds_get_data(omap_lcd->state), - omap_lcd->width, omap_lcd->height, - ds_get_linesize(omap_lcd->state)); + omap_ppm_save(filename, ds_get_data(omap_lcd->state), + omap_lcd->width, omap_lcd->height, + ds_get_linesize(omap_lcd->state)); } static void omap_invalidate_display(void *opaque) { -- cgit v1.1 From d9c7ebb10042a7d29d50b47c110e5cb754293d89 Mon Sep 17 00:00:00 2001 From: Luiz Capitulino Date: Thu, 24 May 2012 11:24:34 -0300 Subject: omap_lcdc: omap_ppm_save(): add error handling Signed-off-by: Luiz Capitulino --- hw/omap_lcdc.c | 59 ++++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 45 insertions(+), 14 deletions(-) (limited to 'hw/omap_lcdc.c') diff --git a/hw/omap_lcdc.c b/hw/omap_lcdc.c index 3d6328f..e2ba108 100644 --- a/hw/omap_lcdc.c +++ b/hw/omap_lcdc.c @@ -224,18 +224,24 @@ static void omap_update_display(void *opaque) omap_lcd->invalidate = 0; } -static int omap_ppm_save(const char *filename, uint8_t *data, - int w, int h, int linesize) +static void omap_ppm_save(const char *filename, uint8_t *data, + int w, int h, int linesize, Error **errp) { FILE *f; uint8_t *d, *d1; unsigned int v; - int y, x, bpp; + int ret, y, x, bpp; f = fopen(filename, "wb"); - if (!f) - return -1; - fprintf(f, "P6\n%d %d\n%d\n", w, h, 255); + if (!f) { + error_setg(errp, "failed to open file '%s': %s", filename, + strerror(errno)); + return; + } + ret = fprintf(f, "P6\n%d %d\n%d\n", w, h, 255); + if (ret < 0) { + goto write_err; + } d1 = data; bpp = linesize / w; for (y = 0; y < h; y ++) { @@ -244,24 +250,49 @@ static int omap_ppm_save(const char *filename, uint8_t *data, v = *(uint32_t *) d; switch (bpp) { case 2: - fputc((v >> 8) & 0xf8, f); - fputc((v >> 3) & 0xfc, f); - fputc((v << 3) & 0xf8, f); + ret = fputc((v >> 8) & 0xf8, f); + if (ret == EOF) { + goto write_err; + } + ret = fputc((v >> 3) & 0xfc, f); + if (ret == EOF) { + goto write_err; + } + ret = fputc((v << 3) & 0xf8, f); + if (ret == EOF) { + goto write_err; + } break; case 3: case 4: default: - fputc((v >> 16) & 0xff, f); - fputc((v >> 8) & 0xff, f); - fputc((v) & 0xff, f); + ret = fputc((v >> 16) & 0xff, f); + if (ret == EOF) { + goto write_err; + } + ret = fputc((v >> 8) & 0xff, f); + if (ret == EOF) { + goto write_err; + } + ret = fputc((v) & 0xff, f); + if (ret == EOF) { + goto write_err; + } break; } d += bpp; } d1 += linesize; } +out: fclose(f); - return 0; + return; + +write_err: + error_setg(errp, "failed to write to file '%s': %s", filename, + strerror(errno)); + unlink(filename); + goto out; } static void omap_screen_dump(void *opaque, const char *filename, bool cswitch, @@ -273,7 +304,7 @@ static void omap_screen_dump(void *opaque, const char *filename, bool cswitch, if (omap_lcd && ds_get_data(omap_lcd->state)) omap_ppm_save(filename, ds_get_data(omap_lcd->state), omap_lcd->width, omap_lcd->height, - ds_get_linesize(omap_lcd->state)); + ds_get_linesize(omap_lcd->state), errp); } static void omap_invalidate_display(void *opaque) { -- cgit v1.1 From a8170e5e97ad17ca169c64ba87ae2f53850dab4c Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Tue, 23 Oct 2012 12:30:10 +0200 Subject: Rename target_phys_addr_t to hwaddr target_phys_addr_t is unwieldly, violates the C standard (_t suffixes are reserved) and its purpose doesn't match the name (most target_phys_addr_t addresses are not target specific). Replace it with a finger-friendly, standards conformant hwaddr. Outstanding patchsets can be fixed up with the command git rebase -i --exec 'find -name "*.[ch]" | xargs s/target_phys_addr_t/hwaddr/g' origin Signed-off-by: Avi Kivity Signed-off-by: Anthony Liguori --- hw/omap_lcdc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'hw/omap_lcdc.c') diff --git a/hw/omap_lcdc.c b/hw/omap_lcdc.c index e2ba108..bf177c2 100644 --- a/hw/omap_lcdc.c +++ b/hw/omap_lcdc.c @@ -117,7 +117,7 @@ static void omap_update_display(void *opaque) draw_line_func draw_line; int size, height, first, last; int width, linesize, step, bpp, frame_offset; - target_phys_addr_t frame_base; + hwaddr frame_base; if (!omap_lcd || omap_lcd->plm == 1 || !omap_lcd->enable || !ds_get_bits_per_pixel(omap_lcd->state)) @@ -359,7 +359,7 @@ static void omap_lcd_update(struct omap_lcd_panel_s *s) { } } -static uint64_t omap_lcdc_read(void *opaque, target_phys_addr_t addr, +static uint64_t omap_lcdc_read(void *opaque, hwaddr addr, unsigned size) { struct omap_lcd_panel_s *s = (struct omap_lcd_panel_s *) opaque; @@ -392,7 +392,7 @@ static uint64_t omap_lcdc_read(void *opaque, target_phys_addr_t addr, return 0; } -static void omap_lcdc_write(void *opaque, target_phys_addr_t addr, +static void omap_lcdc_write(void *opaque, hwaddr addr, uint64_t value, unsigned size) { struct omap_lcd_panel_s *s = (struct omap_lcd_panel_s *) opaque; @@ -465,7 +465,7 @@ void omap_lcdc_reset(struct omap_lcd_panel_s *s) } struct omap_lcd_panel_s *omap_lcdc_init(MemoryRegion *sysmem, - target_phys_addr_t base, + hwaddr base, qemu_irq irq, struct omap_dma_lcd_channel_s *dma, omap_clk clk) -- cgit v1.1 From a93a4a226a2afba147ba5df688b85d844f537c68 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Fri, 28 Sep 2012 15:02:08 +0200 Subject: console: untangle gfx & txt updates Stop abusing displaysurface fields for text mode displays. (bpp = 0, width = cols, height = lines). Add flags to displaystate indicating whenever text mode display (curses) or gfx mode displays (sdl, vnc, ...) are present. Add separate displaychangelistener callbacks for text / gfx mode resize & updates. This allows to enable gfx and txt diplays at the same time and also paves the way for more cleanups in the future. Signed-off-by: Gerd Hoffmann --- hw/omap_lcdc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'hw/omap_lcdc.c') diff --git a/hw/omap_lcdc.c b/hw/omap_lcdc.c index bf177c2..d7ae303 100644 --- a/hw/omap_lcdc.c +++ b/hw/omap_lcdc.c @@ -219,7 +219,7 @@ static void omap_update_display(void *opaque) draw_line, omap_lcd->palette, &first, &last); if (first >= 0) { - dpy_update(omap_lcd->state, 0, first, width, last - first + 1); + dpy_gfx_update(omap_lcd->state, 0, first, width, last - first + 1); } omap_lcd->invalidate = 0; } -- cgit v1.1 From 28ecbaeecb139a214f019207402a35d7b58aec0f Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Wed, 28 Nov 2012 12:06:30 +0100 Subject: ui: move files to ui/ and include/ui/ Signed-off-by: Paolo Bonzini --- hw/omap_lcdc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'hw/omap_lcdc.c') diff --git a/hw/omap_lcdc.c b/hw/omap_lcdc.c index d7ae303..936850a 100644 --- a/hw/omap_lcdc.c +++ b/hw/omap_lcdc.c @@ -17,9 +17,10 @@ * with this program; if not, see . */ #include "hw.h" -#include "console.h" +#include "ui/console.h" #include "omap.h" #include "framebuffer.h" +#include "ui/pixel_ops.h" struct omap_lcd_panel_s { MemoryRegion *sysmem; @@ -66,8 +67,6 @@ static void omap_lcd_interrupts(struct omap_lcd_panel_s *s) qemu_irq_lower(s->irq); } -#include "pixel_ops.h" - #define draw_line_func drawfn #define DEPTH 8 -- cgit v1.1