crtc: Move MetaGpu field to instance-private

Users either set during construction, or get via the helper.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
This commit is contained in:
Jonas Ådahl
2020-02-25 10:39:56 +01:00
committed by Georges Basile Stavracas Neto
parent 2724f36527
commit 2ebd43cba9
9 changed files with 103 additions and 16 deletions

View File

@@ -121,6 +121,7 @@ meta_test_headless_monitor_connect (void)
MetaMonitorTestSetup *test_setup;
MetaCrtcMode **modes;
MetaCrtcMode *crtc_mode;
MetaGpu *gpu;
MetaCrtc *crtc;
MetaCrtc **possible_crtcs;
MetaOutput *output;
@@ -136,7 +137,10 @@ meta_test_headless_monitor_connect (void)
crtc_mode->refresh_rate = 60.0;
test_setup->modes = g_list_append (NULL, crtc_mode);
crtc = g_object_new (META_TYPE_CRTC, NULL);
gpu = META_GPU (meta_backend_get_gpus (meta_get_backend ())->data);
crtc = g_object_new (META_TYPE_CRTC,
"gpu", gpu,
NULL);
crtc->crtc_id = 1;
crtc->all_transforms = ALL_TRANSFORMS;
test_setup->crtcs = g_list_append (NULL, crtc);

View File

@@ -94,8 +94,6 @@ meta_monitor_manager_test_read_current (MetaMonitorManager *manager)
for (l = manager_test->test_setup->outputs; l; l = l->next)
META_OUTPUT (l->data)->gpu = gpu;
for (l = manager_test->test_setup->crtcs; l; l = l->next)
META_CRTC (l->data)->gpu = gpu;
meta_gpu_take_modes (gpu, manager_test->test_setup->modes);
meta_gpu_take_crtcs (gpu, manager_test->test_setup->crtcs);

View File

@@ -27,8 +27,15 @@
#include "backends/meta-monitor-config-manager.h"
#include "backends/meta-monitor-config-store.h"
#include "backends/meta-output.h"
#include "tests/test-utils.h"
#include "meta-backend-test.h"
MetaGpu *
test_get_gpu (void)
{
return META_GPU (meta_backend_get_gpus (meta_get_backend ())->data);
}
void
set_custom_monitor_config (const char *filename)
{
@@ -565,7 +572,9 @@ create_monitor_test_setup (MonitorTestCaseSetup *setup,
{
MetaCrtc *crtc;
crtc = g_object_new (META_TYPE_CRTC, NULL);
crtc = g_object_new (META_TYPE_CRTC,
"gpu", test_get_gpu (),
NULL);
crtc->crtc_id = i + 1;
crtc->all_transforms = ALL_TRANSFORMS;

View File

@@ -191,6 +191,8 @@ struct _MonitorTestCase
MonitorTestCaseExpect expect;
};
MetaGpu * test_get_gpu (void);
void set_custom_monitor_config (const char *filename);
char * read_file (const char *file_path);