static void pxa2xx_lcdc_dma0_redraw_vert(struct pxa2xx_lcdc_s *s,

                uint8_t *fb, int *miny, int *maxy)

{

    int y, src_width, dest_width, dirty[2];

    uint8_t *src, *dest;

    ram_addr_t x, addr, new_addr, start, end;

    drawfn fn = 0;

    if (s->dest_width)

        fn = s->line_fn[s->transp][s->bpp];

    if (!fn)

        return;



    src = fb;

    src_width = (s->xres + 3) & ~3;     /* Pad to a 4 pixels multiple */

    if (s->bpp == pxa_lcdc_19pbpp || s->bpp == pxa_lcdc_18pbpp)

        src_width *= 3;

    else if (s->bpp > pxa_lcdc_16bpp)

        src_width *= 4;

    else if (s->bpp > pxa_lcdc_8bpp)

        src_width *= 2;



    dest_width = s->yres * s->dest_width;

    dest = ds_get_data(s->ds) + dest_width * (s->xres - 1);



    addr = (ram_addr_t) (fb - phys_ram_base);

    start = addr + s->yres * src_width;

    end = addr;

    dirty[0] = dirty[1] = cpu_physical_memory_get_dirty(start, VGA_DIRTY_FLAG);

    for (y = 0; y < s->yres; y ++) {

        new_addr = addr + src_width;

        for (x = addr + TARGET_PAGE_SIZE; x < new_addr;

                        x += TARGET_PAGE_SIZE) {

            dirty[1] = cpu_physical_memory_get_dirty(x, VGA_DIRTY_FLAG);

            dirty[0] |= dirty[1];

        }

        if (dirty[0] || s->invalidated) {

            fn((uint32_t *) s->dma_ch[0].palette,

                            dest, src, s->xres, -dest_width);

            if (addr < start)

                start = addr;

            end = new_addr;

            if (y < *miny)

                *miny = y;

            if (y >= *maxy)

                *maxy = y + 1;

        }

        addr = new_addr;

        dirty[0] = dirty[1];

        src += src_width;

        dest += s->dest_width;

    }



    if (end > start)

        cpu_physical_memory_reset_dirty(start, end, VGA_DIRTY_FLAG);

}

static void pxa2xx_lcdc_dma0_redraw_vert(struct pxa2xx_lcdc_s *s,

                uint8_t *fb, int *miny, int *maxy)

{

    int y, src_width, dest_width, dirty[2];

    uint8_t *src, *dest;

    ram_addr_t x, addr, new_addr, start, end;

    drawfn fn = 0;

    if (s->dest_width)

        fn = s->line_fn[s->transp][s->bpp];

    if (!fn)

        return;



    src = fb;

    src_width = (s->xres + 3) & ~3;     

    if (s->bpp == pxa_lcdc_19pbpp || s->bpp == pxa_lcdc_18pbpp)

        src_width *= 3;

    else if (s->bpp > pxa_lcdc_16bpp)

        src_width *= 4;

    else if (s->bpp > pxa_lcdc_8bpp)

        src_width *= 2;



    dest_width = s->yres * s->dest_width;

    dest = ds_get_data(s->ds) + dest_width * (s->xres - 1);



    addr = (ram_addr_t) (fb - phys_ram_base);

    start = addr + s->yres * src_width;

    end = addr;

    dirty[0] = dirty[1] = cpu_physical_memory_get_dirty(start, VGA_DIRTY_FLAG);

    for (y = 0; y < s->yres; y ++) {

        new_addr = addr + src_width;

        for (x = addr + TARGET_PAGE_SIZE; x < new_addr;

                        x += TARGET_PAGE_SIZE) {

            dirty[1] = cpu_physical_memory_get_dirty(x, VGA_DIRTY_FLAG);

            dirty[0] |= dirty[1];

        }

        if (dirty[0] || s->invalidated) {

            fn((uint32_t *) s->dma_ch[0].palette,

                            dest, src, s->xres, -dest_width);

            if (addr < start)

                start = addr;

            end = new_addr;

            if (y < *miny)

                *miny = y;

            if (y >= *maxy)

                *maxy = y + 1;

        }

        addr = new_addr;

        dirty[0] = dirty[1];

        src += src_width;

        dest += s->dest_width;

    }



    if (end > start)

        cpu_physical_memory_reset_dirty(start, end, VGA_DIRTY_FLAG);

}

static void FUNC_0(struct pxa2xx_lcdc_s *VAR_0,

                uint8_t *VAR_1, int *VAR_2, int *VAR_3)

