Skip to contentSkip to conversation

hw/display/artist: Fix bug in coordinate extraction in artist_vram_read() and artist_vram_write()

PATCH In review Helge Deller 3 participants 3 messages May 25, 2021 – Oct 14, 2021

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 hw/display/artist: Fix bug in coordinate extraction in artist_vram_read() and artist_vram_write()

The CDE desktop on HP-UX 10 shows wrongly rendered pixels when the local screen menu is closed. This bug was introduced by commit c7050f3f167b ("hw/display/artist: Refactor x/y coordination extraction") which converted the coordinate extraction in artist_vram_read() and artist_vram_write() to use the ADDR_TO_X and ADDR_TO_Y macros, but forgot to right-shift the address by 2 as it was done before.

Fixes c7050f3f167b ("hw/display/artist: Refactor x/y coordination extraction")
Cc Philippe Mathieu-Daudé <[email protected]>
Cc Richard Henderson <[email protected]>
Cc Sven Schnelle <[email protected]>

---
v2: Fix artist_vram_write() too, noticed by Philippe Mathieu-Daudé

hw/display/artist.c +4 -4
index ed0e637f25..8758c77bbf 100644
@@ -1171,8 +1171,8 @@ static void artist_vram_write(void *opaque, hwaddr addr, uint64_t val,
     }
 
     buf = vram_write_buffer(s);
-    posy = ADDR_TO_Y(addr);
-    posx = ADDR_TO_X(addr);
+    posy = ADDR_TO_Y(addr >> 2);
+    posx = ADDR_TO_X(addr >> 2);
 
     if (!buf->size) {
         return;
@@ -1233,8 +1233,8 @@ static uint64_t artist_vram_read(void *opaque, hwaddr addr, unsigned size)
         return 0;
     }
 
-    posy = ADDR_TO_Y(addr);
-    posx = ADDR_TO_X(addr);
+    posy = ADDR_TO_Y(addr >> 2);
+    posx = ADDR_TO_X(addr >> 2);
 
     if (posy > buf->height || posx > buf->width) {
         return 0;
Reviewed-by on v2 1/1
#1 lore raw
Quoted 33 lines · Helge Deller

The CDE desktop on HP-UX 10 shows wrongly rendered pixels when the local screen menu is closed. This bug was introduced by commit c7050f3f167b ("hw/display/artist: Refactor x/y coordination extraction") which converted the coordinate extraction in artist_vram_read() and artist_vram_write() to use the ADDR_TO_X and ADDR_TO_Y macros, but forgot to right-shift the address by 2 as it was done before.

Fixes c7050f3f167b ("hw/display/artist: Refactor x/y coordination extraction")
Cc Philippe Mathieu-Daudé <[email protected]>
Cc Richard Henderson <[email protected]>
Cc Sven Schnelle <[email protected]>

---
v2: Fix artist_vram_write() too, noticed by Philippe Mathieu-Daudé

hw/display/artist.c +2 -2
index ed0e637f25..8758c77bbf 100644
@@ -1171,8 +1171,8 @@ static void artist_vram_write(void *opaque, hwaddr addr, uint64_t val,
     }
 
     buf = vram_write_buffer(s);
-    posy = ADDR_TO_Y(addr);
-    posx = ADDR_TO_X(addr);
+    posy = ADDR_TO_Y(addr >> 2);
+    posx = ADDR_TO_X(addr >> 2);
 
     if (!buf->size) {
         return;

hw/display/artist.c static uint64_t artist_vram_read(void *opaque, hwaddr addr, unsigned size) · line 1240

Quoted 10 lines
hw/display/artist.c +2 -2
@@ -1233,8 +1233,8 @@ static uint64_t artist_vram_read(void *opaque, hwaddr addr, unsigned size)
         return 0;
     }
 
-    posy = ADDR_TO_Y(addr);
-    posx = ADDR_TO_X(addr);
+    posy = ADDR_TO_Y(addr >> 2);
+    posx = ADDR_TO_X(addr >> 2);
 
     if (posy > buf->height || posx > buf->width) {
         return 0;
#2 lore raw

Quoting Philippe Mathieu-Daudé (2021-05-26 02:30:19)

Quoted 41 lines · Helge Deller
Quoted 40 lines

The CDE desktop on HP-UX 10 shows wrongly rendered pixels when the local screen menu is closed. This bug was introduced by commit c7050f3f167b ("hw/display/artist: Refactor x/y coordination extraction") which converted the coordinate extraction in artist_vram_read() and artist_vram_write() to use the ADDR_TO_X and ADDR_TO_Y macros, but forgot to right-shift the address by 2 as it was done before.

Fixes c7050f3f167b ("hw/display/artist: Refactor x/y coordination extraction")
Cc Philippe Mathieu-Daudé <[email protected]>
Cc Richard Henderson <[email protected]>
Cc Sven Schnelle <[email protected]>

---
v2: Fix artist_vram_write() too, noticed by Philippe Mathieu-Daudé

hw/display/artist.c +4 -4
index ed0e637f25..8758c77bbf 100644
@@ -1171,8 +1171,8 @@ static void artist_vram_write(void *opaque, hwaddr addr, uint64_t val,
     }
 
     buf = vram_write_buffer(s);
-    posy = ADDR_TO_Y(addr);
-    posx = ADDR_TO_X(addr);
+    posy = ADDR_TO_Y(addr >> 2);
+    posx = ADDR_TO_X(addr >> 2);
 
     if (!buf->size) {
         return;
@@ -1233,8 +1233,8 @@ static uint64_t artist_vram_read(void *opaque, hwaddr addr, unsigned size)
         return 0;
     }
 
-    posy = ADDR_TO_Y(addr);
-    posx = ADDR_TO_X(addr);
+    posy = ADDR_TO_Y(addr >> 2);
+    posx = ADDR_TO_X(addr >> 2);
 
Quoted 6 lines

hw/display/artist.c static uint64_t artist_vram_read(void *opaque, hwaddr addr, unsigned size) · line 1240

Quoted 3 lines
hw/display/artist.c +0 -0
     if (posy > buf->height || posx > buf->width) {
         return 0;

Ping. Looking to include for v6.0.1/v6.1.1 as well.