diff options
author | Vladimir Chtchetkine <vchtchetkine@google.com> | 2010-12-14 09:24:02 -0800 |
---|---|---|
committer | Vladimir Chtchetkine <vchtchetkine@google.com> | 2010-12-14 09:24:02 -0800 |
commit | 72d83df9865cf8f5393a41fc3f6e283ab6aaa81b (patch) | |
tree | c54836b9d2bfd7eb97b1dd4970ae6c50983b1e7f | |
parent | 5c01a94e9233796c7e8c370d348c945390a36068 (diff) | |
download | external_qemu-72d83df9865cf8f5393a41fc3f6e283ab6aaa81b.zip external_qemu-72d83df9865cf8f5393a41fc3f6e283ab6aaa81b.tar.gz external_qemu-72d83df9865cf8f5393a41fc3f6e283ab6aaa81b.tar.bz2 |
Implement core display deriving it from android display
Core display is a framebuffer client that receives framebuffer updates and dispatches
them to the UI attached to the core.
Change-Id: Iff1e0609cbe66240031e3670934a6796a9ae3b15
-rw-r--r-- | Makefile.android | 1 | ||||
-rw-r--r-- | android/display-core.c | 91 | ||||
-rw-r--r-- | android/display-core.h | 34 | ||||
-rw-r--r-- | vl-android.c | 5 |
4 files changed, 131 insertions, 0 deletions
diff --git a/Makefile.android b/Makefile.android index a8274dd..565aa6a 100644 --- a/Makefile.android +++ b/Makefile.android @@ -1044,6 +1044,7 @@ VL_SOURCES := framebuffer.c \ user-events-qemu.c \ android/looper-qemu.c \ android/looper-generic.c \ + android/display-core.c \ # Add common system libraries # diff --git a/android/display-core.c b/android/display-core.c new file mode 100644 index 0000000..e0574a3 --- /dev/null +++ b/android/display-core.c @@ -0,0 +1,91 @@ +/* Copyright (C) 2010 The Android Open Source Project +** +** This software is licensed under the terms of the GNU General Public +** License version 2, as published by the Free Software Foundation, and +** may be copied, distributed, and modified under those terms. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +*/ + +/* + * Contains extension to android display (see android/display.h|c) that is used + * by the core to communicate display changes to the attached UI + */ + +#include "android/utils/system.h" +#include "android/display-core.h" + +/* Core display descriptor. */ +struct CoreDisplay { + /* Display state for this core display. */ + DisplayState* ds; + + /* Framebuffer for this core display. */ + QFrameBuffer* fb; +}; + +/* One and only one core display instance. */ +static CoreDisplay core_display; + +/* + * Framebuffer calls this routine when it detects changes. This routine will + * initiate a "push" of the framebuffer changes to the UI. + * See QFrameBufferUpdateFunc in framebuffer.h for more info on this callback. + */ +static void +core_display_fb_update(void* opaque, int x, int y, int w, int h) +{ +} + +/* + * Framebuffer callback. See QFrameBufferRotateFunc in framebuffer.h for more + * info on this callback. + */ +static void +core_display_fb_rotate(void* opaque, int rotation) +{ +} + +/* + * Framebuffer callback. See QFrameBufferPollFunc in framebuffer.h for more + * info on this callback. + */ +static void +core_display_fb_poll(void* opaque) +{ + // This will eventually call core_display_fb_update. + qframebuffer_check_updates(); +} + +/* + * Framebuffer callback. See QFrameBufferDoneFunc in framebuffer.h for more + * info on this callback. + */ +static void +core_display_fb_done(void* opaque) +{ +} + +void +core_display_init(DisplayState* ds) +{ + core_display.ds = ds; + /* Create and initialize framebuffer instance that will be used for core + * display. + */ + ANEW0(core_display.fb); + qframebuffer_init(core_display.fb, ds->surface->width, ds->surface->height, + 0, QFRAME_BUFFER_RGB565 ); + qframebuffer_fifo_add(core_display.fb); + /* Register core display as the client for the framebuffer, so we can start + * receiving framebuffer notifications. Note that until UI connects to the + * core all framebuffer callbacks are essentially no-ops. + */ + qframebuffer_add_client(core_display.fb, &core_display, + core_display_fb_update, core_display_fb_rotate, + core_display_fb_poll, core_display_fb_done); + android_display_init(ds, core_display.fb); +} diff --git a/android/display-core.h b/android/display-core.h new file mode 100644 index 0000000..9a44f9a --- /dev/null +++ b/android/display-core.h @@ -0,0 +1,34 @@ +/* Copyright (C) 2010 The Android Open Source Project +** +** This software is licensed under the terms of the GNU General Public +** License version 2, as published by the Free Software Foundation, and +** may be copied, distributed, and modified under those terms. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +*/ + +/* + * Contains extension to android display (see android/display.h|c) that is used + * by the core to communicate display changes to the attached UI + */ + +#ifndef _ANDROID_DISPLAY_CORE_H +#define _ANDROID_DISPLAY_CORE_H + +#include "android/display.h" +#include "framebuffer.h" + +/* Descriptor for a core display instance */ +typedef struct CoreDisplay CoreDisplay; + +/* + * Initializes one and only one instance of a core display. + * Param: + * ds - Display state to use for the core display. + */ +extern void core_display_init(DisplayState* ds); + +#endif /* _ANDROID_DISPLAY_CORE_H */ diff --git a/vl-android.c b/vl-android.c index 6d99d6d..3f658d1 100644 --- a/vl-android.c +++ b/vl-android.c @@ -56,6 +56,7 @@ #include "android/charmap.h" #include "android/globals.h" #include "android/utils/bufprint.h" +#include "android/display-core.h" #include "targphys.h" #include "tcpdump.h" @@ -5344,6 +5345,10 @@ int main(int argc, char **argv, char **envp) case DT_SDL: cocoa_display_init(ds, full_screen); break; +#elif defined(CONFIG_STANDALONE_CORE) + case DT_SDL: + core_display_init(ds); + break; #endif case DT_VNC: vnc_display_init(ds); |