diff options
author | David 'Digit' Turner <digit@android.com> | 2011-02-02 15:58:45 +0100 |
---|---|---|
committer | David 'Digit' Turner <digit@android.com> | 2011-02-02 21:09:41 +0100 |
commit | 7a5ee57895822a769f48ab40e590711a2459e2d1 (patch) | |
tree | 1c4ff6ef3cc7bd0c944b65385bba8782de35c875 /android/console.c | |
parent | ce747472342237e882369e486254684ab7708362 (diff) | |
download | external_qemu-7a5ee57895822a769f48ab40e590711a2459e2d1.zip external_qemu-7a5ee57895822a769f48ab40e590711a2459e2d1.tar.gz external_qemu-7a5ee57895822a769f48ab40e590711a2459e2d1.tar.bz2 |
Simplify core framebuffer management.
Remove one layer of indirection between the core's DisplayState
and a ProxyFramebuffer object. The main ideas behind this patch
are that:
- We don't need a QFrameBuffer object when in the core process,
each proxy can receive display updates directly from QEMU.
- The DisplayChangeListener is really lame: its can't dissociate
between several listeners that use the same callback pointers,
so introduce DisplayUpdateListener in console.h to work around
this. This is preferably to modifying DisplayChangeListener
which is going to introduce conflicts with upstream.
- Simplify a lot the console code and display-core. Note that
we can have several framebuffer clients at the same time now.
Note that QFrameBuffer is still used by both the UI program and
the standalone emulator.
Change-Id: I6d5ad6ecd9b34b9d9d1a30ea5000e875c285e84e
Diffstat (limited to 'android/console.c')
-rw-r--r-- | android/console.c | 46 |
1 files changed, 7 insertions, 39 deletions
diff --git a/android/console.c b/android/console.c index d776a5c..d883002 100644 --- a/android/console.c +++ b/android/console.c @@ -121,9 +121,6 @@ typedef struct ControlGlobalRec_ /* UI client currently attached to the core. */ ControlClient attached_ui_client = NULL; -/* Core framebuffer service client. */ -ControlClient framebuffer_client = NULL; - /* User events service client. */ ControlClient user_events_client = NULL; @@ -245,15 +242,6 @@ control_client_destroy( ControlClient client ) attached_ui_client = NULL; } - if (client == framebuffer_client) { - ProxyFramebuffer* core_fb = coredisplay_detach_fb_service(); - if (core_fb != NULL) { - proxyFb_destroy(core_fb); - AFREE(core_fb); - } - framebuffer_client = NULL; - } - if (client == user_events_client) { userEventsImpl_destroy(); user_events_client = NULL; @@ -2525,14 +2513,12 @@ destroy_attach_ui_client(void) } } -/* Core display instance. */ -extern CoreDisplay core_display; - static int do_create_framebuffer_service( ControlClient client, char* args ) { ProxyFramebuffer* core_fb; const char* protocol = "-raw"; // Default framebuffer exchange protocol. + char reply_buf[64]; // Protocol type is defined by the arguments passed with the stream switch // command. @@ -2555,38 +2541,20 @@ do_create_framebuffer_service( ControlClient client, char* args ) } } - // Make sure that there are no framebuffer client already existing. - if (framebuffer_client != NULL) { - control_write( client, "KO: Another framebuffer service is already existing!\r\n" ); - control_client_destroy(client); - return -1; - } - - core_fb = proxyFb_create(client->sock, protocol, coredisplay_get_framebuffer()); - if (!coredisplay_attach_fb_service(core_fb)) { - char reply_buf[4096]; - framebuffer_client = client; - // Reply "OK" with the framebuffer's bits per pixel - snprintf(reply_buf, sizeof(reply_buf), "OK: -bitsperpixel=%d\r\n", - proxyFb_get_bits_per_pixel(core_fb)); - control_write( client, reply_buf); - } else { + core_fb = proxyFb_create(client->sock, protocol); + if (core_fb == NULL) { control_write( client, "KO\r\n" ); control_client_destroy(client); return -1; } + // Reply "OK" with the framebuffer's bits per pixel + snprintf(reply_buf, sizeof(reply_buf), "OK: -bitsperpixel=%d\r\n", + proxyFb_get_bits_per_pixel(core_fb)); + control_write( client, reply_buf); return 0; } -void -destroy_control_fb_client(void) -{ - if (framebuffer_client != NULL) { - control_client_destroy(framebuffer_client); - } -} - static int do_create_user_events_service( ControlClient client, char* args ) { |