* [Qemu-devel] [PULL 0/4] vga: cirrus hwcursor fixes.
@ 2014-12-17 14:42 Gerd Hoffmann
2014-12-17 14:42 ` [Qemu-devel] [PULL 1/4] vga: Add mechanism to force the use of a shadow surface Gerd Hoffmann
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2014-12-17 14:42 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
Hi,
vga patches lingering way too long in my queue.
Finally merging the cirrus hwcursor fixes (for NT4 guests!)
discussed months ago ...
Also minor tweaks picked up during freeze.
please pull,
Gerd
The following changes since commit dfa9c2a0f4d0a0c8b2c1449ecdbb1297427e1560:
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (2014-12-15 16:43:42 +0000)
are available in the git repository at:
git://git.kraxel.org/qemu tags/pull-vga-20141216-1
for you to fetch changes up to 46817e86fc1d97af0a7d9e4060730f7b00183083:
vga: set catagory bit for secondary vga device (2014-12-16 15:14:42 +0100)
----------------------------------------------------------------
cirrus hwcursor fixes.
set secondary-vga category.
----------------------------------------------------------------
Benjamin Herrenschmidt (2):
vga: Add mechanism to force the use of a shadow surface
cirrus: Force use of shadow pixmap when HW cursor is enabled
Gerd Hoffmann (1):
move hw cursor pos from cirrus to vga
Gonglei (1):
vga: set catagory bit for secondary vga device
hw/display/cirrus_vga.c | 40 +++++++++++++++++++++++-----------------
hw/display/vga-pci.c | 1 +
hw/display/vga.c | 17 +++++++++++++++--
hw/display/vga_int.h | 3 +++
4 files changed, 42 insertions(+), 19 deletions(-)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PULL 1/4] vga: Add mechanism to force the use of a shadow surface
2014-12-17 14:42 [Qemu-devel] [PULL 0/4] vga: cirrus hwcursor fixes Gerd Hoffmann
@ 2014-12-17 14:42 ` Gerd Hoffmann
2014-12-17 14:42 ` [Qemu-devel] [PULL 2/4] cirrus: Force use of shadow pixmap when HW cursor is enabled Gerd Hoffmann
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2014-12-17 14:42 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
This prevents surface sharing which will be necessary to
fix cirrus HW cursor support.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/display/vga.c | 17 +++++++++++++++--
hw/display/vga_int.h | 1 +
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/hw/display/vga.c b/hw/display/vga.c
index 52eaf05..a620c07 100644
--- a/hw/display/vga.c
+++ b/hw/display/vga.c
@@ -1436,6 +1436,7 @@ static void vga_draw_graphic(VGACommonState *s, int full_update)
uint8_t *d;
uint32_t v, addr1, addr;
vga_draw_line_func *vga_draw_line = NULL;
+ bool share_surface;
#ifdef HOST_WORDS_BIGENDIAN
bool byteswap = !s->big_endian_fb;
#else
@@ -1479,21 +1480,33 @@ static void vga_draw_graphic(VGACommonState *s, int full_update)
}
depth = s->get_bpp(s);
+
+ share_surface = (!s->force_shadow) &&
+ ( depth == 32 || (depth == 16 && !byteswap) );
if (s->line_offset != s->last_line_offset ||
disp_width != s->last_width ||
height != s->last_height ||
s->last_depth != depth ||
- s->last_byteswap != byteswap) {
- if (depth == 32 || (depth == 16 && !byteswap)) {
+ s->last_byteswap != byteswap ||
+ share_surface != is_buffer_shared(surface)) {
+ if (share_surface) {
pixman_format_code_t format =
qemu_default_pixman_format(depth, !byteswap);
surface = qemu_create_displaysurface_from(disp_width,
height, format, s->line_offset,
s->vram_ptr + (s->start_addr * 4));
dpy_gfx_replace_surface(s->con, surface);
+#ifdef DEBUG_VGA
+ printf("VGA: Using shared surface for depth=%d swap=%d\n",
+ depth, byteswap);
+#endif
} else {
qemu_console_resize(s->con, disp_width, height);
surface = qemu_console_surface(s->con);
+#ifdef DEBUG_VGA
+ printf("VGA: Using shadow surface for depth=%d swap=%d\n",
+ depth, byteswap);
+#endif
}
s->last_scr_width = disp_width;
s->last_scr_height = height;
diff --git a/hw/display/vga_int.h b/hw/display/vga_int.h
index ed69e06..72e00f2 100644
--- a/hw/display/vga_int.h
+++ b/hw/display/vga_int.h
@@ -151,6 +151,7 @@ typedef struct VGACommonState {
uint32_t last_scr_width, last_scr_height; /* in pixels */
uint32_t last_depth; /* in bits */
bool last_byteswap;
+ bool force_shadow;
uint8_t cursor_start, cursor_end;
bool cursor_visible_phase;
int64_t cursor_blink_time;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PULL 2/4] cirrus: Force use of shadow pixmap when HW cursor is enabled
2014-12-17 14:42 [Qemu-devel] [PULL 0/4] vga: cirrus hwcursor fixes Gerd Hoffmann
2014-12-17 14:42 ` [Qemu-devel] [PULL 1/4] vga: Add mechanism to force the use of a shadow surface Gerd Hoffmann
@ 2014-12-17 14:42 ` Gerd Hoffmann
2014-12-17 14:42 ` [Qemu-devel] [PULL 3/4] move hw cursor pos from cirrus to vga Gerd Hoffmann
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2014-12-17 14:42 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
The HW cursor cannot be painted on a shared surface. This fixes HW
cursor display in Windows NT 4.0 and Windows 98.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/display/cirrus_vga.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
index 2725264..686b062 100644
--- a/hw/display/cirrus_vga.c
+++ b/hw/display/cirrus_vga.c
@@ -1351,7 +1351,6 @@ static void cirrus_vga_write_sr(CirrusVGAState * s, uint32_t val)
case 0x0d: // VCLK 2
case 0x0e: // VCLK 3
case 0x0f: // DRAM Control
- case 0x12: // Graphics Cursor Attribute
case 0x13: // Graphics Cursor Pattern Address
case 0x14: // Scratch Register 2
case 0x15: // Scratch Register 3
@@ -1370,6 +1369,14 @@ static void cirrus_vga_write_sr(CirrusVGAState * s, uint32_t val)
s->vga.sr_index, val);
#endif
break;
+ case 0x12: // Graphics Cursor Attribute
+ s->vga.sr[0x12] = val;
+ s->vga.force_shadow = !!(val & CIRRUS_CURSOR_SHOW);
+#ifdef DEBUG_CIRRUS
+ printf("cirrus: cursor ctl SR12=%02x (force shadow: %d)\n",
+ val, s->vga.force_shadow);
+#endif
+ break;
case 0x17: // Configuration Readback and Extended Control
s->vga.sr[s->vga.sr_index] = (s->vga.sr[s->vga.sr_index] & 0x38)
| (val & 0xc7);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PULL 3/4] move hw cursor pos from cirrus to vga
2014-12-17 14:42 [Qemu-devel] [PULL 0/4] vga: cirrus hwcursor fixes Gerd Hoffmann
2014-12-17 14:42 ` [Qemu-devel] [PULL 1/4] vga: Add mechanism to force the use of a shadow surface Gerd Hoffmann
2014-12-17 14:42 ` [Qemu-devel] [PULL 2/4] cirrus: Force use of shadow pixmap when HW cursor is enabled Gerd Hoffmann
@ 2014-12-17 14:42 ` Gerd Hoffmann
2014-12-17 14:42 ` [Qemu-devel] [PULL 4/4] vga: set catagory bit for secondary vga device Gerd Hoffmann
2014-12-19 12:56 ` [Qemu-devel] [PULL 0/4] vga: cirrus hwcursor fixes Peter Maydell
4 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2014-12-17 14:42 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
---
hw/display/cirrus_vga.c | 31 +++++++++++++++----------------
hw/display/vga_int.h | 2 ++
2 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
index 686b062..3a53f20 100644
--- a/hw/display/cirrus_vga.c
+++ b/hw/display/cirrus_vga.c
@@ -202,8 +202,6 @@ typedef struct CirrusVGAState {
uint32_t cirrus_bank_base[2];
uint32_t cirrus_bank_limit[2];
uint8_t cirrus_hidden_palette[48];
- uint32_t hw_cursor_x;
- uint32_t hw_cursor_y;
int cirrus_blt_pixelwidth;
int cirrus_blt_width;
int cirrus_blt_height;
@@ -1328,7 +1326,7 @@ static void cirrus_vga_write_sr(CirrusVGAState * s, uint32_t val)
case 0xd0:
case 0xf0: // Graphics Cursor X
s->vga.sr[0x10] = val;
- s->hw_cursor_x = (val << 3) | (s->vga.sr_index >> 5);
+ s->vga.hw_cursor_x = (val << 3) | (s->vga.sr_index >> 5);
break;
case 0x11:
case 0x31:
@@ -1339,7 +1337,7 @@ static void cirrus_vga_write_sr(CirrusVGAState * s, uint32_t val)
case 0xd1:
case 0xf1: // Graphics Cursor Y
s->vga.sr[0x11] = val;
- s->hw_cursor_y = (val << 3) | (s->vga.sr_index >> 5);
+ s->vga.hw_cursor_y = (val << 3) | (s->vga.sr_index >> 5);
break;
case 0x07: // Extended Sequencer Mode
cirrus_update_memory_access(s);
@@ -2195,14 +2193,14 @@ static void cirrus_cursor_invalidate(VGACommonState *s1)
}
/* invalidate last cursor and new cursor if any change */
if (s->last_hw_cursor_size != size ||
- s->last_hw_cursor_x != s->hw_cursor_x ||
- s->last_hw_cursor_y != s->hw_cursor_y) {
+ s->last_hw_cursor_x != s->vga.hw_cursor_x ||
+ s->last_hw_cursor_y != s->vga.hw_cursor_y) {
invalidate_cursor1(s);
s->last_hw_cursor_size = size;
- s->last_hw_cursor_x = s->hw_cursor_x;
- s->last_hw_cursor_y = s->hw_cursor_y;
+ s->last_hw_cursor_x = s->vga.hw_cursor_x;
+ s->last_hw_cursor_y = s->vga.hw_cursor_y;
/* compute the real cursor min and max y */
cirrus_cursor_compute_yrange(s);
invalidate_cursor1(s);
@@ -2259,14 +2257,15 @@ static void cirrus_cursor_draw_line(VGACommonState *s1, uint8_t *d1, int scr_y)
} else {
h = 32;
}
- if (scr_y < s->hw_cursor_y ||
- scr_y >= (s->hw_cursor_y + h))
+ if (scr_y < s->vga.hw_cursor_y ||
+ scr_y >= (s->vga.hw_cursor_y + h)) {
return;
+ }
src = s->vga.vram_ptr + s->real_vram_size - 16 * 1024;
if (s->vga.sr[0x12] & CIRRUS_CURSOR_LARGE) {
src += (s->vga.sr[0x13] & 0x3c) * 256;
- src += (scr_y - s->hw_cursor_y) * 16;
+ src += (scr_y - s->vga.hw_cursor_y) * 16;
poffset = 8;
content = ((uint32_t *)src)[0] |
((uint32_t *)src)[1] |
@@ -2274,7 +2273,7 @@ static void cirrus_cursor_draw_line(VGACommonState *s1, uint8_t *d1, int scr_y)
((uint32_t *)src)[3];
} else {
src += (s->vga.sr[0x13] & 0x3f) * 256;
- src += (scr_y - s->hw_cursor_y) * 4;
+ src += (scr_y - s->vga.hw_cursor_y) * 4;
poffset = 128;
@@ -2286,10 +2285,10 @@ static void cirrus_cursor_draw_line(VGACommonState *s1, uint8_t *d1, int scr_y)
return;
w = h;
- x1 = s->hw_cursor_x;
+ x1 = s->vga.hw_cursor_x;
if (x1 >= s->vga.last_scr_width)
return;
- x2 = s->hw_cursor_x + w;
+ x2 = s->vga.hw_cursor_x + w;
if (x2 > s->vga.last_scr_width)
x2 = s->vga.last_scr_width;
w = x2 - x1;
@@ -2778,8 +2777,8 @@ static const VMStateDescription vmstate_cirrus_vga = {
VMSTATE_INT32(vga.bank_offset, CirrusVGAState),
VMSTATE_UINT8(cirrus_hidden_dac_lockindex, CirrusVGAState),
VMSTATE_UINT8(cirrus_hidden_dac_data, CirrusVGAState),
- VMSTATE_UINT32(hw_cursor_x, CirrusVGAState),
- VMSTATE_UINT32(hw_cursor_y, CirrusVGAState),
+ VMSTATE_UINT32(vga.hw_cursor_x, CirrusVGAState),
+ VMSTATE_UINT32(vga.hw_cursor_y, CirrusVGAState),
/* XXX: we do not save the bitblt state - we assume we do not save
the state when the blitter is active */
VMSTATE_END_OF_LIST()
diff --git a/hw/display/vga_int.h b/hw/display/vga_int.h
index 72e00f2..fcfcc5f 100644
--- a/hw/display/vga_int.h
+++ b/hw/display/vga_int.h
@@ -163,6 +163,8 @@ typedef struct VGACommonState {
bool default_endian_fb;
/* hardware mouse cursor support */
uint32_t invalidated_y_table[VGA_MAX_HEIGHT / 32];
+ uint32_t hw_cursor_x;
+ uint32_t hw_cursor_y;
void (*cursor_invalidate)(struct VGACommonState *s);
void (*cursor_draw_line)(struct VGACommonState *s, uint8_t *d, int y);
/* tell for each page if it has been updated since the last time */
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PULL 4/4] vga: set catagory bit for secondary vga device
2014-12-17 14:42 [Qemu-devel] [PULL 0/4] vga: cirrus hwcursor fixes Gerd Hoffmann
` (2 preceding siblings ...)
2014-12-17 14:42 ` [Qemu-devel] [PULL 3/4] move hw cursor pos from cirrus to vga Gerd Hoffmann
@ 2014-12-17 14:42 ` Gerd Hoffmann
2014-12-19 12:56 ` [Qemu-devel] [PULL 0/4] vga: cirrus hwcursor fixes Peter Maydell
4 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2014-12-17 14:42 UTC (permalink / raw)
To: qemu-devel; +Cc: Gonglei, Gerd Hoffmann
From: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/display/vga-pci.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/display/vga-pci.c b/hw/display/vga-pci.c
index db922f1..53739e4 100644
--- a/hw/display/vga-pci.c
+++ b/hw/display/vga-pci.c
@@ -321,6 +321,7 @@ static void secondary_class_init(ObjectClass *klass, void *data)
dc->vmsd = &vmstate_vga_pci;
dc->props = secondary_pci_properties;
dc->reset = pci_secondary_vga_reset;
+ set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
}
static const TypeInfo vga_info = {
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PULL 0/4] vga: cirrus hwcursor fixes.
2014-12-17 14:42 [Qemu-devel] [PULL 0/4] vga: cirrus hwcursor fixes Gerd Hoffmann
` (3 preceding siblings ...)
2014-12-17 14:42 ` [Qemu-devel] [PULL 4/4] vga: set catagory bit for secondary vga device Gerd Hoffmann
@ 2014-12-19 12:56 ` Peter Maydell
4 siblings, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2014-12-19 12:56 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: QEMU Developers
On 17 December 2014 at 14:42, Gerd Hoffmann <kraxel@redhat.com> wrote:
> Hi,
>
> vga patches lingering way too long in my queue.
>
> Finally merging the cirrus hwcursor fixes (for NT4 guests!)
> discussed months ago ...
>
> Also minor tweaks picked up during freeze.
>
> please pull,
> Gerd
>
> The following changes since commit dfa9c2a0f4d0a0c8b2c1449ecdbb1297427e1560:
>
> Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (2014-12-15 16:43:42 +0000)
>
> are available in the git repository at:
>
>
> git://git.kraxel.org/qemu tags/pull-vga-20141216-1
>
> for you to fetch changes up to 46817e86fc1d97af0a7d9e4060730f7b00183083:
>
> vga: set catagory bit for secondary vga device (2014-12-16 15:14:42 +0100)
>
> ----------------------------------------------------------------
> cirrus hwcursor fixes.
> set secondary-vga category.
>
> ----------------------------------------------------------------
Applied, thanks.
-- PMM
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-12-19 12:57 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-17 14:42 [Qemu-devel] [PULL 0/4] vga: cirrus hwcursor fixes Gerd Hoffmann
2014-12-17 14:42 ` [Qemu-devel] [PULL 1/4] vga: Add mechanism to force the use of a shadow surface Gerd Hoffmann
2014-12-17 14:42 ` [Qemu-devel] [PULL 2/4] cirrus: Force use of shadow pixmap when HW cursor is enabled Gerd Hoffmann
2014-12-17 14:42 ` [Qemu-devel] [PULL 3/4] move hw cursor pos from cirrus to vga Gerd Hoffmann
2014-12-17 14:42 ` [Qemu-devel] [PULL 4/4] vga: set catagory bit for secondary vga device Gerd Hoffmann
2014-12-19 12:56 ` [Qemu-devel] [PULL 0/4] vga: cirrus hwcursor fixes Peter Maydell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).