ui/dbus: do not require opengl & gbm
Allow to build & use the DBus display without 3d/GPU acceleration support. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
0e1be59ed9
commit
84a0a2ef0a
@ -1746,8 +1746,8 @@ dbus_display = get_option('dbus_display') \
|
|||||||
error_message: '-display dbus requires glib>=2.64') \
|
error_message: '-display dbus requires glib>=2.64') \
|
||||||
.require(gdbus_codegen.found(),
|
.require(gdbus_codegen.found(),
|
||||||
error_message: gdbus_codegen_error.format('-display dbus')) \
|
error_message: gdbus_codegen_error.format('-display dbus')) \
|
||||||
.require(opengl.found() and gbm.found(),
|
.require(targetos != 'windows',
|
||||||
error_message: '-display dbus requires epoxy/egl and gbm') \
|
error_message: '-display dbus is not available on Windows') \
|
||||||
.allowed()
|
.allowed()
|
||||||
|
|
||||||
have_virtfs = get_option('virtfs') \
|
have_virtfs = get_option('virtfs') \
|
||||||
|
@ -101,7 +101,7 @@ qtests_i386 = \
|
|||||||
'numa-test'
|
'numa-test'
|
||||||
]
|
]
|
||||||
|
|
||||||
if dbus_display
|
if dbus_display and targetos != 'windows'
|
||||||
qtests_i386 += ['dbus-display-test']
|
qtests_i386 += ['dbus-display-test']
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -27,9 +27,11 @@
|
|||||||
#include "dbus.h"
|
#include "dbus.h"
|
||||||
#include <gio/gunixfdlist.h>
|
#include <gio/gunixfdlist.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_OPENGL
|
||||||
#include "ui/shader.h"
|
#include "ui/shader.h"
|
||||||
#include "ui/egl-helpers.h"
|
#include "ui/egl-helpers.h"
|
||||||
#include "ui/egl-context.h"
|
#include "ui/egl-context.h"
|
||||||
|
#endif
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
|
||||||
struct _DBusDisplayListener {
|
struct _DBusDisplayListener {
|
||||||
@ -48,6 +50,7 @@ struct _DBusDisplayListener {
|
|||||||
|
|
||||||
G_DEFINE_TYPE(DBusDisplayListener, dbus_display_listener, G_TYPE_OBJECT)
|
G_DEFINE_TYPE(DBusDisplayListener, dbus_display_listener, G_TYPE_OBJECT)
|
||||||
|
|
||||||
|
#ifdef CONFIG_OPENGL
|
||||||
static void dbus_update_gl_cb(GObject *source_object,
|
static void dbus_update_gl_cb(GObject *source_object,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
@ -229,12 +232,14 @@ static void dbus_gl_refresh(DisplayChangeListener *dcl)
|
|||||||
ddl->gl_updates = 0;
|
ddl->gl_updates = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void dbus_refresh(DisplayChangeListener *dcl)
|
static void dbus_refresh(DisplayChangeListener *dcl)
|
||||||
{
|
{
|
||||||
graphic_hw_update(dcl->con);
|
graphic_hw_update(dcl->con);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_OPENGL
|
||||||
static void dbus_gl_gfx_update(DisplayChangeListener *dcl,
|
static void dbus_gl_gfx_update(DisplayChangeListener *dcl,
|
||||||
int x, int y, int w, int h)
|
int x, int y, int w, int h)
|
||||||
{
|
{
|
||||||
@ -242,6 +247,7 @@ static void dbus_gl_gfx_update(DisplayChangeListener *dcl,
|
|||||||
|
|
||||||
ddl->gl_updates++;
|
ddl->gl_updates++;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void dbus_gfx_update(DisplayChangeListener *dcl,
|
static void dbus_gfx_update(DisplayChangeListener *dcl,
|
||||||
int x, int y, int w, int h)
|
int x, int y, int w, int h)
|
||||||
@ -296,6 +302,7 @@ static void dbus_gfx_update(DisplayChangeListener *dcl,
|
|||||||
DBUS_DEFAULT_TIMEOUT, NULL, NULL, NULL);
|
DBUS_DEFAULT_TIMEOUT, NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_OPENGL
|
||||||
static void dbus_gl_gfx_switch(DisplayChangeListener *dcl,
|
static void dbus_gl_gfx_switch(DisplayChangeListener *dcl,
|
||||||
struct DisplaySurface *new_surface)
|
struct DisplaySurface *new_surface)
|
||||||
{
|
{
|
||||||
@ -311,6 +318,7 @@ static void dbus_gl_gfx_switch(DisplayChangeListener *dcl,
|
|||||||
width, height, 0, 0, width, height);
|
width, height, 0, 0, width, height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void dbus_gfx_switch(DisplayChangeListener *dcl,
|
static void dbus_gfx_switch(DisplayChangeListener *dcl,
|
||||||
struct DisplaySurface *new_surface)
|
struct DisplaySurface *new_surface)
|
||||||
@ -361,6 +369,7 @@ static void dbus_cursor_define(DisplayChangeListener *dcl,
|
|||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_OPENGL
|
||||||
const DisplayChangeListenerOps dbus_gl_dcl_ops = {
|
const DisplayChangeListenerOps dbus_gl_dcl_ops = {
|
||||||
.dpy_name = "dbus-gl",
|
.dpy_name = "dbus-gl",
|
||||||
.dpy_gfx_update = dbus_gl_gfx_update,
|
.dpy_gfx_update = dbus_gl_gfx_update,
|
||||||
@ -378,6 +387,7 @@ const DisplayChangeListenerOps dbus_gl_dcl_ops = {
|
|||||||
.dpy_gl_release_dmabuf = dbus_release_dmabuf,
|
.dpy_gl_release_dmabuf = dbus_release_dmabuf,
|
||||||
.dpy_gl_update = dbus_scanout_update,
|
.dpy_gl_update = dbus_scanout_update,
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
const DisplayChangeListenerOps dbus_dcl_ops = {
|
const DisplayChangeListenerOps dbus_dcl_ops = {
|
||||||
.dpy_name = "dbus",
|
.dpy_name = "dbus",
|
||||||
@ -406,11 +416,12 @@ dbus_display_listener_constructed(GObject *object)
|
|||||||
{
|
{
|
||||||
DBusDisplayListener *ddl = DBUS_DISPLAY_LISTENER(object);
|
DBusDisplayListener *ddl = DBUS_DISPLAY_LISTENER(object);
|
||||||
|
|
||||||
|
ddl->dcl.ops = &dbus_dcl_ops;
|
||||||
|
#ifdef CONFIG_OPENGL
|
||||||
if (display_opengl) {
|
if (display_opengl) {
|
||||||
ddl->dcl.ops = &dbus_gl_dcl_ops;
|
ddl->dcl.ops = &dbus_gl_dcl_ops;
|
||||||
} else {
|
|
||||||
ddl->dcl.ops = &dbus_dcl_ops;
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
G_OBJECT_CLASS(dbus_display_listener_parent_class)->constructed(object);
|
G_OBJECT_CLASS(dbus_display_listener_parent_class)->constructed(object);
|
||||||
}
|
}
|
||||||
|
@ -30,8 +30,10 @@
|
|||||||
#include "qom/object_interfaces.h"
|
#include "qom/object_interfaces.h"
|
||||||
#include "sysemu/sysemu.h"
|
#include "sysemu/sysemu.h"
|
||||||
#include "ui/dbus-module.h"
|
#include "ui/dbus-module.h"
|
||||||
|
#ifdef CONFIG_OPENGL
|
||||||
#include "ui/egl-helpers.h"
|
#include "ui/egl-helpers.h"
|
||||||
#include "ui/egl-context.h"
|
#include "ui/egl-context.h"
|
||||||
|
#endif
|
||||||
#include "audio/audio.h"
|
#include "audio/audio.h"
|
||||||
#include "audio/audio_int.h"
|
#include "audio/audio_int.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
@ -41,6 +43,7 @@
|
|||||||
|
|
||||||
static DBusDisplay *dbus_display;
|
static DBusDisplay *dbus_display;
|
||||||
|
|
||||||
|
#ifdef CONFIG_OPENGL
|
||||||
static QEMUGLContext dbus_create_context(DisplayGLCtx *dgc,
|
static QEMUGLContext dbus_create_context(DisplayGLCtx *dgc,
|
||||||
QEMUGLParams *params)
|
QEMUGLParams *params)
|
||||||
{
|
{
|
||||||
@ -84,6 +87,7 @@ static const DisplayGLCtxOps dbus_gl_ops = {
|
|||||||
.dpy_gl_ctx_destroy_texture = dbus_destroy_texture,
|
.dpy_gl_ctx_destroy_texture = dbus_destroy_texture,
|
||||||
.dpy_gl_ctx_update_texture = dbus_update_texture,
|
.dpy_gl_ctx_update_texture = dbus_update_texture,
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
static NotifierList dbus_display_notifiers =
|
static NotifierList dbus_display_notifiers =
|
||||||
NOTIFIER_LIST_INITIALIZER(dbus_display_notifiers);
|
NOTIFIER_LIST_INITIALIZER(dbus_display_notifiers);
|
||||||
@ -112,10 +116,12 @@ dbus_display_init(Object *o)
|
|||||||
DBusDisplay *dd = DBUS_DISPLAY(o);
|
DBusDisplay *dd = DBUS_DISPLAY(o);
|
||||||
g_autoptr(GDBusObjectSkeleton) vm = NULL;
|
g_autoptr(GDBusObjectSkeleton) vm = NULL;
|
||||||
|
|
||||||
|
#ifdef CONFIG_OPENGL
|
||||||
dd->glctx.ops = &dbus_gl_ops;
|
dd->glctx.ops = &dbus_gl_ops;
|
||||||
if (display_opengl) {
|
if (display_opengl) {
|
||||||
dd->glctx.gls = qemu_gl_init_shader();
|
dd->glctx.gls = qemu_gl_init_shader();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
dd->iface = qemu_dbus_display1_vm_skeleton_new();
|
dd->iface = qemu_dbus_display1_vm_skeleton_new();
|
||||||
dd->consoles = g_ptr_array_new_with_free_func(g_object_unref);
|
dd->consoles = g_ptr_array_new_with_free_func(g_object_unref);
|
||||||
|
|
||||||
@ -152,7 +158,9 @@ dbus_display_finalize(Object *o)
|
|||||||
g_clear_object(&dd->iface);
|
g_clear_object(&dd->iface);
|
||||||
g_free(dd->dbus_addr);
|
g_free(dd->dbus_addr);
|
||||||
g_free(dd->audiodev);
|
g_free(dd->audiodev);
|
||||||
|
#ifdef CONFIG_OPENGL
|
||||||
g_clear_pointer(&dd->glctx.gls, qemu_gl_fini_shader);
|
g_clear_pointer(&dd->glctx.gls, qemu_gl_fini_shader);
|
||||||
|
#endif
|
||||||
dbus_display = NULL;
|
dbus_display = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ if dbus_display
|
|||||||
'--generate-c-code', '@BASENAME@'])
|
'--generate-c-code', '@BASENAME@'])
|
||||||
dbus_display1_lib = static_library('dbus-display1', dbus_display1, dependencies: gio)
|
dbus_display1_lib = static_library('dbus-display1', dbus_display1, dependencies: gio)
|
||||||
dbus_display1_dep = declare_dependency(link_with: dbus_display1_lib, include_directories: include_directories('.'))
|
dbus_display1_dep = declare_dependency(link_with: dbus_display1_lib, include_directories: include_directories('.'))
|
||||||
dbus_ss.add(when: [gio, pixman, opengl, gbm, dbus_display1_dep],
|
dbus_ss.add(when: [gio, pixman, dbus_display1_dep],
|
||||||
if_true: [files(
|
if_true: [files(
|
||||||
'dbus-chardev.c',
|
'dbus-chardev.c',
|
||||||
'dbus-clipboard.c',
|
'dbus-clipboard.c',
|
||||||
@ -93,7 +93,7 @@ if dbus_display
|
|||||||
'dbus-error.c',
|
'dbus-error.c',
|
||||||
'dbus-listener.c',
|
'dbus-listener.c',
|
||||||
'dbus.c',
|
'dbus.c',
|
||||||
)])
|
), opengl, gbm])
|
||||||
ui_modules += {'dbus' : dbus_ss}
|
ui_modules += {'dbus' : dbus_ss}
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user