From abbe5233ee07b4caf55fa4fc7b9f49a08d250bdc Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Sat, 5 Mar 2022 20:11:12 +0000 Subject: [PATCH] Remove unused X11/drm auth code The code was added back in 2020 and seemingly never built. Just drop it - if needed it can be git reverted at some point. Signed-off-by: Emil Velikov --- src/auth.cpp | 56 ---------------------------------------------------- src/auth.h | 5 ----- src/gpu.cpp | 8 -------- 3 files changed, 69 deletions(-) delete mode 100644 src/auth.cpp delete mode 100644 src/auth.h diff --git a/src/auth.cpp b/src/auth.cpp deleted file mode 100644 index 5d0d5517..00000000 --- a/src/auth.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - Inspired by radeontop -*/ -#include "auth.h" -#include -#include -#include -#include -#include -#include -#include - -/* Try to authenticate the DRM client with help from the X server. */ -bool authenticate_drm_xcb(drm_magic_t magic) { - xcb_connection_t *conn = xcb_connect(NULL, NULL); - if (!conn) { - return false; - } - if (xcb_connection_has_error(conn)) { - xcb_disconnect(conn); - return false; - } - - xcb_screen_t *screen = xcb_setup_roots_iterator(xcb_get_setup(conn)).data; - xcb_window_t window = screen->root; - - /* Authenticate our client via the X server using the magic. */ - xcb_dri2_authenticate_cookie_t auth_cookie = - xcb_dri2_authenticate(conn, window, magic); - xcb_dri2_authenticate_reply_t *auth_reply = - xcb_dri2_authenticate_reply(conn, auth_cookie, NULL); - free(auth_reply); - - xcb_disconnect(conn); - return true; -} - -bool authenticate_drm(int fd) { - drm_magic_t magic; - - /* Obtain magic for our DRM client. */ - if (drmGetMagic(fd, &magic) < 0) { - return false; - } - - /* Try self-authenticate (if we are somehow the master). */ - if (drmAuthMagic(fd, magic) == 0) { - if (drmDropMaster(fd)) { - perror("MANGOHUD: Failed to drop DRM master"); - fprintf(stderr, "\n\tWARNING: other DRM clients will crash on VT switch\n"); - } - return true; - } - - return authenticate_drm_xcb(magic); -} diff --git a/src/auth.h b/src/auth.h deleted file mode 100644 index 79645e9b..00000000 --- a/src/auth.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once -#include - -bool authenticate_drm_xcb(drm_magic_t magic); -bool authenticate_drm(int fd); diff --git a/src/gpu.cpp b/src/gpu.cpp index a519728a..b838bd94 100644 --- a/src/gpu.cpp +++ b/src/gpu.cpp @@ -12,7 +12,6 @@ #endif #ifdef HAVE_LIBDRM_AMDGPU -//#include "auth.h" #include #include #include @@ -259,13 +258,6 @@ bool amdgpu_open(const char *path) { } g_libdrm.drmFreeVersion(ver); -/* - if (!authenticate_drm(fd)) { - close(fd); - return false; - } -*/ - uint32_t drm_major, drm_minor; amdgpu_device_handle dev; if (libdrm_amdgpu_ptr->amdgpu_device_initialize(fd, &drm_major, &drm_minor, &dev)){