Lines Matching +full:1 +full:- +full:16

1 // SPDX-License-Identifier: GPL-2.0
19 KUNIT_EXPECT_EQ(test, r->x1, expected->x1); in drm_rect_compare()
20 KUNIT_EXPECT_EQ(test, r->y1, expected->y1); in drm_rect_compare()
36 drm_rect_init(&clip, 1, 1, 1, 1); in drm_test_rect_clip_scaled_div_by_zero()
44 drm_rect_init(&clip, 1, 1, 1, 1); in drm_test_rect_clip_scaled_div_by_zero()
56 /* 1:1 scaling */ in drm_test_rect_clip_scaled_not_clipped()
57 drm_rect_init(&src, 0, 0, 1 << 16, 1 << 16); in drm_test_rect_clip_scaled_not_clipped()
58 drm_rect_init(&dst, 0, 0, 1, 1); in drm_test_rect_clip_scaled_not_clipped()
59 drm_rect_init(&clip, 0, 0, 1, 1); in drm_test_rect_clip_scaled_not_clipped()
63 KUNIT_EXPECT_FALSE_MSG(test, src.x1 != 0 || src.x2 != 1 << 16 || in drm_test_rect_clip_scaled_not_clipped()
64 src.y1 != 0 || src.y2 != 1 << 16, "Source badly clipped\n"); in drm_test_rect_clip_scaled_not_clipped()
65 KUNIT_EXPECT_FALSE_MSG(test, dst.x1 != 0 || dst.x2 != 1 || in drm_test_rect_clip_scaled_not_clipped()
66 dst.y1 != 0 || dst.y2 != 1, "Destination badly clipped\n"); in drm_test_rect_clip_scaled_not_clipped()
70 /* 2:1 scaling */ in drm_test_rect_clip_scaled_not_clipped()
71 drm_rect_init(&src, 0, 0, 2 << 16, 2 << 16); in drm_test_rect_clip_scaled_not_clipped()
72 drm_rect_init(&dst, 0, 0, 1, 1); in drm_test_rect_clip_scaled_not_clipped()
73 drm_rect_init(&clip, 0, 0, 1, 1); in drm_test_rect_clip_scaled_not_clipped()
77 KUNIT_EXPECT_FALSE_MSG(test, src.x1 != 0 || src.x2 != 2 << 16 || in drm_test_rect_clip_scaled_not_clipped()
78 src.y1 != 0 || src.y2 != 2 << 16, "Source badly clipped\n"); in drm_test_rect_clip_scaled_not_clipped()
79 KUNIT_EXPECT_FALSE_MSG(test, dst.x1 != 0 || dst.x2 != 1 || in drm_test_rect_clip_scaled_not_clipped()
80 dst.y1 != 0 || dst.y2 != 1, "Destination badly clipped\n"); in drm_test_rect_clip_scaled_not_clipped()
84 /* 1:2 scaling */ in drm_test_rect_clip_scaled_not_clipped()
85 drm_rect_init(&src, 0, 0, 1 << 16, 1 << 16); in drm_test_rect_clip_scaled_not_clipped()
91 KUNIT_EXPECT_FALSE_MSG(test, src.x1 != 0 || src.x2 != 1 << 16 || in drm_test_rect_clip_scaled_not_clipped()
92 src.y1 != 0 || src.y2 != 1 << 16, "Source badly clipped\n"); in drm_test_rect_clip_scaled_not_clipped()
104 /* 1:1 scaling top/left clip */ in drm_test_rect_clip_scaled_clipped()
105 drm_rect_init(&src, 0, 0, 2 << 16, 2 << 16); in drm_test_rect_clip_scaled_clipped()
107 drm_rect_init(&clip, 0, 0, 1, 1); in drm_test_rect_clip_scaled_clipped()
111 KUNIT_EXPECT_FALSE_MSG(test, src.x1 != 0 || src.x2 != 1 << 16 || in drm_test_rect_clip_scaled_clipped()
112 src.y1 != 0 || src.y2 != 1 << 16, "Source badly clipped\n"); in drm_test_rect_clip_scaled_clipped()
113 KUNIT_EXPECT_FALSE_MSG(test, dst.x1 != 0 || dst.x2 != 1 || in drm_test_rect_clip_scaled_clipped()
114 dst.y1 != 0 || dst.y2 != 1, "Destination badly clipped\n"); in drm_test_rect_clip_scaled_clipped()
118 /* 1:1 scaling bottom/right clip */ in drm_test_rect_clip_scaled_clipped()
119 drm_rect_init(&src, 0, 0, 2 << 16, 2 << 16); in drm_test_rect_clip_scaled_clipped()
121 drm_rect_init(&clip, 1, 1, 1, 1); in drm_test_rect_clip_scaled_clipped()
125 KUNIT_EXPECT_FALSE_MSG(test, src.x1 != 1 << 16 || src.x2 != 2 << 16 || in drm_test_rect_clip_scaled_clipped()
126 src.y1 != 1 << 16 || src.y2 != 2 << 16, "Source badly clipped\n"); in drm_test_rect_clip_scaled_clipped()
127 KUNIT_EXPECT_FALSE_MSG(test, dst.x1 != 1 || dst.x2 != 2 || dst.y1 != 1 || in drm_test_rect_clip_scaled_clipped()
132 /* 2:1 scaling top/left clip */ in drm_test_rect_clip_scaled_clipped()
133 drm_rect_init(&src, 0, 0, 4 << 16, 4 << 16); in drm_test_rect_clip_scaled_clipped()
135 drm_rect_init(&clip, 0, 0, 1, 1); in drm_test_rect_clip_scaled_clipped()
139 KUNIT_EXPECT_FALSE_MSG(test, src.x1 != 0 || src.x2 != 2 << 16 || in drm_test_rect_clip_scaled_clipped()
140 src.y1 != 0 || src.y2 != 2 << 16, "Source badly clipped\n"); in drm_test_rect_clip_scaled_clipped()
141 KUNIT_EXPECT_FALSE_MSG(test, dst.x1 != 0 || dst.x2 != 1 || dst.y1 != 0 || in drm_test_rect_clip_scaled_clipped()
142 dst.y2 != 1, "Destination badly clipped\n"); in drm_test_rect_clip_scaled_clipped()
146 /* 2:1 scaling bottom/right clip */ in drm_test_rect_clip_scaled_clipped()
147 drm_rect_init(&src, 0, 0, 4 << 16, 4 << 16); in drm_test_rect_clip_scaled_clipped()
149 drm_rect_init(&clip, 1, 1, 1, 1); in drm_test_rect_clip_scaled_clipped()
153 KUNIT_EXPECT_FALSE_MSG(test, src.x1 != 2 << 16 || src.x2 != 4 << 16 || in drm_test_rect_clip_scaled_clipped()
154 src.y1 != 2 << 16 || src.y2 != 4 << 16, "Source badly clipped\n"); in drm_test_rect_clip_scaled_clipped()
155 KUNIT_EXPECT_FALSE_MSG(test, dst.x1 != 1 || dst.x2 != 2 || dst.y1 != 1 || in drm_test_rect_clip_scaled_clipped()
160 /* 1:2 scaling top/left clip */ in drm_test_rect_clip_scaled_clipped()
161 drm_rect_init(&src, 0, 0, 2 << 16, 2 << 16); in drm_test_rect_clip_scaled_clipped()
167 KUNIT_EXPECT_FALSE_MSG(test, src.x1 != 0 || src.x2 != 1 << 16 || in drm_test_rect_clip_scaled_clipped()
168 src.y1 != 0 || src.y2 != 1 << 16, "Source badly clipped\n"); in drm_test_rect_clip_scaled_clipped()
174 /* 1:2 scaling bottom/right clip */ in drm_test_rect_clip_scaled_clipped()
175 drm_rect_init(&src, 0, 0, 2 << 16, 2 << 16); in drm_test_rect_clip_scaled_clipped()
181 KUNIT_EXPECT_FALSE_MSG(test, src.x1 != 1 << 16 || src.x2 != 2 << 16 || in drm_test_rect_clip_scaled_clipped()
182 src.y1 != 1 << 16 || src.y2 != 2 << 16, "Source badly clipped\n"); in drm_test_rect_clip_scaled_clipped()
195 * 'clip.x2 - dst.x1 >= dst width' could result a negative in drm_test_rect_clip_scaled_signed_vs_unsigned()
204 drm_rect_init(&clip, 3, 3, 1, 1); in drm_test_rect_clip_scaled_signed_vs_unsigned()
221 .description = "top-left x bottom-right",
222 .r1 = DRM_RECT_INIT(1, 1, 2, 2),
225 .expected_intersection = DRM_RECT_INIT(1, 1, 1, 1),
228 .description = "top-right x bottom-left",
230 .r2 = DRM_RECT_INIT(1, -1, 2, 2),
232 .expected_intersection = DRM_RECT_INIT(1, 0, 1, 1),
235 .description = "bottom-left x top-right",
236 .r1 = DRM_RECT_INIT(1, -1, 2, 2),
239 .expected_intersection = DRM_RECT_INIT(1, 0, 1, 1),
242 .description = "bottom-right x top-left",
244 .r2 = DRM_RECT_INIT(1, 1, 2, 2),
246 .expected_intersection = DRM_RECT_INIT(1, 1, 1, 1),
250 .r1 = DRM_RECT_INIT(0, 0, 2, 1),
251 .r2 = DRM_RECT_INIT(1, 0, 3, 1),
253 .expected_intersection = DRM_RECT_INIT(1, 0, 1, 1),
257 .r1 = DRM_RECT_INIT(1, 0, 3, 1),
258 .r2 = DRM_RECT_INIT(0, 0, 2, 1),
260 .expected_intersection = DRM_RECT_INIT(1, 0, 1, 1),
264 .r1 = DRM_RECT_INIT(0, 0, 1, 2),
265 .r2 = DRM_RECT_INIT(0, -1, 1, 3),
267 .expected_intersection = DRM_RECT_INIT(0, 0, 1, 2),
271 .r1 = DRM_RECT_INIT(0, -1, 1, 3),
272 .r2 = DRM_RECT_INIT(0, 0, 1, 2),
274 .expected_intersection = DRM_RECT_INIT(0, 0, 1, 2),
278 .r1 = DRM_RECT_INIT(0, 0, 1, 1),
279 .r2 = DRM_RECT_INIT(1, 1, 2, 2),
281 .expected_intersection = DRM_RECT_INIT(1, 1, 0, 0),
285 .r1 = DRM_RECT_INIT(0, 0, 1, 1),
286 .r2 = DRM_RECT_INIT(1, 0, 1, 1),
288 .expected_intersection = DRM_RECT_INIT(1, 0, 0, 1),
300 .r2 = DRM_RECT_INIT(1, 1, 1, 1),
302 .expected_intersection = DRM_RECT_INIT(1, 1, 1, 1),
306 .r1 = DRM_RECT_INIT(0, 0, 1, 1),
307 .r2 = DRM_RECT_INIT(3, 6, 1, 1),
309 .expected_intersection = DRM_RECT_INIT(3, 6, -2, -5),
323 .expected_intersection = DRM_RECT_INIT(5, 10, -5, -10),
331 t->description, DRM_RECT_ARG(&t->r1), DRM_RECT_ARG(&t->r2)); in drm_rect_intersect_case_desc()
338 const struct drm_rect_intersect_case *params = test->param_value; in drm_test_rect_intersect()
339 struct drm_rect r1_aux = params->r1; in drm_test_rect_intersect()
342 visible = drm_rect_intersect(&r1_aux, &params->r2); in drm_test_rect_intersect()
344 KUNIT_EXPECT_EQ(test, visible, params->should_be_visible); in drm_test_rect_intersect()
345 drm_rect_compare(test, &r1_aux, &params->expected_intersection); in drm_test_rect_intersect()
358 .src = DRM_RECT_INIT(0, 0, 2 << 16, 2 << 16),
359 .dst = DRM_RECT_INIT(0, 0, 1 << 16, 1 << 16),
365 .src = DRM_RECT_INIT(0, 0, 10 << 16, 10 << 16),
366 .dst = DRM_RECT_INIT(0, 0, 1 << 16, 1 << 16),
368 .expected_scaling_factor = -ERANGE,
372 .src = DRM_RECT_INIT(0, 0, 2 << 16, 2 << 16),
373 .dst = DRM_RECT_INIT(0, 0, 1 << 16, 1 << 16),
375 .expected_scaling_factor = -ERANGE,
379 .src = DRM_RECT_INIT(0, 0, 2 << 16, 2 << 16),
380 .dst = DRM_RECT_INIT(0, 0, 0 << 16, 0 << 16),
386 .src = DRM_RECT_INIT(0, 0, -(1 << 16), -(1 << 16)),
387 .dst = DRM_RECT_INIT(0, 0, 1 << 16, 1 << 16),
389 .expected_scaling_factor = -EINVAL,
393 .src = DRM_RECT_INIT(0, 0, 1 << 16, 1 << 16),
394 .dst = DRM_RECT_INIT(0, 0, -(1 << 16), -(1 << 16)),
396 .expected_scaling_factor = -EINVAL,
402 strscpy(desc, t->name, KUNIT_PARAM_DESC_SIZE); in drm_rect_scale_case_desc()
409 const struct drm_rect_scale_case *params = test->param_value; in drm_test_rect_calc_hscale()
412 scaling_factor = drm_rect_calc_hscale(&params->src, &params->dst, in drm_test_rect_calc_hscale()
413 params->min_range, params->max_range); in drm_test_rect_calc_hscale()
415 KUNIT_EXPECT_EQ(test, scaling_factor, params->expected_scaling_factor); in drm_test_rect_calc_hscale()
420 const struct drm_rect_scale_case *params = test->param_value; in drm_test_rect_calc_vscale()
423 scaling_factor = drm_rect_calc_vscale(&params->src, &params->dst, in drm_test_rect_calc_vscale()
424 params->min_range, params->max_range); in drm_test_rect_calc_vscale()
426 KUNIT_EXPECT_EQ(test, scaling_factor, params->expected_scaling_factor); in drm_test_rect_calc_vscale()
439 .name = "reflect-x",
446 .name = "reflect-y",
453 .name = "rotate-0",
460 .name = "rotate-90",
467 .name = "rotate-180",
471 .expected = DRM_RECT_INIT(-11, -3, 5, 10),
474 .name = "rotate-270",
478 .expected = DRM_RECT_INIT(-3, 6, 10, 5),
484 strscpy(desc, t->name, KUNIT_PARAM_DESC_SIZE); in drm_rect_rotate_case_desc()
491 const struct drm_rect_rotate_case *params = test->param_value; in drm_test_rect_rotate()
492 struct drm_rect r = params->rect; in drm_test_rect_rotate()
494 drm_rect_rotate(&r, params->width, params->height, params->rotation); in drm_test_rect_rotate()
496 drm_rect_compare(test, &r, &params->expected); in drm_test_rect_rotate()
501 const struct drm_rect_rotate_case *params = test->param_value; in drm_test_rect_rotate_inv()
502 struct drm_rect r = params->expected; in drm_test_rect_rotate_inv()
504 drm_rect_rotate_inv(&r, params->width, params->height, params->rotation); in drm_test_rect_rotate_inv()
506 drm_rect_compare(test, &r, &params->rect); in drm_test_rect_rotate_inv()