[Spice-devel,RFC] server: api: add spice_qxl_* calls based on QXLWorker contents

Submitted by Alon Levy on July 19, 2011, 8:08 p.m.

Details

Message ID 1311080884-12455-1-git-send-email-alevy@redhat.com
State New, archived
Headers show

Not browsing as part of any series.

Commit Message

Alon Levy July 19, 2011, 8:08 p.m.
For each callback in QXLWorker, for example QXLWorker::update_area, add
a direct call named spice_qxl_update_area.

This will (a) remove the pointless indirection and (b) make shared
library versioning alot easier as we'll get new linker symbols which
we can tag with the version they appeared in the shared library.
---
 server/red_dispatcher.c |   95 +++++++++++++++++++++++++++++++++++++++++++++++
 server/spice.h          |   19 +++++++++
 2 files changed, 114 insertions(+), 0 deletions(-)

Patch hide | download patch | download mbox

diff --git a/server/red_dispatcher.c b/server/red_dispatcher.c
index 56446ab..d96f01c 100644
--- a/server/red_dispatcher.c
+++ b/server/red_dispatcher.c
@@ -482,6 +482,101 @@  uint32_t red_dispatcher_qxl_ram_size(void)
     return qxl_info.qxl_ram_size;
 }
 
+SPICE_GNUC_VISIBLE
+void spice_qxl_wakeup(QXLWorker *worker)
+{
+    qxl_worker_wakeup(worker);
+}
+
+SPICE_GNUC_VISIBLE
+void spice_qxl_oom(QXLWorker *worker)
+{
+    qxl_worker_oom(worker);
+}
+
+SPICE_GNUC_VISIBLE
+void spice_qxl_start(QXLWorker *worker)
+{
+    qxl_worker_start(worker);
+}
+
+SPICE_GNUC_VISIBLE
+void spice_qxl_stop(QXLWorker *worker)
+{
+    qxl_worker_stop(worker);
+}
+
+SPICE_GNUC_VISIBLE
+void spice_qxl_update_area(QXLWorker *qxl_worker, uint32_t surface_id,
+                    struct QXLRect *area, struct QXLRect *dirty_rects,
+                    uint32_t num_dirty_rects, uint32_t clear_dirty_region)
+{
+    qxl_worker_update_area(qxl_worker, surface_id, area, dirty_rects,
+                           num_dirty_rects, clear_dirty_region);
+}
+
+SPICE_GNUC_VISIBLE
+void spice_qxl_add_memslot(QXLWorker *worker, QXLDevMemSlot *slot)
+{
+    qxl_worker_add_memslot(worker, slot);
+}
+
+SPICE_GNUC_VISIBLE
+void spice_qxl_del_memslot(QXLWorker *worker, uint32_t slot_group_id, uint32_t slot_id)
+{
+    qxl_worker_del_memslot(worker, slot_group_id, slot_id);
+}
+
+SPICE_GNUC_VISIBLE
+void spice_qxl_reset_memslots(QXLWorker *worker)
+{
+    qxl_worker_reset_memslots(worker);
+}
+
+SPICE_GNUC_VISIBLE
+void spice_qxl_destroy_surfaces(QXLWorker *worker)
+{
+    qxl_worker_destroy_surfaces(worker);
+}
+
+SPICE_GNUC_VISIBLE
+void spice_qxl_destroy_primary_surface(QXLWorker *worker, uint32_t surface_id)
+{
+    qxl_worker_destroy_primary(worker, surface_id);
+}
+
+SPICE_GNUC_VISIBLE
+void spice_qxl_create_primary_surface(QXLWorker *worker, uint32_t surface_id,
+                                QXLDevSurfaceCreate *surface)
+{
+    qxl_worker_create_primary(worker, surface_id, surface);
+}
+
+SPICE_GNUC_VISIBLE
+void spice_qxl_reset_image_cache(QXLWorker *worker)
+{
+    qxl_worker_reset_image_cache(worker);
+}
+
+SPICE_GNUC_VISIBLE
+void spice_qxl_reset_cursor(QXLWorker *worker)
+{
+    qxl_worker_reset_cursor(worker);
+}
+
+SPICE_GNUC_VISIBLE
+void spice_qxl_destroy_surface_wait(QXLWorker *worker, uint32_t surface_id)
+{
+    qxl_worker_destroy_surface_wait(worker, surface_id);
+}
+
+SPICE_GNUC_VISIBLE
+void spice_qxl_loadvm_commands(QXLWorker *worker, struct QXLCommandExt *ext, uint32_t count)
+{
+    qxl_worker_loadvm_commands(worker, ext, count);
+}
+
+
 RedDispatcher *red_dispatcher_init(QXLInstance *qxl)
 {
     RedDispatcher *dispatcher;
diff --git a/server/spice.h b/server/spice.h
index f64ff41..196b90b 100644
--- a/server/spice.h
+++ b/server/spice.h
@@ -124,6 +124,25 @@  struct QXLWorker {
     void (*loadvm_commands)(QXLWorker *worker, struct QXLCommandExt *ext, uint32_t count);
 };
 
+void spice_qxl_wakeup(QXLWorker *worker);
+void spice_qxl_oom(QXLWorker *worker);
+void spice_qxl_start(QXLWorker *worker);
+void spice_qxl_stop(QXLWorker *worker);
+void spice_qxl_update_area(QXLWorker *qxl_worker, uint32_t surface_id,
+                   struct QXLRect *area, struct QXLRect *dirty_rects,
+                   uint32_t num_dirty_rects, uint32_t clear_dirty_region);
+void spice_qxl_add_memslot(QXLWorker *worker, QXLDevMemSlot *slot);
+void spice_qxl_del_memslot(QXLWorker *worker, uint32_t slot_group_id, uint32_t slot_id);
+void spice_qxl_reset_memslots(QXLWorker *worker);
+void spice_qxl_destroy_surfaces(QXLWorker *worker);
+void spice_qxl_destroy_primary_surface(QXLWorker *worker, uint32_t surface_id);
+void spice_qxl_create_primary_surface(QXLWorker *worker, uint32_t surface_id,
+                               QXLDevSurfaceCreate *surface);
+void spice_qxl_reset_image_cache(QXLWorker *worker);
+void spice_qxl_reset_cursor(QXLWorker *worker);
+void spice_qxl_destroy_surface_wait(QXLWorker *worker, uint32_t surface_id);
+void spice_qxl_loadvm_commands(QXLWorker *worker, struct QXLCommandExt *ext, uint32_t count);
+
 typedef struct QXLDrawArea {
     uint8_t *buf;
     uint32_t size;

Comments

On 07/19/11 15:08, Alon Levy wrote:
> For each callback in QXLWorker, for example QXLWorker::update_area, add
> a direct call named spice_qxl_update_area.

> +SPICE_GNUC_VISIBLE
> +void spice_qxl_wakeup(QXLWorker *worker)
> +{
> +    qxl_worker_wakeup(worker);
> +}

I think we should better pass in QXLInstance here, so we can deprecate 
QXLWorker altogether.

cheers,
   Gerd
On Tue, Jul 19, 2011 at 03:13:42PM +0200, Gerd Hoffmann wrote:
> On 07/19/11 15:08, Alon Levy wrote:
> >For each callback in QXLWorker, for example QXLWorker::update_area, add
> >a direct call named spice_qxl_update_area.
> 
> >+SPICE_GNUC_VISIBLE
> >+void spice_qxl_wakeup(QXLWorker *worker)
> >+{
> >+    qxl_worker_wakeup(worker);
> >+}
> 
> I think we should better pass in QXLInstance here, so we can
> deprecate QXLWorker altogether.
> 

getting back a RedDispatcher from a given QXLInstance will then require using some hash
or just going over a list, since QXLInstance is created by qemu, there is no "spice" field
for an opaque there, that's what we use QXLWorker for (it is allocated by spice, so it
is wrapped by the RedDispatcher, hence you can get from QXLWorker->RedDispatcher).

> cheers,
>   Gerd
>
On 07/19/11 16:22, Alon Levy wrote:
> On Tue, Jul 19, 2011 at 03:13:42PM +0200, Gerd Hoffmann wrote:
>> On 07/19/11 15:08, Alon Levy wrote:
>>> For each callback in QXLWorker, for example QXLWorker::update_area, add
>>> a direct call named spice_qxl_update_area.
>>
>>> +SPICE_GNUC_VISIBLE
>>> +void spice_qxl_wakeup(QXLWorker *worker)
>>> +{
>>> +    qxl_worker_wakeup(worker);
>>> +}
>>
>> I think we should better pass in QXLInstance here, so we can
>> deprecate QXLWorker altogether.
>>
>
> getting back a RedDispatcher from a given QXLInstance will then require using some hash
> or just going over a list, since QXLInstance is created by qemu, there is no "spice" field
> for an opaque there,

There is a pointer to QXLState (opaque type in the library interface) 
where libspice can stuff in private state data, and it actually has a 
pointer to the dispatcher.  Just use qxl->st->dispatcher.

cheers,
   Gerd