xref: /aosp_15_r20/external/igt-gpu-tools/tests/kms_prop_blob.c (revision d83cc019efdc2edc6c4b16e9034a3ceb8d35d77c)
1*d83cc019SAndroid Build Coastguard Worker /*
2*d83cc019SAndroid Build Coastguard Worker  * Copyright © 2014-2015 Intel Corporation
3*d83cc019SAndroid Build Coastguard Worker  *
4*d83cc019SAndroid Build Coastguard Worker  * Permission is hereby granted, free of charge, to any person obtaining a
5*d83cc019SAndroid Build Coastguard Worker  * copy of this software and associated documentation files (the "Software"),
6*d83cc019SAndroid Build Coastguard Worker  * to deal in the Software without restriction, including without limitation
7*d83cc019SAndroid Build Coastguard Worker  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8*d83cc019SAndroid Build Coastguard Worker  * and/or sell copies of the Software, and to permit persons to whom the
9*d83cc019SAndroid Build Coastguard Worker  * Software is furnished to do so, subject to the following conditions:
10*d83cc019SAndroid Build Coastguard Worker  *
11*d83cc019SAndroid Build Coastguard Worker  * The above copyright notice and this permission notice (including the next
12*d83cc019SAndroid Build Coastguard Worker  * paragraph) shall be included in all copies or substantial portions of the
13*d83cc019SAndroid Build Coastguard Worker  * Software.
14*d83cc019SAndroid Build Coastguard Worker  *
15*d83cc019SAndroid Build Coastguard Worker  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16*d83cc019SAndroid Build Coastguard Worker  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17*d83cc019SAndroid Build Coastguard Worker  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18*d83cc019SAndroid Build Coastguard Worker  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19*d83cc019SAndroid Build Coastguard Worker  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20*d83cc019SAndroid Build Coastguard Worker  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21*d83cc019SAndroid Build Coastguard Worker  * IN THE SOFTWARE.
22*d83cc019SAndroid Build Coastguard Worker  *
23*d83cc019SAndroid Build Coastguard Worker  * Authors:
24*d83cc019SAndroid Build Coastguard Worker  *   Damien Lespiau <[email protected]>
25*d83cc019SAndroid Build Coastguard Worker  *   Daniel Stone <[email protected]>
26*d83cc019SAndroid Build Coastguard Worker  */
27*d83cc019SAndroid Build Coastguard Worker 
28*d83cc019SAndroid Build Coastguard Worker #include "igt.h"
29*d83cc019SAndroid Build Coastguard Worker #include <errno.h>
30*d83cc019SAndroid Build Coastguard Worker #include <stdbool.h>
31*d83cc019SAndroid Build Coastguard Worker #include <stdio.h>
32*d83cc019SAndroid Build Coastguard Worker #include <string.h>
33*d83cc019SAndroid Build Coastguard Worker 
34*d83cc019SAndroid Build Coastguard Worker IGT_TEST_DESCRIPTION("Tests behaviour of mass-data 'blob' properties.");
35*d83cc019SAndroid Build Coastguard Worker 
36*d83cc019SAndroid Build Coastguard Worker static const struct drm_mode_modeinfo test_mode_valid = {
37*d83cc019SAndroid Build Coastguard Worker 	.clock = 1234,
38*d83cc019SAndroid Build Coastguard Worker 	.hdisplay = 640,
39*d83cc019SAndroid Build Coastguard Worker 	.hsync_start = 641,
40*d83cc019SAndroid Build Coastguard Worker 	.hsync_end = 642,
41*d83cc019SAndroid Build Coastguard Worker 	.htotal = 643,
42*d83cc019SAndroid Build Coastguard Worker 	.hskew = 0,
43*d83cc019SAndroid Build Coastguard Worker 	.vdisplay = 480,
44*d83cc019SAndroid Build Coastguard Worker 	.vsync_start = 481,
45*d83cc019SAndroid Build Coastguard Worker 	.vsync_end = 482,
46*d83cc019SAndroid Build Coastguard Worker 	.vtotal = 483,
47*d83cc019SAndroid Build Coastguard Worker 	.vscan = 0,
48*d83cc019SAndroid Build Coastguard Worker 	.vrefresh = 60000,
49*d83cc019SAndroid Build Coastguard Worker 	.flags = 0,
50*d83cc019SAndroid Build Coastguard Worker 	.type = 0,
51*d83cc019SAndroid Build Coastguard Worker 	.name = "FROMUSER",
52*d83cc019SAndroid Build Coastguard Worker };
53*d83cc019SAndroid Build Coastguard Worker 
54*d83cc019SAndroid Build Coastguard Worker 
55*d83cc019SAndroid Build Coastguard Worker #define ioctl_or_ret_errno(fd, ioc, ioc_data) { \
56*d83cc019SAndroid Build Coastguard Worker 	if (drmIoctl(fd, ioc, ioc_data) != 0) \
57*d83cc019SAndroid Build Coastguard Worker 		return errno; \
58*d83cc019SAndroid Build Coastguard Worker }
59*d83cc019SAndroid Build Coastguard Worker 
igt_require_propblob(int fd)60*d83cc019SAndroid Build Coastguard Worker static void igt_require_propblob(int fd)
61*d83cc019SAndroid Build Coastguard Worker {
62*d83cc019SAndroid Build Coastguard Worker 	struct drm_mode_create_blob c;
63*d83cc019SAndroid Build Coastguard Worker 	struct drm_mode_destroy_blob d;
64*d83cc019SAndroid Build Coastguard Worker 	uint32_t blob_data;
65*d83cc019SAndroid Build Coastguard Worker 	c.data = (uintptr_t) &blob_data;
66*d83cc019SAndroid Build Coastguard Worker 	c.length = sizeof(blob_data);
67*d83cc019SAndroid Build Coastguard Worker 
68*d83cc019SAndroid Build Coastguard Worker 	igt_require(drmIoctl(fd, DRM_IOCTL_MODE_CREATEPROPBLOB, &c) == 0);
69*d83cc019SAndroid Build Coastguard Worker 	d.blob_id = c.blob_id;
70*d83cc019SAndroid Build Coastguard Worker 	igt_require(drmIoctl(fd, DRM_IOCTL_MODE_DESTROYPROPBLOB, &d) == 0);
71*d83cc019SAndroid Build Coastguard Worker }
72*d83cc019SAndroid Build Coastguard Worker 
73*d83cc019SAndroid Build Coastguard Worker static int
validate_prop(int fd,uint32_t prop_id)74*d83cc019SAndroid Build Coastguard Worker validate_prop(int fd, uint32_t prop_id)
75*d83cc019SAndroid Build Coastguard Worker {
76*d83cc019SAndroid Build Coastguard Worker 	struct drm_mode_get_blob get;
77*d83cc019SAndroid Build Coastguard Worker 	struct drm_mode_modeinfo ret_mode;
78*d83cc019SAndroid Build Coastguard Worker 
79*d83cc019SAndroid Build Coastguard Worker 	get.blob_id = prop_id;
80*d83cc019SAndroid Build Coastguard Worker 	get.length = 0;
81*d83cc019SAndroid Build Coastguard Worker 	get.data = (uintptr_t) 0;
82*d83cc019SAndroid Build Coastguard Worker 	ioctl_or_ret_errno(fd, DRM_IOCTL_MODE_GETPROPBLOB, &get);
83*d83cc019SAndroid Build Coastguard Worker 
84*d83cc019SAndroid Build Coastguard Worker 	if (get.length != sizeof(test_mode_valid))
85*d83cc019SAndroid Build Coastguard Worker 		return ENOMEM;
86*d83cc019SAndroid Build Coastguard Worker 
87*d83cc019SAndroid Build Coastguard Worker 	get.data = (uintptr_t) &ret_mode;
88*d83cc019SAndroid Build Coastguard Worker 	ioctl_or_ret_errno(fd, DRM_IOCTL_MODE_GETPROPBLOB, &get);
89*d83cc019SAndroid Build Coastguard Worker 
90*d83cc019SAndroid Build Coastguard Worker 	if (memcmp(&ret_mode, &test_mode_valid, sizeof(test_mode_valid)) != 0)
91*d83cc019SAndroid Build Coastguard Worker 		return EINVAL;
92*d83cc019SAndroid Build Coastguard Worker 
93*d83cc019SAndroid Build Coastguard Worker 	return 0;
94*d83cc019SAndroid Build Coastguard Worker }
95*d83cc019SAndroid Build Coastguard Worker 
96*d83cc019SAndroid Build Coastguard Worker static uint32_t
create_prop(int fd)97*d83cc019SAndroid Build Coastguard Worker create_prop(int fd)
98*d83cc019SAndroid Build Coastguard Worker {
99*d83cc019SAndroid Build Coastguard Worker 	struct drm_mode_create_blob create;
100*d83cc019SAndroid Build Coastguard Worker 
101*d83cc019SAndroid Build Coastguard Worker 	create.length = sizeof(test_mode_valid);
102*d83cc019SAndroid Build Coastguard Worker 	create.data = (uintptr_t) &test_mode_valid;
103*d83cc019SAndroid Build Coastguard Worker 
104*d83cc019SAndroid Build Coastguard Worker 	do_ioctl(fd, DRM_IOCTL_MODE_CREATEPROPBLOB, &create);
105*d83cc019SAndroid Build Coastguard Worker 	igt_assert_neq_u32(create.blob_id, 0);
106*d83cc019SAndroid Build Coastguard Worker 
107*d83cc019SAndroid Build Coastguard Worker 	return create.blob_id;
108*d83cc019SAndroid Build Coastguard Worker }
109*d83cc019SAndroid Build Coastguard Worker 
110*d83cc019SAndroid Build Coastguard Worker static int
destroy_prop(int fd,uint32_t prop_id)111*d83cc019SAndroid Build Coastguard Worker destroy_prop(int fd, uint32_t prop_id)
112*d83cc019SAndroid Build Coastguard Worker {
113*d83cc019SAndroid Build Coastguard Worker 	struct drm_mode_destroy_blob destroy;
114*d83cc019SAndroid Build Coastguard Worker 
115*d83cc019SAndroid Build Coastguard Worker 	destroy.blob_id = prop_id;
116*d83cc019SAndroid Build Coastguard Worker 	ioctl_or_ret_errno(fd, DRM_IOCTL_MODE_DESTROYPROPBLOB, &destroy);
117*d83cc019SAndroid Build Coastguard Worker 
118*d83cc019SAndroid Build Coastguard Worker 	return 0;
119*d83cc019SAndroid Build Coastguard Worker }
120*d83cc019SAndroid Build Coastguard Worker 
121*d83cc019SAndroid Build Coastguard Worker static void
test_validate(int fd)122*d83cc019SAndroid Build Coastguard Worker test_validate(int fd)
123*d83cc019SAndroid Build Coastguard Worker {
124*d83cc019SAndroid Build Coastguard Worker 	struct drm_mode_create_blob create;
125*d83cc019SAndroid Build Coastguard Worker 	struct drm_mode_get_blob get;
126*d83cc019SAndroid Build Coastguard Worker 	char too_small[32];
127*d83cc019SAndroid Build Coastguard Worker 	uint32_t prop_id;
128*d83cc019SAndroid Build Coastguard Worker 
129*d83cc019SAndroid Build Coastguard Worker 	memset(too_small, 0, sizeof(too_small));
130*d83cc019SAndroid Build Coastguard Worker 
131*d83cc019SAndroid Build Coastguard Worker 	/* Outlandish size. */
132*d83cc019SAndroid Build Coastguard Worker 	create.length = 0x10000;
133*d83cc019SAndroid Build Coastguard Worker 	create.data = (uintptr_t) &too_small;
134*d83cc019SAndroid Build Coastguard Worker 	do_ioctl_err(fd, DRM_IOCTL_MODE_CREATEPROPBLOB, &create, EFAULT);
135*d83cc019SAndroid Build Coastguard Worker 
136*d83cc019SAndroid Build Coastguard Worker 	/* Outlandish address. */
137*d83cc019SAndroid Build Coastguard Worker 	create.length = sizeof(test_mode_valid);
138*d83cc019SAndroid Build Coastguard Worker 	create.data = (uintptr_t) 0xdeadbeee;
139*d83cc019SAndroid Build Coastguard Worker 	do_ioctl_err(fd, DRM_IOCTL_MODE_CREATEPROPBLOB, &create, EFAULT);
140*d83cc019SAndroid Build Coastguard Worker 
141*d83cc019SAndroid Build Coastguard Worker 	/* When we pass an incorrect size, the kernel should correct us. */
142*d83cc019SAndroid Build Coastguard Worker 	prop_id = create_prop(fd);
143*d83cc019SAndroid Build Coastguard Worker 	get.blob_id = prop_id;
144*d83cc019SAndroid Build Coastguard Worker 	get.length = sizeof(too_small);
145*d83cc019SAndroid Build Coastguard Worker 	get.data = (uintptr_t) too_small;
146*d83cc019SAndroid Build Coastguard Worker 	do_ioctl(fd, DRM_IOCTL_MODE_GETPROPBLOB, &get);
147*d83cc019SAndroid Build Coastguard Worker 	igt_assert_eq_u32(get.length, sizeof(test_mode_valid));
148*d83cc019SAndroid Build Coastguard Worker 
149*d83cc019SAndroid Build Coastguard Worker 	get.blob_id = prop_id;
150*d83cc019SAndroid Build Coastguard Worker 	get.data = (uintptr_t) 0xdeadbeee;
151*d83cc019SAndroid Build Coastguard Worker 	do_ioctl_err(fd, DRM_IOCTL_MODE_CREATEPROPBLOB, &create, EFAULT);
152*d83cc019SAndroid Build Coastguard Worker }
153*d83cc019SAndroid Build Coastguard Worker 
154*d83cc019SAndroid Build Coastguard Worker static void
test_lifetime(int fd)155*d83cc019SAndroid Build Coastguard Worker test_lifetime(int fd)
156*d83cc019SAndroid Build Coastguard Worker {
157*d83cc019SAndroid Build Coastguard Worker 	int fd2;
158*d83cc019SAndroid Build Coastguard Worker 	uint32_t prop_id, prop_id2;
159*d83cc019SAndroid Build Coastguard Worker 
160*d83cc019SAndroid Build Coastguard Worker 	fd2 = drm_open_driver(DRIVER_ANY);
161*d83cc019SAndroid Build Coastguard Worker 	igt_assert_fd(fd2);
162*d83cc019SAndroid Build Coastguard Worker 
163*d83cc019SAndroid Build Coastguard Worker 	/* Ensure clients can see properties created by other clients. */
164*d83cc019SAndroid Build Coastguard Worker 	prop_id = create_prop(fd);
165*d83cc019SAndroid Build Coastguard Worker 	igt_assert_eq(validate_prop(fd, prop_id), 0);
166*d83cc019SAndroid Build Coastguard Worker 	igt_assert_eq(validate_prop(fd2, prop_id), 0);
167*d83cc019SAndroid Build Coastguard Worker 
168*d83cc019SAndroid Build Coastguard Worker 	/* ... but can't destroy them. */
169*d83cc019SAndroid Build Coastguard Worker 	igt_assert_eq(destroy_prop(fd2, prop_id), EPERM);
170*d83cc019SAndroid Build Coastguard Worker 
171*d83cc019SAndroid Build Coastguard Worker 	/* Make sure properties can't be accessed once explicitly destroyed. */
172*d83cc019SAndroid Build Coastguard Worker 	prop_id2 = create_prop(fd2);
173*d83cc019SAndroid Build Coastguard Worker 	igt_assert_eq(validate_prop(fd2, prop_id2), 0);
174*d83cc019SAndroid Build Coastguard Worker 	igt_assert_eq(destroy_prop(fd2, prop_id2), 0);
175*d83cc019SAndroid Build Coastguard Worker 	igt_assert_eq(validate_prop(fd2, prop_id2), ENOENT);
176*d83cc019SAndroid Build Coastguard Worker 	igt_assert_eq(validate_prop(fd, prop_id2), ENOENT);
177*d83cc019SAndroid Build Coastguard Worker 
178*d83cc019SAndroid Build Coastguard Worker 	/* Make sure properties are cleaned up on client exit. */
179*d83cc019SAndroid Build Coastguard Worker 	prop_id2 = create_prop(fd2);
180*d83cc019SAndroid Build Coastguard Worker 	igt_assert_eq(validate_prop(fd, prop_id2), 0);
181*d83cc019SAndroid Build Coastguard Worker 	igt_assert_eq(close(fd2), 0);
182*d83cc019SAndroid Build Coastguard Worker 	igt_assert_eq(validate_prop(fd, prop_id2), ENOENT);
183*d83cc019SAndroid Build Coastguard Worker 
184*d83cc019SAndroid Build Coastguard Worker 	igt_assert_eq(validate_prop(fd, prop_id), 0);
185*d83cc019SAndroid Build Coastguard Worker 	igt_assert_eq(destroy_prop(fd, prop_id), 0);
186*d83cc019SAndroid Build Coastguard Worker 	igt_assert_eq(validate_prop(fd, prop_id), ENOENT);
187*d83cc019SAndroid Build Coastguard Worker }
188*d83cc019SAndroid Build Coastguard Worker 
189*d83cc019SAndroid Build Coastguard Worker static void
test_multiple(int fd)190*d83cc019SAndroid Build Coastguard Worker test_multiple(int fd)
191*d83cc019SAndroid Build Coastguard Worker {
192*d83cc019SAndroid Build Coastguard Worker 	uint32_t prop_ids[5];
193*d83cc019SAndroid Build Coastguard Worker 	int fd2;
194*d83cc019SAndroid Build Coastguard Worker 	int i;
195*d83cc019SAndroid Build Coastguard Worker 
196*d83cc019SAndroid Build Coastguard Worker 	fd2 = drm_open_driver(DRIVER_ANY);
197*d83cc019SAndroid Build Coastguard Worker 	igt_assert_fd(fd2);
198*d83cc019SAndroid Build Coastguard Worker 
199*d83cc019SAndroid Build Coastguard Worker 	/* Ensure destroying multiple properties explicitly works as needed. */
200*d83cc019SAndroid Build Coastguard Worker 	for (i = 0; i < ARRAY_SIZE(prop_ids); i++) {
201*d83cc019SAndroid Build Coastguard Worker 		prop_ids[i] = create_prop(fd2);
202*d83cc019SAndroid Build Coastguard Worker 		igt_assert_eq(validate_prop(fd, prop_ids[i]), 0);
203*d83cc019SAndroid Build Coastguard Worker 		igt_assert_eq(validate_prop(fd2, prop_ids[i]), 0);
204*d83cc019SAndroid Build Coastguard Worker 	}
205*d83cc019SAndroid Build Coastguard Worker 	for (i = 0; i < ARRAY_SIZE(prop_ids); i++) {
206*d83cc019SAndroid Build Coastguard Worker 		igt_assert_eq(destroy_prop(fd2, prop_ids[i]), 0);
207*d83cc019SAndroid Build Coastguard Worker 		igt_assert_eq(validate_prop(fd2, prop_ids[i]), ENOENT);
208*d83cc019SAndroid Build Coastguard Worker 	}
209*d83cc019SAndroid Build Coastguard Worker 	igt_assert_eq(close(fd2), 0);
210*d83cc019SAndroid Build Coastguard Worker 
211*d83cc019SAndroid Build Coastguard Worker 	fd2 = drm_open_driver(DRIVER_ANY);
212*d83cc019SAndroid Build Coastguard Worker 	igt_assert_fd(fd2);
213*d83cc019SAndroid Build Coastguard Worker 
214*d83cc019SAndroid Build Coastguard Worker 	/* Ensure that multiple properties get cleaned up on fd close. */
215*d83cc019SAndroid Build Coastguard Worker 	for (i = 0; i < ARRAY_SIZE(prop_ids); i++) {
216*d83cc019SAndroid Build Coastguard Worker 		prop_ids[i] = create_prop(fd2);
217*d83cc019SAndroid Build Coastguard Worker 		igt_assert_eq(validate_prop(fd, prop_ids[i]), 0);
218*d83cc019SAndroid Build Coastguard Worker 		igt_assert_eq(validate_prop(fd2, prop_ids[i]), 0);
219*d83cc019SAndroid Build Coastguard Worker 	}
220*d83cc019SAndroid Build Coastguard Worker 	igt_assert_eq(close(fd2), 0);
221*d83cc019SAndroid Build Coastguard Worker 
222*d83cc019SAndroid Build Coastguard Worker 	for (i = 0; i < ARRAY_SIZE(prop_ids); i++)
223*d83cc019SAndroid Build Coastguard Worker 		igt_assert_eq(validate_prop(fd, prop_ids[i]), ENOENT);
224*d83cc019SAndroid Build Coastguard Worker }
225*d83cc019SAndroid Build Coastguard Worker 
226*d83cc019SAndroid Build Coastguard Worker static void
test_core(int fd)227*d83cc019SAndroid Build Coastguard Worker test_core(int fd)
228*d83cc019SAndroid Build Coastguard Worker {
229*d83cc019SAndroid Build Coastguard Worker 	uint32_t prop_id;
230*d83cc019SAndroid Build Coastguard Worker 
231*d83cc019SAndroid Build Coastguard Worker 	/* The first hurdle. */
232*d83cc019SAndroid Build Coastguard Worker 	prop_id = create_prop(fd);
233*d83cc019SAndroid Build Coastguard Worker 	igt_assert_eq(validate_prop(fd, prop_id), 0);
234*d83cc019SAndroid Build Coastguard Worker 	igt_assert_eq(destroy_prop(fd, prop_id), 0);
235*d83cc019SAndroid Build Coastguard Worker 
236*d83cc019SAndroid Build Coastguard Worker 	/* Look up some invalid property IDs. They should fail. */
237*d83cc019SAndroid Build Coastguard Worker 	igt_assert_eq(validate_prop(fd, 0xffffffff), ENOENT);
238*d83cc019SAndroid Build Coastguard Worker 	igt_assert_eq(validate_prop(fd, 0), ENOENT);
239*d83cc019SAndroid Build Coastguard Worker }
240*d83cc019SAndroid Build Coastguard Worker 
241*d83cc019SAndroid Build Coastguard Worker static void
test_basic(int fd)242*d83cc019SAndroid Build Coastguard Worker test_basic(int fd)
243*d83cc019SAndroid Build Coastguard Worker {
244*d83cc019SAndroid Build Coastguard Worker 	uint32_t prop_id;
245*d83cc019SAndroid Build Coastguard Worker 
246*d83cc019SAndroid Build Coastguard Worker 	/* A very simple gating test to ensure property support exists. */
247*d83cc019SAndroid Build Coastguard Worker 	prop_id = create_prop(fd);
248*d83cc019SAndroid Build Coastguard Worker 	igt_assert_eq(destroy_prop(fd, prop_id), 0);
249*d83cc019SAndroid Build Coastguard Worker }
250*d83cc019SAndroid Build Coastguard Worker 
prop_tests(int fd)251*d83cc019SAndroid Build Coastguard Worker static void prop_tests(int fd)
252*d83cc019SAndroid Build Coastguard Worker {
253*d83cc019SAndroid Build Coastguard Worker 	struct drm_mode_obj_get_properties get_props = {};
254*d83cc019SAndroid Build Coastguard Worker 	struct drm_mode_obj_set_property set_prop = {};
255*d83cc019SAndroid Build Coastguard Worker 	uint64_t prop, prop_val, blob_id;
256*d83cc019SAndroid Build Coastguard Worker 
257*d83cc019SAndroid Build Coastguard Worker 	igt_fixture
258*d83cc019SAndroid Build Coastguard Worker 		blob_id = create_prop(fd);
259*d83cc019SAndroid Build Coastguard Worker 
260*d83cc019SAndroid Build Coastguard Worker 	get_props.props_ptr = (uintptr_t) &prop;
261*d83cc019SAndroid Build Coastguard Worker 	get_props.prop_values_ptr = (uintptr_t) &prop_val;
262*d83cc019SAndroid Build Coastguard Worker 	get_props.count_props = 1;
263*d83cc019SAndroid Build Coastguard Worker 	get_props.obj_id = blob_id;
264*d83cc019SAndroid Build Coastguard Worker 
265*d83cc019SAndroid Build Coastguard Worker 	igt_subtest("invalid-get-prop-any") {
266*d83cc019SAndroid Build Coastguard Worker 		get_props.obj_type = 0; /* DRM_MODE_OBJECT_ANY */
267*d83cc019SAndroid Build Coastguard Worker 
268*d83cc019SAndroid Build Coastguard Worker 		igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_OBJ_GETPROPERTIES,
269*d83cc019SAndroid Build Coastguard Worker 				    &get_props) == -1 && errno == EINVAL);
270*d83cc019SAndroid Build Coastguard Worker 	}
271*d83cc019SAndroid Build Coastguard Worker 
272*d83cc019SAndroid Build Coastguard Worker 	igt_subtest("invalid-get-prop") {
273*d83cc019SAndroid Build Coastguard Worker 		get_props.obj_type = DRM_MODE_OBJECT_BLOB;
274*d83cc019SAndroid Build Coastguard Worker 
275*d83cc019SAndroid Build Coastguard Worker 		igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_OBJ_GETPROPERTIES,
276*d83cc019SAndroid Build Coastguard Worker 				    &get_props) == -1 && errno == EINVAL);
277*d83cc019SAndroid Build Coastguard Worker 	}
278*d83cc019SAndroid Build Coastguard Worker 
279*d83cc019SAndroid Build Coastguard Worker 	set_prop.value = 0;
280*d83cc019SAndroid Build Coastguard Worker 	set_prop.prop_id = 1;
281*d83cc019SAndroid Build Coastguard Worker 	set_prop.obj_id = blob_id;
282*d83cc019SAndroid Build Coastguard Worker 
283*d83cc019SAndroid Build Coastguard Worker 	igt_subtest("invalid-set-prop-any") {
284*d83cc019SAndroid Build Coastguard Worker 		set_prop.obj_type = 0; /* DRM_MODE_OBJECT_ANY */
285*d83cc019SAndroid Build Coastguard Worker 
286*d83cc019SAndroid Build Coastguard Worker 		igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_OBJ_SETPROPERTY,
287*d83cc019SAndroid Build Coastguard Worker 				    &set_prop) == -1 && errno == EINVAL);
288*d83cc019SAndroid Build Coastguard Worker 	}
289*d83cc019SAndroid Build Coastguard Worker 
290*d83cc019SAndroid Build Coastguard Worker 	igt_subtest("invalid-set-prop") {
291*d83cc019SAndroid Build Coastguard Worker 		set_prop.obj_type = DRM_MODE_OBJECT_BLOB;
292*d83cc019SAndroid Build Coastguard Worker 
293*d83cc019SAndroid Build Coastguard Worker 		igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_OBJ_SETPROPERTY,
294*d83cc019SAndroid Build Coastguard Worker 				    &set_prop) == -1 && errno == EINVAL);
295*d83cc019SAndroid Build Coastguard Worker 	}
296*d83cc019SAndroid Build Coastguard Worker 
297*d83cc019SAndroid Build Coastguard Worker 	igt_fixture
298*d83cc019SAndroid Build Coastguard Worker 		destroy_prop(fd, blob_id);
299*d83cc019SAndroid Build Coastguard Worker }
300*d83cc019SAndroid Build Coastguard Worker 
301*d83cc019SAndroid Build Coastguard Worker igt_main
302*d83cc019SAndroid Build Coastguard Worker {
303*d83cc019SAndroid Build Coastguard Worker 	int fd;
304*d83cc019SAndroid Build Coastguard Worker 
305*d83cc019SAndroid Build Coastguard Worker 	igt_fixture {
306*d83cc019SAndroid Build Coastguard Worker 		fd = drm_open_driver(DRIVER_ANY);
307*d83cc019SAndroid Build Coastguard Worker 		igt_require(fd >= 0);
308*d83cc019SAndroid Build Coastguard Worker 		igt_require_propblob(fd);
309*d83cc019SAndroid Build Coastguard Worker 	}
310*d83cc019SAndroid Build Coastguard Worker 
311*d83cc019SAndroid Build Coastguard Worker 	igt_subtest("basic")
312*d83cc019SAndroid Build Coastguard Worker 		test_basic(fd);
313*d83cc019SAndroid Build Coastguard Worker 
314*d83cc019SAndroid Build Coastguard Worker 	igt_subtest("blob-prop-core")
315*d83cc019SAndroid Build Coastguard Worker 		test_core(fd);
316*d83cc019SAndroid Build Coastguard Worker 
317*d83cc019SAndroid Build Coastguard Worker 	igt_subtest("blob-prop-validate")
318*d83cc019SAndroid Build Coastguard Worker 		test_validate(fd);
319*d83cc019SAndroid Build Coastguard Worker 
320*d83cc019SAndroid Build Coastguard Worker 	igt_subtest("blob-prop-lifetime")
321*d83cc019SAndroid Build Coastguard Worker 		test_lifetime(fd);
322*d83cc019SAndroid Build Coastguard Worker 
323*d83cc019SAndroid Build Coastguard Worker 	igt_subtest("blob-multiple")
324*d83cc019SAndroid Build Coastguard Worker 		test_multiple(fd);
325*d83cc019SAndroid Build Coastguard Worker 
326*d83cc019SAndroid Build Coastguard Worker 	prop_tests(fd);
327*d83cc019SAndroid Build Coastguard Worker 
328*d83cc019SAndroid Build Coastguard Worker 	igt_fixture
329*d83cc019SAndroid Build Coastguard Worker 		close(fd);
330*d83cc019SAndroid Build Coastguard Worker }
331