In GSK the following pattern is used four times:
```
switch (self->filter)
{
default:
g_assert_not_reached ();
G_GNUC_FALLTHROUGH;
case GSK_GPU_BLIT_LINEAR:
filter = GL_LINEAR;
break;
case GSK_GPU_BLIT_NEAREST:
filter = GL_NEAREST;
break;
}
```
The G_GNUC_FALLTHROUGH macro is not required. When G_DISABLE_ASSERT
is defined the body of the `default` case is empty, thus there is
no need. When G_DISABLE_ASSERT is not defined the body of the `default`
case contains g_assert_not_reached() thus it won't fallthrough.
This resolves the following:
```
[221/1379] Compiling C object gsk/libgsk.a.p/gpu_gskgpublitop.c.o
[...]
error: fallthrough annotation in unreachable code [-Werror,-Wimplicit-fallthrough]
1 error generated.
```
It includes a fallback list of fourccs. Otherwise we might miss some
DRM_FORMAT definition.
This happens in SLES12:
```
../testsuite/gdk/dmabufformats.c: In function ‘test_dmabuf_formats_basic’:
../testsuite/gdk/dmabufformats.c:29:56: error: ‘DRM_FORMAT_ABGR16161616F’ undeclared (first use in this function); did you mean ‘DRM_FORMAT_ABGR2101010’?
29 | g_assert_true (gdk_dmabuf_formats_contains (formats, DRM_FORMAT_ABGR16161616F, DRM_FORMAT_MOD_LINEAR));
```
This can be helpful to see that there is an enormous scale blowing
things up. We omit the matrix, since it is 16 floats that are hard
to interpret at a glance.
Unless the renderer has been explicitly selected via the
GSK_RENDERER environment variable, don't use it with llvmpipe.
It is important that we allow explicit setting to override
this, so we can continue to use ngl in ci, where we don't
have hw and want to test with llvmpipe.
This should address many of the "performance is terrible in
GNOME OS" complaints that are coming from people running in
VMs, etc.
Allow specifying padding via --padding. The argument to --padding
is a string of up to 4 comma-separated numbers, for the left, right,
top, bottom padding. If less numbers are given, the remaining ones
are set to zero.
This commit also includes an image that can be used for testing with
testdmabuf --padding 20,20,20,20 NV12 padded.png
Look for nodes like subsurface { clip { texture {} } }, and use
the clip to provide a source rectangle for subsetting the texture.
Update affected tests, and add a new one.
This will let us use a subset of the full texture, which can
be necessary in the case that converters put padding around
content in dmabufs. The naming follows the Wayland viewporter
spec.
For now, make all callers pass the full texture rect.
We are going to introduce another rect, so better to be clear in
naming. We are following the naming of the Wayland viewporter spec
and call the rectangle that we drawing into the dest(ination).
Make the picture not expand, and add Ctrl-S to toggle the
horizontal alignment between start and center. This makes the
offloaded picture move under the overlaid controls, or out
from under them, triggering some offloading transitions.
We were collecting diffs based on the can_offload/can_raise
information, but attaching the texture to the subsurface can
fail (e.g. if its not a dmabuf texture), in which case can_offload
turned out to be wrong. So move the diff collection to the end
and do it based on the whether we actually succeeded in attaching
the texture.
We can just check if the subsurfaces contain content - and if they do,
they will be offloading and we can ignore the diff.
This essentially reverts 48740de71a
Instead of relying on diffing subsurface nodes, we track damage
generated by offloaded contents inside GskOffload.
There are 3 stages a subsurface node can be in:
1. not offloaded
Drawing is done by the renderer
2. offloaded above
The renderer draws nothing
3. offloaded below
The renderer needs to punch a hole.
Whenever the stage changes, we need to repaint.
And that can happen without the subsurface's contents changing, like
when a widget is put above the subsurface and it needs to to go from
offloaded above to below.
So we now recruit GskOffload for tracking these changes, instead of
relying on the subsurface diffing.
But we still need the subsurface diffing code to work for the
non-offloaded case, because then the offloading code is not used.
So we keep using it whenever that happens.
Not that when a subsurface transitions between being offloaded and not
being offloaded, we may diff it twice - once in the offload code and
once in the node diffing - but that shouldn't matter.