xref: /openbmc/qemu/ui/dbus.h (revision 142ca628)
1*142ca628SMarc-André Lureau /*
2*142ca628SMarc-André Lureau  * QEMU DBus display
3*142ca628SMarc-André Lureau  *
4*142ca628SMarc-André Lureau  * Copyright (c) 2021 Marc-André Lureau <marcandre.lureau@redhat.com>
5*142ca628SMarc-André Lureau  *
6*142ca628SMarc-André Lureau  * Permission is hereby granted, free of charge, to any person obtaining a copy
7*142ca628SMarc-André Lureau  * of this software and associated documentation files (the "Software"), to deal
8*142ca628SMarc-André Lureau  * in the Software without restriction, including without limitation the rights
9*142ca628SMarc-André Lureau  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10*142ca628SMarc-André Lureau  * copies of the Software, and to permit persons to whom the Software is
11*142ca628SMarc-André Lureau  * furnished to do so, subject to the following conditions:
12*142ca628SMarc-André Lureau  *
13*142ca628SMarc-André Lureau  * The above copyright notice and this permission notice shall be included in
14*142ca628SMarc-André Lureau  * all copies or substantial portions of the Software.
15*142ca628SMarc-André Lureau  *
16*142ca628SMarc-André Lureau  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17*142ca628SMarc-André Lureau  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18*142ca628SMarc-André Lureau  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19*142ca628SMarc-André Lureau  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20*142ca628SMarc-André Lureau  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21*142ca628SMarc-André Lureau  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22*142ca628SMarc-André Lureau  * THE SOFTWARE.
23*142ca628SMarc-André Lureau  */
24*142ca628SMarc-André Lureau #ifndef UI_DBUS_H_
25*142ca628SMarc-André Lureau #define UI_DBUS_H_
26*142ca628SMarc-André Lureau 
27*142ca628SMarc-André Lureau #include "qemu/dbus.h"
28*142ca628SMarc-André Lureau #include "qom/object.h"
29*142ca628SMarc-André Lureau #include "ui/console.h"
30*142ca628SMarc-André Lureau 
31*142ca628SMarc-André Lureau #include "dbus-display1.h"
32*142ca628SMarc-André Lureau 
33*142ca628SMarc-André Lureau struct DBusDisplay {
34*142ca628SMarc-André Lureau     Object parent;
35*142ca628SMarc-André Lureau 
36*142ca628SMarc-André Lureau     DisplayGLMode gl_mode;
37*142ca628SMarc-André Lureau     char *dbus_addr;
38*142ca628SMarc-André Lureau     DisplayGLCtx glctx;
39*142ca628SMarc-André Lureau 
40*142ca628SMarc-André Lureau     GDBusConnection *bus;
41*142ca628SMarc-André Lureau     GDBusObjectManagerServer *server;
42*142ca628SMarc-André Lureau     QemuDBusDisplay1VM *iface;
43*142ca628SMarc-André Lureau     GPtrArray *consoles;
44*142ca628SMarc-André Lureau };
45*142ca628SMarc-André Lureau 
46*142ca628SMarc-André Lureau #define TYPE_DBUS_DISPLAY "dbus-display"
47*142ca628SMarc-André Lureau OBJECT_DECLARE_SIMPLE_TYPE(DBusDisplay, DBUS_DISPLAY)
48*142ca628SMarc-André Lureau 
49*142ca628SMarc-André Lureau #define DBUS_DISPLAY_TYPE_CONSOLE dbus_display_console_get_type()
50*142ca628SMarc-André Lureau G_DECLARE_FINAL_TYPE(DBusDisplayConsole,
51*142ca628SMarc-André Lureau                      dbus_display_console,
52*142ca628SMarc-André Lureau                      DBUS_DISPLAY,
53*142ca628SMarc-André Lureau                      CONSOLE,
54*142ca628SMarc-André Lureau                      GDBusObjectSkeleton)
55*142ca628SMarc-André Lureau 
56*142ca628SMarc-André Lureau DBusDisplayConsole *
57*142ca628SMarc-André Lureau dbus_display_console_new(DBusDisplay *display, QemuConsole *con);
58*142ca628SMarc-André Lureau 
59*142ca628SMarc-André Lureau int
60*142ca628SMarc-André Lureau dbus_display_console_get_index(DBusDisplayConsole *ddc);
61*142ca628SMarc-André Lureau 
62*142ca628SMarc-André Lureau #define DBUS_DISPLAY_TYPE_LISTENER dbus_display_listener_get_type()
63*142ca628SMarc-André Lureau G_DECLARE_FINAL_TYPE(DBusDisplayListener,
64*142ca628SMarc-André Lureau                      dbus_display_listener,
65*142ca628SMarc-André Lureau                      DBUS_DISPLAY,
66*142ca628SMarc-André Lureau                      LISTENER,
67*142ca628SMarc-André Lureau                      GObject)
68*142ca628SMarc-André Lureau 
69*142ca628SMarc-André Lureau DBusDisplayListener *
70*142ca628SMarc-André Lureau dbus_display_listener_new(const char *bus_name,
71*142ca628SMarc-André Lureau                           GDBusConnection *conn,
72*142ca628SMarc-André Lureau                           DBusDisplayConsole *console);
73*142ca628SMarc-André Lureau 
74*142ca628SMarc-André Lureau DBusDisplayConsole *
75*142ca628SMarc-André Lureau dbus_display_listener_get_console(DBusDisplayListener *ddl);
76*142ca628SMarc-André Lureau 
77*142ca628SMarc-André Lureau const char *
78*142ca628SMarc-André Lureau dbus_display_listener_get_bus_name(DBusDisplayListener *ddl);
79*142ca628SMarc-André Lureau 
80*142ca628SMarc-André Lureau extern const DisplayChangeListenerOps dbus_gl_dcl_ops;
81*142ca628SMarc-André Lureau extern const DisplayChangeListenerOps dbus_dcl_ops;
82*142ca628SMarc-André Lureau 
83*142ca628SMarc-André Lureau #endif /* UI_DBUS_H_ */
84