diff mbox

tcx: Fix 24-bit display mode

Message ID 1370086861-12499-1-git-send-email-mark.cave-ayland@ilande.co.uk
State New
Headers show

Commit Message

Mark Cave-Ayland June 1, 2013, 11:41 a.m. UTC
Commit d08151bf (conversion of tcx to the memory API) broke the 24-bit mode of
the tcx display adapter by accidentally passing in the final address of the
dirty region to memory_region_reset_dirty() instead of its size.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/display/tcx.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Blue Swirl June 1, 2013, 8:59 p.m. UTC | #1
On Sat, Jun 1, 2013 at 11:41 AM, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
> Commit d08151bf (conversion of tcx to the memory API) broke the 24-bit mode of
> the tcx display adapter by accidentally passing in the final address of the
> dirty region to memory_region_reset_dirty() instead of its size.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

Patch looks OK, but please wrap the lines:
WARNING: line over 80 characters
#81: FILE: hw/display/tcx.c:196:
+                              page_min, (page_max - page_min) +
TARGET_PAGE_SIZE,

WARNING: line over 80 characters
#100: FILE: hw/display/tcx.c:288:
+                                  page_min, (page_max - page_min) +
TARGET_PAGE_SIZE,

total: 0 errors, 2 warnings, 26 lines checked

> ---
>  hw/display/tcx.c |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/hw/display/tcx.c b/hw/display/tcx.c
> index fc27f45..2d2123c 100644
> --- a/hw/display/tcx.c
> +++ b/hw/display/tcx.c
> @@ -193,15 +193,15 @@ static inline void reset_dirty(TCXState *ts, ram_addr_t page_min,
>                                ram_addr_t cpage)
>  {
>      memory_region_reset_dirty(&ts->vram_mem,
> -                              page_min, page_max + TARGET_PAGE_SIZE,
> +                              page_min, (page_max - page_min) + TARGET_PAGE_SIZE,
>                                DIRTY_MEMORY_VGA);
>      memory_region_reset_dirty(&ts->vram_mem,
>                                page24 + page_min * 4,
> -                              page24 + page_max * 4 + TARGET_PAGE_SIZE,
> +                              (page_max - page_min) * 4 + TARGET_PAGE_SIZE,
>                                DIRTY_MEMORY_VGA);
>      memory_region_reset_dirty(&ts->vram_mem,
>                                cpage + page_min * 4,
> -                              cpage + page_max * 4 + TARGET_PAGE_SIZE,
> +                              (page_max - page_min) * 4 + TARGET_PAGE_SIZE,
>                                DIRTY_MEMORY_VGA);
>  }
>
> @@ -285,7 +285,7 @@ static void tcx_update_display(void *opaque)
>      /* reset modified pages */
>      if (page_max >= page_min) {
>          memory_region_reset_dirty(&ts->vram_mem,
> -                                  page_min, page_max + TARGET_PAGE_SIZE,
> +                                  page_min, (page_max - page_min) + TARGET_PAGE_SIZE,
>                                    DIRTY_MEMORY_VGA);
>      }
>  }
> --
> 1.7.10.4
>
>
Mark Cave-Ayland June 2, 2013, 4:18 p.m. UTC | #2
On 01/06/13 21:59, Blue Swirl wrote:

> On Sat, Jun 1, 2013 at 11:41 AM, Mark Cave-Ayland
> <mark.cave-ayland@ilande.co.uk>  wrote:
>> Commit d08151bf (conversion of tcx to the memory API) broke the 24-bit mode of
>> the tcx display adapter by accidentally passing in the final address of the
>> dirty region to memory_region_reset_dirty() instead of its size.
>>
>> Signed-off-by: Mark Cave-Ayland<mark.cave-ayland@ilande.co.uk>
>
> Patch looks OK, but please wrap the lines:
> WARNING: line over 80 characters
> #81: FILE: hw/display/tcx.c:196:
> +                              page_min, (page_max - page_min) +
> TARGET_PAGE_SIZE,
>
> WARNING: line over 80 characters
> #100: FILE: hw/display/tcx.c:288:
> +                                  page_min, (page_max - page_min) +
> TARGET_PAGE_SIZE,
>
> total: 0 errors, 2 warnings, 26 lines checked

Thanks for the pointers - I'll resubmit a tidied-up v2 patch shortly.


ATB,

Mark.
diff mbox

Patch

diff --git a/hw/display/tcx.c b/hw/display/tcx.c
index fc27f45..2d2123c 100644
--- a/hw/display/tcx.c
+++ b/hw/display/tcx.c
@@ -193,15 +193,15 @@  static inline void reset_dirty(TCXState *ts, ram_addr_t page_min,
                               ram_addr_t cpage)
 {
     memory_region_reset_dirty(&ts->vram_mem,
-                              page_min, page_max + TARGET_PAGE_SIZE,
+                              page_min, (page_max - page_min) + TARGET_PAGE_SIZE,
                               DIRTY_MEMORY_VGA);
     memory_region_reset_dirty(&ts->vram_mem,
                               page24 + page_min * 4,
-                              page24 + page_max * 4 + TARGET_PAGE_SIZE,
+                              (page_max - page_min) * 4 + TARGET_PAGE_SIZE,
                               DIRTY_MEMORY_VGA);
     memory_region_reset_dirty(&ts->vram_mem,
                               cpage + page_min * 4,
-                              cpage + page_max * 4 + TARGET_PAGE_SIZE,
+                              (page_max - page_min) * 4 + TARGET_PAGE_SIZE,
                               DIRTY_MEMORY_VGA);
 }
 
@@ -285,7 +285,7 @@  static void tcx_update_display(void *opaque)
     /* reset modified pages */
     if (page_max >= page_min) {
         memory_region_reset_dirty(&ts->vram_mem,
-                                  page_min, page_max + TARGET_PAGE_SIZE,
+                                  page_min, (page_max - page_min) + TARGET_PAGE_SIZE,
                                   DIRTY_MEMORY_VGA);
     }
 }