diff options
author | Søren Sandmann Pedersen <ssp@redhat.com> | 2009-03-29 22:30:07 -0400 |
---|---|---|
committer | Søren Sandmann Pedersen <ssp@redhat.com> | 2009-03-29 22:30:07 -0400 |
commit | 4b48daf466e2bacdb4cb84080ea8df9009612693 (patch) | |
tree | e4e9dc38b539ae31d9883c2dde2b984cad18c78e | |
parent | 7be9348dca4fa55289439b045079a9e819bf00e7 (diff) |
TODO; beginning of image hashing; move virtual/phsyical functions to qxl.h
-rw-r--r-- | TODO | 22 | ||||
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/qxl.h | 42 | ||||
-rw-r--r-- | src/qxl_cursor.c | 6 | ||||
-rw-r--r-- | src/qxl_driver.c | 70 | ||||
-rw-r--r-- | src/qxl_image.c | 59 |
6 files changed, 111 insertions, 89 deletions
@@ -104,6 +104,23 @@ for the root pixmap (and in general for the (few) windows that have a pixmap background). + - When copying from pixmap to framebuffer, right now we just copy + the bits from the fb allocated pixmap. + + - With hashing, we need to copy it to video memory, hash it, then set the + "unique" field to that hash value (plus the QXL_CACHE + flag). Presumably we'll get a normal remove on it when it is no + longer in use. + + - If we know an image is available in video memory already, we should just + submit it. There is no race condition here because the image is + ultimately removed from vmem by the driver. + + (Note hash value could probably just be XID plus a serial number). + + - So for the proof of concept we'll be hashing complete pixmaps every time + we submit them. + - Tiles It may be beneficial to send pixmaps in smaller tiles, though Yaniv @@ -182,4 +199,7 @@ Question: - Split out ring code into qxl_ring.c - Don't keep the maps around that are just used in preinit - (Is there any real reason to not just do the CheckDevice in ScreenInit?) + (Is there any real reason to not just do the CheckDevice in + ScreenInit?) + + diff --git a/src/Makefile.am b/src/Makefile.am index 369f311..cb4ce0d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -32,6 +32,7 @@ INCLUDES = -Wall -g qxl_drv_la_SOURCES = \ qxl.h \ qxl_driver.c \ + qxl_image.c \ qxl_ring.c \ qxl_mem.c \ qxl_cursor.c @@ -477,18 +477,6 @@ struct qxl_ram_header { #pragma pack(pop) -struct qxl_ring; - -struct qxl_ring *qxl_ring_create (struct qxl_ring_header *header, - int element_size, - int n_elements, - int prod_notify); -void qxl_ring_push (struct qxl_ring *ring, - const void *element); -Bool qxl_ring_pop (struct qxl_ring *ring, - void *element); -void qxl_ring_wait_idle (struct qxl_ring *ring); - struct _qxlScreen { /* These are the names QXL uses */ @@ -544,4 +532,34 @@ struct _qxlScreen ScrnInfoPtr pScrn; }; +static inline uint64_t +physical_address (qxlScreen *qxl, void *virtual) +{ + return (uint64_t) ((unsigned long)virtual + (((unsigned long)qxl->ram_physical - (unsigned long)qxl->ram))); +} + +static inline void * +virtual_address (qxlScreen *qxl, void *physical) +{ + return (void *) ((unsigned long)physical + ((unsigned long)qxl->ram - (unsigned long)qxl->ram_physical)); +} + +struct qxl_ring; + extern void qxlCursorInit(ScreenPtr pScreen); + +struct qxl_ring *qxl_ring_create (struct qxl_ring_header *header, + int element_size, + int n_elements, + int prod_notify); +void qxl_ring_push (struct qxl_ring *ring, + const void *element); +Bool qxl_ring_pop (struct qxl_ring *ring, + void *element); +void qxl_ring_wait_idle (struct qxl_ring *ring); + +struct qxl_image *make_image (qxlScreen *qxl, const uint8_t *data, + int x, int y, + int width, int height, + int stride); + diff --git a/src/qxl_cursor.c b/src/qxl_cursor.c index 6b00870..2675727 100644 --- a/src/qxl_cursor.c +++ b/src/qxl_cursor.c @@ -24,12 +24,6 @@ #include "qxl.h" #include <cursorstr.h> -static inline uint64_t -physical_address (qxlScreen *qxl, void *virtual) -{ - return (uint64_t) (virtual + (qxl->ram_physical - qxl->ram)); -} - static void push_cursor (qxlScreen *qxl, struct qxl_cursor_cmd *cursor) { diff --git a/src/qxl_driver.c b/src/qxl_driver.c index fd314eb..466d9b0 100644 --- a/src/qxl_driver.c +++ b/src/qxl_driver.c @@ -43,18 +43,6 @@ #endif #define CHECK_POINT() -static inline uint64_t -physical_address (qxlScreen *qxl, void *virtual) -{ - return (uint64_t) ((unsigned long)virtual + (((unsigned long)qxl->ram_physical - (unsigned long)qxl->ram))); -} - -static inline void * -virtual_address (qxlScreen *qxl, void *physical) -{ - return (void *) ((unsigned long)physical + ((unsigned long)qxl->ram - (unsigned long)qxl->ram_physical)); -} - static int garbage_collect (qxlScreen *qxl) { @@ -293,64 +281,6 @@ push_drawable (qxlScreen *qxl, struct qxl_drawable *drawable) qxl_ring_push (qxl->command_ring, &cmd); } -static struct qxl_image * -make_image (qxlScreen *qxl, const uint8_t *data, - int x, int y, - int width, int height, - int stride) -{ - struct qxl_image *image; - struct qxl_data_chunk *chunk; - uint8_t *dest_line; - const uint8_t *src_line; - int dest_stride = width * sizeof (uint32_t); - int i, j; - - data += y * stride + x * sizeof (uint32_t); - - /* Chunk */ - - /* FIXME: Check integer overflow */ - chunk = qxl_allocnf (qxl, sizeof *chunk + height * dest_stride); - - chunk->data_size = height * dest_stride; - chunk->prev_chunk = 0; - chunk->next_chunk = 0; - - for (i = 0; i < height; ++i) - { - dest_line = chunk->data + i * dest_stride; - src_line = data + i * stride; - - for (j = 0; j < width; ++j) - { - uint32_t *s = (uint32_t *)src_line; - uint32_t *d = (uint32_t *)dest_line; - - d[j] = s[j]; - } - } - - /* Image */ - image = qxl_allocnf (qxl, sizeof *image); - - image->descriptor.id = 0; - image->descriptor.type = QXL_IMAGE_TYPE_BITMAP; - image->descriptor.flags = 0; - image->descriptor.width = width; - image->descriptor.height = height; - - image->u.bitmap.format = QXL_BITMAP_FMT_32BIT; - image->u.bitmap.flags = QXL_BITMAP_TOP_DOWN; - image->u.bitmap.x = width; - image->u.bitmap.y = height; - image->u.bitmap.stride = width * sizeof (uint32_t); - image->u.bitmap.palette = 0; - image->u.bitmap.data = physical_address (qxl, chunk); - - return image; -} - static struct qxl_drawable * make_drawable (qxlScreen *qxl, uint8_t type, const struct qxl_rect *rect diff --git a/src/qxl_image.c b/src/qxl_image.c new file mode 100644 index 0000000..c5c2b5e --- /dev/null +++ b/src/qxl_image.c @@ -0,0 +1,59 @@ +#include "qxl.h" + +struct qxl_image * +make_image (qxlScreen *qxl, const uint8_t *data, + int x, int y, + int width, int height, + int stride) +{ + struct qxl_image *image; + struct qxl_data_chunk *chunk; + uint8_t *dest_line; + const uint8_t *src_line; + int dest_stride = width * sizeof (uint32_t); + int i, j; + + data += y * stride + x * sizeof (uint32_t); + + /* Chunk */ + + /* FIXME: Check integer overflow */ + chunk = qxl_allocnf (qxl, sizeof *chunk + height * dest_stride); + + chunk->data_size = height * dest_stride; + chunk->prev_chunk = 0; + chunk->next_chunk = 0; + + for (i = 0; i < height; ++i) + { + dest_line = chunk->data + i * dest_stride; + src_line = data + i * stride; + + for (j = 0; j < width; ++j) + { + uint32_t *s = (uint32_t *)src_line; + uint32_t *d = (uint32_t *)dest_line; + + d[j] = s[j]; + } + } + + /* Image */ + image = qxl_allocnf (qxl, sizeof *image); + + image->descriptor.id = 0; + image->descriptor.type = QXL_IMAGE_TYPE_BITMAP; + image->descriptor.flags = 0; + image->descriptor.width = width; + image->descriptor.height = height; + + image->u.bitmap.format = QXL_BITMAP_FMT_32BIT; + image->u.bitmap.flags = QXL_BITMAP_TOP_DOWN; + image->u.bitmap.x = width; + image->u.bitmap.y = height; + image->u.bitmap.stride = width * sizeof (uint32_t); + image->u.bitmap.palette = 0; + image->u.bitmap.data = physical_address (qxl, chunk); + + return image; +} |