Merge branch 'matthiasc/for-main' into 'main'

ci: Add another offload test

See merge request GNOME/gtk!7414
This commit is contained in:
Matthias Clasen 2024-07-08 12:16:49 +00:00
commit a858736516
8 changed files with 42 additions and 14 deletions

View File

@ -5,10 +5,12 @@ Slug: gtk-running
GTK inspects a number of environment variables in addition to
standard variables like `LANG`, `PATH`, `HOME` or `DISPLAY`; mostly
to determine paths to look for certain files. The [X11](#x11-envar),
[Wayland](#wayland-envar), [Windows](#win32-envar) and
[Broadway](#broadway-envar) GDK backends use some additional
environment variables.
to determine paths to look for certain files. The
[X11](https://docs.gtk.org/gtk4/x11.html#x11-specific-environment-variables),
[Wayland](https://docs.gtk.org/gtk4/wayland.html#wayland-specific-environment-variables),
[Windows](https://docs.gtk.org/gtk4/windows.html#windows-specific-environment-variables) and
[Broadway](https://docs.gtk.org/gtk4/broadway.html#broadway-specific-environment-variables)
GDK backends use some additional environment variables.
Note that environment variables are generally used for debugging
purposes. They are not guaranteed to be API stable, and should not

View File

@ -43,7 +43,7 @@ X11 details, in particular the ICCCM and the Extended Window Manager
Hints specifications. [freedesktop.org](http://www.freedesktop.org/standards/)
has links to many relevant specifications.
The GDK manual covers [using Xlib in a GTK program](#gdk-X-Window-System-Interaction).
The GDK manual covers [using Xlib in a GTK program](https://docs.gtk.org/gdk4/x11.html).
### Server, client, window manager

View File

@ -31,6 +31,7 @@
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <glib.h>
#ifdef HAVE_MEMFD_CREATE
#include <sys/mman.h>
@ -134,6 +135,7 @@ os_create_anonymous_file(off_t size)
{
path = getenv("XDG_RUNTIME_DIR");
if (!path) {
g_warning ("os_create_anonymous_file(): XDG_RUNTIME_DIR is not set");
errno = ENOENT;
return -1;
}
@ -147,15 +149,19 @@ os_create_anonymous_file(off_t size)
fd = create_tmpfile_cloexec(name);
free(name);
if (fd < 0)
if (fd < 0) {
g_warning ("os_create_anonymous_file(): create_tmpfile_cloexec(\"%s\") failed", name);
free(name);
return -1;
}
free(name);
}
#ifdef HAVE_POSIX_FALLOCATE
ret = posix_fallocate(fd, 0, size);
if (ret != 0) {
g_warning ("os_create_anonymous_file(): posix_fallocate(%d, 0, %ld) failed: %s", fd, size, strerror (errno));
close(fd);
errno = ret;
return -1;
@ -163,6 +169,7 @@ os_create_anonymous_file(off_t size)
#else
ret = ftruncate(fd, size);
if (ret < 0) {
g_warning ("os_create_anonymous_file(): ftruncate() failed");
close(fd);
return -1;
}

View File

@ -54,18 +54,24 @@ shm_pool_create(struct wl_shm *shm, int size)
struct shm_pool *pool;
pool = malloc(sizeof *pool);
if (!pool)
if (!pool) {
g_warning ("malloc() failed");
return NULL;
}
pool->fd = os_create_anonymous_file (size);
if (pool->fd < 0)
if (pool->fd < 0) {
g_warning ("os_create_anonymous_file() failed");
goto err_free;
}
pool->data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED,
pool->fd, 0);
if (pool->data == MAP_FAILED)
if (pool->data == MAP_FAILED) {
g_warning ("mmap() failed: %s", strerror (errno));
goto err_close;
}
pool->pool = wl_shm_create_pool(shm, pool->fd, size);
pool->size = size;

View File

@ -1,5 +1,9 @@
# GDK backends
# Windowing system backends
# Note: The options change the abi (what backend api is available) without
# changing the soname, so think twice before deviating from the default values.
option('x11-backend',
type: 'boolean',
value: true,

View File

@ -385,13 +385,13 @@ parse_node_file (GFile *file, const char *generate)
if (!GDK_DISPLAY_DEBUG_CHECK (gdk_display_get_default (), FORCE_OFFLOAD))
{
g_print ("Offload tests require GDK_DEBUG=force-offload");
g_print ("Offload tests require GDK_DEBUG=force-offload\n");
exit (77);
}
if (gdk_surface_get_scale (surface) != 1.0)
{
g_print ("Offload tests don't work with fractional scales");
g_print ("Offload tests don't work with fractional scales\n");
exit (77);
}

View File

@ -7,6 +7,14 @@ container {
}
}
}
subsurface {
child: transform {
transform: rotate(45);
child: texture {
texture: url('data:image/svg+xml;utf-8,<svg width="13" height="17"></svg>');
}
}
}
transform {
transform: translate3d(0, 1, 2);
child: subsurface {

View File

@ -1,3 +1,4 @@
0: not offloaded
1: not offloaded
2: offloaded, raised, above: -, texture: 16x16, source: 0 0 16 16, dest: 1 2 50 50
2: not offloaded
3: offloaded, raised, above: -, texture: 16x16, source: 0 0 16 16, dest: 1 2 50 50