Vga 20200528 patches
[PULL 03/21] hw/display/cirrus_vga: Convert debug printf() to trace event
In reply to Gerd HoffmannFrom: Philippe Mathieu-Daudé <[email protected]>
Message-id: [email protected]
--- hw/display/cirrus_vga.c | 4 +--- hw/display/trace-events | 1 + 2 files changed, 2 insertions(+), 3 deletions(-)
hw/display/cirrus_vga.c +1 -3
@@ -1512,9 +1512,7 @@ static int cirrus_vga_read_gr(CirrusVGAState * s, unsigned reg_index)static void cirrus_vga_write_gr (CirrusVGAState * s,unsigned reg_index,int reg_value) { -#if defined(DEBUG_BITBLT ) &&0 -printf ("gr%02x: %02x\n" , reg_index, reg_value); -#endif +trace_vga_cirrus_write_gr (reg_index, reg_value);switch (reg_index) {case 0x00 :// Standard VGA, BGCOLOR 0x000000ff s->vga.gr[reg_index] = reg_value & gr_mask[reg_index];
hw/display/trace-events +1 -0
@@ -133,6 +133,7 @@ vga_vbe_write(uint32_t index, uint32_t val) "index 0x%x, val 0x%x" vga_cirrus_read_io(uint32_t addr, uint32_t val) "addr 0x%x, val 0x%x" vga_cirrus_write_io(uint32_t addr, uint32_t val) "addr 0x%x, val 0x%x" vga_cirrus_write_blt(uint32_t offset, uint32_t val) "offset 0x%x, val 0x%x" +vga_cirrus_write_gr(uint8_t index, uint8_t val) "GR addr 0x%02x, val 0x%02x" # sii9022.c sii9022_read_reg(uint8_t addr, uint8_t val) "addr 0x%02x, val 0x%02x"
Signature · 1 line
2.18.4
The following changes since commit 06539ebc76b8625587aa78d646a9d8d5fddf84f3:
Merge remote-tracking branch 'remotes/philmd-gitlab/tags/mips-hw-next-20200526' into staging (2020-05-26 20:25:06 +0100)
are available in the Git repository at:
git://git.kraxel.org/qemu tags/vga-20200528-pull-request
for you to fetch changes up to fa0013a1bc5f6011a1017e0e655740403e5555d9:
sm501: Remove obsolete changelog and todo comment (2020-05-28 11:38:57 +0200)
----------------------------------------------------------------
hw/dispaly/sm501: bugfixes, add sanity checks.
hw/display: use tracepoints, misc cleanups.
----------------------------------------------------------------
BALATON Zoltan (7):
sm501: Convert printf + abort to qemu_log_mask
sm501: Shorten long variable names in sm501_2d_operation
sm501: Use BIT(x) macro to shorten constant
sm501: Clean up local variables in sm501_2d_operation
sm501: Replace hand written implementation with pixman where possible
sm501: Optimize small overlapping blits
sm501: Remove obsolete changelog and todo comment
Philippe Mathieu-Daudé (14):
hw/display/edid: Add missing 'qdev-properties.h' header hw/display/cg3: Convert debug printf()s to trace events hw/display/cirrus_vga: Convert debug printf() to trace event hw/display/cirrus_vga: Use qemu_log_mask(UNIMP) instead of debug
printf
hw/display/cirrus_vga: Use qemu_log_mask(ERROR) instead of debug
printf
hw/display/cirrus_vga: Convert debug printf() to trace event hw/display/dpcd: Fix memory region size
hw/display/dpcd: Convert debug printf()s to trace events hw/display/xlnx_dp: Replace disabled DPRINTF() by error_report() hw/display/vmware_vga: Replace printf() calls by qemu_log_mask(ERROR) hw/display/vmware_vga: Let the PCI device own its I/O MemoryRegion hw/display/exynos4210_fimd: Use qemu_log_mask(GUEST_ERROR) hw/display/omap_dss: Replace fprintf() call by
qemu_log_mask(LOG_UNIMP)
hw/display/pxa2xx_lcd: Replace printf() call by qemu_log_mask()
include/hw/display/edid.h | 1 + hw/display/cg3.c | 14 +- hw/display/cirrus_vga.c | 119 ++++++------- hw/display/dpcd.c | 20 +-- hw/display/exynos4210_fimd.c | 46 +++-- hw/display/omap_dss.c | 2 +- hw/display/pxa2xx_lcd.c | 26 +-- hw/display/sm501.c | 313 ++++++++++++++++++----------------- hw/display/vmware_vga.c | 18 +- hw/display/xlnx_dp.c | 14 +- hw/display/trace-events | 10 ++ 11 files changed, 301 insertions(+), 282 deletions(-)
Signature · 1 line
2.18.4
[PULL 04/21] hw/display/cirrus_vga: Use qemu_log_mask(UNIMP) instead of debug printf
From: Philippe Mathieu-Daudé <[email protected]>
Replace some debug printf() calls by qemu_log_mask(LOG_UNIMP), and add a new one in cirrus_linear_bitblt_read().
Message-id: [email protected]
--- hw/display/cirrus_vga.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
hw/display/cirrus_vga.c +8 -6
@@ -35,6 +35,7 @@#include "qemu/osdep.h" #include "qemu/module.h" #include "qemu/units.h" +#include "qemu/log.h" #include "sysemu/reset.h" #include "qapi/error.h" #include "trace.h"
@@ -905,9 +906,8 @@ static int cirrus_bitblt_cputovideo(CirrusVGAState * s)static int cirrus_bitblt_videotocpu (CirrusVGAState * s) {/* XXX */ -#ifdef DEBUG_BITBLT -printf ("cirrus: bitblt (video to cpu) is not implemented yet\n" ); -#endif +qemu_log_mask (LOG_UNIMP , +"cirrus: bitblt (video to cpu) is not implemented\n" );return 0 ; }
@@ -989,9 +989,8 @@ static void cirrus_bitblt_start(CirrusVGAState * s) cirrus_blt_mode & (CIRRUS_BLTMODE_MEMSYSSRC | CIRRUS_BLTMODE_MEMSYSDEST)) == (CIRRUS_BLTMODE_MEMSYSSRC | CIRRUS_BLTMODE_MEMSYSDEST)) { -#ifdef DEBUG_BITBLT -printf ("cirrus: bitblt - memory-to-memory copy is requested\n" ); -#endif +qemu_log_mask (LOG_UNIMP , +"cirrus: bitblt - memory-to-memory copy requested\n" ); goto bitblt_ignore; }
@@ -2412,6 +2411,9 @@ static uint64_t cirrus_linear_bitblt_read(void *opaque,/* XXX handle bitblt */ (void )s; +qemu_log_mask (LOG_UNIMP , +"cirrus: linear bitblt is not implemented\n" ); +return 0xff ; }
Signature · 1 line
2.18.4
[PULL 18/21] sm501: Clean up local variables in sm501_2d_operation
In reply to Gerd HoffmannFrom: BALATON Zoltan <[email protected]>
Make variables local to the block they are used in to make it clearer which operation they are needed for.
Message-id: ae59f8138afe7f6a5a4a82539d0f61496a906b06.1590089984.git.balaton@eik.bme.hu
--- hw/display/sm501.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-)
hw/display/sm501.c +16 -15
@@ -699,28 +699,19 @@ static inline void hwc_invalidate(SM501State *s, int crt)static void sm501_2d_operation (SM501State *s) { -/* obtain operation parameters */ int cmd = (s->twoD_control >>16 ) &0x1F ;int rtl = s->twoD_control &BIT (27 ); -int src_x = (s->twoD_source >>16 ) &0x01FFF ; -int src_y = s->twoD_source &0xFFFF ; -int dst_x = (s->twoD_destination >>16 ) &0x01FFF ; -int dst_y = s->twoD_destination &0xFFFF ; -int width = (s->twoD_dimension >>16 ) &0x1FFF ; -int height = s->twoD_dimension &0xFFFF ; -uint32_t color = s->twoD_foreground;int format = (s->twoD_stretch >>20 ) &0x3 ;int rop_mode = (s->twoD_control >>15 ) &0x1 ;/* 1 for rop2, else rop3 */ /* 1 if rop2 source is the pattern, otherwise the source is the bitmap */ int rop2_source_is_pattern = (s->twoD_control >>14 ) &0x1 ;int rop = s->twoD_control &0xFF ; -uint32_t src_base = s->twoD_source_base &0x03FFFFFF ; +int dst_x = (s->twoD_destination >>16 ) &0x01FFF ; +int dst_y = s->twoD_destination &0xFFFF ; +int width = (s->twoD_dimension >>16 ) &0x1FFF ; +int height = s->twoD_dimension &0xFFFF ;uint32_t dst_base = s->twoD_destination_base &0x03FFFFFF ; - -/* get frame buffer info */ -uint8_t *src = s->local_mem + src_base;uint8_t *dst = s->local_mem + dst_base; -int src_pitch = s->twoD_pitch &0x1FFF ;int dst_pitch = (s->twoD_pitch >>16 ) &0x1FFF ;int crt = (s->dc_crt_control &SM501_DC_CRT_CONTROL_SEL ) ?1 :0 ;int fb_len =get_width (s, crt) *get_height (s, crt) *get_bpp (s, crt);
@@ -758,6 +749,13 @@ static void sm501_2d_operation(SM501State *s)switch (cmd) {case 0x00 :/* copy area */ + { +int src_x = (s->twoD_source >>16 ) &0x01FFF ; +int src_y = s->twoD_source &0xFFFF ; +uint32_t src_base = s->twoD_source_base &0x03FFFFFF ; +uint8_t *src = s->local_mem + src_base; +int src_pitch = s->twoD_pitch &0x1FFF ; +#define COPY_AREA (_bpp, _pixel_type, rtl) { \ int y, x, index_d, index_s; \ for (y = 0; y < height; y++) { \
@@ -793,8 +791,11 @@ static void sm501_2d_operation(SM501State *s)break ; }break ; - + }case 0x01 :/* fill rectangle */ + { +uint32_t color = s->twoD_foreground; +#define FILL_RECT (_bpp, _pixel_type) { \ int y, x; \ for (y = 0; y < height; y++) { \
@@ -819,7 +820,7 @@ static void sm501_2d_operation(SM501State *s)break ; }break ; - + }default :qemu_log_mask (LOG_UNIMP ,"sm501: not implemented 2D operation: %d\n" , cmd);
Signature · 1 line
2.18.4
[PULL 08/21] hw/display/dpcd: Convert debug printf()s to trace events
In reply to Gerd HoffmannFrom: Philippe Mathieu-Daudé <[email protected]>
Convert DPRINTF() to trace events and remove ifdef'ry.
Message-id: [email protected]
--- hw/display/dpcd.c | 16 +++------------- hw/display/trace-events | 4 ++++ 2 files changed, 7 insertions(+), 13 deletions(-)
hw/display/dpcd.c +3 -13
@@ -32,16 +32,7 @@#include "hw/misc/auxbus.h" #include "migration/vmstate.h" #include "hw/display/dpcd.h" - -#ifndef DEBUG_DPCD -#define DEBUG_DPCD 0 -#endif - -#define DPRINTF (fmt, ...) do { \ - if (DEBUG_DPCD) { \ - qemu_log("dpcd: " fmt, ## __VA_ARGS__); \ - } \ -} while (0) +#include "trace.h" #define DPCD_READABLE_AREA 0x600
@@ -70,8 +61,8 @@ static uint64_t dpcd_read(void *opaque, hwaddr offset, unsigned size) offset); ret =0 ; } +trace_dpcd_read (offset, ret); -DPRINTF ("read 0x%" PRIX8 " @0x%" HWADDR_PRIX "\n" , ret, offset);return ret; }
@@ -80,8 +71,7 @@ static void dpcd_write(void *opaque, hwaddr offset, uint64_t value, {DPCDState *e =DPCD (opaque); -DPRINTF ("write 0x%" PRIX8 " @0x%" HWADDR_PRIX "\n" , (uint8_t )value, offset); - +trace_dpcd_write (offset, value);if (offset <DPCD_READABLE_AREA ) { e->dpcd_info[offset] = value; }else {
hw/display/trace-events +4 -0
@@ -157,3 +157,7 @@ artist_draw_line(unsigned int start_x, unsigned int start_y, unsigned int end_x, # cg3.c cg3_read(uint32_t addr, uint32_t val, unsigned size) "read addr:0x%06"PRIx32" val:0x%08"PRIx32" size:%u" cg3_write(uint32_t addr, uint32_t val, unsigned size) "write addr:0x%06"PRIx32" val:0x%08"PRIx32" size:%u" + +# dpcd.c +dpcd_read(uint32_t addr, uint8_t val) "read addr:0x%"PRIx32" val:0x%02x" +dpcd_write(uint32_t addr, uint8_t val) "write addr:0x%"PRIx32" val:0x%02x"
Signature · 1 line
2.18.4
[PULL 13/21] hw/display/omap_dss: Replace fprintf() call by qemu_log_mask(LOG_UNIMP)
In reply to Gerd HoffmannFrom: Philippe Mathieu-Daudé <[email protected]>
Replace fprintf() call by qemu_log_mask(LOG_UNIMP), which is disabled by default. This avoid flooding the terminal when fuzzing the device.
Message-id: [email protected]
--- hw/display/omap_dss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/display/omap_dss.c +1 -1
@@ -619,7 +619,7 @@ static void omap_rfbi_transfer_start(struct omap_dss_s *s)if (s->rfbi.control & (1 <<1 )) {/* BYPASS */ /* TODO: in non-Bypass mode we probably need to just assert the * DRQ and wait for DMA to write the pixels. */ -fprintf (stderr,"%s: Bypass mode unimplemented\n" , __func__); +qemu_log_mask (LOG_UNIMP ,"%s: Bypass mode unimplemented\n" , __func__);return ; }
Signature · 1 line
2.18.4
[PULL 06/21] hw/display/cirrus_vga: Convert debug printf() to trace event
In reply to Gerd HoffmannFrom: Philippe Mathieu-Daudé <[email protected]>
Convert the final bit of DEBUG_BITBLT to a tracepoint.
Message-id: [email protected]
--- hw/display/cirrus_vga.c | 24 ++++++++++-------------- hw/display/trace-events | 1 + 2 files changed, 11 insertions(+), 14 deletions(-)
hw/display/cirrus_vga.c +10 -14
@@ -53,7 +53,6 @@*/ //#define DEBUG_CIRRUS -//#define DEBUG_BITBLT /*************************************** *
@@ -950,19 +949,16 @@ static void cirrus_bitblt_start(CirrusVGAState * s) s->cirrus_blt_dstaddr &= s->cirrus_addr_mask; s->cirrus_blt_srcaddr &= s->cirrus_addr_mask; -#ifdef DEBUG_BITBLT -printf ("rop=0x%02x mode=0x%02x modeext=0x%02x w=%d h=%d dpitch=%d spitch=%d daddr=0x%08x saddr=0x%08x writemask=0x%02x\n" , - blt_rop, - s->cirrus_blt_mode, - s->cirrus_blt_modeext, - s->cirrus_blt_width, - s->cirrus_blt_height, - s->cirrus_blt_dstpitch, - s->cirrus_blt_srcpitch, - s->cirrus_blt_dstaddr, - s->cirrus_blt_srcaddr, - s->vga.gr[0x2f ]); -#endif +trace_vga_cirrus_bitblt_start (blt_rop, + s->cirrus_blt_mode, + s->cirrus_blt_modeext, + s->cirrus_blt_width, + s->cirrus_blt_height, + s->cirrus_blt_dstpitch, + s->cirrus_blt_srcpitch, + s->cirrus_blt_dstaddr, + s->cirrus_blt_srcaddr, + s->vga.gr[0x2f ]);switch (s->cirrus_blt_mode &CIRRUS_BLTMODE_PIXELWIDTHMASK ) {case CIRRUS_BLTMODE_PIXELWIDTH8 :
hw/display/trace-events +1 -0
@@ -134,6 +134,7 @@ vga_cirrus_read_io(uint32_t addr, uint32_t val) "addr 0x%x, val 0x%x" vga_cirrus_write_io(uint32_t addr, uint32_t val) "addr 0x%x, val 0x%x" vga_cirrus_write_blt(uint32_t offset, uint32_t val) "offset 0x%x, val 0x%x" vga_cirrus_write_gr(uint8_t index, uint8_t val) "GR addr 0x%02x, val 0x%02x" +vga_cirrus_bitblt_start(uint8_t blt_rop, uint8_t blt_mode, uint8_t blt_modeext, int blt_width, int blt_height, int blt_dstpitch, int blt_srcpitch, uint32_t blt_dstaddr, uint32_t blt_srcaddr, uint8_t gr_val) "rop=0x%02x mode=0x%02x modeext=0x%02x w=%d h=%d dpitch=%d spitch=%d daddr=0x%08"PRIx32" saddr=0x%08"PRIx32" writemask=0x%02x" # sii9022.c sii9022_read_reg(uint8_t addr, uint8_t val) "addr 0x%02x, val 0x%02x"
Signature · 1 line
2.18.4
[PULL 02/21] hw/display/cg3: Convert debug printf()s to trace events
In reply to Gerd HoffmannFrom: Philippe Mathieu-Daudé <[email protected]>
Convert DPRINTF() to trace events and remove ifdef'ry.
Message-id: [email protected]
--- hw/display/cg3.c | 14 ++++---------- hw/display/trace-events | 4 ++++ 2 files changed, 8 insertions(+), 10 deletions(-)
hw/display/cg3.c +4 -10
@@ -35,6 +35,7 @@#include "hw/qdev-properties.h" #include "qemu/log.h" #include "qemu/module.h" +#include "trace.h" /* Change to 1 to enable debugging */ #define DEBUG_CG3 0
@@ -63,12 +64,6 @@#define CG3_VRAM_SIZE 0x100000#define CG3_VRAM_OFFSET 0x800000 -#define DPRINTF (fmt, ...) do { \ - if (DEBUG_CG3) { \ - printf("CG3: " fmt , ## __VA_ARGS__); \ - } \ -} while (0) -#define TYPE_CG3 "cgthree"#define CG3 (obj) OBJECT_CHECK(CG3State, (obj), TYPE_CG3)
@@ -195,7 +190,8 @@ static uint64_t cg3_reg_read(void *opaque, hwaddr addr, unsigned size) val =0 ;break ; } -DPRINTF ("read %02x from reg %" HWADDR_PRIx"\n" , val, addr); +trace_cg3_read (addr, val, size); +return val; }
@@ -206,9 +202,7 @@ static void cg3_reg_write(void *opaque, hwaddr addr, uint64_t val,uint8_t regval;int i; -DPRINTF ("write %" PRIx64" to reg %" HWADDR_PRIx" size %d\n" , - val, addr, size); - +trace_cg3_write (addr, val, size);switch (addr) {case CG3_REG_BT458_ADDR : s->dac_index = val;
hw/display/trace-events +4 -0
@@ -151,3 +151,7 @@ artist_vram_write(unsigned int size, uint64_t addr, uint64_t val) "%u 0x%"PRIx64 artist_fill_window(unsigned int start_x, unsigned int start_y, unsigned int width, unsigned int height, uint32_t op, uint32_t ctlpln) "start=%ux%u length=%ux%u op=0x%08x ctlpln=0x%08x" artist_block_move(unsigned int start_x, unsigned int start_y, unsigned int dest_x, unsigned int dest_y, unsigned int width, unsigned int height) "source %ux%u -> dest %ux%u size %ux%u" artist_draw_line(unsigned int start_x, unsigned int start_y, unsigned int end_x, unsigned int end_y) "%ux%u %ux%u" + +# cg3.c +cg3_read(uint32_t addr, uint32_t val, unsigned size) "read addr:0x%06"PRIx32" val:0x%08"PRIx32" size:%u" +cg3_write(uint32_t addr, uint32_t val, unsigned size) "write addr:0x%06"PRIx32" val:0x%08"PRIx32" size:%u"
Signature · 1 line
2.18.4
[PULL 19/21] sm501: Replace hand written implementation with pixman where possible
In reply to Gerd HoffmannFrom: BALATON Zoltan <[email protected]>
Besides being faster this should also prevent malicious guests to abuse 2D engine to overwrite data or cause a crash.
Message-id: 58666389b6cae256e4e972a32c05cf8aa51bffc0.1590089984.git.balaton@eik.bme.hu
--- hw/display/sm501.c | 205 ++++++++++++++++++++++++++------------------- 1 file changed, 118 insertions(+), 87 deletions(-)
hw/display/sm501.c +118 -87
@@ -706,13 +706,12 @@ static void sm501_2d_operation(SM501State *s)/* 1 if rop2 source is the pattern, otherwise the source is the bitmap */ int rop2_source_is_pattern = (s->twoD_control >>14 ) &0x1 ;int rop = s->twoD_control &0xFF ; -int dst_x = (s->twoD_destination >>16 ) &0x01FFF ; -int dst_y = s->twoD_destination &0xFFFF ; -int width = (s->twoD_dimension >>16 ) &0x1FFF ; -int height = s->twoD_dimension &0xFFFF ; +unsigned int dst_x = (s->twoD_destination >>16 ) &0x01FFF ; +unsigned int dst_y = s->twoD_destination &0xFFFF ; +unsigned int width = (s->twoD_dimension >>16 ) &0x1FFF ; +unsigned int height = s->twoD_dimension &0xFFFF ;uint32_t dst_base = s->twoD_destination_base &0x03FFFFFF ; -uint8_t *dst = s->local_mem + dst_base; -int dst_pitch = (s->twoD_pitch >>16 ) &0x1FFF ; +unsigned int dst_pitch = (s->twoD_pitch >>16 ) &0x1FFF ;int crt = (s->dc_crt_control &SM501_DC_CRT_CONTROL_SEL ) ?1 :0 ;int fb_len =get_width (s, crt) *get_height (s, crt) *get_bpp (s, crt);
@@ -721,104 +720,136 @@ static void sm501_2d_operation(SM501State *s)return ; } -if (rop_mode ==0 ) { -if (rop !=0xcc ) { -/* Anything other than plain copies are not supported */ -qemu_log_mask (LOG_UNIMP ,"sm501: rop3 mode with rop %x is not " -"supported.\n" , rop); - } - }else { -if (rop2_source_is_pattern && rop !=0x5 ) { -/* For pattern source, we support only inverse dest */ -qemu_log_mask (LOG_UNIMP ,"sm501: rop2 source being the pattern and " -"rop %x is not supported.\n" , rop); - }else { -if (rop !=0x5 && rop !=0xc ) { -/* Anything other than plain copies or inverse dest is not -* supported */ -qemu_log_mask (LOG_UNIMP ,"sm501: rop mode %x is not " -"supported.\n" , rop); - } - } - } -if (s->twoD_source_base &BIT (27 ) || s->twoD_destination_base &BIT (27 )) {qemu_log_mask (LOG_UNIMP ,"sm501: only local memory is supported.\n" );return ; } +if (!dst_pitch) { +qemu_log_mask (LOG_GUEST_ERROR ,"sm501: Zero dest pitch.\n" ); +return ; + } + +if (!width || !height) { +qemu_log_mask (LOG_GUEST_ERROR ,"sm501: Zero size 2D op.\n" ); +return ; + } + +if (rtl) { + dst_x -= width -1 ; + dst_y -= height -1 ; + } + +if (dst_base >=get_local_mem_size (s) || dst_base + + (dst_x + width + (dst_y + height) * (dst_pitch + width)) * + (1 << format) >=get_local_mem_size (s)) { +qemu_log_mask (LOG_GUEST_ERROR ,"sm501: 2D op dest is outside vram.\n" ); +return ; + } +switch (cmd) { -case 0x00 :/* copy area */ +case 0 :/* BitBlt */ { -int src_x = (s->twoD_source >>16 ) &0x01FFF ; -int src_y = s->twoD_source &0xFFFF ; +unsigned int src_x = (s->twoD_source >>16 ) &0x01FFF ; +unsigned int src_y = s->twoD_source &0xFFFF ;uint32_t src_base = s->twoD_source_base &0x03FFFFFF ; -uint8_t *src = s->local_mem + src_base; -int src_pitch = s->twoD_pitch &0x1FFF ; +unsigned int src_pitch = s->twoD_pitch &0x1FFF ; -#define COPY_AREA (_bpp, _pixel_type, rtl) { \ - int y, x, index_d, index_s; \ - for (y = 0; y < height; y++) { \ - for (x = 0; x < width; x++) { \ - _pixel_type val; \ - \ - if (rtl) { \ - index_s = ((src_y - y) * src_pitch + src_x - x) * _bpp; \ - index_d = ((dst_y - y) * dst_pitch + dst_x - x) * _bpp; \ - } else { \ - index_s = ((src_y + y) * src_pitch + src_x + x) * _bpp; \ - index_d = ((dst_y + y) * dst_pitch + dst_x + x) * _bpp; \ - } \ - if (rop_mode == 1 && rop == 5) { \ -/* Invert dest */ \ - val = ~*(_pixel_type *)&dst[index_d]; \ - } else { \ - val = *(_pixel_type *)&src[index_s]; \ - } \ - *(_pixel_type *)&dst[index_d] = val; \ - } \ - } \ - } -switch (format) { -case 0 : -COPY_AREA (1 , uint8_t, rtl); -break ; -case 1 : -COPY_AREA (2 , uint16_t, rtl); -break ; -case 2 : -COPY_AREA (4 , uint32_t, rtl); -break ; +if (!src_pitch) { +qemu_log_mask (LOG_GUEST_ERROR ,"sm501: Zero src pitch.\n" ); +return ; + } + +if (rtl) { + src_x -= width -1 ; + src_y -= height -1 ; + } + +if (src_base >=get_local_mem_size (s) || src_base + + (src_x + width + (src_y + height) * (src_pitch + width)) * + (1 << format) >=get_local_mem_size (s)) { +qemu_log_mask (LOG_GUEST_ERROR , +"sm501: 2D op src is outside vram.\n" ); +return ; + } + +if ((rop_mode && rop ==0x5 ) || (!rop_mode && rop ==0x55 )) { +/* Invert dest, is there a way to do this with pixman? */ +unsigned int x, y, i; +uint8_t *d = s->local_mem + dst_base; + +for (y =0 ; y < height; y++) { + i = (dst_x + (dst_y + y) * dst_pitch) * (1 << format); +for (x =0 ; x < width; x++, i += (1 << format)) { +switch (format) { +case 0 : + d[i] = ~d[i]; +break ; +case 1 : + *(uint16_t *)&d[i] = ~*(uint16_t *)&d[i]; +break ; +case 2 : + *(uint32_t *)&d[i] = ~*(uint32_t *)&d[i]; +break ; + } + } + } + }else { +/* Do copy src for unimplemented ops, better than unpainted area */ +if ((rop_mode && (rop !=0xc || rop2_source_is_pattern)) || + (!rop_mode && rop !=0xcc )) { +qemu_log_mask (LOG_UNIMP , +"sm501: rop%d op %x%s not implemented\n" , + (rop_mode ?2 :3 ), rop, + (rop2_source_is_pattern ? +" with pattern source" :"" )); + } +/* Check for overlaps, this could be made more exact */ +uint32_t sb, se, db, de; + sb = src_base + src_x + src_y * (width + src_pitch); + se = sb + width + height * (width + src_pitch); + db = dst_base + dst_x + dst_y * (width + dst_pitch); + de = db + width + height * (width + dst_pitch); +if (rtl && ((db >= sb && db <= se) || (de >= sb && de <= se))) { +/* regions may overlap: copy via temporary */ +int llb = width * (1 << format); +int tmp_stride =DIV_ROUND_UP (llb,sizeof (uint32_t )); +uint32_t *tmp =g_malloc (tmp_stride *sizeof (uint32_t ) * + height); +pixman_blt ((uint32_t *)&s->local_mem[src_base], tmp, + src_pitch * (1 << format) /sizeof (uint32_t ), + tmp_stride,8 * (1 << format),8 * (1 << format), + src_x, src_y,0 ,0 , width, height); +pixman_blt (tmp, (uint32_t *)&s->local_mem[dst_base], + tmp_stride, + dst_pitch * (1 << format) /sizeof (uint32_t ), +8 * (1 << format),8 * (1 << format), +0 ,0 , dst_x, dst_y, width, height); +g_free (tmp); + }else { +pixman_blt ((uint32_t *)&s->local_mem[src_base], + (uint32_t *)&s->local_mem[dst_base], + src_pitch * (1 << format) /sizeof (uint32_t ), + dst_pitch * (1 << format) /sizeof (uint32_t ), +8 * (1 << format),8 * (1 << format), + src_x, src_y, dst_x, dst_y, width, height); + } }break ; } -case 0x01 :/* fill rectangle */ +case 1 :/* Rectangle Fill */ {uint32_t color = s->twoD_foreground; -#define FILL_RECT (_bpp, _pixel_type) { \ - int y, x; \ - for (y = 0; y < height; y++) { \ - for (x = 0; x < width; x++) { \ - int index = ((dst_y + y) * dst_pitch + dst_x + x) * _bpp; \ - *(_pixel_type *)&dst[index] = (_pixel_type)color; \ - } \ - } \ - } - -switch (format) { -case 0 : -FILL_RECT (1 , uint8_t); -break ; -case 1 : - color =cpu_to_le16 (color); -FILL_RECT (2 , uint16_t); -break ; -case 2 : +if (format ==2 ) { color =cpu_to_le32 (color); -FILL_RECT (4 , uint32_t); -break ; + }else if (format ==1 ) { + color =cpu_to_le16 (color); } + +pixman_fill ((uint32_t *)&s->local_mem[dst_base], + dst_pitch * (1 << format) /sizeof (uint32_t ), +8 * (1 << format), dst_x, dst_y, width, height, color);break ; }default :
Signature · 1 line
2.18.4
[PULL 15/21] sm501: Convert printf + abort to qemu_log_mask
In reply to Gerd HoffmannFrom: BALATON Zoltan <[email protected]>
Some places already use qemu_log_mask() to log unimplemented features or errors but some others have printf() then abort(). Convert these to qemu_log_mask() and avoid aborting to prevent guests to easily cause denial of service.
Message-id: 305af87f59d81e92f2aaff09eb8a3603b8baa322.1590089984.git.balaton@eik.bme.hu
--- hw/display/sm501.c | 57 ++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 30 deletions(-)
hw/display/sm501.c +27 -30
@@ -727,8 +727,8 @@ static void sm501_2d_operation(SM501State *s)int fb_len =get_width (s, crt) *get_height (s, crt) *get_bpp (s, crt);if (addressing !=0x0 ) { -printf ("%s: only XY addressing is supported.\n" , __func__); -abort (); +qemu_log_mask (LOG_UNIMP ,"sm501: only XY addressing is supported.\n" ); +return ; }if (rop_mode ==0 ) {
@@ -754,8 +754,8 @@ static void sm501_2d_operation(SM501State *s)if ((s->twoD_source_base &0x08000000 ) || (s->twoD_destination_base &0x08000000 )) { -printf ("%s: only local memory is supported.\n" , __func__); -abort (); +qemu_log_mask (LOG_UNIMP ,"sm501: only local memory is supported.\n" ); +return ; }switch (operation) {
@@ -823,9 +823,9 @@ static void sm501_2d_operation(SM501State *s)break ;default : -printf ("non-implemented SM501 2D operation. %d\n" , operation); -abort (); -break ; +qemu_log_mask (LOG_UNIMP ,"sm501: not implemented 2D operation: %d\n" , + operation); +return ; } if (dst_base >= get_fb_addr(s, crt) &&
@@ -892,9 +892,8 @@ static uint64_t sm501_system_config_read(void *opaque, hwaddr addr,break ;default : -printf ("sm501 system config : not implemented register read." -" addr=%x\n" , (int )addr); -abort (); +qemu_log_mask (LOG_UNIMP ,"sm501: not implemented system config" +"register read. addr=%" HWADDR_PRIx"\n" , addr); }return ret;
@@ -948,15 +947,15 @@ static void sm501_system_config_write(void *opaque, hwaddr addr,break ;case SM501_ENDIAN_CONTROL :if (value &0x00000001 ) { -printf ("sm501 system config : big endian mode not implemented.\n" ); -abort (); +qemu_log_mask (LOG_UNIMP ,"sm501: system config big endian mode not" +" implemented.\n" ); }break ;default : -printf ("sm501 system config : not implemented register write." -" addr=%x, val=%x\n" , (int )addr, (uint32_t )value); -abort (); +qemu_log_mask (LOG_UNIMP ,"sm501: not implemented system config" +"register write. addr=%" HWADDR_PRIx +", val=%" PRIx64"\n" , addr, value); } }
@@ -1207,9 +1206,8 @@ static uint64_t sm501_disp_ctrl_read(void *opaque, hwaddr addr,break ;default : -printf ("sm501 disp ctrl : not implemented register read." -" addr=%x\n" , (int )addr); -abort (); +qemu_log_mask (LOG_UNIMP ,"sm501: not implemented disp ctrl register " +"read. addr=%" HWADDR_PRIx"\n" , addr); }return ret;
@@ -1345,9 +1343,9 @@ static void sm501_disp_ctrl_write(void *opaque, hwaddr addr,break ;default : -printf ("sm501 disp ctrl : not implemented register write." -" addr=%x, val=%x\n" , (int )addr, (unsigned )value); -abort (); +qemu_log_mask (LOG_UNIMP ,"sm501: not implemented disp ctrl register " +"write. addr=%" HWADDR_PRIx +", val=%" PRIx64"\n" , addr, value); } }
@@ -1433,9 +1431,8 @@ static uint64_t sm501_2d_engine_read(void *opaque, hwaddr addr, ret =0 ;/* Should return interrupt status */ break ;default : -printf ("sm501 disp ctrl : not implemented register read." -" addr=%x\n" , (int )addr); -abort (); +qemu_log_mask (LOG_UNIMP ,"sm501: not implemented disp ctrl register " +"read. addr=%" HWADDR_PRIx"\n" , addr); }return ret;
@@ -1520,9 +1517,9 @@ static void sm501_2d_engine_write(void *opaque, hwaddr addr,/* ignored, writing 0 should clear interrupt status */ break ;default : -printf ("sm501 2d engine : not implemented register write." -" addr=%x, val=%x\n" , (int )addr, (unsigned )value); -abort (); +qemu_log_mask (LOG_UNIMP ,"sm501: not implemented 2d engine register " +"write. addr=%" HWADDR_PRIx +", val=%" PRIx64"\n" , addr, value); } }
@@ -1670,9 +1667,9 @@ static void sm501_update_display(void *opaque) draw_line = draw_line32_funcs[dst_depth_index];break ;default : -printf ("sm501 update display : invalid control register value.\n" ); -abort (); -break ; +qemu_log_mask (LOG_GUEST_ERROR ,"sm501: update display" +"invalid control register value.\n" ); +return ; }/* set up to draw hardware cursor */
Signature · 1 line
2.18.4
[PULL 12/21] hw/display/exynos4210_fimd: Use qemu_log_mask(GUEST_ERROR)
In reply to Gerd HoffmannFrom: Philippe Mathieu-Daudé <[email protected]>
Replace DPRINT_ERROR() by qemu_log_mask(GUEST_ERROR).
Message-id: [email protected]
--- hw/display/exynos4210_fimd.c | 46 +++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 17 deletions(-)
hw/display/exynos4210_fimd.c +29 -17
@@ -31,6 +31,7 @@#include "ui/pixel_ops.h" #include "qemu/bswap.h" #include "qemu/module.h" +#include "qemu/log.h" /* Debug messages configuration */ #define EXYNOS4210_FIMD_DEBUG 0
@@ -39,20 +40,15 @@#if EXYNOS4210_FIMD_DEBUG ==0 #define DPRINT_L1(fmt, args...) do { } while (0) #define DPRINT_L2(fmt, args...) do { } while (0) - #define DPRINT_ERROR(fmt, args...) do { } while (0)#elif EXYNOS4210_FIMD_DEBUG ==1 #define DPRINT_L1(fmt, args...) \ do {fprintf(stderr, "QEMU FIMD: "fmt, ## args); } while (0) #define DPRINT_L2(fmt, args...) do { } while (0) - #define DPRINT_ERROR(fmt, args...) \ - do {fprintf(stderr, "QEMU FIMD ERROR: "fmt, ## args); } while (0)#else #define DPRINT_L1(fmt, args...) \ do {fprintf(stderr, "QEMU FIMD: "fmt, ## args); } while (0) #define DPRINT_L2(fmt, args...) \ do {fprintf(stderr, "QEMU FIMD: "fmt, ## args); } while (0) - #define DPRINT_ERROR(fmt, args...) \ - do {fprintf(stderr, "QEMU FIMD ERROR: "fmt, ## args); } while (0)#endif #if EXYNOS4210_FIMD_MODE_TRACE ==0
@@ -1108,7 +1104,7 @@ static inline int fimd_get_buffer_id(Exynos4210fimdWindow *w)case FIMD_WINCON_BUF2_STAT :return 2 ;default : -DPRINT_ERROR ("Non-existent buffer index\n" ); +qemu_log_mask (LOG_GUEST_ERROR ,"FIMD: Non-existent buffer index\n" );return 0 ; } }
@@ -1160,20 +1156,24 @@ static void fimd_update_memory_section(Exynos4210fimdState *s, unsigned win)if (int128_get64 (w->mem_section.size) != w->fb_len || !memory_region_is_ram (w->mem_section.mr)) { -DPRINT_ERROR ("Failed to find window %u framebuffer region\n" , win); +qemu_log_mask (LOG_GUEST_ERROR , +"FIMD: Failed to find window %u framebuffer region\n" , + win); goto error_return; } w->host_fb_addr =cpu_physical_memory_map (fb_start_addr, &fb_mapped_len, false);if (!w->host_fb_addr) { -DPRINT_ERROR ("Failed to map window %u framebuffer\n" , win); +qemu_log_mask (LOG_GUEST_ERROR , +"FIMD: Failed to map window %u framebuffer\n" , win); goto error_return; }if (fb_mapped_len != w->fb_len) { -DPRINT_ERROR ("Window %u mapped framebuffer length is less then " -"expected\n" , win); +qemu_log_mask (LOG_GUEST_ERROR , +"FIMD: Window %u mapped framebuffer length is less than " +"expected\n" , win);cpu_physical_memory_unmap (w->host_fb_addr, fb_mapped_len,0 ,0 ); goto error_return; }
@@ -1490,7 +1490,9 @@ static void exynos4210_fimd_write(void *opaque, hwaddr offset,break ;case 3 :if (w !=1 && w !=2 ) { -DPRINT_ERROR ("Bad write offset 0x%08x\n" , offset); +qemu_log_mask (LOG_GUEST_ERROR , +"FIMD: Bad write offset 0x%08" HWADDR_PRIx"\n" , + offset);return ; } s->window[w].osdsize = val;
@@ -1624,7 +1626,9 @@ static void exynos4210_fimd_write(void *opaque, hwaddr offset,break ; case FIMD_VIDW0ADD0_B2 ... FIMD_VIDW4ADD0_B2:if (offset &0x0004 ) { -DPRINT_ERROR ("bad write offset 0x%08x\n" , offset); +qemu_log_mask (LOG_GUEST_ERROR , +"FIMD: bad write offset 0x%08" HWADDR_PRIx"\n" , + offset);break ; } w = (offset -FIMD_VIDW0ADD0_B2 ) >>3 ;
@@ -1638,14 +1642,18 @@ static void exynos4210_fimd_write(void *opaque, hwaddr offset,break ; case FIMD_SHD_ADD0_START ... FIMD_SHD_ADD0_END:if (offset &0x0004 ) { -DPRINT_ERROR ("bad write offset 0x%08x\n" , offset); +qemu_log_mask (LOG_GUEST_ERROR , +"FIMD: bad write offset 0x%08" HWADDR_PRIx"\n" , + offset);break ; } s->window[(offset -FIMD_SHD_ADD0_START ) >>3 ].shadow_buf_start = val;break ; case FIMD_SHD_ADD1_START ... FIMD_SHD_ADD1_END:if (offset &0x0004 ) { -DPRINT_ERROR ("bad write offset 0x%08x\n" , offset); +qemu_log_mask (LOG_GUEST_ERROR , +"FIMD: bad write offset 0x%08" HWADDR_PRIx"\n" , + offset);break ; } s->window[(offset -FIMD_SHD_ADD1_START ) >>3 ].shadow_buf_end = val;
@@ -1665,7 +1673,8 @@ static void exynos4210_fimd_write(void *opaque, hwaddr offset, s->window[w].palette[i] = val;break ;default : -DPRINT_ERROR ("bad write offset 0x%08x\n" , offset); +qemu_log_mask (LOG_GUEST_ERROR , +"FIMD: bad write offset 0x%08" HWADDR_PRIx"\n" , offset);break ; } }
@@ -1715,7 +1724,9 @@ static uint64_t exynos4210_fimd_read(void *opaque, hwaddr offset,break ;case 3 :if (w !=1 && w !=2 ) { -DPRINT_ERROR ("bad read offset 0x%08x\n" , offset); +qemu_log_mask (LOG_GUEST_ERROR , +"FIMD: bad read offset 0x%08" HWADDR_PRIx"\n" , + offset);return 0xBAADBAAD ; } ret = s->window[w].osdsize;
@@ -1809,7 +1820,8 @@ static uint64_t exynos4210_fimd_read(void *opaque, hwaddr offset,return s->window[w].palette[i]; } -DPRINT_ERROR ("bad read offset 0x%08x\n" , offset); +qemu_log_mask (LOG_GUEST_ERROR , +"FIMD: bad read offset 0x%08" HWADDR_PRIx"\n" , offset);return 0xBAADBAAD ; }
Signature · 1 line
2.18.4
[PULL 17/21] sm501: Use BIT(x) macro to shorten constant
In reply to Gerd HoffmannFrom: BALATON Zoltan <[email protected]>
Message-id: 124bf5de8d7cf503b32b377d0445029a76bfbd49.1590089984.git.balaton@eik.bme.hu
--- hw/display/sm501.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
hw/display/sm501.c +2 -3
@@ -701,7 +701,7 @@ static void sm501_2d_operation(SM501State *s) {/* obtain operation parameters */ int cmd = (s->twoD_control >>16 ) &0x1F ; -int rtl = s->twoD_control &0x8000000 ; +int rtl = s->twoD_control &BIT (27 );int src_x = (s->twoD_source >>16 ) &0x01FFF ;int src_y = s->twoD_source &0xFFFF ;int dst_x = (s->twoD_destination >>16 ) &0x01FFF ;
@@ -751,8 +751,7 @@ static void sm501_2d_operation(SM501State *s) } } -if ((s->twoD_source_base &0x08000000 ) || - (s->twoD_destination_base &0x08000000 )) { +if (s->twoD_source_base &BIT (27 ) || s->twoD_destination_base &BIT (27 )) {qemu_log_mask (LOG_UNIMP ,"sm501: only local memory is supported.\n" );return ; }
Signature · 1 line
2.18.4
[PULL 16/21] sm501: Shorten long variable names in sm501_2d_operation
In reply to Gerd HoffmannFrom: BALATON Zoltan <[email protected]>
This increases readability and cleans up some confusing naming.
Message-id: b9b67b94c46e945252a73c77dfd117132c63c4fb.1590089984.git.balaton@eik.bme.hu
--- hw/display/sm501.c | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-)
hw/display/sm501.c +22 -23
@@ -700,17 +700,16 @@ static inline void hwc_invalidate(SM501State *s, int crt)static void sm501_2d_operation (SM501State *s) {/* obtain operation parameters */ -int operation = (s->twoD_control >>16 ) &0x1f ; +int cmd = (s->twoD_control >>16 ) &0x1F ;int rtl = s->twoD_control &0x8000000 ;int src_x = (s->twoD_source >>16 ) &0x01FFF ;int src_y = s->twoD_source &0xFFFF ;int dst_x = (s->twoD_destination >>16 ) &0x01FFF ;int dst_y = s->twoD_destination &0xFFFF ; -int operation_width = (s->twoD_dimension >>16 ) &0x1FFF ; -int operation_height = s->twoD_dimension &0xFFFF ; +int width = (s->twoD_dimension >>16 ) &0x1FFF ; +int height = s->twoD_dimension &0xFFFF ;uint32_t color = s->twoD_foreground; -int format_flags = (s->twoD_stretch >>20 ) &0x3 ; -int addressing = (s->twoD_stretch >>16 ) &0xF ; +int format = (s->twoD_stretch >>20 ) &0x3 ;int rop_mode = (s->twoD_control >>15 ) &0x1 ;/* 1 for rop2, else rop3 */ /* 1 if rop2 source is the pattern, otherwise the source is the bitmap */ int rop2_source_is_pattern = (s->twoD_control >>14 ) &0x1 ;
@@ -721,12 +720,12 @@ static void sm501_2d_operation(SM501State *s)/* get frame buffer info */ uint8_t *src = s->local_mem + src_base;uint8_t *dst = s->local_mem + dst_base; -int src_width = s->twoD_pitch &0x1FFF ; -int dst_width = (s->twoD_pitch >>16 ) &0x1FFF ; +int src_pitch = s->twoD_pitch &0x1FFF ; +int dst_pitch = (s->twoD_pitch >>16 ) &0x1FFF ;int crt = (s->dc_crt_control &SM501_DC_CRT_CONTROL_SEL ) ?1 :0 ;int fb_len =get_width (s, crt) *get_height (s, crt) *get_bpp (s, crt); -if (addressing !=0x0 ) { +if ((s->twoD_stretch >>16 ) &0xF ) {qemu_log_mask (LOG_UNIMP ,"sm501: only XY addressing is supported.\n" );return ; }
@@ -758,20 +757,20 @@ static void sm501_2d_operation(SM501State *s)return ; } -switch (operation) { +switch (cmd) {case 0x00 :/* copy area */ #define COPY_AREA (_bpp, _pixel_type, rtl) { \ int y, x, index_d, index_s; \ - for (y = 0; y < operation_height; y++) { \ - for (x = 0; x < operation_width; x++) { \ + for (y = 0; y < height; y++) { \ + for (x = 0; x < width; x++) { \ _pixel_type val; \ \ if (rtl) { \ - index_s = ((src_y - y) * src_width + src_x - x) * _bpp; \ - index_d = ((dst_y - y) * dst_width + dst_x - x) * _bpp; \ + index_s = ((src_y - y) * src_pitch + src_x - x) * _bpp; \ + index_d = ((dst_y - y) * dst_pitch + dst_x - x) * _bpp; \ } else { \ - index_s = ((src_y + y) * src_width + src_x + x) * _bpp; \ - index_d = ((dst_y + y) * dst_width + dst_x + x) * _bpp; \ + index_s = ((src_y + y) * src_pitch + src_x + x) * _bpp; \ + index_d = ((dst_y + y) * dst_pitch + dst_x + x) * _bpp; \ } \ if (rop_mode == 1 && rop == 5) { \/* Invert dest */ \
@@ -783,7 +782,7 @@ static void sm501_2d_operation(SM501State *s) } \ } \ } -switch (format_flags) { +switch (format) {case 0 :COPY_AREA (1 , uint8_t, rtl);break ;
@@ -799,15 +798,15 @@ static void sm501_2d_operation(SM501State *s)case 0x01 :/* fill rectangle */ #define FILL_RECT (_bpp, _pixel_type) { \ int y, x; \ - for (y = 0; y < operation_height; y++) { \ - for (x = 0; x < operation_width; x++) { \ - int index = ((dst_y + y) * dst_width + dst_x + x) * _bpp; \ + for (y = 0; y < height; y++) { \ + for (x = 0; x < width; x++) { \ + int index = ((dst_y + y) * dst_pitch + dst_x + x) * _bpp; \ *(_pixel_type *)&dst[index] = (_pixel_type)color; \ } \ } \ } -switch (format_flags) { +switch (format) {case 0 :FILL_RECT (1 , uint8_t);break ;
@@ -824,14 +823,14 @@ static void sm501_2d_operation(SM501State *s)default :qemu_log_mask (LOG_UNIMP ,"sm501: not implemented 2D operation: %d\n" , - operation); + cmd);return ; }if (dst_base >=get_fb_addr (s, crt) && dst_base <=get_fb_addr (s, crt) + fb_len) { -int dst_len =MIN (fb_len, ((dst_y + operation_height -1 ) * dst_width + - dst_x + operation_width) * (1 << format_flags)); +int dst_len =MIN (fb_len, ((dst_y + height -1 ) * dst_pitch + + dst_x + width) * (1 << format));if (dst_len) {memory_region_set_dirty (&s->local_mem_region, dst_base, dst_len); }
Signature · 1 line
2.18.4
[PULL 07/21] hw/display/dpcd: Fix memory region size
In reply to Gerd HoffmannFrom: Philippe Mathieu-Daudé <[email protected]>
The memory region size is 512K.
Message-id: [email protected]
--- hw/display/dpcd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/display/dpcd.c +2 -2
@@ -1,5 +1,5 @@/* -* dpcd.c +* Xilinx Display Port Control Data * * Copyright (C) 2015 : GreenSocs Ltd * http://www.greensocs.com/ , email: [email protected]
@@ -137,7 +137,7 @@ static void dpcd_init(Object *obj) {DPCDState *s =DPCD (obj); -memory_region_init_io (&s->iomem, obj, &aux_ops, s,TYPE_DPCD ,0x7FFFF ); +memory_region_init_io (&s->iomem, obj, &aux_ops, s,TYPE_DPCD ,0x80000 );aux_init_mmio (AUX_SLAVE (obj), &s->iomem); }
Signature · 1 line
2.18.4
[PULL 21/21] sm501: Remove obsolete changelog and todo comment
In reply to Gerd HoffmannFrom: BALATON Zoltan <[email protected]>
Also update copyright year for latest changes
Message-id: 1392cad2ad1315a5a50409970e0af061821462e6.1590089984.git.balaton@eik.bme.hu
--- hw/display/sm501.c | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-)
hw/display/sm501.c +1 -18
@@ -2,7 +2,7 @@* QEMU SM501 Device * * Copyright (c) 2008 Shin-ichiro KAWASAKI -* Copyright (c) 2016 BALATON Zoltan +* Copyright (c) 2016-2020 BALATON Zoltan * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal
@@ -40,23 +40,6 @@#include "ui/pixel_ops.h" #include "qemu/bswap.h" -/* -* Status: 2010/05/07 -* - Minimum implementation for Linux console : mmio regs and CRT layer. -* - 2D graphics acceleration partially supported : only fill rectangle. -* -* Status: 2016/12/04 -* - Misc fixes: endianness, hardware cursor -* - Panel support -* -* TODO: -* - Touch panel support -* - USB support -* - UART support -* - More 2D graphics engine support -* - Performance tuning -*/ -/*#define DEBUG_SM501*/ /*#define DEBUG_BITBLT*/
Signature · 1 line
2.18.4
[PULL 14/21] hw/display/pxa2xx_lcd: Replace printf() call by qemu_log_mask()
In reply to Gerd HoffmannFrom: Philippe Mathieu-Daudé <[email protected]>
Replace printf() calls by qemu_log_mask(UNIMP), which is disabled by default. This avoid flooding the terminal when fuzzing the device.
Message-id: [email protected]
--- hw/display/pxa2xx_lcd.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-)
hw/display/pxa2xx_lcd.c +14 -12
@@ -426,9 +426,10 @@ static void pxa2xx_lcdc_write(void *opaque, hwaddr offset,if ((s->control[0 ] &LCCR0_ENB ) && !(value &LCCR0_ENB )) s->status[0 ] |=LCSR0_QD ; -if (!(s->control[0 ] &LCCR0_LCDT ) && (value &LCCR0_LCDT )) -printf ("%s: internal frame buffer unsupported\n" , __func__); - +if (!(s->control[0 ] &LCCR0_LCDT ) && (value &LCCR0_LCDT )) { +qemu_log_mask (LOG_UNIMP , +"%s: internal frame buffer unsupported\n" , __func__); + }if ((s->control[3 ] &LCCR3_API ) && (value &LCCR0_ENB ) && !(value &LCCR0_LCDT )) s->status[0 ] |=LCSR0_ABC ;
@@ -462,9 +463,9 @@ static void pxa2xx_lcdc_write(void *opaque, hwaddr offset,break ;case OVL1C1 : -if (!(s->ovl1c[0 ] &OVLC1_EN ) && (value &OVLC1_EN )) -printf ("%s: Overlay 1 not supported\n" , __func__); - +if (!(s->ovl1c[0 ] &OVLC1_EN ) && (value &OVLC1_EN )) { +qemu_log_mask (LOG_UNIMP ,"%s: Overlay 1 not supported\n" , __func__); + } s->ovl1c[0 ] = value &0x80ffffff ; s->dma_ch[1 ].up = (value &OVLC1_EN ) || (s->control[0 ] &LCCR0_SDS );break ;
@@ -474,9 +475,9 @@ static void pxa2xx_lcdc_write(void *opaque, hwaddr offset,break ;case OVL2C1 : -if (!(s->ovl2c[0 ] &OVLC1_EN ) && (value &OVLC1_EN )) -printf ("%s: Overlay 2 not supported\n" , __func__); - +if (!(s->ovl2c[0 ] &OVLC1_EN ) && (value &OVLC1_EN )) { +qemu_log_mask (LOG_UNIMP ,"%s: Overlay 2 not supported\n" , __func__); + } s->ovl2c[0 ] = value &0x80ffffff ; s->dma_ch[2 ].up = !!(value &OVLC1_EN ); s->dma_ch[3 ].up = !!(value &OVLC1_EN );
@@ -488,9 +489,10 @@ static void pxa2xx_lcdc_write(void *opaque, hwaddr offset,break ;case CCR : -if (!(s->ccr &CCR_CEN ) && (value &CCR_CEN )) -printf ("%s: Hardware cursor unimplemented\n" , __func__); - +if (!(s->ccr &CCR_CEN ) && (value &CCR_CEN )) { +qemu_log_mask (LOG_UNIMP , +"%s: Hardware cursor unimplemented\n" , __func__); + } s->ccr = value &0x81ffffe7 ; s->dma_ch[5 ].up = !!(value &CCR_CEN );break ;
Signature · 1 line
2.18.4
[PULL 09/21] hw/display/xlnx_dp: Replace disabled DPRINTF() by error_report()
In reply to Gerd HoffmannFrom: Philippe Mathieu-Daudé <[email protected]>
DPRINTF() calls are disabled by default, so when unexpected data is used, the whole process abort without information.
Display a bit of information with error_report() before crashing.
Message-id: [email protected]
--- hw/display/xlnx_dp.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
hw/display/xlnx_dp.c +8 -6
@@ -1,5 +1,5 @@/* -* xlnx_dp.c +* Xilinx Display Port * * Copyright (C) 2015 : GreenSocs Ltd * http://www.greensocs.com/ , email: [email protected]
@@ -24,6 +24,7 @@#include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu/error-report.h" #include "qemu/log.h" #include "qemu/module.h" #include "hw/display/xlnx_dp.h"
@@ -465,7 +466,7 @@ static uint8_t xlnx_dp_aux_pop_tx_fifo(XlnxDPState *s)uint8_t ret;if (fifo8_is_empty (&s->tx_fifo)) { -DPRINTF ("tx_fifo underflow..\n" ); +error_report ("%s: TX_FIFO underflow" , __func__);abort (); } ret =fifo8_pop (&s->tx_fifo);
@@ -525,6 +526,7 @@ static void xlnx_dp_aux_set_command(XlnxDPState *s, uint32_t value)qemu_log_mask (LOG_UNIMP ,"xlnx_dp: Write i2c status not implemented\n" );break ;default : +error_report ("%s: invalid command: %u" , __func__, cmd);abort (); }
@@ -631,8 +633,8 @@ static void xlnx_dp_change_graphic_fmt(XlnxDPState *s) s->g_plane.format = PIXMAN_b8g8r8;break ;default : -DPRINTF ("error: unsupported graphic format %u.\n" , - s->avbufm_registers[AV_BUF_FORMAT ] &DP_GRAPHIC_MASK ); +error_report ("%s: unsupported graphic format %u" , __func__, + s->avbufm_registers[AV_BUF_FORMAT ] &DP_GRAPHIC_MASK );abort (); }
@@ -647,8 +649,8 @@ static void xlnx_dp_change_graphic_fmt(XlnxDPState *s) s->v_plane.format = PIXMAN_x8b8g8r8;break ;default : -DPRINTF ("error: unsupported video format %u.\n" , - s->avbufm_registers[AV_BUF_FORMAT ] &DP_NL_VID_FMT_MASK ); +error_report ("%s: unsupported video format %u" , __func__, + s->avbufm_registers[AV_BUF_FORMAT ] &DP_NL_VID_FMT_MASK );abort (); }
Signature · 1 line
2.18.4
[PULL 11/21] hw/display/vmware_vga: Let the PCI device own its I/O MemoryRegion
In reply to Gerd HoffmannFrom: Philippe Mathieu-Daudé <[email protected]>
To avoid the orphan I/O memory region being added in the /unattached QOM container, register the PCI device as its owner.
Message-id: [email protected]
--- hw/display/vmware_vga.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/display/vmware_vga.c +1 -1
@@ -1306,7 +1306,7 @@ static void pci_vmsvga_realize(PCIDevice *dev, Error **errp) dev->config[PCI_LATENCY_TIMER ] =0x40 ; dev->config[PCI_INTERRUPT_LINE ] =0xff ;/* End */ -memory_region_init_io (&s->io_bar,NULL , &vmsvga_io_ops, &s->chip, +memory_region_init_io (&s->io_bar,OBJECT (dev), &vmsvga_io_ops, &s->chip,"vmsvga-io" ,0x10 );memory_region_set_flush_coalesced (&s->io_bar);pci_register_bar (dev,0 ,PCI_BASE_ADDRESS_SPACE_IO , &s->io_bar);
Signature · 1 line
2.18.4
[PULL 10/21] hw/display/vmware_vga: Replace printf() calls by qemu_log_mask(ERROR)
In reply to Gerd HoffmannFrom: Philippe Mathieu-Daudé <[email protected]>
Avoid flooding stdio by converting printf() calls to qemu_log_mask(GUEST_ERROR), which are disabled by default.
Message-id: [email protected]
--- hw/display/vmware_vga.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
hw/display/vmware_vga.c +11 -5
@@ -26,6 +26,7 @@#include "qemu/module.h" #include "qemu/units.h" #include "qapi/error.h" +#include "qemu/log.h" #include "hw/loader.h" #include "trace.h" #include "ui/vnc.h"
@@ -953,7 +954,8 @@ static uint32_t vmsvga_value_read(void *opaque, uint32_t address) ret = s->scratch[s->index -SVGA_SCRATCH_BASE ];break ; } -printf ("%s: Bad register %02x\n" , __func__, s->index); +qemu_log_mask (LOG_GUEST_ERROR , +"%s: Bad register %02x\n" , __func__, s->index); ret =0 ;break ; }
@@ -1002,7 +1004,8 @@ static void vmsvga_value_write(void *opaque, uint32_t address, uint32_t value) s->new_width = value; s->invalidated =1 ; }else { -printf ("%s: Bad width: %i\n" , __func__, value); +qemu_log_mask (LOG_GUEST_ERROR , +"%s: Bad width: %i\n" , __func__, value); }break ;
@@ -1011,13 +1014,15 @@ static void vmsvga_value_write(void *opaque, uint32_t address, uint32_t value) s->new_height = value; s->invalidated =1 ; }else { -printf ("%s: Bad height: %i\n" , __func__, value); +qemu_log_mask (LOG_GUEST_ERROR , +"%s: Bad height: %i\n" , __func__, value); }break ;case SVGA_REG_BITS_PER_PIXEL :if (value !=32 ) { -printf ("%s: Bad bits per pixel: %i bits\n" , __func__, value); +qemu_log_mask (LOG_GUEST_ERROR , +"%s: Bad bits per pixel: %i bits\n" , __func__, value); s->config =0 ; s->invalidated =1 ; }
@@ -1082,7 +1087,8 @@ static void vmsvga_value_write(void *opaque, uint32_t address, uint32_t value) s->scratch[s->index -SVGA_SCRATCH_BASE ] = value;break ; } -printf ("%s: Bad register %02x\n" , __func__, s->index); +qemu_log_mask (LOG_GUEST_ERROR , +"%s: Bad register %02x\n" , __func__, s->index); } }
Signature · 1 line
2.18.4
[PULL 01/21] hw/display/edid: Add missing 'qdev-properties.h' header
In reply to Gerd HoffmannFrom: Philippe Mathieu-Daudé <[email protected]>
When trying to consume the DEFINE_EDID_PROPERTIES() macro by including "hw/display/edid.h", we get this build failure:
include/hw/display/edid.h:24:5: error: implicit declaration of
function ‘DEFINE_PROP_UINT32’ [-Werror=implicit-function-declaration]
24 | DEFINE_PROP_UINT32("xres", _state, _edid_info.prefx, 0), \
| ^~~~~~~~~~~~~~~~~~Headers should be self-contained, and one shouldn't have to dig to find the missing headers.
In this case "hw/qdev-properties.h" is missing. Add it.
Message-id: [email protected]
--- include/hw/display/edid.h | 1 + 1 file changed, 1 insertion(+)
include/hw/display/edid.h +1 -0
@@ -2,6 +2,7 @@#define EDID_H #include "qom/object.h" +#include "hw/qdev-properties.h" typedef struct qemu_edid_info { const char *vendor; /* http://www.uefi.org/pnp_id_list */
Signature · 1 line
2.18.4
[PULL 05/21] hw/display/cirrus_vga: Use qemu_log_mask(ERROR) instead of debug printf
In reply to Gerd HoffmannFrom: Philippe Mathieu-Daudé <[email protected]>
Replace some debug printf() calls by qemu_log_mask(LOG_GUEST_ERROR).
Message-id: [email protected]
--- hw/display/cirrus_vga.c | 77 ++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 44 deletions(-)
hw/display/cirrus_vga.c +33 -44
@@ -978,9 +978,8 @@ static void cirrus_bitblt_start(CirrusVGAState * s) s->cirrus_blt_pixelwidth =4 ;break ;default : -#ifdef DEBUG_BITBLT -printf ("cirrus: bitblt - pixel width is unknown\n" ); -#endif +qemu_log_mask (LOG_GUEST_ERROR , +"cirrus: bitblt - pixel width is unknown\n" ); goto bitblt_ignore; } s->cirrus_blt_mode &= ~CIRRUS_BLTMODE_PIXELWIDTHMASK ;
@@ -1037,7 +1036,9 @@ static void cirrus_bitblt_start(CirrusVGAState * s) }else {if (s->cirrus_blt_mode &CIRRUS_BLTMODE_TRANSPARENTCOMP ) {if (s->cirrus_blt_pixelwidth >2 ) { -printf ("src transparent without colorexpand must be 8bpp or 16bpp\n" ); +qemu_log_mask (LOG_GUEST_ERROR , +"cirrus: src transparent without colorexpand " +"must be 8bpp or 16bpp\n" ); goto bitblt_ignore; }if (s->cirrus_blt_mode &CIRRUS_BLTMODE_BACKWARDS ) {
@@ -1135,10 +1136,9 @@ static uint32_t cirrus_get_bpp16_depth(CirrusVGAState * s) ret =16 ;break ;/* XGA HiColor */ default : -#ifdef DEBUG_CIRRUS -printf ("cirrus: invalid DAC value %x in 16bpp\n" , - (s->cirrus_hidden_dac_data &0xf )); -#endif +qemu_log_mask (LOG_GUEST_ERROR , +"cirrus: invalid DAC value 0x%x in 16bpp\n" , + (s->cirrus_hidden_dac_data &0xf )); ret =15 ;/* XXX */ break ; }
@@ -1307,11 +1307,9 @@ static int cirrus_vga_read_sr(CirrusVGAState * s)#endif return s->vga.sr[s->vga.sr_index];default : -#ifdef DEBUG_CIRRUS -printf ("cirrus: inport sr_index %02x\n" , s->vga.sr_index); -#endif +qemu_log_mask (LOG_GUEST_ERROR , +"cirrus: inport sr_index 0x%02x\n" , s->vga.sr_index);return 0xff ; -break ; } }
@@ -1400,10 +1398,9 @@ static void cirrus_vga_write_sr(CirrusVGAState * s, uint32_t val)cirrus_update_memory_access (s);break ;default : -#ifdef DEBUG_CIRRUS -printf ("cirrus: outport sr_index %02x, sr_value %02x\n" , - s->vga.sr_index, val); -#endif +qemu_log_mask (LOG_GUEST_ERROR , +"cirrus: outport sr_index 0x%02x, sr_value 0x%02x\n" , + s->vga.sr_index, val);break ; } }
@@ -1501,9 +1498,8 @@ static int cirrus_vga_read_gr(CirrusVGAState * s, unsigned reg_index)if (reg_index <0x3a ) {return s->vga.gr[reg_index]; }else { -#ifdef DEBUG_CIRRUS -printf ("cirrus: inport gr_index %02x\n" , reg_index); -#endif +qemu_log_mask (LOG_GUEST_ERROR , +"cirrus: inport gr_index 0x%02x\n" , reg_index);return 0xff ; } }
@@ -1590,10 +1586,9 @@ cirrus_vga_write_gr(CirrusVGAState * s, unsigned reg_index, int reg_value)cirrus_write_bitblt (s, reg_value);break ;default : -#ifdef DEBUG_CIRRUS -printf ("cirrus: outport gr_index %02x, gr_value %02x\n" , reg_index, - reg_value); -#endif +qemu_log_mask (LOG_GUEST_ERROR , +"cirrus: outport gr_index 0x%02x, gr_value 0x%02x\n" , + reg_index, reg_value);break ; } }
@@ -1648,9 +1643,8 @@ static int cirrus_vga_read_cr(CirrusVGAState * s, unsigned reg_index)return s->vga.ar_index &0x3f ;break ;default : -#ifdef DEBUG_CIRRUS -printf ("cirrus: inport cr_index %02x\n" , reg_index); -#endif +qemu_log_mask (LOG_GUEST_ERROR , +"cirrus: inport cr_index 0x%02x\n" , reg_index);return 0xff ; } }
@@ -1721,10 +1715,9 @@ static void cirrus_vga_write_cr(CirrusVGAState * s, int reg_value)break ;case 0x25 :// Part Status default : -#ifdef DEBUG_CIRRUS -printf ("cirrus: outport cr_index %02x, cr_value %02x\n" , - s->vga.cr_index, reg_value); -#endif +qemu_log_mask (LOG_GUEST_ERROR , +"cirrus: outport cr_index 0x%02x, cr_value 0x%02x\n" , + s->vga.cr_index, reg_value);break ; } }
@@ -1834,9 +1827,8 @@ static uint8_t cirrus_mmio_blt_read(CirrusVGAState * s, unsigned address) value =cirrus_vga_read_gr (s,0x31 );break ;default : -#ifdef DEBUG_CIRRUS -printf ("cirrus: mmio read - address 0x%04x\n" , address); -#endif +qemu_log_mask (LOG_GUEST_ERROR , +"cirrus: mmio read - address 0x%04x\n" , address);break ; }
@@ -1946,10 +1938,9 @@ static void cirrus_mmio_blt_write(CirrusVGAState * s, unsigned address,cirrus_vga_write_gr (s,0x31 , value);break ;default : -#ifdef DEBUG_CIRRUS -printf ("cirrus: mmio write - addr 0x%04x val 0x%02x (ignored)\n" , - address, value); -#endif +qemu_log_mask (LOG_GUEST_ERROR , +"cirrus: mmio write - addr 0x%04x val 0x%02x (ignored)\n" , + address, value);break ; } }
@@ -2047,9 +2038,8 @@ static uint64_t cirrus_vga_mem_read(void *opaque, } }else { val =0xff ; -#ifdef DEBUG_CIRRUS -printf ("cirrus: mem_readb " TARGET_FMT_plx"\n" , addr); -#endif +qemu_log_mask (LOG_GUEST_ERROR , +"cirrus: mem_readb 0x" TARGET_FMT_plx"\n" , addr); }return val; }
@@ -2112,10 +2102,9 @@ static void cirrus_vga_mem_write(void *opaque,cirrus_mmio_blt_write (s, addr &0xff , mem_value); } }else { -#ifdef DEBUG_CIRRUS -printf ("cirrus: mem_writeb " TARGET_FMT_plx" value 0x%02" PRIu64"\n" , addr, - mem_value); -#endif +qemu_log_mask (LOG_GUEST_ERROR , +"cirrus: mem_writeb 0x" TARGET_FMT_plx" " +"value 0x%02" PRIu64"\n" , addr, mem_value); } }
Signature · 1 line
2.18.4
[PULL 20/21] sm501: Optimize small overlapping blits
In reply to Gerd HoffmannFrom: BALATON Zoltan <[email protected]>
AmigaOS tends to do a lot of small blits (even 1 pixel). Avoid malloc overhead by keeping around a buffer for this and only alloc when blitting larger areas.
Message-id: 7946852258d528497e85f465327fc90b5c3b59fb.1590089984.git.balaton@eik.bme.hu
--- hw/display/sm501.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
hw/display/sm501.c +11 -4
@@ -750,6 +750,7 @@ static void sm501_2d_operation(SM501State *s)switch (cmd) {case 0 :/* BitBlt */ { +static uint32_t tmp_buf[16384 ];unsigned int src_x = (s->twoD_source >>16 ) &0x01FFF ;unsigned int src_y = s->twoD_source &0xFFFF ;uint32_t src_base = s->twoD_source_base &0x03FFFFFF ;
@@ -812,10 +813,14 @@ static void sm501_2d_operation(SM501State *s) de = db + width + height * (width + dst_pitch);if (rtl && ((db >= sb && db <= se) || (de >= sb && de <= se))) {/* regions may overlap: copy via temporary */ -int llb = width * (1 << format); +int free_buf =0 , llb = width * (1 << format);int tmp_stride =DIV_ROUND_UP (llb,sizeof (uint32_t )); -uint32_t *tmp =g_malloc (tmp_stride *sizeof (uint32_t ) * - height); +uint32_t *tmp = tmp_buf; + +if (tmp_stride *sizeof (uint32_t ) * height >sizeof (tmp_buf)) { + tmp =g_malloc (tmp_stride *sizeof (uint32_t ) * height); + free_buf =1 ; + } pixman_blt((uint32_t *)&s->local_mem[src_base], tmp, src_pitch * (1 << format) / sizeof(uint32_t), tmp_stride, 8 * (1 << format), 8 * (1 << format),
@@ -825,7 +830,9 @@ static void sm501_2d_operation(SM501State *s) dst_pitch * (1 << format) /sizeof (uint32_t ),8 * (1 << format),8 * (1 << format), 0, 0, dst_x, dst_y, width, height); -g_free (tmp); +if (free_buf) { +g_free (tmp); + } }else { pixman_blt((uint32_t *)&s->local_mem[src_base], (uint32_t *)&s->local_mem[dst_base],
Signature · 1 line
2.18.4
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series seems to have some coding style problems. See output below for more information:
Message-id: [email protected]
Subject: [PULL 00/21] Vga 20200528 patches
Type: series
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
- [tag update] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
9f2de8c sm501: Remove obsolete changelog and todo comment
40c6179 sm501: Optimize small overlapping blits
a57f549 sm501: Replace hand written implementation with pixman where possible 757eb94 sm501: Clean up local variables in sm501_2d_operation 8d8e3be sm501: Use BIT(x) macro to shorten constant
e7baa0b sm501: Shorten long variable names in sm501_2d_operation b038590 sm501: Convert printf + abort to qemu_log_mask
a524b11 hw/display/pxa2xx_lcd: Replace printf() call by qemu_log_mask() 41000f1 hw/display/omap_dss: Replace fprintf() call by qemu_log_mask(LOG_UNIMP) dad32f3 hw/display/exynos4210_fimd: Use qemu_log_mask(GUEST_ERROR) 98b6d1b hw/display/vmware_vga: Let the PCI device own its I/O MemoryRegion f1eadac hw/display/vmware_vga: Replace printf() calls by qemu_log_mask(ERROR) 6ad1e39 hw/display/xlnx_dp: Replace disabled DPRINTF() by error_report() 3cffc59 hw/display/dpcd: Convert debug printf()s to trace events e359084 hw/display/dpcd: Fix memory region size
0e19973 hw/display/cirrus_vga: Convert debug printf() to trace event 97f369f hw/display/cirrus_vga: Use qemu_log_mask(ERROR) instead of debug printf 0758566 hw/display/cirrus_vga: Use qemu_log_mask(UNIMP) instead of debug printf 46f4782 hw/display/cirrus_vga: Convert debug printf() to trace event 4e2d47f hw/display/cg3: Convert debug printf()s to trace events 60a4146 hw/display/edid: Add missing 'qdev-properties.h' header
=== OUTPUT BEGIN ===
1/21 Checking commit 60a4146dff34 (hw/display/edid: Add missing 'qdev-properties.h' header) 2/21 Checking commit 4e2d47f82c1e (hw/display/cg3: Convert debug printf()s to trace events) 3/21 Checking commit 46f47822efea (hw/display/cirrus_vga: Convert debug printf() to trace event) 4/21 Checking commit 0758566b5a09 (hw/display/cirrus_vga: Use qemu_log_mask(UNIMP) instead of debug printf) 5/21 Checking commit 97f369f2479d (hw/display/cirrus_vga: Use qemu_log_mask(ERROR) instead of debug printf)
ERROR: suspect code indent for conditional statements (16, 12)
#34: FILE: hw/display/cirrus_vga.c:1038:
if (s->cirrus_blt_pixelwidth > 2) {+ qemu_log_mask(LOG_GUEST_ERROR,
total: 1 errors, 0 warnings, 156 lines checked
Patch 5/21 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
6/21 Checking commit 0e199736615e (hw/display/cirrus_vga: Convert debug printf() to trace event) 7/21 Checking commit e3590842cc63 (hw/display/dpcd: Fix memory region size)
8/21 Checking commit 3cffc590ddc1 (hw/display/dpcd: Convert debug printf()s to trace events) 9/21 Checking commit 6ad1e398b3a1 (hw/display/xlnx_dp: Replace disabled DPRINTF() by error_report()) 10/21 Checking commit f1eadacbf17b (hw/display/vmware_vga: Replace printf() calls by qemu_log_mask(ERROR)) 11/21 Checking commit 98b6d1b284b1 (hw/display/vmware_vga: Let the PCI device own its I/O MemoryRegion) 12/21 Checking commit dad32f3b2d7a (hw/display/exynos4210_fimd: Use qemu_log_mask(GUEST_ERROR)) 13/21 Checking commit 41000f19872c (hw/display/omap_dss: Replace fprintf() call by qemu_log_mask(LOG_UNIMP)) 14/21 Checking commit a524b11a2cb3 (hw/display/pxa2xx_lcd: Replace printf() call by qemu_log_mask()) 15/21 Checking commit b03859016467 (sm501: Convert printf + abort to qemu_log_mask)
16/21 Checking commit e7baa0b4bdde (sm501: Shorten long variable names in sm501_2d_operation) 17/21 Checking commit 8d8e3be40796 (sm501: Use BIT(x) macro to shorten constant)
18/21 Checking commit 757eb94bd007 (sm501: Clean up local variables in sm501_2d_operation) 19/21 Checking commit a57f549846a1 (sm501: Replace hand written implementation with pixman where possible) 20/21 Checking commit 40c6179925f0 (sm501: Optimize small overlapping blits)
21/21 Checking commit 9f2de8c702a3 (sm501: Remove obsolete changelog and todo comment)
=== OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]
Peter Maydell
AppliedQuoted 9 lines · Gerd Hoffmann
The following changes since commit
06539ebc76b8625587aa78d646a9d8d5fddf84f3:Merge remote-tracking branch 'remotes/philmd-gitlab/tags/mips-hw-next-20200526' into staging (2020-05-26 20:25:06 +0100)
are available in the Git repository at:
git://git.kraxel.org/qemutags/vga-20200528-pull-request
Quoted 8 lines
for you to fetch changes up to
fa0013a1bc5f6011a1017e0e655740403e5555d9:sm501: Remove obsolete changelog and todo comment (2020-05-28 11:38:57 +0200)
----------------------------------------------------------------
hw/dispaly/sm501: bugfixes, add sanity checks.
hw/display: use tracepoints, misc cleanups.
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/5.1
for any user-visible changes.
Could somebody send a followup patch to fix the indentation error checkpatch notices, please?
5/21 Checking commit 97f369f2479d (hw/display/cirrus_vga: Use qemu_log_mask(ERROR) instead of debug printf)
ERROR: suspect code indent for conditional statements (16, 12) #34: FILE: hw/display/cirrus_vga.c:1038:
if (s->cirrus_blt_pixelwidth > 2) {+ qemu_log_mask(LOG_GUEST_ERROR,
-- PMM
Hi Peter,
Quoted 20 lines · Peter Maydell
Quoted 9 lines · Gerd Hoffmann
The following changes since commit
06539ebc76b8625587aa78d646a9d8d5fddf84f3:Merge remote-tracking branch 'remotes/philmd-gitlab/tags/mips-hw-next-20200526' into staging (2020-05-26 20:25:06 +0100)
are available in the Git repository at:
git://git.kraxel.org/qemutags/vga-20200528-pull-requestQuoted 8 lines
for you to fetch changes up to
fa0013a1bc5f6011a1017e0e655740403e5555d9:sm501: Remove obsolete changelog and todo comment (2020-05-28 11:38:57 +0200)
----------------------------------------------------------------
hw/dispaly/sm501: bugfixes, add sanity checks.
hw/display: use tracepoints, misc cleanups.
Quoted 7 lines
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/5.1
for any user-visible changes.Could somebody send a followup patch to fix the indentation error checkpatch notices, please?
If this is part of your scripts, this is a nice feature :)
Quoted 7 lines
5/21 Checking commit
97f369f2479d(hw/display/cirrus_vga: Useqemu_log_mask(ERROR)instead of debug printf)
ERROR: suspect code indent for conditional statements (16, 12) #34: FILE:hw/display/cirrus_vga.c:1038:if (s->cirrus_blt_pixelwidth > 2) {+ qemu_log_mask(LOG_GUEST_ERROR,
I explained on the patches:
False positive.
Checkpatch is confused by the mis-indented code
previous to this line.
https://www.mail-archive.com/[email protected]/msg706364.html
Quoted 3 lines
-- PMM
Quoted 5 lines · Philippe Mathieu-Daudé
Quoted 2 lines · Peter Maydell
Could somebody send a followup patch to fix the indentation error checkpatch notices, please?
If this is part of your scripts, this is a nice feature :)
No, I just noticed the patchew email.
Quoted 11 lines
Quoted 7 lines
5/21 Checking commit
97f369f2479d(hw/display/cirrus_vga: Useqemu_log_mask(ERROR)instead of debug printf)
ERROR: suspect code indent for conditional statements (16, 12) #34: FILE:hw/display/cirrus_vga.c:1038:if (s->cirrus_blt_pixelwidth > 2) {+ qemu_log_mask(LOG_GUEST_ERROR,
I explained on the patches:
False positive.
The code is
if (s->cirrus_blt_mode & CIRRUS_BLTMODE_TRANSPARENTCOMP) {
if (s->cirrus_blt_pixelwidth > 2) {
qemu_log_mask(LOG_GUEST_ERROR,
"cirrus: src transparent without colorexpand "
"must be 8bpp or 16bpp\n");
goto bitblt_ignore;
}checkpatch seems correct; the qemu_log_mask line is misindented, and looking at the commit this is a misindent introduced in commit 2b55f4d3504a9f34 "hw/display/cirrus_vga: Use qemu_log_mask(ERROR) instead of debug printf". The old fprintf() line was using indent of tab+tab+4 spaces, but the new qemu_log_mask line is indented by 12 spaces, not 20. (Tabs are always 8 spaces equivalent.)
Some days I wonder whether we should just do a bulk detabify of the QEMU sources.
thanks
-- PMM
Quoted 30 lines · Peter Maydell
Quoted 5 lines · Philippe Mathieu-Daudé
Quoted 2 lines · Peter Maydell
Could somebody send a followup patch to fix the indentation error checkpatch notices, please?
If this is part of your scripts, this is a nice feature :)
No, I just noticed the patchew email.
Quoted 11 lines
Quoted 7 lines
5/21 Checking commit
97f369f2479d(hw/display/cirrus_vga: Useqemu_log_mask(ERROR)instead of debug printf)
ERROR: suspect code indent for conditional statements (16, 12) #34: FILE:hw/display/cirrus_vga.c:1038:if (s->cirrus_blt_pixelwidth > 2) {+ qemu_log_mask(LOG_GUEST_ERROR,
I explained on the patches:
False positive.
The code is
if (s->cirrus_blt_mode & CIRRUS_BLTMODE_TRANSPARENTCOMP) { if (s->cirrus_blt_pixelwidth > 2) { qemu_log_mask(LOG_GUEST_ERROR, "cirrus: src transparent without colorexpand " "must be 8bpp or 16bpp\n"); goto bitblt_ignore; }
Quoted 7 lines
checkpatch seems correct; the
qemu_log_maskline is misindented, and looking at the commit this is a misindent introduced in commit2b55f4d3504a9f34"hw/display/cirrus_vga: Useqemu_log_mask(ERROR)instead of debug printf". The oldfprintf()line was using indent of tab+tab+4 spaces, but the newqemu_log_maskline is indented by 12 spaces, not 20. (Tabs are always 8 spaces equivalent.)
OK now I understand, I use "set ts=4 sw=4" in my .vimrc and see this file completely un-indented (and the qemu_log_mask call well placed).
I'll send a cleanup patch. Sorry and thanks for noticing this.
Quoted 7 lines
Some days I wonder whether we should just do a bulk detabify of the QEMU sources.
thanks
-- PMM
Hi,
Quoted 2 lines
Some days I wonder whether we should just do a bulk detabify of the QEMU sources.
git & patch utils have switches to ignore whitespace changes, so I'd expect such a bulk change shouldn't be too disruptive in terms of conflicts. A one-time "git rebase --ignore-whitespace" for WIP patches should handle it.
cheers,
Gerd