drivers/gpu/drm/vkms/tests/vkms_config_test.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/vkms/tests/vkms_config_test.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/vkms/tests/vkms_config_test.c- Extension
.c- Size
- 32913 bytes
- Lines
- 1030
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
kunit/test.h../vkms_config.h
Detected Declarations
struct default_config_casefunction vkms_config_get_num_planesfunction vkms_config_get_num_encodersfunction vkms_config_get_num_connectorsfunction vkms_config_test_empty_configfunction vkms_config_test_default_configfunction vkms_config_for_each_planefunction vkms_config_plane_for_each_possible_crtcfunction vkms_config_test_get_planesfunction vkms_config_test_get_crtcsfunction vkms_config_test_get_encodersfunction vkms_config_test_get_connectorsfunction vkms_config_test_invalid_plane_numberfunction vkms_config_test_valid_plane_typefunction vkms_config_test_valid_plane_possible_crtcsfunction vkms_config_test_invalid_crtc_numberfunction vkms_config_test_invalid_encoder_numberfunction vkms_config_test_valid_encoder_possible_crtcsfunction vkms_config_test_invalid_connector_numberfunction vkms_config_test_valid_connector_possible_encodersfunction vkms_config_test_attach_different_configsfunction vkms_config_test_plane_attach_crtcfunction vkms_config_test_plane_get_possible_crtcsfunction vkms_config_plane_for_each_possible_crtcfunction vkms_config_test_encoder_get_possible_crtcsfunction vkms_config_encoder_for_each_possible_crtcfunction vkms_config_test_connector_get_possible_encodersfunction vkms_config_connector_for_each_possible_encoderfunction vkms_config_test_connector_status
Annotated Snippet
struct default_config_case {
bool enable_cursor;
bool enable_writeback;
bool enable_overlay;
bool enable_plane_pipeline;
};
static void vkms_config_test_empty_config(struct kunit *test)
{
struct vkms_config *config;
const char *dev_name = "test";
config = vkms_config_create(dev_name);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, config);
/* The dev_name string and the config have different lifetimes */
dev_name = NULL;
KUNIT_EXPECT_STREQ(test, vkms_config_get_device_name(config), "test");
KUNIT_EXPECT_EQ(test, vkms_config_get_num_planes(config), 0);
KUNIT_EXPECT_EQ(test, vkms_config_get_num_crtcs(config), 0);
KUNIT_EXPECT_EQ(test, vkms_config_get_num_encoders(config), 0);
KUNIT_EXPECT_EQ(test, vkms_config_get_num_connectors(config), 0);
KUNIT_EXPECT_FALSE(test, vkms_config_is_valid(config));
vkms_config_destroy(config);
}
static struct default_config_case default_config_cases[] = {
{ false, false, false, false },
{ true, false, false, false },
{ true, true, false, false },
{ true, false, true, false },
{ false, true, false, false },
{ false, true, true, false },
{ false, false, true, false },
{ true, true, true, false },
{ false, false, false, true },
{ true, false, false, true },
{ true, true, false, true },
{ true, false, true, true },
{ false, true, false, true },
{ false, true, true, true },
{ false, false, true, true },
{ true, true, true, true },
};
KUNIT_ARRAY_PARAM(default_config, default_config_cases, NULL);
static void vkms_config_test_default_config(struct kunit *test)
{
const struct default_config_case *params = test->param_value;
struct vkms_config *config;
struct vkms_config_plane *plane_cfg;
struct vkms_config_crtc *crtc_cfg;
int n_primaries = 0;
int n_cursors = 0;
int n_overlays = 0;
config = vkms_config_default_create(params->enable_cursor,
params->enable_writeback,
params->enable_overlay,
params->enable_plane_pipeline);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, config);
/* Planes */
vkms_config_for_each_plane(config, plane_cfg) {
KUNIT_EXPECT_EQ(test,
vkms_config_plane_get_default_pipeline(plane_cfg),
params->enable_plane_pipeline);
switch (vkms_config_plane_get_type(plane_cfg)) {
case DRM_PLANE_TYPE_PRIMARY:
n_primaries++;
break;
case DRM_PLANE_TYPE_CURSOR:
n_cursors++;
break;
case DRM_PLANE_TYPE_OVERLAY:
n_overlays++;
break;
default:
KUNIT_FAIL_AND_ABORT(test, "Unknown plane type");
}
}
KUNIT_EXPECT_EQ(test, n_primaries, 1);
KUNIT_EXPECT_EQ(test, n_cursors, params->enable_cursor ? 1 : 0);
KUNIT_EXPECT_EQ(test, n_overlays, params->enable_overlay ? 8 : 0);
/* CRTCs */
Annotation
- Immediate include surface: `kunit/test.h`, `../vkms_config.h`.
- Detected declarations: `struct default_config_case`, `function vkms_config_get_num_planes`, `function vkms_config_get_num_encoders`, `function vkms_config_get_num_connectors`, `function vkms_config_test_empty_config`, `function vkms_config_test_default_config`, `function vkms_config_for_each_plane`, `function vkms_config_plane_for_each_possible_crtc`, `function vkms_config_test_get_planes`, `function vkms_config_test_get_crtcs`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.