tests/ref-test: Inhibit direct scanout for ref-tests

When capturing the view we have to make sure the stage is actually
updated. In direct scanout mode the stage is unmodified and we can't
find the content we want to test.

Currently the ref-tests are all running on non-native setups where
direct scanout is impossible but we will change that soon!

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3350>
This commit is contained in:
Sebastian Wick 2023-10-27 17:34:31 +02:00 committed by Marge Bot
parent e42c5dbd79
commit 2993462700

View File

@ -79,6 +79,7 @@
#include "backends/meta-gpu.h"
#include "backends/meta-stage-private.h"
#include "clutter/clutter/clutter-stage-view-private.h"
#include "meta/compositor-mutter.h"
typedef struct _Range
{
@ -313,8 +314,12 @@ capture_view (ClutterStageView *stage_view)
MetaCrtc *crtc = meta_renderer_view_get_crtc (view);
MetaBackend *backend = meta_crtc_get_backend (crtc);
MetaStage *stage = META_STAGE (meta_backend_get_stage (backend));
MetaContext *context = meta_backend_get_context (backend);
MetaDisplay *display = meta_context_get_display (context);
CaptureViewData data = { 0 };
meta_disable_unredirect_for_display (display);
data.loop = g_main_loop_new (NULL, FALSE);
data.watch = meta_stage_watch_view (stage, stage_view,
META_STAGE_WATCH_AFTER_PAINT,
@ -329,6 +334,8 @@ capture_view (ClutterStageView *stage_view)
g_assert_null (data.watch);
g_assert_nonnull (data.out_image);
meta_enable_unredirect_for_display (display);
return data.out_image;
}