1 /* 2 * Copyright © 2017 Broadcom 3 * Copyright © 2019 Collabora, Ltd. 4 * 5 * Permission is hereby granted, free of charge, to any person obtaining a 6 * copy of this software and associated documentation files (the "Software"), 7 * to deal in the Software without restriction, including without limitation 8 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 * and/or sell copies of the Software, and to permit persons to whom the 10 * Software is furnished to do so, subject to the following conditions: 11 * 12 * The above copyright notice and this permission notice (including the next 13 * paragraph) shall be included in all copies or substantial portions of the 14 * Software. 15 * 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 22 * IN THE SOFTWARE. 23 */ 24 25 #include "igt.h" 26 #include "igt_panfrost.h" 27 #include <unistd.h> 28 #include <stdlib.h> 29 #include <stdio.h> 30 #include <string.h> 31 #include <fcntl.h> 32 #include <inttypes.h> 33 #include <errno.h> 34 #include <sys/stat.h> 35 #include <sys/ioctl.h> 36 #include <poll.h> 37 #include "panfrost_drm.h" 38 39 igt_main 40 { 41 int fd; 42 43 igt_fixture 44 fd = drm_open_driver(DRIVER_PANFROST); 45 46 igt_subtest("base-params") { 47 int last_base_param = DRM_PANFROST_PARAM_GPU_PROD_ID; 48 uint32_t results[last_base_param + 1]; 49 50 for (int i = 0; i < ARRAY_SIZE(results); i++) 51 results[i] = igt_panfrost_get_param(fd, i); 52 53 igt_assert(results[DRM_PANFROST_PARAM_GPU_PROD_ID]); 54 } 55 56 igt_subtest("get-bad-param") { 57 struct drm_panfrost_get_param get = { 58 .param = 0xd0d0d0d0, 59 }; 60 do_ioctl_err(fd, DRM_IOCTL_PANFROST_GET_PARAM, &get, EINVAL); 61 } 62 63 igt_subtest("get-bad-padding") { 64 struct drm_panfrost_get_param get = { 65 .param = DRM_PANFROST_PARAM_GPU_PROD_ID, 66 .pad = 1, 67 }; 68 do_ioctl_err(fd, DRM_IOCTL_PANFROST_GET_PARAM, &get, EINVAL); 69 } 70 71 igt_fixture 72 close(fd); 73 } 74