mirror of
https://github.com/brl/mutter.git
synced 2024-11-29 19:40:43 -05:00
tests/kms: Use test helper for finding planes
A set of primary planes can be usable with a set of CRTCs, meaning we can't have general purpose functions that gets a plane for a CRTC, as there is no such one to one relationship. For tests we still want to have helpers that makes writing tests easier, so to prepare for those functions going away, make the tests do the equivalent themselves. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3428>
This commit is contained in:
parent
4c0f3ea80f
commit
f7043ca3d6
@ -29,6 +29,8 @@
|
|||||||
#include "backends/native/meta-kms-crtc.h"
|
#include "backends/native/meta-kms-crtc.h"
|
||||||
#include "backends/native/meta-kms-device.h"
|
#include "backends/native/meta-kms-device.h"
|
||||||
#include "backends/native/meta-kms-mode.h"
|
#include "backends/native/meta-kms-mode.h"
|
||||||
|
#include "backends/native/meta-kms-plane.h"
|
||||||
|
#include "backends/native/meta-kms-types.h"
|
||||||
#include "backends/native/meta-kms-update.h"
|
#include "backends/native/meta-kms-update.h"
|
||||||
#include "backends/native/meta-kms.h"
|
#include "backends/native/meta-kms.h"
|
||||||
|
|
||||||
@ -67,6 +69,41 @@ meta_get_test_kms_connector (MetaKmsDevice *device)
|
|||||||
return META_KMS_CONNECTOR (connectors->data);
|
return META_KMS_CONNECTOR (connectors->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static MetaKmsPlane *
|
||||||
|
get_plane_with_type_for (MetaKmsDevice *device,
|
||||||
|
MetaKmsCrtc *crtc,
|
||||||
|
MetaKmsPlaneType type)
|
||||||
|
{
|
||||||
|
GList *l;
|
||||||
|
|
||||||
|
for (l = meta_kms_device_get_planes (device); l; l = l->next)
|
||||||
|
{
|
||||||
|
MetaKmsPlane *plane = l->data;
|
||||||
|
|
||||||
|
if (meta_kms_plane_get_plane_type (plane) != type)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (meta_kms_plane_is_usable_with (plane, crtc))
|
||||||
|
return plane;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
MetaKmsPlane *
|
||||||
|
meta_get_primary_test_plane_for (MetaKmsDevice *device,
|
||||||
|
MetaKmsCrtc *crtc)
|
||||||
|
{
|
||||||
|
return get_plane_with_type_for (device, crtc, META_KMS_PLANE_TYPE_PRIMARY);
|
||||||
|
}
|
||||||
|
|
||||||
|
MetaKmsPlane *
|
||||||
|
meta_get_cursor_test_plane_for (MetaKmsDevice *device,
|
||||||
|
MetaKmsCrtc *crtc)
|
||||||
|
{
|
||||||
|
return get_plane_with_type_for (device, crtc, META_KMS_PLANE_TYPE_CURSOR);
|
||||||
|
}
|
||||||
|
|
||||||
static MetaDeviceFile *
|
static MetaDeviceFile *
|
||||||
open_device_file_for (MetaKmsDevice *device)
|
open_device_file_for (MetaKmsDevice *device)
|
||||||
{
|
{
|
||||||
|
@ -29,6 +29,12 @@ MetaKmsCrtc * meta_get_test_kms_crtc (MetaKmsDevice *device);
|
|||||||
|
|
||||||
MetaKmsConnector * meta_get_test_kms_connector (MetaKmsDevice *device);
|
MetaKmsConnector * meta_get_test_kms_connector (MetaKmsDevice *device);
|
||||||
|
|
||||||
|
MetaKmsPlane * meta_get_primary_test_plane_for (MetaKmsDevice *device,
|
||||||
|
MetaKmsCrtc *crtc);
|
||||||
|
|
||||||
|
MetaKmsPlane * meta_get_cursor_test_plane_for (MetaKmsDevice *device,
|
||||||
|
MetaKmsCrtc *crtc);
|
||||||
|
|
||||||
MetaDrmBuffer * meta_create_test_dumb_buffer (MetaKmsDevice *device,
|
MetaDrmBuffer * meta_create_test_dumb_buffer (MetaKmsDevice *device,
|
||||||
int width,
|
int width,
|
||||||
int height);
|
int height);
|
||||||
|
@ -76,9 +76,9 @@ meta_test_kms_device_sanity (void)
|
|||||||
|
|
||||||
planes = meta_kms_device_get_planes (device);
|
planes = meta_kms_device_get_planes (device);
|
||||||
g_assert_cmpuint (g_list_length (planes), ==, 2);
|
g_assert_cmpuint (g_list_length (planes), ==, 2);
|
||||||
primary_plane = meta_kms_device_get_primary_plane_for (device, crtc);
|
primary_plane = meta_get_primary_test_plane_for (device, crtc);
|
||||||
g_assert_nonnull (primary_plane);
|
g_assert_nonnull (primary_plane);
|
||||||
cursor_plane = meta_kms_device_get_cursor_plane_for (device, crtc);
|
cursor_plane = meta_get_cursor_test_plane_for (device, crtc);
|
||||||
g_assert_nonnull (cursor_plane);
|
g_assert_nonnull (cursor_plane);
|
||||||
g_assert (cursor_plane != primary_plane);
|
g_assert (cursor_plane != primary_plane);
|
||||||
g_assert_nonnull (g_list_find (planes, primary_plane));
|
g_assert_nonnull (g_list_find (planes, primary_plane));
|
||||||
@ -280,7 +280,7 @@ meta_test_kms_device_mode_set (void)
|
|||||||
|
|
||||||
primary_buffer = meta_create_test_mode_dumb_buffer (device, mode);
|
primary_buffer = meta_create_test_mode_dumb_buffer (device, mode);
|
||||||
|
|
||||||
primary_plane = meta_kms_device_get_primary_plane_for (device, crtc);
|
primary_plane = meta_get_primary_test_plane_for (device, crtc);
|
||||||
meta_kms_update_assign_plane (update,
|
meta_kms_update_assign_plane (update,
|
||||||
crtc,
|
crtc,
|
||||||
primary_plane,
|
primary_plane,
|
||||||
@ -334,7 +334,7 @@ meta_test_kms_device_power_save (void)
|
|||||||
crtc = meta_get_test_kms_crtc (device);
|
crtc = meta_get_test_kms_crtc (device);
|
||||||
connector = meta_get_test_kms_connector (device);
|
connector = meta_get_test_kms_connector (device);
|
||||||
mode = meta_kms_connector_get_preferred_mode (connector);
|
mode = meta_kms_connector_get_preferred_mode (connector);
|
||||||
primary_plane = meta_kms_device_get_primary_plane_for (device, crtc);
|
primary_plane = meta_get_primary_test_plane_for (device, crtc);
|
||||||
primary_buffer = meta_create_test_mode_dumb_buffer (device, mode);
|
primary_buffer = meta_create_test_mode_dumb_buffer (device, mode);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -480,8 +480,8 @@ meta_test_kms_device_discard_disabled (void)
|
|||||||
crtc = meta_get_test_kms_crtc (device);
|
crtc = meta_get_test_kms_crtc (device);
|
||||||
connector = meta_get_test_kms_connector (device);
|
connector = meta_get_test_kms_connector (device);
|
||||||
mode = meta_kms_connector_get_preferred_mode (connector);
|
mode = meta_kms_connector_get_preferred_mode (connector);
|
||||||
primary_plane = meta_kms_device_get_primary_plane_for (device, crtc);
|
primary_plane = meta_get_primary_test_plane_for (device, crtc);
|
||||||
cursor_plane = meta_kms_device_get_cursor_plane_for (device, crtc);
|
cursor_plane = meta_get_cursor_test_plane_for (device, crtc);
|
||||||
|
|
||||||
device_pool = meta_backend_native_get_device_pool (backend_native);
|
device_pool = meta_backend_native_get_device_pool (backend_native);
|
||||||
device_file = meta_device_pool_open (device_pool,
|
device_file = meta_device_pool_open (device_pool,
|
||||||
@ -659,7 +659,7 @@ meta_test_kms_device_empty_update (void)
|
|||||||
crtc = meta_get_test_kms_crtc (device);
|
crtc = meta_get_test_kms_crtc (device);
|
||||||
connector = meta_get_test_kms_connector (device);
|
connector = meta_get_test_kms_connector (device);
|
||||||
mode = meta_kms_connector_get_preferred_mode (connector);
|
mode = meta_kms_connector_get_preferred_mode (connector);
|
||||||
primary_plane = meta_kms_device_get_primary_plane_for (device, crtc);
|
primary_plane = meta_get_primary_test_plane_for (device, crtc);
|
||||||
primary_buffer = meta_create_test_mode_dumb_buffer (device, mode);
|
primary_buffer = meta_create_test_mode_dumb_buffer (device, mode);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -88,7 +88,7 @@ populate_update (MetaKmsUpdate *update,
|
|||||||
|
|
||||||
*buffer = meta_create_test_mode_dumb_buffer (device, mode);
|
*buffer = meta_create_test_mode_dumb_buffer (device, mode);
|
||||||
|
|
||||||
primary_plane = meta_kms_device_get_primary_plane_for (device, crtc);
|
primary_plane = meta_get_primary_test_plane_for (device, crtc);
|
||||||
meta_kms_update_assign_plane (update,
|
meta_kms_update_assign_plane (update,
|
||||||
crtc,
|
crtc,
|
||||||
primary_plane,
|
primary_plane,
|
||||||
@ -142,10 +142,10 @@ meta_test_kms_update_plane_assignments (void)
|
|||||||
crtc = meta_get_test_kms_crtc (device);
|
crtc = meta_get_test_kms_crtc (device);
|
||||||
connector = meta_get_test_kms_connector (device);
|
connector = meta_get_test_kms_connector (device);
|
||||||
|
|
||||||
primary_plane = meta_kms_device_get_primary_plane_for (device, crtc);
|
primary_plane = meta_get_primary_test_plane_for (device, crtc);
|
||||||
g_assert_nonnull (primary_plane);
|
g_assert_nonnull (primary_plane);
|
||||||
|
|
||||||
cursor_plane = meta_kms_device_get_cursor_plane_for (device, crtc);
|
cursor_plane = meta_get_cursor_test_plane_for (device, crtc);
|
||||||
g_assert_nonnull (cursor_plane);
|
g_assert_nonnull (cursor_plane);
|
||||||
|
|
||||||
mode = meta_kms_connector_get_preferred_mode (connector);
|
mode = meta_kms_connector_get_preferred_mode (connector);
|
||||||
@ -380,7 +380,7 @@ meta_test_kms_update_page_flip (void)
|
|||||||
|
|
||||||
primary_buffer1 = meta_create_test_mode_dumb_buffer (device, mode);
|
primary_buffer1 = meta_create_test_mode_dumb_buffer (device, mode);
|
||||||
|
|
||||||
primary_plane = meta_kms_device_get_primary_plane_for (device, crtc);
|
primary_plane = meta_get_primary_test_plane_for (device, crtc);
|
||||||
meta_kms_update_assign_plane (update,
|
meta_kms_update_assign_plane (update,
|
||||||
crtc,
|
crtc,
|
||||||
primary_plane,
|
primary_plane,
|
||||||
@ -458,8 +458,8 @@ meta_test_kms_update_merge (void)
|
|||||||
device = meta_get_test_kms_device (test_context);
|
device = meta_get_test_kms_device (test_context);
|
||||||
crtc = meta_get_test_kms_crtc (device);
|
crtc = meta_get_test_kms_crtc (device);
|
||||||
connector = meta_get_test_kms_connector (device);
|
connector = meta_get_test_kms_connector (device);
|
||||||
primary_plane = meta_kms_device_get_primary_plane_for (device, crtc);
|
primary_plane = meta_get_primary_test_plane_for (device, crtc);
|
||||||
cursor_plane = meta_kms_device_get_cursor_plane_for (device, crtc);
|
cursor_plane = meta_get_cursor_test_plane_for (device, crtc);
|
||||||
|
|
||||||
mode = meta_kms_connector_get_preferred_mode (connector);
|
mode = meta_kms_connector_get_preferred_mode (connector);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user