sm501: Get rid of base address in draw_hwc_line
Do not use the base address to access data in local memory. This is in preparation to allow chip connected via PCI where base address depends on where the BAR is mapped so it will be unknown. 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: 79dab21bc6ec4d563aabf265c3bab40e2e95aae8.1492787889.git.balaton@eik.bme.hu Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
ca8a110470
commit
c795fa8447
@ -461,7 +461,6 @@ typedef struct SM501State {
|
|||||||
QemuConsole *con;
|
QemuConsole *con;
|
||||||
|
|
||||||
/* status & internal resources */
|
/* status & internal resources */
|
||||||
hwaddr base;
|
|
||||||
uint32_t local_mem_size_index;
|
uint32_t local_mem_size_index;
|
||||||
uint8_t *local_mem;
|
uint8_t *local_mem;
|
||||||
MemoryRegion local_mem_region;
|
MemoryRegion local_mem_region;
|
||||||
@ -1432,10 +1431,9 @@ static void sm501_reset(SM501State *s)
|
|||||||
s->twoD_control = 0;
|
s->twoD_control = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sm501_init(SM501State *s, DeviceState *dev, uint32_t base,
|
static void sm501_init(SM501State *s, DeviceState *dev,
|
||||||
uint32_t local_mem_bytes)
|
uint32_t local_mem_bytes)
|
||||||
{
|
{
|
||||||
s->base = base;
|
|
||||||
s->local_mem_size_index = get_local_mem_size_index(local_mem_bytes);
|
s->local_mem_size_index = get_local_mem_size_index(local_mem_bytes);
|
||||||
SM501_DPRINTF("sm501 local mem size=%x. index=%d\n", get_local_mem_size(s),
|
SM501_DPRINTF("sm501 local mem size=%x. index=%d\n", get_local_mem_size(s),
|
||||||
s->local_mem_size_index);
|
s->local_mem_size_index);
|
||||||
@ -1489,7 +1487,7 @@ static void sm501_realize_sysbus(DeviceState *dev, Error **errp)
|
|||||||
SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
|
SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
|
||||||
DeviceState *usb_dev;
|
DeviceState *usb_dev;
|
||||||
|
|
||||||
sm501_init(&s->state, dev, s->base, s->vram_size);
|
sm501_init(&s->state, dev, s->vram_size);
|
||||||
if (get_local_mem_size(&s->state) != s->vram_size) {
|
if (get_local_mem_size(&s->state) != s->vram_size) {
|
||||||
error_setg(errp, "Invalid VRAM size, nearest valid size is %" PRIu32,
|
error_setg(errp, "Invalid VRAM size, nearest valid size is %" PRIu32,
|
||||||
get_local_mem_size(&s->state));
|
get_local_mem_size(&s->state));
|
||||||
|
@ -103,13 +103,13 @@ static void glue(draw_hwc_line_, PIXEL_NAME)(SM501State *s, int crt,
|
|||||||
uint8_t *palette, int c_y, uint8_t *d, int width)
|
uint8_t *palette, int c_y, uint8_t *d, int width)
|
||||||
{
|
{
|
||||||
int x, i;
|
int x, i;
|
||||||
uint8_t bitset = 0;
|
uint8_t *pixval, bitset = 0;
|
||||||
|
|
||||||
/* get hardware cursor pattern */
|
/* get hardware cursor pattern */
|
||||||
uint32_t cursor_addr = get_hwc_address(s, crt);
|
uint32_t cursor_addr = get_hwc_address(s, crt);
|
||||||
assert(0 <= c_y && c_y < SM501_HWC_HEIGHT);
|
assert(0 <= c_y && c_y < SM501_HWC_HEIGHT);
|
||||||
cursor_addr += SM501_HWC_WIDTH * c_y / 4; /* 4 pixels per byte */
|
cursor_addr += SM501_HWC_WIDTH * c_y / 4; /* 4 pixels per byte */
|
||||||
cursor_addr += s->base;
|
pixval = s->local_mem + cursor_addr;
|
||||||
|
|
||||||
/* get cursor position */
|
/* get cursor position */
|
||||||
x = get_hwc_x(s, crt);
|
x = get_hwc_x(s, crt);
|
||||||
@ -120,8 +120,8 @@ static void glue(draw_hwc_line_, PIXEL_NAME)(SM501State *s, int crt,
|
|||||||
|
|
||||||
/* get pixel value */
|
/* get pixel value */
|
||||||
if (i % 4 == 0) {
|
if (i % 4 == 0) {
|
||||||
bitset = ldub_phys(&address_space_memory, cursor_addr);
|
bitset = ldub_p(pixval);
|
||||||
cursor_addr++;
|
pixval++;
|
||||||
}
|
}
|
||||||
v = bitset & 3;
|
v = bitset & 3;
|
||||||
bitset >>= 2;
|
bitset >>= 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user