tests/monitor-test-utils: Add way to make the GAMMA_LUT zero sized

This will be used to test devices that has no gamma capabilities.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2611>
This commit is contained in:
Jonas Ådahl 2022-09-03 15:48:54 +02:00 committed by Marge Bot
parent b29604c3f8
commit c724cb3720
4 changed files with 20 additions and 1 deletions

View File

@ -488,7 +488,9 @@ meta_output_test_class_init (MetaOutputTestClass *klass)
static size_t
meta_crtc_test_get_gamma_lut_size (MetaCrtc *crtc)
{
return GAMMA_SIZE;
MetaCrtcTest *crtc_test = META_CRTC_TEST (crtc);
return crtc_test->gamma.size;
}
static MetaGammaLut *
@ -497,6 +499,8 @@ meta_crtc_test_get_gamma_lut (MetaCrtc *crtc)
MetaCrtcTest *crtc_test = META_CRTC_TEST (crtc);
MetaGammaLut *lut;
g_assert_cmpint (crtc_test->gamma.size, >, 0);
lut = g_new0 (MetaGammaLut, 1);
lut->size = crtc_test->gamma.size;
lut->red = g_memdup2 (crtc_test->gamma.red,
@ -573,3 +577,12 @@ meta_crtc_test_init (MetaCrtcTest *crtc_test)
crtc_test->gamma.blue[i] = gamma;
}
}
void
meta_crtc_test_disable_gamma_lut (MetaCrtcTest *crtc_test)
{
crtc_test->gamma.size = 0;
g_clear_pointer (&crtc_test->gamma.red, g_free);
g_clear_pointer (&crtc_test->gamma.green, g_free);
g_clear_pointer (&crtc_test->gamma.blue, g_free);
}

View File

@ -87,4 +87,7 @@ void meta_monitor_manager_test_set_handles_transforms (MetaMonitorManagerTest *m
META_EXPORT
int meta_monitor_manager_test_get_tiled_monitor_count (MetaMonitorManagerTest *manager_test);
META_EXPORT
void meta_crtc_test_disable_gamma_lut (MetaCrtcTest *crtc_test);
#endif /* META_MONITOR_MANAGER_TEST_H */

View File

@ -666,6 +666,8 @@ meta_create_monitor_test_setup (MetaBackend *backend,
"id", (uint64_t) i + 1,
"gpu", meta_test_get_gpu (backend),
NULL);
if (setup->crtcs[i].disable_gamma_lut)
meta_crtc_test_disable_gamma_lut (META_CRTC_TEST (crtc));
test_setup->crtcs = g_list_append (test_setup->crtcs, crtc);
}

View File

@ -119,6 +119,7 @@ typedef struct _MonitorTestCaseOutput
typedef struct _MonitorTestCaseCrtc
{
int current_mode;
gboolean disable_gamma_lut;
} MonitorTestCaseCrtc;
typedef struct _MonitorTestCaseSetup