From 078fdc1539ede74782021db189911d61726b6799 Mon Sep 17 00:00:00 2001 From: Jerry Date: Tue, 25 Apr 2023 20:52:50 +0800 Subject: [PATCH] 1 --- server.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/server.c b/server.c index 39e0247..b4dd1f6 100644 --- a/server.c +++ b/server.c @@ -13,17 +13,6 @@ #include -struct drm_nvidia_gem_map_offset_params { - uint32_t handle; /* IN Handle to gem object */ - uint32_t __pad; - - uint64_t offset; /* OUT Fake offset */ -}; -#define DRM_NVIDIA_GEM_MAP_OFFSET 0x0a -#define DRM_IOCTL_NVIDIA_GEM_MAP_OFFSET \ - DRM_IOWR((DRM_COMMAND_BASE + DRM_NVIDIA_GEM_MAP_OFFSET), \ - struct drm_nvidia_gem_map_offset_params) - #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) /* 10 frames per second (if we can) */ #define PICTURE_TIMEOUT (1.0/10.0) @@ -436,15 +425,16 @@ int main(int argc, const char **argv) else if (strcmp(drm_ver->name, "nvidia-drm") == 0) { convert_func = &convert_nv_stripe; vblank_func = &drm_wait_vblank_noop; - struct drm_nvidia_gem_map_offset_params mmap_arg; - memset(&mmap_arg, 0, sizeof(mmap_arg)); - mmap_arg.handle = open_arg.handle; - if (ioctl_err = drmIoctl(drmfd, DRM_IOCTL_NVIDIA_GEM_MAP_OFFSET, &mmap_arg)) { + + struct drm_mode_map_dumb mreq; + memset(&mreq, 0, sizeof(mreq)); + mreq.handle = open_arg.handle; + if (ioctl_err = drmIoctl(drmfd, DRM_IOCTL_MODE_MAP_DUMB, &mreq)) { fprintf(stderr, "DRM ioctl error %d on line %d\n", ioctl_err, __LINE__); goto cleanup; } mmap_size = open_arg.size; - mmap_offset = mmap_arg.offset; + mmap_offset = mreq.offset; } else { fprintf(stderr, "Unimplemented drm driver\n");