Skip to content

Instantly share code, notes, and snippets.

@DavisNT
Created November 29, 2021 23:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DavisNT/319a845b2e891b42fe7571f1d849e836 to your computer and use it in GitHub Desktop.
Save DavisNT/319a845b2e891b42fe7571f1d849e836 to your computer and use it in GitHub Desktop.
libSDL 2.0.16 handle logging
diff --git a/src/video/kmsdrm/SDL_kmsdrmmouse.c b/src/video/kmsdrm/SDL_kmsdrmmouse.c
index 57cb35c75..8068c4fc4 100644
--- a/src/video/kmsdrm/SDL_kmsdrmmouse.c
+++ b/src/video/kmsdrm/SDL_kmsdrmmouse.c
@@ -412,6 +412,7 @@ static int
KMSDRM_WarpMouseGlobal(int x, int y)
{
SDL_Mouse *mouse = SDL_GetMouse();
+ struct gbm_device *tmpgbm;
if (mouse && mouse->cur_cursor && mouse->focus) {
@@ -426,8 +427,19 @@ KMSDRM_WarpMouseGlobal(int x, int y)
int drm_fd;
int ret = 0;
- drm_fd = KMSDRM_gbm_device_get_fd(KMSDRM_gbm_bo_get_device(dispdata->cursor_bo));
+ SDL_LogSetAllPriority(SDL_LOG_PRIORITY_DEBUG);
+
+ tmpgbm = KMSDRM_gbm_bo_get_device(dispdata->cursor_bo);
+ drm_fd = KMSDRM_gbm_device_get_fd(tmpgbm);
+ SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "DEBUG2 Handle is %d", drm_fd);
+ drm_fd = KMSDRM_gbm_device_get_fd(tmpgbm);
+ SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "DEBUG2 Handle is %d", drm_fd);
+ drm_fd = KMSDRM_gbm_device_get_fd(tmpgbm);
+ SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "DEBUG2 Handle is %d", drm_fd);
+
+
ret = KMSDRM_drmModeMoveCursor(drm_fd, dispdata->crtc->crtc_id, x, y);
+ close(drm_fd);
if (ret) {
SDL_SetError("drmModeMoveCursor() failed.");
@@ -480,6 +492,7 @@ KMSDRM_MoveCursor(SDL_Cursor * cursor)
SDL_Mouse *mouse = SDL_GetMouse();
int drm_fd;
int ret = 0;
+ struct gbm_device *tmpgbm;
/* We must NOT call SDL_SendMouseMotion() here or we will enter recursivity!
That's why we move the cursor graphic ONLY. */
@@ -493,10 +506,20 @@ KMSDRM_MoveCursor(SDL_Cursor * cursor)
return;
}
- drm_fd = KMSDRM_gbm_device_get_fd(KMSDRM_gbm_bo_get_device(dispdata->cursor_bo));
+ SDL_LogSetAllPriority(SDL_LOG_PRIORITY_DEBUG);
+
+ tmpgbm = KMSDRM_gbm_bo_get_device(dispdata->cursor_bo);
+ drm_fd = KMSDRM_gbm_device_get_fd(tmpgbm);
+ SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "DEBUG Handle is %d", drm_fd);
+ drm_fd = KMSDRM_gbm_device_get_fd(tmpgbm);
+ SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "DEBUG Handle is %d", drm_fd);
+ drm_fd = KMSDRM_gbm_device_get_fd(tmpgbm);
+ SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "DEBUG Handle is %d", drm_fd);
ret = KMSDRM_drmModeMoveCursor(drm_fd, dispdata->crtc->crtc_id, mouse->x, mouse->y);
+ close(drm_fd);
+
if (ret) {
SDL_SetError("drmModeMoveCursor() failed.");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment