aboutsummaryrefslogtreecommitdiffstats
path: root/console.h
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@android.com>2011-02-02 15:58:45 +0100
committerDavid 'Digit' Turner <digit@android.com>2011-02-02 21:09:41 +0100
commit7a5ee57895822a769f48ab40e590711a2459e2d1 (patch)
tree1c4ff6ef3cc7bd0c944b65385bba8782de35c875 /console.h
parentce747472342237e882369e486254684ab7708362 (diff)
downloadexternal_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 'console.h')
-rw-r--r--console.h35
1 files changed, 34 insertions, 1 deletions
diff --git a/console.h b/console.h
index bfbc71c..eda9207 100644
--- a/console.h
+++ b/console.h
@@ -169,6 +169,19 @@ struct DisplayChangeListener {
struct DisplayChangeListener *next;
};
+#ifdef CONFIG_ANDROID
+/* The problem with DisplayChangeListener is that the callbacks can't
+ * differentiate between different DisplayChangeListeners. Instead of
+ * modifying the type above, which is going to generate conflicts with
+ * upstream changes, we define our own listener type here.
+ */
+typedef struct DisplayUpdateListener {
+ void* opaque;
+ void (*dpy_update)(void* opaque, int x, int y, int w, int h);
+ struct DisplayUpdateListener *next;
+} DisplayUpdateListener;
+#endif
+
struct DisplayAllocator {
DisplaySurface* (*create_displaysurface)(int width, int height);
DisplaySurface* (*resize_displaysurface)(DisplaySurface *surface, int width, int height);
@@ -182,7 +195,9 @@ struct DisplayState {
struct DisplayAllocator* allocator;
struct DisplayChangeListener* listeners;
-
+#ifdef CONFIG_ANDROID
+ struct DisplayUpdateListener* update_listeners;
+#endif
void (*mouse_set)(int x, int y, int on);
void (*cursor_define)(QEMUCursor *cursor);
@@ -233,6 +248,17 @@ static inline void register_displaychangelistener(DisplayState *ds, DisplayChang
ds->listeners = dcl;
}
+#ifdef CONFIG_ANDROID
+static inline void register_displayupdatelistener(DisplayState *ds, DisplayUpdateListener *dul)
+{
+ dul->next = ds->update_listeners;
+ ds->update_listeners = dul;
+}
+
+void unregister_displayupdatelistener(DisplayState *ds, DisplayUpdateListener *dul);
+
+#endif
+
static inline void dpy_update(DisplayState *s, int x, int y, int w, int h)
{
struct DisplayChangeListener *dcl = s->listeners;
@@ -240,6 +266,13 @@ static inline void dpy_update(DisplayState *s, int x, int y, int w, int h)
dcl->dpy_update(s, x, y, w, h);
dcl = dcl->next;
}
+#ifdef CONFIG_ANDROID
+ DisplayUpdateListener* dul = s->update_listeners;
+ while (dul != NULL) {
+ dul->dpy_update(dul->opaque, x, y, w, h);
+ dul = dul->next;
+ }
+#endif
}
static inline void dpy_resize(DisplayState *s)