Skip to contentSkip to conversation

hw/display/tcx: Avoid clearing dirty bitmap in DeviceReset()

PATCH In review Philippe Mathieu-Daudé via 2 participants 3 messages Jan 22, 2022 – Jan 26, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/display/tcx: Avoid clearing dirty bitmap in DeviceReset()

Commit 2dd285b5f3 ("tcx: make display updates thread safe") converted this model to use the DirtyBitmapSnapshot API, resetting the dirty bitmap in tcx_update_display(). There is no need to do it again in the DeviceReset handler.

See more details in commit fec5e8c92b ("vga: make display updates thread safe.").

---
 hw/display/tcx.c | 2 --
 1 file changed, 2 deletions(-)
hw/display/tcx.c +0 -2
index d4d09d0df8..22b0ae4761 100644
@@ -371,8 +371,6 @@ static void tcx_reset(DeviceState *d)
     s->r[258] = s->g[258] = s->b[258] = 255;
     update_palette_entries(s, 0, 260);
     memset(s->vram, 0, MAXX*MAXY);
-    memory_region_reset_dirty(&s->vram_mem, 0, MAXX * MAXY * (1 + 4 + 4),
-                              DIRTY_MEMORY_VGA);
     s->dac_index = 0;
     s->dac_state = 0;
     s->cursx = 0xf000; /* Put cursor off screen */
Signature · 1 line
2.34.1
#1 lore raw
Quoted 18 lines · Philippe Mathieu-Daudé via

Commit 2dd285b5f3 ("tcx: make display updates thread safe") converted this model to use the DirtyBitmapSnapshot API, resetting the dirty bitmap in tcx_update_display(). There is no need to do it again in the DeviceReset handler.

See more details in commit fec5e8c92b ("vga: make display updates thread safe.").

---
  hw/display/tcx.c | 2 --
  1 file changed, 2 deletions(-)
hw/display/tcx.c +0 -0
index d4d09d0df8..22b0ae4761 100644

hw/display/tcx.c static void tcx_reset(DeviceState *d) · line 376

Quoted 8 lines
hw/display/tcx.c +0 -2
@@ -371,8 +371,6 @@ static void tcx_reset(DeviceState *d)
      s->r[258] = s->g[258] = s->b[258] = 255;
      update_palette_entries(s, 0, 260);
      memset(s->vram, 0, MAXX*MAXY);
-    memory_region_reset_dirty(&s->vram_mem, 0, MAXX * MAXY * (1 + 4 + 4),
-                              DIRTY_MEMORY_VGA);
      s->dac_index = 0;
      s->dac_state = 0;
      s->cursx = 0xf000; /* Put cursor off screen */

I think the issue here is that tcx_reset() should be marking the entire VRAM dirty due to the memset() i.e. we should be setting the dirty bitmap rather than resetting it. Perhaps memory_region_reset_dirty() should be replaced with tcx_invalidate_display() instead?

ATB,

Mark.

#2 lore raw
Quoted 26 lines · Mark Cave-Ayland
Quoted 24 lines · Philippe Mathieu-Daudé via

Commit 2dd285b5f3 ("tcx: make display updates thread safe") converted this model to use the DirtyBitmapSnapshot API, resetting the dirty bitmap in tcx_update_display(). There is no need to do it again in the DeviceReset handler.

See more details in commit fec5e8c92b ("vga: make display updates thread safe.").

---
  hw/display/tcx.c | 2 --

  1 file changed, 2 deletions(-)
hw/display/tcx.c +0 -2
index d4d09d0df8..22b0ae4761 100644
@@ -371,8 +371,6 @@ static void tcx_reset(DeviceState *d)
       s->r[258] = s->g[258] = s->b[258] = 255;
       update_palette_entries(s, 0, 260);
       memset(s->vram, 0, MAXX*MAXY);
-    memory_region_reset_dirty(&s->vram_mem, 0, MAXX * MAXY * (1 + 4 +
 4),
-                              DIRTY_MEMORY_VGA);
Quoted 8 lines
Quoted 3 lines
hw/display/tcx.c +0 -0
       s->dac_index = 0;
       s->dac_state = 0;

      s->cursx = 0xf000; /* Put cursor off screen */

I think the issue here is that tcx_reset() should be marking the entire VRAM dirty due to the memset() i.e. we should be setting the dirty bitmap rather than resetting it. Perhaps memory_region_reset_dirty() should be replaced with tcx_invalidate_display() instead?

Yeah I was not sure, and your suggestion sounds right. I'll respin.