Commit Graph

154 Commits

Author SHA1 Message Date
Christian Hergert
dbcfbe61a6 Merge branch 'bilelmoussaoui/fix-license' into 'main'
fix: Update license content to match used license

Closes #11

See merge request GNOME/libmks!40
2023-09-07 20:29:06 +00:00
Bilal Elmoussaoui
f4ad23a65a build/gi: Stop hardcoding wrong header file name
As we now use link_with, and meson can figure out the rest by itself
2023-09-07 22:02:53 +02:00
Bilal Elmoussaoui
414b26fcd9 build/gi: Split generated sources to public/private
Since the switch to manual-register for gresources, the generated
functions were exposed in the gir file which is something we don't want
2023-09-07 22:02:49 +02:00
Bilal Elmoussaoui
9e13893267 build: Use enabled to check for existance of feature options 2023-09-07 21:31:59 +02:00
Bilal Elmoussaoui
801013ff33 fix: Update license content to match used license
Fixes #11
2023-09-01 10:58:51 +02:00
Bilal Elmoussaoui
efecc90f1f cleanup: Consistently use setters for properties 2023-08-31 18:51:09 +02:00
Christian Hergert
21136f13f3 Merge branch 'bilelmoussaoui/fix-gir-build' into 'main'
build: Fix generating GIR

See merge request GNOME/libmks!39
2023-08-31 16:24:16 +00:00
Christian Hergert
939bfe56f4 Merge branch 'bilelmoussaoui/dbus-iface' into 'main'
data: Sync the DBus spec file

See merge request GNOME/libmks!38
2023-08-31 16:23:05 +00:00
Christian Hergert
7a101fc4d7 Merge branch 'bilelmoussaoui/dmabuf-division-0' into 'main'
dmabuf: Avoid division by 0

See merge request GNOME/libmks!36
2023-08-31 16:12:04 +00:00
Christian Hergert
ac87feda05 Merge branch 'bilelmoussaoui/leaks' into 'main'
fix: Plug few Touchable related leaks

See merge request GNOME/libmks!34
2023-08-31 16:10:17 +00:00
Bilal Elmoussaoui
7598cb3eac build: Use manual registration for gresource
As that is the recommendation for libraries having their own init function
2023-08-31 12:17:35 +02:00
Bilal Elmoussaoui
545b29e2bf build: Fix generating GIR
We didn't pass the generated sources to GIR making some of the types
unavailable
2023-08-31 12:02:40 +02:00
Bilal Elmoussaoui
73e49437e2 data: Sync the DBus spec file
Minus few Windows specific bits that we are not going to use any time soon
2023-08-30 11:05:59 +02:00
Bilal Elmoussaoui
4f08953fb0 dmabuf: Avoid division by 0
When opening mks for an already running VM, the QEMU dbus backend has no
way to tell to the VM refresh the display and submit a new UpdateDMABuf.

So by the time size_allocate is called, the height and width of the paintable are
still set to 0.

This should fix the size allocate warning we see now until we figure out a proper
fix from the QEMU side.
2023-08-29 11:42:15 +02:00
Bilal Elmoussaoui
035d9b7ac2 dmabuf: Only create a new texture when needed
If the widget gets resized, snapshot would end up being called
and we will try to re-create the same texture again which can
cause some artifacts
2023-08-23 23:07:48 +02:00
Bilal Elmoussaoui
edd6308822 fix: Plug few Touchable related leaks 2023-08-23 10:12:17 +02:00
Bilal Elmoussaoui
640587ed0f dmabuf-paintable: Build the texture when snapshot is called
Always creating the texture even if the app is not being displayed
(minimized / different virtual monitor) or
if the GdkFrameClock drops a frame we end up doing a comparison with a
very old frame causing full redraws in certain cases or even artifacts
in others.

