SDL  2.0
SDL_kmsdrmmouse.c
Go to the documentation of this file.
1 /*
2  Simple DirectMedia Layer
3  Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
4 
5  This software is provided 'as-is', without any express or implied
6  warranty. In no event will the authors be held liable for any damages
7  arising from the use of this software.
8 
9  Permission is granted to anyone to use this software for any purpose,
10  including commercial applications, and to alter it and redistribute it
11  freely, subject to the following restrictions:
12 
13  1. The origin of this software must not be misrepresented; you must not
14  claim that you wrote the original software. If you use this software
15  in a product, an acknowledgment in the product documentation would be
16  appreciated but is not required.
17  2. Altered source versions must be plainly marked as such, and must not be
18  misrepresented as being the original software.
19  3. This notice may not be removed or altered from any source distribution.
20 */
21 
22 #include "../../SDL_internal.h"
23 
24 #if SDL_VIDEO_DRIVER_KMSDRM
25 
26 #include "SDL_kmsdrmvideo.h"
27 #include "SDL_kmsdrmmouse.h"
28 #include "SDL_kmsdrmdyn.h"
29 
30 #include "../../events/SDL_mouse_c.h"
31 #include "../../events/default_cursor.h"
32 
33 static SDL_Cursor *KMSDRM_CreateDefaultCursor(void);
34 static SDL_Cursor *KMSDRM_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y);
35 static int KMSDRM_ShowCursor(SDL_Cursor * cursor);
36 static void KMSDRM_MoveCursor(SDL_Cursor * cursor);
37 static void KMSDRM_FreeCursor(SDL_Cursor * cursor);
38 static void KMSDRM_WarpMouse(SDL_Window * window, int x, int y);
39 static int KMSDRM_WarpMouseGlobal(int x, int y);
40 
41 static SDL_Cursor *
42 KMSDRM_CreateDefaultCursor(void)
43 {
45 }
46 
47 /* Evaluate if a given cursor size is supported or not. Notably, current Intel gfx only support 64x64 and up. */
48 static SDL_bool
49 KMSDRM_IsCursorSizeSupported (int w, int h, uint32_t bo_format) {
50 
52  SDL_VideoData *viddata = ((SDL_VideoData *)dev->driverdata);
54 
55  int ret;
57  struct gbm_bo *bo = KMSDRM_gbm_bo_create(viddata->gbm, w, h, bo_format,
58  GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE);
59 
60  if (!bo) {
61  SDL_SetError("Could not create GBM cursor BO width size %dx%d for size testing", w, h);
62  goto cleanup;
63  }
64 
65  bo_handle = KMSDRM_gbm_bo_get_handle(bo).u32;
66  ret = KMSDRM_drmModeSetCursor(viddata->drm_fd, dispdata->crtc_id, bo_handle, w, h);
67 
68  if (ret) {
69  goto cleanup;
70  }
71  else {
72  KMSDRM_gbm_bo_destroy(bo);
73  return SDL_TRUE;
74  }
75 
76 cleanup:
77  if (bo) {
78  KMSDRM_gbm_bo_destroy(bo);
79  }
80  return SDL_FALSE;
81 }
82 
83 /* Create a cursor from a surface */
84 static SDL_Cursor *
85 KMSDRM_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y)
86 {
88  SDL_VideoData *viddata = ((SDL_VideoData *)dev->driverdata);
89  SDL_PixelFormat *pixlfmt = surface->format;
90  KMSDRM_CursorData *curdata;
92  SDL_bool cursor_supported = SDL_FALSE;
93  int i, ret, usable_cursor_w, usable_cursor_h;
94  uint32_t bo_format, bo_stride;
95  char *buffer = NULL;
96  size_t bufsize;
97 
98  switch(pixlfmt->format) {
100  bo_format = GBM_FORMAT_RGB332;
101  break;
103  bo_format = GBM_FORMAT_ARGB4444;
104  break;
106  bo_format = GBM_FORMAT_RGBA4444;
107  break;
109  bo_format = GBM_FORMAT_ABGR4444;
110  break;
112  bo_format = GBM_FORMAT_BGRA4444;
113  break;
115  bo_format = GBM_FORMAT_ARGB1555;
116  break;
118  bo_format = GBM_FORMAT_RGBA5551;
119  break;
121  bo_format = GBM_FORMAT_ABGR1555;
122  break;
124  bo_format = GBM_FORMAT_BGRA5551;
125  break;
127  bo_format = GBM_FORMAT_RGB565;
128  break;
130  bo_format = GBM_FORMAT_BGR565;
131  break;
134  bo_format = GBM_FORMAT_RGB888;
135  break;
138  bo_format = GBM_FORMAT_BGR888;
139  break;
141  bo_format = GBM_FORMAT_RGBX8888;
142  break;
144  bo_format = GBM_FORMAT_BGRX8888;
145  break;
147  bo_format = GBM_FORMAT_ARGB8888;
148  break;
150  bo_format = GBM_FORMAT_RGBA8888;
151  break;
153  bo_format = GBM_FORMAT_ABGR8888;
154  break;
156  bo_format = GBM_FORMAT_BGRA8888;
157  break;
159  bo_format = GBM_FORMAT_ARGB2101010;
160  break;
161  default:
162  SDL_SetError("Unsupported pixel format for cursor");
163  return NULL;
164  }
165 
166  if (!KMSDRM_gbm_device_is_format_supported(viddata->gbm, bo_format, GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE)) {
167  SDL_SetError("Unsupported pixel format for cursor");
168  return NULL;
169  }
170 
171  cursor = (SDL_Cursor *) SDL_calloc(1, sizeof(*cursor));
172  if (!cursor) {
173  SDL_OutOfMemory();
174  return NULL;
175  }
176  curdata = (KMSDRM_CursorData *) SDL_calloc(1, sizeof(*curdata));
177  if (!curdata) {
178  SDL_OutOfMemory();
179  SDL_free(cursor);
180  return NULL;
181  }
182 
183  /* We have to know beforehand if a cursor with the same size as the surface is supported.
184  * If it's not, we have to find an usable cursor size and use an intermediate and clean buffer.
185  * If we can't find a cursor size supported by the hardware, we won't go on trying to
186  * call SDL_SetCursor() later. */
187 
188  usable_cursor_w = surface->w;
189  usable_cursor_h = surface->h;
190 
191  while (usable_cursor_w <= MAX_CURSOR_W && usable_cursor_h <= MAX_CURSOR_H) {
192  if (KMSDRM_IsCursorSizeSupported(usable_cursor_w, usable_cursor_h, bo_format)) {
193  cursor_supported = SDL_TRUE;
194  break;
195  }
196  usable_cursor_w += usable_cursor_w;
197  usable_cursor_h += usable_cursor_h;
198  }
199 
200  if (!cursor_supported) {
201  SDL_SetError("Could not find a cursor size supported by the kernel driver");
202  goto cleanup;
203  }
204 
205  curdata->hot_x = hot_x;
206  curdata->hot_y = hot_y;
207  curdata->w = usable_cursor_w;
208  curdata->h = usable_cursor_h;
209 
210  curdata->bo = KMSDRM_gbm_bo_create(viddata->gbm, usable_cursor_w, usable_cursor_h, bo_format,
211  GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE);
212 
213  if (!curdata->bo) {
214  SDL_SetError("Could not create GBM cursor BO");
215  goto cleanup;
216  }
217 
218  bo_stride = KMSDRM_gbm_bo_get_stride(curdata->bo);
219  bufsize = bo_stride * curdata->h;
220 
221  if (surface->pitch != bo_stride) {
222  /* pitch doesn't match stride, must be copied to temp buffer */
224  if (!buffer) {
225  SDL_OutOfMemory();
226  goto cleanup;
227  }
228 
229  if (SDL_MUSTLOCK(surface)) {
230  if (SDL_LockSurface(surface) < 0) {
231  /* Could not lock surface */
232  goto cleanup;
233  }
234  }
235 
236  /* Clean the whole temporary buffer */
237  SDL_memset(buffer, 0x00, bo_stride * curdata->h);
238 
239  /* Copy to temporary buffer */
240  for (i = 0; i < surface->h; i++) {
241  SDL_memcpy(buffer + (i * bo_stride),
242  ((char *)surface->pixels) + (i * surface->pitch),
243  surface->w * pixlfmt->BytesPerPixel);
244  }
245 
246  if (SDL_MUSTLOCK(surface)) {
248  }
249 
250  if (KMSDRM_gbm_bo_write(curdata->bo, buffer, bufsize)) {
251  SDL_SetError("Could not write to GBM cursor BO");
252  goto cleanup;
253  }
254 
255  /* Free temporary buffer */
256  SDL_free(buffer);
257  buffer = NULL;
258  } else {
259  /* surface matches BO format */
260  if (SDL_MUSTLOCK(surface)) {
261  if (SDL_LockSurface(surface) < 0) {
262  /* Could not lock surface */
263  goto cleanup;
264  }
265  }
266 
267  ret = KMSDRM_gbm_bo_write(curdata->bo, surface->pixels, bufsize);
268 
269  if (SDL_MUSTLOCK(surface)) {
271  }
272 
273  if (ret) {
274  SDL_SetError("Could not write to GBM cursor BO");
275  goto cleanup;
276  }
277  }
278 
279  cursor->driverdata = curdata;
280 
281  return cursor;
282 
283 cleanup:
284  if (buffer) {
285  SDL_free(buffer);
286  }
287  if (cursor) {
288  SDL_free(cursor);
289  }
290  if (curdata) {
291  if (curdata->bo) {
292  KMSDRM_gbm_bo_destroy(curdata->bo);
293  }
294  SDL_free(curdata);
295  }
296  return NULL;
297 }
298 
299 /* Show the specified cursor, or hide if cursor is NULL */
300 static int
301 KMSDRM_ShowCursor(SDL_Cursor * cursor)
302 {
304  SDL_VideoData *viddata = ((SDL_VideoData *)dev->driverdata);
305  SDL_Mouse *mouse;
306  KMSDRM_CursorData *curdata;
307  SDL_VideoDisplay *display = NULL;
308  SDL_DisplayData *dispdata = NULL;
309  int ret;
311 
312  mouse = SDL_GetMouse();
313  if (!mouse) {
314  return SDL_SetError("No mouse.");
315  }
316 
317  if (mouse->focus) {
318  display = SDL_GetDisplayForWindow(mouse->focus);
319  if (display) {
320  dispdata = (SDL_DisplayData*) display->driverdata;
321  }
322  }
323 
324  if (!cursor) {
325  /* Hide current cursor */
326  if (mouse->cur_cursor && mouse->cur_cursor->driverdata) {
327  curdata = (KMSDRM_CursorData *) mouse->cur_cursor->driverdata;
328 
329  if (curdata->crtc_id != 0) {
330  ret = KMSDRM_drmModeSetCursor(viddata->drm_fd, curdata->crtc_id, 0, 0, 0);
331  if (ret) {
332  SDL_SetError("Could not hide current cursor with drmModeSetCursor().");
333  return ret;
334  }
335  /* Mark previous cursor as not-displayed */
336  curdata->crtc_id = 0;
337 
338  return 0;
339  }
340  }
341  /* otherwise if possible, hide global cursor */
342  if (dispdata && dispdata->crtc_id != 0) {
343  ret = KMSDRM_drmModeSetCursor(viddata->drm_fd, dispdata->crtc_id, 0, 0, 0);
344  if (ret) {
345  SDL_SetError("Could not hide display's cursor with drmModeSetCursor().");
346  return ret;
347  }
348  return 0;
349  }
350 
351  return SDL_SetError("Couldn't find cursor to hide.");
352  }
353  /* If cursor != NULL, show new cursor on display */
354  if (!display) {
355  return SDL_SetError("Could not get display for mouse.");
356  }
357  if (!dispdata) {
358  return SDL_SetError("Could not get display driverdata.");
359  }
360 
361  curdata = (KMSDRM_CursorData *) cursor->driverdata;
362  if (!curdata || !curdata->bo) {
363  return SDL_SetError("Cursor not initialized properly.");
364  }
365 
366  bo_handle = KMSDRM_gbm_bo_get_handle(curdata->bo).u32;
367  if (curdata->hot_x == 0 && curdata->hot_y == 0) {
368  ret = KMSDRM_drmModeSetCursor(viddata->drm_fd, dispdata->crtc_id, bo_handle,
369  curdata->w, curdata->h);
370  } else {
371  ret = KMSDRM_drmModeSetCursor2(viddata->drm_fd, dispdata->crtc_id, bo_handle,
372  curdata->w, curdata->h, curdata->hot_x, curdata->hot_y);
373  }
374  if (ret) {
375  SDL_SetError("drmModeSetCursor failed.");
376  return ret;
377  }
378 
379  curdata->crtc_id = dispdata->crtc_id;
380 
381  return 0;
382 }
383 
384 /* Free a window manager cursor */
385 static void
386 KMSDRM_FreeCursor(SDL_Cursor * cursor)
387 {
388  KMSDRM_CursorData *curdata;
389  int drm_fd;
390 
391  if (cursor) {
392  curdata = (KMSDRM_CursorData *) cursor->driverdata;
393 
394  if (curdata) {
395  if (curdata->bo) {
396  if (curdata->crtc_id != 0) {
397  drm_fd = KMSDRM_gbm_device_get_fd(KMSDRM_gbm_bo_get_device(curdata->bo));
398  /* Hide the cursor if previously shown on a CRTC */
399  KMSDRM_drmModeSetCursor(drm_fd, curdata->crtc_id, 0, 0, 0);
400  curdata->crtc_id = 0;
401  }
402  KMSDRM_gbm_bo_destroy(curdata->bo);
403  curdata->bo = NULL;
404  }
406  }
407  SDL_free(cursor);
408  }
409 }
410 
411 /* Warp the mouse to (x,y) */
412 static void
413 KMSDRM_WarpMouse(SDL_Window * window, int x, int y)
414 {
415  /* Only one global/fullscreen window is supported */
416  KMSDRM_WarpMouseGlobal(x, y);
417 }
418 
419 /* Warp the mouse to (x,y) */
420 static int
421 KMSDRM_WarpMouseGlobal(int x, int y)
422 {
423  KMSDRM_CursorData *curdata;
424  SDL_Mouse *mouse = SDL_GetMouse();
425 
426  if (mouse && mouse->cur_cursor && mouse->cur_cursor->driverdata) {
427  /* Update internal mouse position. */
428  SDL_SendMouseMotion(mouse->focus, mouse->mouseID, 0, x, y);
429 
430  /* And now update the cursor graphic position on screen. */
431  curdata = (KMSDRM_CursorData *) mouse->cur_cursor->driverdata;
432  if (curdata->bo) {
433 
434  if (curdata->crtc_id != 0) {
435  int ret, drm_fd;
436  drm_fd = KMSDRM_gbm_device_get_fd(KMSDRM_gbm_bo_get_device(curdata->bo));
437  ret = KMSDRM_drmModeMoveCursor(drm_fd, curdata->crtc_id, x, y);
438 
439  if (ret) {
440  SDL_SetError("drmModeMoveCursor() failed.");
441  }
442 
443  return ret;
444  } else {
445  return SDL_SetError("Cursor is not currently shown.");
446  }
447  } else {
448  return SDL_SetError("Cursor not initialized properly.");
449  }
450  } else {
451  return SDL_SetError("No mouse or current cursor.");
452  }
453 }
454 
455 void
457 {
458  /* FIXME: Using UDEV it should be possible to scan all mice
459  * but there's no point in doing so as there's no multimice support...yet!
460  */
461  SDL_Mouse *mouse = SDL_GetMouse();
462 
463  mouse->CreateCursor = KMSDRM_CreateCursor;
464  mouse->ShowCursor = KMSDRM_ShowCursor;
465  mouse->MoveCursor = KMSDRM_MoveCursor;
466  mouse->FreeCursor = KMSDRM_FreeCursor;
467  mouse->WarpMouse = KMSDRM_WarpMouse;
468  mouse->WarpMouseGlobal = KMSDRM_WarpMouseGlobal;
469 
470  SDL_SetDefaultCursor(KMSDRM_CreateDefaultCursor());
471 }
472 
473 void
475 {
476  /* TODO: ? */
477 }
478 
479 /* This is called when a mouse motion event occurs */
480 static void
481 KMSDRM_MoveCursor(SDL_Cursor * cursor)
482 {
483  SDL_Mouse *mouse = SDL_GetMouse();
484  KMSDRM_CursorData *curdata;
485  int drm_fd, ret;
486 
487  /* We must NOT call SDL_SendMouseMotion() here or we will enter recursivity!
488  That's why we move the cursor graphic ONLY. */
489  if (mouse && mouse->cur_cursor && mouse->cur_cursor->driverdata) {
490  curdata = (KMSDRM_CursorData *) mouse->cur_cursor->driverdata;
491  drm_fd = KMSDRM_gbm_device_get_fd(KMSDRM_gbm_bo_get_device(curdata->bo));
492  ret = KMSDRM_drmModeMoveCursor(drm_fd, curdata->crtc_id, mouse->x, mouse->y);
493 
494  if (ret) {
495  SDL_SetError("drmModeMoveCursor() failed.");
496  }
497  }
498 }
499 
500 #endif /* SDL_VIDEO_DRIVER_KMSDRM */
501 
502 /* vi: set ts=4 sw=4 expandtab: */
SDL_GetMouse
SDL_Mouse * SDL_GetMouse(void)
Definition: SDL_mouse.c:170
SDL_UnlockSurface
#define SDL_UnlockSurface
Definition: SDL_dynapi_overrides.h:449
SDL_memset
#define SDL_memset
Definition: SDL_dynapi_overrides.h:386
SDL_PIXELFORMAT_ARGB1555
@ SDL_PIXELFORMAT_ARGB1555
Definition: SDL_pixels.h:215
SDL_Mouse::WarpMouseGlobal
int(* WarpMouseGlobal)(int x, int y)
Definition: SDL_mouse_c.h:64
SDL_PIXELFORMAT_BGRA4444
@ SDL_PIXELFORMAT_BGRA4444
Definition: SDL_pixels.h:212
bo_handle
int uint32_t uint32_t uint32_t uint32_t uint32_t int drmModeModeInfoPtr mode int uint32_t uint32_t bo_handle
Definition: SDL_kmsdrmsym.h:55
SDL_VideoDevice::driverdata
void * driverdata
Definition: SDL_sysvideo.h:389
SDL_PixelFormat::BytesPerPixel
Uint8 BytesPerPixel
Definition: SDL_pixels.h:323
MAX_CURSOR_H
#define MAX_CURSOR_H
Definition: SDL_kmsdrmmouse.h:30
KMSDRM_CursorData::w
int w
Definition: SDL_kmsdrmmouse.h:37
SDL_Surface
A collection of pixels used in software blitting.
Definition: SDL_surface.h:71
SDL_Cursor
Definition: SDL_mouse_c.h:31
if
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro pixld1_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl else error unsupported endif endm macro pixld2_s mem_operand if mov asr add asl add asl mov asr sub UNIT_X add asl mov asr add asl add asl mov asr add UNIT_X add asl else pixld1_s mem_operand pixld1_s mem_operand endif endm macro pixld0_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl endif endm macro pixld_s_internal mem_operand if mem_operand pixld2_s mem_operand pixdeinterleave basereg elseif mem_operand elseif mem_operand elseif mem_operand elseif mem_operand pixld0_s mem_operand else pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else error unsupported mem_operand if bpp mem_operand endif endm macro vuzp8 reg2 vuzp d d &reg2 endm macro vzip8 reg2 vzip d d &reg2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld[DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld if[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro fetch_mask_pixblock pixld mask_basereg pixblock_size MASK endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp skip1(dst_w_bpp<=(lowbit *8)) &&((lowbit *8)<(pixblock_size *dst_w_bpp)) .if lowbit< 16 tst DST_R
Definition: pixman-arm-neon-asm.h:469
SDL_PIXELFORMAT_RGB888
@ SDL_PIXELFORMAT_RGB888
Definition: SDL_pixels.h:239
DEFAULT_CHOTY
#define DEFAULT_CHOTY
Definition: default_cursor.h:28
KMSDRM_QuitMouse
void KMSDRM_QuitMouse(_THIS)
SDL_kmsdrmvideo.h
SDL_PIXELFORMAT_RGBX8888
@ SDL_PIXELFORMAT_RGBX8888
Definition: SDL_pixels.h:242
NULL
#define NULL
Definition: begin_code.h:167
surface
EGLSurface surface
Definition: eglext.h:248
SDL_PixelFormat::format
Uint32 format
Definition: SDL_pixels.h:320
KMSDRM_CursorData
Definition: SDL_kmsdrmmouse.h:33
KMSDRM_CursorData::crtc_id
uint32_t crtc_id
Definition: SDL_kmsdrmmouse.h:35
SDL_PIXELFORMAT_BGR888
@ SDL_PIXELFORMAT_BGR888
Definition: SDL_pixels.h:245
SDL_GetDisplayForWindow
SDL_VideoDisplay * SDL_GetDisplayForWindow(SDL_Window *window)
Definition: SDL_video.c:1110
default_cmask
static const unsigned char default_cmask[]
Definition: default_cursor.h:54
SDL_PIXELFORMAT_BGR565
@ SDL_PIXELFORMAT_BGR565
Definition: SDL_pixels.h:230
SDL_Mouse::y
int y
Definition: SDL_mouse_c.h:79
KMSDRM_InitMouse
void KMSDRM_InitMouse(_THIS)
SDL_MUSTLOCK
#define SDL_MUSTLOCK(S)
Definition: SDL_surface.h:62
SDL_PIXELFORMAT_RGB565
@ SDL_PIXELFORMAT_RGB565
Definition: SDL_pixels.h:227
SDL_PIXELFORMAT_BGRX8888
@ SDL_PIXELFORMAT_BGRX8888
Definition: SDL_pixels.h:248
h
GLfloat GLfloat GLfloat GLfloat h
Definition: SDL_opengl_glext.h:1949
SDL_kmsdrmmouse.h
SDL_GetDisplayDriverData
void * SDL_GetDisplayDriverData(int displayIndex)
Definition: SDL_video.c:660
SDL_Cursor::driverdata
void * driverdata
Definition: SDL_mouse_c.h:33
DEFAULT_CWIDTH
#define DEFAULT_CWIDTH
Definition: default_cursor.h:25
SDL_Window
The type used to identify a window.
Definition: SDL_sysvideo.h:75
SDL_PIXELFORMAT_RGB332
@ SDL_PIXELFORMAT_RGB332
Definition: SDL_pixels.h:188
SDL_memcpy
#define SDL_memcpy
Definition: SDL_dynapi_overrides.h:387
SDL_Mouse::MoveCursor
void(* MoveCursor)(SDL_Cursor *cursor)
Definition: SDL_mouse_c.h:55
buffer
GLuint buffer
Definition: SDL_opengl_glext.h:536
SDL_VideoData::gbm
struct gbm_device * gbm
Definition: SDL_kmsdrmvideo.h:42
SDL_PIXELFORMAT_ARGB4444
@ SDL_PIXELFORMAT_ARGB4444
Definition: SDL_pixels.h:203
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
SDL_Mouse::WarpMouse
void(* WarpMouse)(SDL_Window *window, int x, int y)
Definition: SDL_mouse_c.h:61
window
EGLSurface EGLNativeWindowType * window
Definition: eglext.h:1025
SDL_PIXELFORMAT_RGBA5551
@ SDL_PIXELFORMAT_RGBA5551
Definition: SDL_pixels.h:218
DEFAULT_CHEIGHT
#define DEFAULT_CHEIGHT
Definition: default_cursor.h:26
SDL_free
#define SDL_free
Definition: SDL_dynapi_overrides.h:377
SDL_PIXELFORMAT_ARGB2101010
@ SDL_PIXELFORMAT_ARGB2101010
Definition: SDL_pixels.h:263
SDL_SendMouseMotion
int SDL_SendMouseMotion(SDL_Window *window, SDL_MouseID mouseID, int relative, int x, int y)
Definition: SDL_mouse.c:293
SDL_PIXELFORMAT_ABGR1555
@ SDL_PIXELFORMAT_ABGR1555
Definition: SDL_pixels.h:221
bufsize
GLenum GLuint GLsizei bufsize
Definition: SDL_opengl_glext.h:1765
_THIS
#define _THIS
Definition: SDL_alsa_audio.h:31
cleanup
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro pixld1_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl else error unsupported endif endm macro pixld2_s mem_operand if mov asr add asl add asl mov asr sub UNIT_X add asl mov asr add asl add asl mov asr add UNIT_X add asl else pixld1_s mem_operand pixld1_s mem_operand endif endm macro pixld0_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl endif endm macro pixld_s_internal mem_operand if mem_operand pixld2_s mem_operand pixdeinterleave basereg elseif mem_operand elseif mem_operand elseif mem_operand elseif mem_operand pixld0_s mem_operand else pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else error unsupported mem_operand if bpp mem_operand endif endm macro vuzp8 reg2 vuzp d d &reg2 endm macro vzip8 reg2 vzip d d &reg2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld[DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld cleanup[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro fetch_mask_pixblock pixld mask_basereg pixblock_size MASK endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp skip1 beq endif SRC MASK if dst_r_bpp DST_R else add endif PF add sub src_basereg pixdeinterleave mask_basereg pixdeinterleave dst_r_basereg process_pixblock_head pixblock_size cache_preload_simple process_pixblock_tail pixinterleave dst_w_basereg irp beq endif process_pixblock_tail_head tst beq irp if pixblock_size chunk_size tst beq pixld_src SRC pixld MASK if DST_R else pixld DST_R endif if src_basereg pixdeinterleave mask_basereg pixdeinterleave dst_r_basereg process_pixblock_head if pixblock_size cache_preload_simple endif process_pixblock_tail pixinterleave dst_w_basereg irp if pixblock_size chunk_size tst beq if DST_W else pixst DST_W else mov ORIG_W endif add lsl if lsl endif if lsl endif lsl endif lsl endif lsl endif subs mov DST_W if regs_shortage str endif bge start_of_loop_label endm macro generate_composite_function
Definition: pixman-arm-neon-asm.h:625
SDL_Mouse
Definition: SDL_mouse_c.h:44
SDL_PIXELFORMAT_ABGR4444
@ SDL_PIXELFORMAT_ABGR4444
Definition: SDL_pixels.h:209
SDL_TRUE
@ SDL_TRUE
Definition: SDL_stdinc.h:164
SDL_PIXELFORMAT_ARGB8888
@ SDL_PIXELFORMAT_ARGB8888
Definition: SDL_pixels.h:251
SDL_PixelFormat
Definition: SDL_pixels.h:319
hot_x
int uint32_t uint32_t uint32_t uint32_t uint32_t int drmModeModeInfoPtr mode int uint32_t uint32_t uint32_t uint32_t int32_t hot_x
Definition: SDL_kmsdrmsym.h:57
KMSDRM_CursorData::h
int h
Definition: SDL_kmsdrmmouse.h:37
SDL_Mouse::focus
SDL_Window * focus
Definition: SDL_mouse_c.h:77
SDL_VideoDisplay::driverdata
void * driverdata
Definition: SDL_sysvideo.h:140
SDL_PIXELFORMAT_RGBA4444
@ SDL_PIXELFORMAT_RGBA4444
Definition: SDL_pixels.h:206
SDL_DisplayData
Definition: SDL_cocoamodes.h:27
SDL_VideoDevice
Definition: SDL_sysvideo.h:150
cursor
SDL_Cursor * cursor
Definition: testwm2.c:40
SDL_OutOfMemory
#define SDL_OutOfMemory()
Definition: SDL_error.h:52
MAX_CURSOR_W
#define MAX_CURSOR_W
Definition: SDL_kmsdrmmouse.h:29
SDL_Mouse::ShowCursor
int(* ShowCursor)(SDL_Cursor *cursor)
Definition: SDL_mouse_c.h:52
y
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1574
SDL_VideoData::drm_fd
int drm_fd
Definition: SDL_kmsdrmvideo.h:41
SDL_LockSurface
#define SDL_LockSurface
Definition: SDL_dynapi_overrides.h:448
SDL_SetDefaultCursor
void SDL_SetDefaultCursor(SDL_Cursor *cursor)
Definition: SDL_mouse.c:159
SDL_calloc
#define SDL_calloc
Definition: SDL_dynapi_overrides.h:375
SDL_CreateCursor
#define SDL_CreateCursor
Definition: SDL_dynapi_overrides.h:251
uint32_t
unsigned int uint32_t
Definition: SDL_config_windows.h:63
SDL_Mouse::x
int x
Definition: SDL_mouse_c.h:78
SDL_PIXELFORMAT_RGBA8888
@ SDL_PIXELFORMAT_RGBA8888
Definition: SDL_pixels.h:254
SDL_VideoDisplay
Definition: SDL_sysvideo.h:127
SDL_SetError
#define SDL_SetError
Definition: SDL_dynapi_overrides.h:30
SDL_kmsdrmdyn.h
SDL_PIXELFORMAT_RGB24
@ SDL_PIXELFORMAT_RGB24
Definition: SDL_pixels.h:233
DEFAULT_CHOTX
#define DEFAULT_CHOTX
Definition: default_cursor.h:27
default_cdata
static const unsigned char default_cdata[]
Definition: default_cursor.h:35
SDL_Mouse::FreeCursor
void(* FreeCursor)(SDL_Cursor *cursor)
Definition: SDL_mouse_c.h:58
SDL_PIXELFORMAT_BGRA5551
@ SDL_PIXELFORMAT_BGRA5551
Definition: SDL_pixels.h:224
SDL_Mouse::CreateCursor
SDL_Cursor *(* CreateCursor)(SDL_Surface *surface, int hot_x, int hot_y)
Definition: SDL_mouse_c.h:46
SDL_PIXELFORMAT_BGRA8888
@ SDL_PIXELFORMAT_BGRA8888
Definition: SDL_pixels.h:260
SDL_Mouse::mouseID
SDL_MouseID mouseID
Definition: SDL_mouse_c.h:76
KMSDRM_CursorData::hot_y
int hot_y
Definition: SDL_kmsdrmmouse.h:36
KMSDRM_CursorData::bo
struct gbm_bo * bo
Definition: SDL_kmsdrmmouse.h:34
SDL_PIXELFORMAT_BGR24
@ SDL_PIXELFORMAT_BGR24
Definition: SDL_pixels.h:236
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:162
SDL_GetVideoDevice
SDL_VideoDevice * SDL_GetVideoDevice(void)
Definition: SDL_video.c:586
SDL_DisplayData::crtc_id
uint32_t crtc_id
Definition: SDL_kmsdrmvideo.h:58
SDL_FALSE
@ SDL_FALSE
Definition: SDL_stdinc.h:163
SDL_malloc
#define SDL_malloc
Definition: SDL_dynapi_overrides.h:374
KMSDRM_CursorData::hot_x
int hot_x
Definition: SDL_kmsdrmmouse.h:36
SDL_PIXELFORMAT_ABGR8888
@ SDL_PIXELFORMAT_ABGR8888
Definition: SDL_pixels.h:257
i
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:50
SDL_Mouse::cur_cursor
SDL_Cursor * cur_cursor
Definition: SDL_mouse_c.h:105
SDL_VideoData
Definition: SDL_androidvideo.h:37
w
GLubyte GLubyte GLubyte GLubyte w
Definition: SDL_opengl_glext.h:734