diff options
author | Soren Sandmann <ssp@localhost.localdomain> | 2010-04-13 04:54:59 -0400 |
---|---|---|
committer | Soren Sandmann <ssp@localhost.localdomain> | 2010-04-13 04:54:59 -0400 |
commit | 1ef8b341cda9e4d378a0d9b65fc3fa03cfd084c5 (patch) | |
tree | 03bd1b96b3e7ed1b71580182a5d6bb9edfa8bcfe | |
parent | f59d71a94323adcff6d9a9495f5ae336dc5918f0 (diff) |
Add memslot arguments to virtual_ and physical_address
-rw-r--r-- | src/qxl.h | 40 | ||||
-rw-r--r-- | src/qxl_cursor.c | 4 | ||||
-rw-r--r-- | src/qxl_driver.c | 8 | ||||
-rw-r--r-- | src/qxl_image.c | 6 |
4 files changed, 47 insertions, 11 deletions
@@ -479,6 +479,21 @@ struct qxl_ram_header { typedef struct _qxl_screen_t qxl_screen_t; +typedef struct +{ + uint8_t generation; + uint64_t start_phys_addr; + uint64_t end_phys_addr; + uint64_t start_virt_addr; + uint64_t end_virt_addr; +} qxl_memslot_t; + +typedef struct +{ + qxl_memslot_t slot; + uint64_t high_bits; +} qxl_pmemslot_t; + struct _qxl_screen_t { /* These are the names QXL uses */ @@ -531,18 +546,39 @@ struct _qxl_screen_t int16_t hot_y; ScrnInfoPtr pScrn; + + qxl_pmemslot_t * mem_slots; + uint8_t n_mem_slots; + uint8_t main_mem_slot; + uint8_t slot_id_bits; + uint8_t slot_gen_bits; + uint64_t va_slot_mask; }; static inline uint64_t -physical_address (qxl_screen_t *qxl, void *virtual) +physical_address (qxl_screen_t *qxl, void *virtual, uint8_t slot_id) { + qxl_pmemslot_t *p_slot = &(qxl->mem_slots[slot_id]); + + return p_slot->high_bits | ((unsigned long)virtual - p_slot->slot.start_virt_addr); +#if 0 return (uint64_t) ((unsigned long)virtual + (((unsigned long)qxl->ram_physical - (unsigned long)qxl->ram))); +#endif } static inline void * -virtual_address (qxl_screen_t *qxl, void *physical) +virtual_address (qxl_screen_t *qxl, void *physical, uint8_t slot_id) { + qxl_pmemslot_t *p_slot = &(qxl->mem_slots[slot_id]); + unsigned long virt; + + virt = ((unsigned long)physical) & qxl->va_slot_mask; + virt += p_slot->slot.start_virt_addr; + + return (void *)virt; +#if 0 return (void *) ((unsigned long)physical + ((unsigned long)qxl->ram - (unsigned long)qxl->ram_physical)); +#endif } static inline void * diff --git a/src/qxl_cursor.c b/src/qxl_cursor.c index 54e8948..b161542 100644 --- a/src/qxl_cursor.c +++ b/src/qxl_cursor.c @@ -33,7 +33,7 @@ push_cursor (qxl_screen_t *qxl, struct qxl_cursor_cmd *cursor) if (qxl->rom->mode != ~0) { cmd.type = QXL_CMD_CURSOR; - cmd.data = physical_address (qxl, cursor); + cmd.data = physical_address (qxl, cursor, qxl->main_mem_slot); qxl_ring_push (qxl->cursor_ring, &cmd); } @@ -127,7 +127,7 @@ qxl_load_cursor_argb (ScrnInfoPtr pScrn, CursorPtr pCurs) cmd->type = QXL_CURSOR_SET; cmd->u.set.position.x = qxl->cur_x + qxl->hot_x; cmd->u.set.position.y = qxl->cur_y + qxl->hot_y; - cmd->u.set.shape = physical_address (qxl, cursor); + cmd->u.set.shape = physical_address (qxl, cursor, qxl->main_mem_slot); cmd->u.set.visible = TRUE; push_cursor(qxl, cmd); diff --git a/src/qxl_driver.c b/src/qxl_driver.c index 187e581..372688c 100644 --- a/src/qxl_driver.c +++ b/src/qxl_driver.c @@ -71,14 +71,14 @@ garbage_collect (qxl_screen_t *qxl) if (is_cursor && cmd->type == QXL_CURSOR_SET) { struct qxl_cursor *cursor = (void *)virtual_address ( - qxl, u64_to_pointer (cmd->u.set.shape)); + qxl, u64_to_pointer (cmd->u.set.shape), qxl->main_mem_slot); qxl_free (qxl->mem, cursor); } else if (!is_cursor && drawable->type == QXL_DRAW_COPY) { struct qxl_image *image = virtual_address ( - qxl, u64_to_pointer (drawable->u.copy.src_bitmap)); + qxl, u64_to_pointer (drawable->u.copy.src_bitmap), qxl->main_mem_slot); qxl_image_destroy (qxl, image); } @@ -336,7 +336,7 @@ push_drawable (qxl_screen_t *qxl, struct qxl_drawable *drawable) if (qxl->rom->mode != ~0) { cmd.type = QXL_CMD_DRAW; - cmd.data = physical_address (qxl, drawable); + cmd.data = physical_address (qxl, drawable, qxl->main_mem_slot); qxl_ring_push (qxl->command_ring, &cmd); } @@ -467,7 +467,7 @@ submit_copy (qxl_screen_t *qxl, const struct qxl_rect *rect) qxl, qxl_image_create (qxl, qxl->fb, rect->left, rect->top, rect->right - rect->left, rect->bottom - rect->top, - pScrn->displayWidth * qxl->bytes_per_pixel)); + pScrn->displayWidth * qxl->bytes_per_pixel), qxl->main_mem_slot); drawable->u.copy.src_area = *rect; translate_rect (&drawable->u.copy.src_area); drawable->u.copy.rop_descriptor = ROPD_OP_PUT; diff --git a/src/qxl_image.c b/src/qxl_image.c index d87e378..147cc18 100644 --- a/src/qxl_image.c +++ b/src/qxl_image.c @@ -124,7 +124,7 @@ qxl_image_create (qxl_screen_t *qxl, const uint8_t *data, const uint8_t *src_line = data + i * stride; uint32_t *dest_line; - chunk = virtual_address (qxl, u64_to_pointer (info->image->u.bitmap.data)); + chunk = virtual_address (qxl, u64_to_pointer (info->image->u.bitmap.data), qxl->main_mem_slot); dest_line = (uint32_t *)chunk->data + width * i; @@ -193,7 +193,7 @@ qxl_image_create (qxl_screen_t *qxl, const uint8_t *data, image->u.bitmap.y = height; image->u.bitmap.stride = width * qxl->bytes_per_pixel; image->u.bitmap.palette = 0; - image->u.bitmap.data = physical_address (qxl, chunk); + image->u.bitmap.data = physical_address (qxl, chunk, qxl->main_mem_slot); #if 0 ErrorF ("%p has size %d %d\n", image, width, height); @@ -224,7 +224,7 @@ qxl_image_destroy (qxl_screen_t *qxl, struct qxl_data_chunk *chunk; image_info_t *info; - chunk = virtual_address (qxl, u64_to_pointer (image->u.bitmap.data)); + chunk = virtual_address (qxl, u64_to_pointer (image->u.bitmap.data), qxl->main_mem_slot); info = lookup_image_info (image->descriptor.id, image->descriptor.width, |