Instead, we only build the texture once snapshot is called and accumulate
the damage area until that happens to avoid updating the wrong area
2023-08-15 19:37:57 +02:00
Bilal Elmoussaoui
7e51d6d38e cleanup: Drop remaining publicly exposed speaker types
Should have been more careful...
2023-07-06 01:48:20 +02:00
Bilal Elmoussaoui
7fafb9f268 cleanup: Prefix & rename create_socketpair 2023-06-23 22:28:34 +02:00
Bilal Elmoussaoui
af8d90d1b5 display: Expose a helper for retriving guest position
When running an Android VM with GL support, Android somehow enforces
support for only touch events making it difficult to work with QEMU +
Android for devolpement / demo purposes without a touch screen.

This helper is useful for being able to emulate motion / click
events as touch ones
2023-06-21 21:09:29 +02:00
Bilal Elmoussaoui
3aee839269 touch: update per latest changes in upstream API 2023-06-20 00:04:04 +02:00
Christian Hergert
a8b605f401 lib: use GLib numeric types
I'm trying to be consistent and keep with GLib type definitions except for
char/int/double/float.
2023-06-15 16:09:22 -07:00
Christian Hergert
5a55efe987 build: add mks-touchable.h to enums generation
Related !26
2023-06-15 16:06:25 -07:00
Bilal Elmoussaoui
10fa9edd8f misc: Replace some of g_warning usages with g_debug
To avoid spamming the user's journald
2023-06-15 13:57:19 +02:00
Bilal Elmoussaoui
c28a6f85e2 device: Implement the new touch interface 2023-06-15 13:57:19 +02:00
Bilal Elmoussaoui
f8a8b61171 display-picture: Split guest absolute position into a helper
Will be shared with touch events in the next commit
2023-06-15 13:47:20 +02:00
Christian Hergert
93e2e70c7b dmabuf-paintable: remove use of arc box
There is only a single unref of this, via the GdkGLTexture so just use a
free function and g_new0()/g_free().
2023-06-02 10:23:31 -07:00
Christian Hergert
a2525530ec screen: remove mks-screen-private.h
It wasn't doing anything for us, so just remove it.
2023-06-02 10:22:27 -07:00
Christian Hergert
58d99fb8b1 dmabuf-paintable: code style cleanup 2023-06-02 10:19:37 -07:00
Christian Hergert
0d43432bfa janitorial: code style and formatting cleanup 2023-06-02 10:18:54 -07:00
Christian Hergert
43dda37c79 license: update sources to LGPLv2.1+
See merge request !25
2023-06-02 10:18:05 -07:00
Bilal Elmoussaoui
7c67084055 Relicense as LGPLv2.1+ 2023-06-01 12:04:35 +01:00
Bilal Elmoussaoui
b23bdcffd7 In certain cases, you might want to control the VM size when running
QEMU instead of having libmks handling that when resizing the widget

This also would allow having an option for auto-scaling that would
scale the texture to fit the widget size
2023-05-31 20:13:06 +01:00
Christian Hergert
6d6c470288 Merge branch 'set-lib-soname' into 'main'
build: Set a SONAME version in the libmks library

See merge request chergert/libmks!23
2023-05-31 16:46:58 +00:00
Bilal Elmoussaoui
fc996f251b build: Don't include Speaker type
Currently, the Speaker device is not fully implemented. So let us stop
building those files to avoid exposing them as part of the docs/gir API
until someone finishes it implementation

Part of #6
2023-05-30 11:16:01 +01:00
Javier Martinez Canillas
868aad0244
build: Set a SONAME version in the libmks library
The libmks library is currently unversioned, but donwstream users expect
this library to have a proper SONAME version in order to package them.

A stable release has not yet happened because the project is still under
development and the API/ABI might change. But having a versioned SONAME
would allow distributions to package libmks, without the need to add any
downstream patch to set the library version.

