drivers/gpu/drm/tests/drm_framebuffer_test.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/tests/drm_framebuffer_test.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/tests/drm_framebuffer_test.c- Extension
.c- Size
- 27315 bytes
- Lines
- 726
- 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/device.hkunit/test.hdrm/drm_device.hdrm/drm_drv.hdrm/drm_mode.hdrm/drm_framebuffer.hdrm/drm_fourcc.hdrm/drm_kunit_helpers.hdrm/drm_print.h../drm_crtc_internal.h
Detected Declarations
struct drm_framebuffer_teststruct drm_framebuffer_test_privstruct drm_framebuffer_check_src_coords_casefunction drm_framebuffer_test_initfunction drm_test_framebuffer_createfunction drm_framebuffer_test_to_descfunction drm_test_framebuffer_modifiers_not_supportedfunction drm_test_framebuffer_check_src_coordsfunction check_src_coords_test_to_descfunction drm_framebuffer_cleanupfunction drm_test_framebuffer_lookupfunction drm_test_framebuffer_lookup_inexistentfunction drm_test_framebuffer_initfunction drm_test_framebuffer_init_bad_formatfunction drm_framebuffer_initfunction destroy_free_mockfunction drm_test_framebuffer_free
Annotated Snippet
struct drm_framebuffer_test {
int buffer_created;
struct drm_mode_fb_cmd2 cmd;
const char *name;
};
static const struct drm_framebuffer_test drm_framebuffer_create_cases[] = {
{ .buffer_created = 1, .name = "ABGR8888 normal sizes",
.cmd = { .width = 600, .height = 600, .pixel_format = DRM_FORMAT_ABGR8888,
.handles = { 1, 0, 0 }, .pitches = { 4 * 600, 0, 0 },
}
},
{ .buffer_created = 1, .name = "ABGR8888 max sizes",
.cmd = { .width = MAX_WIDTH, .height = MAX_HEIGHT, .pixel_format = DRM_FORMAT_ABGR8888,
.handles = { 1, 0, 0 }, .pitches = { 4 * MAX_WIDTH, 0, 0 },
}
},
{ .buffer_created = 1, .name = "ABGR8888 pitch greater than min required",
.cmd = { .width = MAX_WIDTH, .height = MAX_HEIGHT, .pixel_format = DRM_FORMAT_ABGR8888,
.handles = { 1, 0, 0 }, .pitches = { 4 * MAX_WIDTH + 1, 0, 0 },
}
},
{ .buffer_created = 0, .name = "ABGR8888 pitch less than min required",
.cmd = { .width = MAX_WIDTH, .height = MAX_HEIGHT, .pixel_format = DRM_FORMAT_ABGR8888,
.handles = { 1, 0, 0 }, .pitches = { 4 * MAX_WIDTH - 1, 0, 0 },
}
},
{ .buffer_created = 0, .name = "ABGR8888 Invalid width",
.cmd = { .width = MAX_WIDTH + 1, .height = MAX_HEIGHT, .pixel_format = DRM_FORMAT_ABGR8888,
.handles = { 1, 0, 0 }, .pitches = { 4 * (MAX_WIDTH + 1), 0, 0 },
}
},
{ .buffer_created = 0, .name = "ABGR8888 Invalid buffer handle",
.cmd = { .width = MAX_WIDTH, .height = MAX_HEIGHT, .pixel_format = DRM_FORMAT_ABGR8888,
.handles = { 0, 0, 0 }, .pitches = { 4 * MAX_WIDTH, 0, 0 },
}
},
{ .buffer_created = 0, .name = "No pixel format",
.cmd = { .width = MAX_WIDTH, .height = MAX_HEIGHT, .pixel_format = 0,
.handles = { 1, 0, 0 }, .pitches = { 4 * MAX_WIDTH, 0, 0 },
}
},
{ .buffer_created = 0, .name = "ABGR8888 Width 0",
.cmd = { .width = 0, .height = MAX_HEIGHT, .pixel_format = DRM_FORMAT_ABGR8888,
.handles = { 1, 0, 0 }, .pitches = { 4 * MAX_WIDTH, 0, 0 },
}
},
{ .buffer_created = 0, .name = "ABGR8888 Height 0",
.cmd = { .width = MAX_WIDTH, .height = 0, .pixel_format = DRM_FORMAT_ABGR8888,
.handles = { 1, 0, 0 }, .pitches = { 4 * MAX_WIDTH, 0, 0 },
}
},
{ .buffer_created = 0, .name = "ABGR8888 Out of bound height * pitch combination",
.cmd = { .width = MAX_WIDTH, .height = MAX_HEIGHT, .pixel_format = DRM_FORMAT_ABGR8888,
.handles = { 1, 0, 0 }, .offsets = { UINT_MAX - 1, 0, 0 },
.pitches = { 4 * MAX_WIDTH, 0, 0 },
}
},
{ .buffer_created = 1, .name = "ABGR8888 Large buffer offset",
.cmd = { .width = MAX_WIDTH, .height = MAX_HEIGHT, .pixel_format = DRM_FORMAT_ABGR8888,
.handles = { 1, 0, 0 }, .offsets = { UINT_MAX / 2, 0, 0 },
.pitches = { 4 * MAX_WIDTH, 0, 0 },
}
},
/*
* All entries in members that represents per-plane values (@modifier, @handles,
* @pitches and @offsets) must be zero when unused.
*/
{ .buffer_created = 0, .name = "ABGR8888 Buffer offset for inexistent plane",
.cmd = { .width = MAX_WIDTH, .height = MAX_HEIGHT, .pixel_format = DRM_FORMAT_ABGR8888,
.handles = { 1, 0, 0 }, .offsets = { UINT_MAX / 2, UINT_MAX / 2, 0 },
.pitches = { 4 * MAX_WIDTH, 0, 0 }, .flags = DRM_MODE_FB_MODIFIERS,
}
},
{ .buffer_created = 0, .name = "ABGR8888 Invalid flag",
.cmd = { .width = MAX_WIDTH, .height = MAX_HEIGHT, .pixel_format = DRM_FORMAT_ABGR8888,
.handles = { 1, 0, 0 }, .offsets = { UINT_MAX / 2, 0, 0 },
.pitches = { 4 * MAX_WIDTH, 0, 0 }, .flags = DRM_MODE_FB_INVALID,
}
},
{ .buffer_created = 1, .name = "ABGR8888 Set DRM_MODE_FB_MODIFIERS without modifiers",
.cmd = { .width = MAX_WIDTH, .height = MAX_HEIGHT, .pixel_format = DRM_FORMAT_ABGR8888,
.handles = { 1, 0, 0 }, .offsets = { UINT_MAX / 2, 0, 0 },
.pitches = { 4 * MAX_WIDTH, 0, 0 }, .flags = DRM_MODE_FB_MODIFIERS,
}
},
{ .buffer_created = 1, .name = "ABGR8888 Valid buffer modifier",
.cmd = { .width = MAX_WIDTH, .height = MAX_HEIGHT, .pixel_format = DRM_FORMAT_ABGR8888,
Annotation
- Immediate include surface: `kunit/device.h`, `kunit/test.h`, `drm/drm_device.h`, `drm/drm_drv.h`, `drm/drm_mode.h`, `drm/drm_framebuffer.h`, `drm/drm_fourcc.h`, `drm/drm_kunit_helpers.h`.
- Detected declarations: `struct drm_framebuffer_test`, `struct drm_framebuffer_test_priv`, `struct drm_framebuffer_check_src_coords_case`, `function drm_framebuffer_test_init`, `function drm_test_framebuffer_create`, `function drm_framebuffer_test_to_desc`, `function drm_test_framebuffer_modifiers_not_supported`, `function drm_test_framebuffer_check_src_coords`, `function check_src_coords_test_to_desc`, `function drm_framebuffer_cleanup`.
- 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.