summaryrefslogtreecommitdiff
path: root/hw/vigs/vigs_onscreen_server.c
diff options
context:
space:
mode:
authorjinhyung.jo <jinhyung.jo@samsung.com>2015-01-14 19:05:16 +0900
committerjinhyung.jo <jinhyung.jo@samsung.com>2015-01-20 18:03:39 +0900
commitc1636d620372cea284a2cec0299e1ee8d9580965 (patch)
treedabce500f6c9d43b448baa3bf4c673c7bd38d539 /hw/vigs/vigs_onscreen_server.c
parente5f242786a0396f734ea911ee4eba9ecc7969ba3 (diff)
downloadqemu-c1636d620372cea284a2cec0299e1ee8d9580965.tar.gz
qemu-c1636d620372cea284a2cec0299e1ee8d9580965.tar.bz2
qemu-c1636d620372cea284a2cec0299e1ee8d9580965.zip
Direct Rendering: New feature added
Modified the vigs & the yagl device for the direct rendering Added Qt5 UI for the direct rendering This is a compressed many commits produced by several authors below into one. Change-Id: I455f607c363851c57d0a250f1220ede6027e1ea0 Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com> Signed-off-by: Stanislav Vorobiov <s.vorobiov@samsung.com> Signed-off-by: Vasiliy Ulyanov <v.ulyanov@samsung.com> Signed-off-by: SungMin Ha <sungmin82.ha@samsung.com> Signed-off-by: hyunjin816.lee <hyunjin816.lee@samsung.com> Signed-off-by: Munkyu Im <munkyu.im@samsung.com> Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com> Signed-off-by: Jinhyung Jo <jinhyung.jo@samsung.com>
Diffstat (limited to 'hw/vigs/vigs_onscreen_server.c')
-rw-r--r--hw/vigs/vigs_onscreen_server.c190
1 files changed, 190 insertions, 0 deletions
diff --git a/hw/vigs/vigs_onscreen_server.c b/hw/vigs/vigs_onscreen_server.c
new file mode 100644
index 0000000000..7fcc352b33
--- /dev/null
+++ b/hw/vigs/vigs_onscreen_server.c
@@ -0,0 +1,190 @@
+/*
+ * vigs
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "vigs_onscreen_server.h"
+#include "vigs_backend.h"
+#include "vigs_log.h"
+#include "work_queue.h"
+
+static bool vigs_onscreen_server_begin_update(struct vigs_server *server,
+ bool is_capturing,
+ bool force)
+{
+ struct vigs_onscreen_server *onscreen_server =
+ (struct vigs_onscreen_server*)server;
+
+ qemu_mutex_lock(&onscreen_server->mutex);
+
+ if (force) {
+ ++onscreen_server->invalidate_cnt;
+ }
+
+ if (is_capturing) {
+ /*
+ * If capturing is in progress then just skip this update.
+ */
+ goto out;
+ }
+
+ onscreen_server->updated = false;
+ onscreen_server->composited = false;
+ onscreen_server->dirty = false;
+
+out:
+ qemu_mutex_unlock(&onscreen_server->mutex);
+
+ return false;
+}
+
+static void vigs_onscreen_server_finish_update(struct vigs_server *server,
+ bool composited,
+ bool dirty)
+{
+ struct vigs_onscreen_server *onscreen_server =
+ (struct vigs_onscreen_server*)server;
+
+ qemu_mutex_lock(&onscreen_server->mutex);
+
+ onscreen_server->updated = true;
+ onscreen_server->composited = composited;
+ onscreen_server->dirty = dirty;
+
+ qemu_mutex_unlock(&onscreen_server->mutex);
+
+ qemu_cond_signal(&onscreen_server->cond);
+}
+
+static bool vigs_onscreen_server_display(struct vigs_server *server,
+ bool *displayed)
+{
+ struct vigs_onscreen_server *onscreen_server =
+ (struct vigs_onscreen_server*)server;
+ bool force = false;
+
+ qemu_mutex_lock(&onscreen_server->mutex);
+
+ /*
+ * Wait until rendering is finished.
+ */
+ while (!onscreen_server->updated) {
+ qemu_cond_wait(&onscreen_server->cond, &onscreen_server->mutex);
+ }
+
+ if (onscreen_server->invalidate_cnt > 0) {
+ --onscreen_server->invalidate_cnt;
+ force = true;
+ }
+
+ onscreen_server->updated = false;
+
+ qemu_mutex_unlock(&onscreen_server->mutex);
+
+ *displayed = true;
+
+ if (onscreen_server->dirty) {
+ /*
+ * Software composition took place, finish ASAP and
+ * process captured data.
+ */
+ vigs_server_finish_update_display(server, true);
+ return vigs_server_process_captured(server, force);
+ } else if (onscreen_server->composited) {
+ /*
+ * Hw composition took place, display the content.
+ */
+ server->backend->display(server->backend, NULL);
+ } else if (force) {
+ /*
+ * Nothing happened, but if it's a forced display, then
+ * we should try to display hw stuff first, if there isn't any
+ * then display sw stuff.
+ */
+ if (!server->backend->display(server->backend, NULL)) {
+ vigs_server_finish_update_display(server, false);
+ return vigs_server_process_captured(server, force);
+ }
+ } else {
+ *displayed = false;
+ }
+
+ vigs_server_finish_update_display(server, false);
+
+ return false;
+}
+
+static bool vigs_onscreen_server_capture(struct vigs_server *server,
+ struct vigs_surface *sfc,
+ void *pixels)
+{
+ return server->backend->capture(sfc, pixels);
+}
+
+static void vigs_onscreen_server_destroy(struct vigs_server *server)
+{
+ struct vigs_onscreen_server *onscreen_server =
+ (struct vigs_onscreen_server*)server;
+
+ qemu_cond_destroy(&onscreen_server->cond);
+ qemu_mutex_destroy(&onscreen_server->mutex);
+
+ vigs_server_cleanup(server);
+
+ g_free(server);
+}
+
+struct vigs_server *vigs_onscreen_server_create(uint8_t *vram_ptr,
+ uint8_t *ram_ptr,
+ struct vigs_display_ops *display_ops,
+ struct vigs_capture_ops *capture_ops,
+ void *display_user_data,
+ struct vigs_backend *backend,
+ struct work_queue *render_queue)
+{
+ struct vigs_onscreen_server *server = NULL;
+
+ server = g_malloc0(sizeof(*server));
+
+ if (!vigs_server_init(&server->base, vram_ptr, ram_ptr,
+ display_ops, capture_ops, display_user_data,
+ backend, render_queue)) {
+ g_free(server);
+ return NULL;
+ }
+
+ qemu_mutex_init(&server->mutex);
+ qemu_cond_init(&server->cond);
+
+ server->base.begin_update = &vigs_onscreen_server_begin_update;
+ server->base.finish_update = &vigs_onscreen_server_finish_update;
+ server->base.display = &vigs_onscreen_server_display;
+ server->base.capture = &vigs_onscreen_server_capture;
+ server->base.destroy = &vigs_onscreen_server_destroy;
+
+ return &server->base;
+}