aboutsummaryrefslogtreecommitdiff
path: root/hw/display/sm501_template.h
diff options
context:
space:
mode:
authorBALATON Zoltan <balaton@eik.bme.hu>2017-04-21 17:18:09 +0200
committerPeter Maydell <peter.maydell@linaro.org>2017-04-24 12:32:12 +0100
commit6a2a5aae02b9a0b53807b9ad91f15cd4988781f9 (patch)
treecbd408e8bf03553a6dd13c223fe02f6d00285ddc /hw/display/sm501_template.h
parentafef2e1d537dce002f15ab12d85e99baaa7b6651 (diff)
sm501: Fix hardware cursor
Rework HWC handling to simplify it and fix cursor not updating on screen as needed. Previously cursor was not updated because checking for changes in a line overrode the update flag set for the cursor but fixing this is not enough because the cursor should also be updated if its shape or location changes. Introduce hwc_invalidate() function to handle that similar to other display controller models. Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Tested-by: Aurelien Jarno <aurelien@aurel32.net> Message-id: 6970a5e9868b7246656c1d02038dc5d5fa369507.1492787889.git.balaton@eik.bme.hu Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/display/sm501_template.h')
-rw-r--r--hw/display/sm501_template.h25
1 files changed, 10 insertions, 15 deletions
diff --git a/hw/display/sm501_template.h b/hw/display/sm501_template.h
index 54807bdc6e..fa0d6a92c0 100644
--- a/hw/display/sm501_template.h
+++ b/hw/display/sm501_template.h
@@ -92,29 +92,24 @@ static void glue(draw_line32_, PIXEL_NAME)(
/**
* Draw hardware cursor image on the given line.
*/
-static void glue(draw_hwc_line_, PIXEL_NAME)(SM501State *s, int crt,
- uint8_t *palette, int c_y, uint8_t *d, int width)
+static void glue(draw_hwc_line_, PIXEL_NAME)(uint8_t *d, const uint8_t *s,
+ int width, const uint8_t *palette, int c_x, int c_y)
{
- int x, i;
- uint8_t *pixval, bitset = 0;
-
- /* get hardware cursor pattern */
- uint32_t cursor_addr = get_hwc_address(s, crt);
- assert(0 <= c_y && c_y < SM501_HWC_HEIGHT);
- cursor_addr += SM501_HWC_WIDTH * c_y / 4; /* 4 pixels per byte */
- pixval = s->local_mem + cursor_addr;
+ int i;
+ uint8_t bitset = 0;
/* get cursor position */
- x = get_hwc_x(s, crt);
- d += x * BPP;
+ assert(0 <= c_y && c_y < SM501_HWC_HEIGHT);
+ s += SM501_HWC_WIDTH * c_y / 4; /* 4 pixels per byte */
+ d += c_x * BPP;
- for (i = 0; i < SM501_HWC_WIDTH && x + i < width; i++) {
+ for (i = 0; i < SM501_HWC_WIDTH && c_x + i < width; i++) {
uint8_t v;
/* get pixel value */
if (i % 4 == 0) {
- bitset = ldub_p(pixval);
- pixval++;
+ bitset = ldub_p(s);
+ s++;
}
v = bitset & 3;
bitset >>= 2;