mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-14 14:20:21 +00:00
tests: Use dmabufs in compare tests
Make the --replay mode of compare-render randomly turn textures it finds into dmabuf textures, using /dev/udmabuf.
This commit is contained in:
parent
acad180cee
commit
107ef2017c
@ -1,5 +1,5 @@
|
||||
compare_render = executable('compare-render',
|
||||
['compare-render.c', '../reftests/reftest-compare.c', 'replay-node.c'],
|
||||
['compare-render.c', '../reftests/reftest-compare.c', 'replay-node.c', '../gdk/udmabuf.c'],
|
||||
dependencies: libgtk_static_dep,
|
||||
c_args: common_cflags + ['-DGTK_COMPILATION'],
|
||||
)
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include <gtk/gtksnapshotprivate.h>
|
||||
#include <gsk/gskrendernodeprivate.h>
|
||||
#include "../gdk/udmabuf.h"
|
||||
|
||||
void
|
||||
replay_node (GskRenderNode *node, GtkSnapshot *snapshot);
|
||||
@ -113,7 +114,23 @@ replay_texture_node (GskRenderNode *node, GtkSnapshot *snapshot)
|
||||
graphene_rect_t bounds;
|
||||
gsk_render_node_get_bounds (node, &bounds);
|
||||
|
||||
g_object_ref (texture);
|
||||
|
||||
if (g_test_rand_bit ())
|
||||
{
|
||||
GdkTexture *t;
|
||||
|
||||
t = udmabuf_texture_from_texture (texture, NULL);
|
||||
if (t)
|
||||
{
|
||||
g_object_unref (texture);
|
||||
texture = t;
|
||||
}
|
||||
}
|
||||
|
||||
gtk_snapshot_append_texture (snapshot, texture, &bounds);
|
||||
|
||||
g_object_unref (texture);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -327,7 +344,30 @@ replay_texture_scale_node (GskRenderNode *node, GtkSnapshot *snapshot)
|
||||
graphene_rect_t bounds;
|
||||
gsk_render_node_get_bounds (node, &bounds);
|
||||
|
||||
g_object_ref (texture);
|
||||
|
||||
if (g_test_rand_bit ())
|
||||
{
|
||||
GdkTexture *t;
|
||||
GError *error = NULL;
|
||||
|
||||
t = udmabuf_texture_from_texture (texture, &error);
|
||||
if (t)
|
||||
{
|
||||
g_test_message ("Using dmabuf texture");
|
||||
g_object_unref (texture);
|
||||
texture = t;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_test_message ("Creating dmabuf texture failed: %s", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
}
|
||||
|
||||
gtk_snapshot_append_scaled_texture (snapshot, texture, filter, &bounds);
|
||||
|
||||
g_object_unref (texture);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user