Since the "0.1.0" version is already set as the meson project, let's use
it to set the library version as well. The meson build system will use the
first part of the version (0) as the SONAME version, which is aligned with
the convention used by other projects:

  $ ls ./lib/libmks-1.so* -1
  ./lib/libmks-1.so
  ./lib/libmks-1.so.0
  ./lib/libmks-1.so.0.1.0

  $ objdump -p ./lib/libmks-1.so.0.1.0 | grep SONAME
  SONAME               libmks-1.so.0
2023-05-30 11:46:27 +02:00
Christian Hergert
543c0cbbda Merge branch 'aesteve/fix-atomic-kms-cursor' into 'main'
display-picture: set cursor on init

See merge request chergert/libmks!19
2023-05-26 04:51:34 +00:00
Albert Esteve
25b58fc0a2 display-picture: set cursor on init
Set cursor to none (i.e., hide it) on init.
Otherwise, in cases where the define_cursor
signal is not received (e.g., atomic kms),
there are two cursors painted on the Widget
display.

Signed-off-by: Albert Esteve <aesteve@redhat.com>
2023-05-25 10:19:17 +02:00
Bilal Elmoussaoui
6b29de7164 Drop duplicated create_socketpair 2023-05-25 09:59:45 +02:00
Bilal Elmoussaoui
5736f4e19f paintable: Properly close DMABuf FD
As g_unix_fd_list_get will dup the FD, we must close it once we are done
with it.
The issue went unnoticable during my testing as apprently, the max
number of open FDs is not in sync between host & toolbox and that is
annoying podman issue...
2023-05-24 15:17:46 +02:00
Bilal Elmoussaoui
c7772df9aa docs: Document most of the public APIs 2023-05-23 12:34:01 +02:00
Christian Hergert
c0f0d1c22c build: fix include directories for subprojects
We have no need to include the top-level when depended on, as config.h
will only ever be used by our internal .c files.

Related !17
2023-05-17 14:35:56 -07:00
Christian Hergert
f71a2002ba display-picture: use compute_point()
The gtk_widget_translate_coordinates() API is now deprecated, so use the
compute_point() API and ensure that we can translate to the target widget.
2023-05-17 13:53:49 -07:00
Christian Hergert
4be889b608 display-picture: remove deprecated allocation API usage 2023-05-17 13:48:21 -07:00
Christian Hergert
cae805a728 resizer: only branch when non-NULL
My previous commit broke this, which is needed because we always return
FALSE when either are NULL.
2023-05-17 13:37:33 -07:00
Christian Hergert
69dfaddb9d resizer: various code-style cleanup
Related !13
2023-05-17 13:36:11 -07:00
Christian Hergert
6a024f0e5d Merge branch 'bilelmoussaoui/reconfigure' into 'main'
display: Reconfigure screen when size change

See merge request chergert/libmks!13
2023-05-17 20:11:49 +00:00
Bilal Elmoussaoui
c259212be5 dmabuf: Properly propagate damage area
The current approach makes use of
- A tiled rendering to work around gdk_texture_diff only doing pointer
comparaison
- Assumes that we would only recieve a scanout cmd followed by multiple
flush ones

In reality, with virtio-gpu at least, the scanout cmd is always
submitted followed by a flush one containing the damaged region.

With the assumption currently made, we end up creating a new paintable
for every scanout cmd causing a full redraw instead
of only redrawing the damaged areas.
Isntead we create the paintable once and call import whenever
we receive a flush cmd (UpdateDMABUF) so we can properly
pass the damage area when creating a GdkGLTexture making
the tiled rendering no longer needed.
2023-05-17 13:08:37 -07:00
Bilal Elmoussaoui
51f8615099 build: Set the pkg-config name when generating GIR
Should help gi-docgen figure out the pkg-config name to display in the
docs
2023-05-14 19:03:01 +02:00
Bilal Elmoussaoui
2636c9e1a9 build: Various fixes to auto generated sources
Needed to fix the build when GTK is also built from a subproject
2023-05-14 19:03:01 +02:00