mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 18:11:05 -05:00
tests/kms-utils: Add helpers for common buffer sizes
This makes it more convenient to allocate and configure buffers covering the whole primary plane given a mode. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
This commit is contained in:
parent
c35e8f5a51
commit
6a9e2e9e2d
@ -30,6 +30,8 @@
|
|||||||
#include "backends/native/meta-kms-connector.h"
|
#include "backends/native/meta-kms-connector.h"
|
||||||
#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-update.h"
|
||||||
#include "backends/native/meta-kms.h"
|
#include "backends/native/meta-kms.h"
|
||||||
|
|
||||||
MetaKmsDevice *
|
MetaKmsDevice *
|
||||||
@ -103,3 +105,28 @@ meta_create_test_dumb_buffer (MetaKmsDevice *device,
|
|||||||
|
|
||||||
return META_DRM_BUFFER (dumb_buffer);
|
return META_DRM_BUFFER (dumb_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MetaDrmBuffer *
|
||||||
|
meta_create_test_mode_dumb_buffer (MetaKmsDevice *device,
|
||||||
|
MetaKmsMode *mode)
|
||||||
|
{
|
||||||
|
return meta_create_test_dumb_buffer (device,
|
||||||
|
meta_kms_mode_get_width (mode),
|
||||||
|
meta_kms_mode_get_height (mode));
|
||||||
|
}
|
||||||
|
|
||||||
|
MetaFixed16Rectangle
|
||||||
|
meta_get_mode_fixed_rect_16 (MetaKmsMode *mode)
|
||||||
|
{
|
||||||
|
return META_FIXED_16_RECTANGLE_INIT_INT (0, 0,
|
||||||
|
meta_kms_mode_get_width (mode),
|
||||||
|
meta_kms_mode_get_height (mode));
|
||||||
|
}
|
||||||
|
|
||||||
|
MetaRectangle
|
||||||
|
meta_get_mode_rect (MetaKmsMode *mode)
|
||||||
|
{
|
||||||
|
return META_RECTANGLE_INIT (0, 0,
|
||||||
|
meta_kms_mode_get_width (mode),
|
||||||
|
meta_kms_mode_get_height (mode));
|
||||||
|
}
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include "backends/native/meta-drm-buffer.h"
|
#include "backends/native/meta-drm-buffer.h"
|
||||||
#include "backends/native/meta-kms-types.h"
|
#include "backends/native/meta-kms-types.h"
|
||||||
#include "meta/meta-context.h"
|
#include "meta/meta-context.h"
|
||||||
|
#include "meta/boxes.h"
|
||||||
|
|
||||||
MetaKmsDevice * meta_get_test_kms_device (MetaContext *context);
|
MetaKmsDevice * meta_get_test_kms_device (MetaContext *context);
|
||||||
|
|
||||||
@ -35,4 +36,11 @@ MetaDrmBuffer * meta_create_test_dumb_buffer (MetaKmsDevice *device,
|
|||||||
int width,
|
int width,
|
||||||
int height);
|
int height);
|
||||||
|
|
||||||
|
MetaDrmBuffer * meta_create_test_mode_dumb_buffer (MetaKmsDevice *device,
|
||||||
|
MetaKmsMode *mode);
|
||||||
|
|
||||||
|
MetaFixed16Rectangle meta_get_mode_fixed_rect_16 (MetaKmsMode *mode);
|
||||||
|
|
||||||
|
MetaRectangle meta_get_mode_rect (MetaKmsMode *mode);
|
||||||
|
|
||||||
#endif /* META_KMS_TEST_UTILS_H */
|
#endif /* META_KMS_TEST_UTILS_H */
|
||||||
|
@ -106,19 +106,15 @@ meta_test_kms_update_plane_assignments (void)
|
|||||||
|
|
||||||
mode_width = meta_kms_mode_get_width (mode);
|
mode_width = meta_kms_mode_get_width (mode);
|
||||||
mode_height = meta_kms_mode_get_height (mode);
|
mode_height = meta_kms_mode_get_height (mode);
|
||||||
primary_buffer = meta_create_test_dumb_buffer (device,
|
primary_buffer = meta_create_test_mode_dumb_buffer (device, mode);
|
||||||
mode_width, mode_height);
|
|
||||||
|
|
||||||
primary_plane_assignment =
|
primary_plane_assignment =
|
||||||
meta_kms_update_assign_plane (update,
|
meta_kms_update_assign_plane (update,
|
||||||
crtc,
|
crtc,
|
||||||
primary_plane,
|
primary_plane,
|
||||||
primary_buffer,
|
primary_buffer,
|
||||||
META_FIXED_16_RECTANGLE_INIT_INT (0, 0,
|
meta_get_mode_fixed_rect_16 (mode),
|
||||||
mode_width,
|
meta_get_mode_rect (mode),
|
||||||
mode_height),
|
|
||||||
META_RECTANGLE_INIT (0, 0,
|
|
||||||
mode_width, mode_height),
|
|
||||||
META_KMS_ASSIGN_PLANE_FLAG_NONE);
|
META_KMS_ASSIGN_PLANE_FLAG_NONE);
|
||||||
g_assert_nonnull (primary_plane_assignment);
|
g_assert_nonnull (primary_plane_assignment);
|
||||||
g_assert_cmpint (primary_plane_assignment->src_rect.x, ==, 0);
|
g_assert_cmpint (primary_plane_assignment->src_rect.x, ==, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user