Skip to contentSkip to conversation

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

PATCH Superseded Helge Deller 2 participants 3 messages May 24, 2021 – May 25, 2021

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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

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() 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]>
hw/display/artist.c +2 -2
index ed0e637f25..34efd3a565 100644
@@ -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;
#1 lore raw

Hi Helge,

Quoted 5 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() 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.

OK, but there is a similar issue in artist_vram_write(), right?

Quoted 24 lines
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]>
hw/display/artist.c +2 -2
index ed0e637f25..34efd3a565 100644
@@ -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
Quoted 1 line · Philippe Mathieu-Daudé

Hi Helge,

Hi Plilippe,

Quoted 8 lines · Helge Deller
Quoted 5 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() 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.

OK, but there is a similar issue in artist_vram_write(), right?

Similar code: Yes.
Issue: Maybe.
I applied the same patch in artist_vram_write() and it didn't showed any negative (or positive) effects.
So, I'll resend my patch with artist_vram_write() adjusted as well.

Thanks!
Helge

Quoted 23 lines
Quoted 23 lines
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]>
hw/display/artist.c +2 -2
index ed0e637f25..34efd3a565 100644
@@ -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;