{

    int VAR_4, VAR_5, VAR_6, VAR_7[2];

    uint8_t *src, *dest;

    ram_addr_t x, addr, new_addr, start, end;

    drawfn fn = 0;

    if (VAR_0->VAR_6)

        fn = VAR_0->line_fn[VAR_0->transp][VAR_0->bpp];

    if (!fn)

        return;



    src = VAR_1;

    VAR_5 = (VAR_0->xres + 3) & ~3;     

    if (VAR_0->bpp == pxa_lcdc_19pbpp || VAR_0->bpp == pxa_lcdc_18pbpp)

        VAR_5 *= 3;

    else if (VAR_0->bpp > pxa_lcdc_16bpp)

        VAR_5 *= 4;

    else if (VAR_0->bpp > pxa_lcdc_8bpp)

        VAR_5 *= 2;



    VAR_6 = VAR_0->yres * VAR_0->VAR_6;

    dest = ds_get_data(VAR_0->ds) + VAR_6 * (VAR_0->xres - 1);



    addr = (ram_addr_t) (VAR_1 - phys_ram_base);

    start = addr + VAR_0->yres * VAR_5;

    end = addr;

    VAR_7[0] = VAR_7[1] = cpu_physical_memory_get_dirty(start, VGA_DIRTY_FLAG);

    for (VAR_4 = 0; VAR_4 < VAR_0->yres; VAR_4 ++) {

        new_addr = addr + VAR_5;

        for (x = addr + TARGET_PAGE_SIZE; x < new_addr;

                        x += TARGET_PAGE_SIZE) {

            VAR_7[1] = cpu_physical_memory_get_dirty(x, VGA_DIRTY_FLAG);

            VAR_7[0] |= VAR_7[1];

        }

        if (VAR_7[0] || VAR_0->invalidated) {

            fn((uint32_t *) VAR_0->dma_ch[0].palette,

                            dest, src, VAR_0->xres, -VAR_6);

            if (addr < start)

                start = addr;

            end = new_addr;

            if (VAR_4 < *VAR_2)

                *VAR_2 = VAR_4;

            if (VAR_4 >= *VAR_3)

                *VAR_3 = VAR_4 + 1;

        }

        addr = new_addr;

        VAR_7[0] = VAR_7[1];

        src += VAR_5;

        dest += VAR_0->VAR_6;

    }



    if (end > start)

        cpu_physical_memory_reset_dirty(start, end, VGA_DIRTY_FLAG);

}

static void FUNC_0(struct pxa2xx_lcdc_s *VAR_0,
uint8_t *VAR_1, int *VAR_2, int *VAR_3)
{ int VAR_4, VAR_5, VAR_6, VAR_7[2]; uint8_t *src, *dest; ram_addr_t x, addr, new_addr, start, end; drawfn fn = 0; if (VAR_0->VAR_6)
fn = VAR_0->line_fn[VAR_0->transp][VAR_0->bpp]; if (!fn)
return; src = VAR_1; VAR_5 = (VAR_0->xres + 3) & ~3; if (VAR_0->bpp == pxa_lcdc_19pbpp || VAR_0->bpp == pxa_lcdc_18pbpp)
VAR_5 *= 3; else if (VAR_0->bpp > pxa_lcdc_16bpp)
VAR_5 *= 4; else if (VAR_0->bpp > pxa_lcdc_8bpp)
VAR_5 *= 2; VAR_6 = VAR_0->yres * VAR_0->VAR_6; dest = ds_get_data(VAR_0->ds) + VAR_6 * (VAR_0->xres - 1); addr = (ram_addr_t) (VAR_1 - phys_ram_base); start = addr + VAR_0->yres * VAR_5; end = addr; VAR_7[0] = VAR_7[1] = cpu_physical_memory_get_dirty(start, VGA_DIRTY_FLAG); for (VAR_4 = 0; VAR_4 < VAR_0->yres; VAR_4 ++) { new_addr = addr + VAR_5; for (x = addr + TARGET_PAGE_SIZE; x < new_addr; x += TARGET_PAGE_SIZE) { VAR_7[1] = cpu_physical_memory_get_dirty(x, VGA_DIRTY_FLAG); VAR_7[0] |= VAR_7[1]; } if (VAR_7[0] || VAR_0->invalidated) { fn((uint32_t *) VAR_0->dma_ch[0].palette,
dest, src, VAR_0->xres, -VAR_6); if (addr < start)
start = addr; end = new_addr; if (VAR_4 < *VAR_2)
*VAR_2 = VAR_4; if (VAR_4 >= *VAR_3)
*VAR_3 = VAR_4 + 1; } addr = new_addr; VAR_7[0] = VAR_7[1]; src += VAR_5; dest += VAR_0->VAR_6; } if (end > start)
cpu_physical_memory_reset_dirty(start, end, VGA_DIRTY_FLAG); }