mod common;
use common::{card_guard, fixture, open_card};
use drmkit_scene::{DisplayParams, FixedRect, Rect};
#[test]
#[ignore = "needs a DRM device and DRM master"]
fn a_sub_pixel_crop_reaches_the_kernel_unrounded_vkms() {
let _guard = card_guard();
let Some(device) = open_card() else { return };
let Some(mut fx) = fixture(device) else {
drmkit_testkit::skipped("no connected output");
return;
};
let (w, h) = fx.mode_size();
let Some(handle) = fx.add_layer(0, 0, w + 1, h) else {
drmkit_testkit::skipped("no layer buffer this device will frame");
return;
};
fx.scene
.layer_mut(handle)
.expect("the layer")
.set_display(DisplayParams {
src_rect_fixed: Some(FixedRect {
x: 0x8000,
y: 0,
w: w << 16,
h: h << 16,
}),
dst_rect: Rect { x: 0, y: 0, w, h },
..DisplayParams::default()
});
let report = fx.commit().expect("the frame");
let plane = report
.placements
.iter()
.find_map(|p| p.plane_id)
.expect("the crop is unscaled, so a plane takes it");
assert_eq!(fx.plane_property(plane, "SRC_X"), Some(0x8000));
assert_eq!(fx.plane_property(plane, "SRC_Y"), Some(0));
assert_eq!(fx.plane_property(plane, "SRC_W"), Some(u64::from(w) << 16));
assert_eq!(fx.plane_property(plane, "SRC_H"), Some(u64::from(h) << 16));
fx.teardown();
}