23 #include "../../SDL_internal.h"
25 #if SDL_VIDEO_DRIVER_KMSDRM
28 #include "../SDL_sysvideo.h"
30 #include "../../events/SDL_events_c.h"
31 #include "../../events/SDL_mouse_c.h"
32 #include "../../events/SDL_keyboard_c.h"
34 #ifdef SDL_INPUT_LINUXEV
35 #include "../../core/linux/SDL_evdev.h"
51 #ifndef DRM_FORMAT_MOD_VENDOR_NONE
52 #define DRM_FORMAT_MOD_VENDOR_NONE 0
54 #ifndef DRM_FORMAT_MOD_LINEAR
55 #define DRM_FORMAT_MOD_LINEAR fourcc_mod_code(NONE, 0)
58 #define KMSDRM_DRI_PATH "/dev/dri/"
60 static int set_client_caps (
int fd)
62 if (KMSDRM_drmSetClientCap(
fd, DRM_CLIENT_CAP_ATOMIC, 1)) {
65 if (KMSDRM_drmSetClientCap(
fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1)) {
72 check_modesetting(
int devindex)
82 drm_fd = open(
device, O_RDWR | O_CLOEXEC);
85 drmModeRes *resources = (set_client_caps(drm_fd) < 0) ?
NULL : KMSDRM_drmModeGetResources(drm_fd);
88 KMSDRM_DRI_PATH, devindex,
89 resources->count_connectors, resources->count_encoders, resources->count_crtcs);
91 if (resources->count_connectors > 0 && resources->count_encoders > 0 && resources->count_crtcs > 0) {
92 for (
i = 0;
i < resources->count_connectors;
i++) {
93 drmModeConnector *conn = KMSDRM_drmModeGetConnector(drm_fd, resources->connectors[
i]);
99 if (conn->connection == DRM_MODE_CONNECTED && conn->count_modes) {
103 KMSDRM_drmModeFreeConnector(conn);
109 KMSDRM_drmModeFreeResources(resources);
119 static unsigned int get_dricount(
void)
121 unsigned int devcount = 0;
126 if (!(stat(KMSDRM_DRI_PATH, &sb) == 0 && S_ISDIR(sb.st_mode))) {
127 SDL_SetError(
"The path %s cannot be opened or is not available",
132 if (
access(KMSDRM_DRI_PATH, F_OK) == -1) {
138 folder = opendir(KMSDRM_DRI_PATH);
140 while ((
res = readdir(folder))) {
155 const unsigned int devcount = get_dricount();
158 for (
i = 0;
i < devcount;
i++) {
159 if (check_modesetting(
i)) {
175 static dumb_buffer *KMSDRM_CreateDumbBuffer(
_THIS)
180 struct drm_mode_create_dumb create;
181 struct drm_mode_map_dumb
map;
182 struct drm_mode_destroy_dumb destroy;
184 dumb_buffer *ret =
SDL_calloc(1,
sizeof(*ret));
201 create = (
struct drm_mode_create_dumb) {
202 .width = dispdata->
mode.hdisplay,
203 .height = dispdata->
mode.vdisplay,
207 if (KMSDRM_drmIoctl(viddata->
drm_fd, DRM_IOCTL_MODE_CREATE_DUMB, &create)) {
212 ret->gem_handles[0] = create.handle;
213 ret->format = DRM_FORMAT_XRGB8888;
214 ret->modifier = DRM_FORMAT_MOD_LINEAR;
215 ret->width = create.width;
216 ret->height = create.height;
217 ret->pitches[0] = create.pitch;
227 map = (
struct drm_mode_map_dumb) {
228 .handle = ret->gem_handles[0],
231 if (KMSDRM_drmIoctl(viddata->
drm_fd, DRM_IOCTL_MODE_MAP_DUMB, &
map)) {
232 SDL_SetError(
"failed to get mmap offset for the dumb buffer.");
236 ret->dumb.mem = mmap(
NULL, create.size, PROT_WRITE, MAP_SHARED,
239 if (ret->dumb.mem == MAP_FAILED) {
240 SDL_SetError(
"failed to get mmap offset for the dumb buffer.");
243 ret->dumb.size = create.size;
248 destroy = (
struct drm_mode_destroy_dumb) { .handle = create.handle };
249 KMSDRM_drmIoctl(viddata->
drm_fd, DRM_IOCTL_MODE_DESTROY_DUMB, &destroy);
256 KMSDRM_DestroyDumbBuffer(
_THIS, dumb_buffer **
buffer)
260 struct drm_mode_destroy_dumb destroy = {
261 .handle = (*buffer)->gem_handles[0],
264 KMSDRM_drmModeRmFB(viddata->
drm_fd, (*buffer)->fb_id);
266 munmap((*buffer)->dumb.mem, (*buffer)->dumb.size);
267 KMSDRM_drmIoctl(viddata->
drm_fd, DRM_IOCTL_MODE_DESTROY_DUMB, &destroy);
274 KMSDRM_FillDumbBuffer(dumb_buffer *
buffer)
280 *pix++ = (0x00000000);
285 static dumb_buffer *KMSDRM_CreateBuffer(
_THIS)
292 ret = KMSDRM_CreateDumbBuffer(
_this);
301 err = KMSDRM_drmModeAddFB2(viddata->
drm_fd, ret->width, ret->height,
302 ret->format, ret->gem_handles, ret->pitches,
303 ret->offsets, &ret->fb_id, 0);
305 if (err != 0 || ret->fb_id == 0) {
312 KMSDRM_DestroyDumbBuffer(
_this, &ret);
326 #define VOID2U64(x) ((uint64_t)(unsigned long)(x))
367 return KMSDRM_drmModeAtomicAddProperty(req,
crtc->
crtc->crtc_id, prop_id,
value);
388 return KMSDRM_drmModeAtomicAddProperty(req,
plane->
plane->plane_id, prop_id,
value);
393 void print_plane_info(
_THIS, drmModePlanePtr
plane)
396 drmModeRes *resources;
401 drmModeObjectPropertiesPtr
props = KMSDRM_drmModeObjectGetProperties(viddata->
drm_fd,
402 plane->plane_id, DRM_MODE_OBJECT_PLANE);
405 for (
i = 0;
i <
props->count_props;
i++) {
406 drmModePropertyPtr
p = KMSDRM_drmModeGetProperty(viddata->
drm_fd,
props->props[
i]);
407 if ((strcmp(
p->name,
"type") == 0)) {
411 KMSDRM_drmModeFreeProperty(
p);
415 case DRM_PLANE_TYPE_OVERLAY:
416 plane_type =
"overlay";
419 case DRM_PLANE_TYPE_PRIMARY:
420 plane_type =
"primary";
423 case DRM_PLANE_TYPE_CURSOR:
424 plane_type =
"cursor";
434 resources = KMSDRM_drmModeGetResources(viddata->
drm_fd);
438 printf(
"--PLANE ID: %d\nPLANE TYPE: %s\nCRTC READING THIS PLANE: %d\nCRTCS SUPPORTED BY THIS PLANE: ",
plane->plane_id, plane_type,
plane->crtc_id);
439 for (
i = 0;
i < resources->count_crtcs;
i++) {
440 if (
plane->possible_crtcs & (1 <<
i)) {
442 printf (
"%d", crtc_id);
450 void get_planes_info(
_THIS)
452 drmModePlaneResPtr plane_resources;
458 plane_resources = KMSDRM_drmModeGetPlaneResources(viddata->
drm_fd);
459 if (!plane_resources) {
460 printf(
"drmModeGetPlaneResources failed: %s\n", strerror(errno));
464 printf(
"--Number of planes found: %d-- \n", plane_resources->count_planes);
465 printf(
"--Usable CRTC that we have chosen: %d-- \n", dispdata->
crtc->
crtc->crtc_id);
468 for (
i = 0; (
i < plane_resources->count_planes);
i++) {
470 uint32_t plane_id = plane_resources->planes[
i];
472 drmModePlanePtr
plane = KMSDRM_drmModeGetPlane(viddata->
drm_fd, plane_id);
474 printf(
"drmModeGetPlane(%u) failed: %s\n", plane_id, strerror(errno));
480 KMSDRM_drmModeFreePlane(
plane);
483 KMSDRM_drmModeFreePlaneResources(plane_resources);
492 drmModeRes *resources =
NULL;
493 drmModePlaneResPtr plane_resources =
NULL;
495 unsigned int crtc_index = 0;
502 resources = KMSDRM_drmModeGetResources(viddata->
drm_fd);
506 for (
i = 0;
i < resources->count_crtcs;
i++) {
507 if (resources->crtcs[
i] == dispdata->
crtc->
crtc->crtc_id) {
513 plane_resources = KMSDRM_drmModeGetPlaneResources(viddata->
drm_fd);
514 if (!plane_resources) {
515 return SDL_SetError(
"drmModeGetPlaneResources failed.");
519 for (
i = 0; (
i < plane_resources->count_planes) && !found;
i++) {
521 uint32_t plane_id = plane_resources->planes[
i];
523 drmModePlanePtr
plane = KMSDRM_drmModeGetPlane(viddata->
drm_fd, plane_id);
529 if (
plane->possible_crtcs & (1 << crtc_index)) {
531 drmModeObjectPropertiesPtr
props = KMSDRM_drmModeObjectGetProperties(
532 viddata->
drm_fd, plane_id, DRM_MODE_OBJECT_PLANE);
537 for (
j = 0;
j <
props->count_props;
j++) {
539 drmModePropertyPtr
p = KMSDRM_drmModeGetProperty(viddata->
drm_fd,
542 if ((strcmp(
p->name,
"type") == 0) && (
props->prop_values[
j] == plane_type)) {
547 KMSDRM_drmModeFreeProperty(
p);
550 KMSDRM_drmModeFreeObjectProperties(
props);
553 KMSDRM_drmModeFreePlane(
plane);
556 KMSDRM_drmModeFreePlaneResources(plane_resources);
557 KMSDRM_drmModeFreeResources(resources);
577 plane_id = get_plane_id(
_this, plane_type);
585 (*plane)->plane = KMSDRM_drmModeGetPlane(viddata->
drm_fd, plane_id);
588 if ((*plane)->plane) {
590 (*plane)->props = KMSDRM_drmModeObjectGetProperties(viddata->
drm_fd,
591 (*plane)->plane->plane_id, DRM_MODE_OBJECT_PLANE);
592 (*plane)->props_info =
SDL_calloc((*plane)->props->count_props,
593 sizeof(*(*plane)->props_info));
595 if ( !((*plane)->props_info) ) {
600 for (
i = 0;
i < (*plane)->props->count_props;
i++) {
601 (*plane)->props_info[
i] = KMSDRM_drmModeGetProperty(viddata->
drm_fd,
602 (*plane)->props->props[
i]);
622 if ((*plane)->plane) {
623 KMSDRM_drmModeFreePlane((*plane)->plane);
624 (*plane)->plane =
NULL;
626 if ((*plane)->props_info) {
628 (*plane)->props_info =
NULL;
660 dispdata->
atomic_req = KMSDRM_drmModeAtomicAlloc();
688 SDL_SetError(
"Atomic commit failed, returned %d.", ret);
691 printf(
"ATOMIC COMMIT FAILED: %s.\n", strerror(errno));
702 KMSDRM_drmModeAtomicFree(dispdata->
atomic_req);
720 status =
_this->egl_data->eglClientWaitSyncKHR(
_this->egl_data->egl_display,
721 dispdata->
kms_fence, 0, EGL_FOREVER_KHR);
722 }
while (status != EGL_CONDITION_SATISFIED_KHR);
734 KMSDRM_Available(
void)
738 ret = get_driindex();
778 w = dispdata->
mode.hdisplay;
779 h = dispdata->
mode.vdisplay;
781 *hdpi = display_mm_width ? (((float)
w) * 25.4f / display_mm_width) : 0.0f;
782 *vdpi = display_mm_height ? (((float)
h) * 25.4f / display_mm_height) : 0.0f;
789 KMSDRM_CreateDevice(
int devindex)
794 if (!KMSDRM_Available()) {
798 if (!devindex || (devindex > 99)) {
799 devindex = get_driindex();
803 SDL_SetError(
"devindex (%d) must be between 0 and 99.", devindex);
825 device->driverdata = viddata;
832 device->GetDisplayDPI = KMSDRM_GetDisplayDPI;
849 #if SDL_VIDEO_OPENGL_EGL
850 device->GL_DefaultProfileConfig = KMSDRM_GLES_DefaultProfileConfig;
862 device->free = KMSDRM_DeleteDevice;
864 device->Vulkan_LoadLibrary = KMSDRM_Vulkan_LoadLibrary;
865 device->Vulkan_UnloadLibrary = KMSDRM_Vulkan_UnloadLibrary;
866 device->Vulkan_GetInstanceExtensions = KMSDRM_Vulkan_GetInstanceExtensions;
867 device->Vulkan_CreateSurface = KMSDRM_Vulkan_CreateSurface;
868 device->Vulkan_GetDrawableSize = KMSDRM_Vulkan_GetDrawableSize;
882 "KMS/DRM Video Driver",
888 KMSDRM_FBDestroyCallback(
struct gbm_bo *bo,
void *
data)
892 if (fb_info && fb_info->
drm_fd >= 0 && fb_info->
fb_id != 0) {
893 KMSDRM_drmModeRmFB(fb_info->
drm_fd, fb_info->
fb_id);
906 const int num_planes = KMSDRM_gbm_bo_get_plane_count(bo);
927 width = KMSDRM_gbm_bo_get_width(bo);
928 height = KMSDRM_gbm_bo_get_height(bo);
929 format = KMSDRM_gbm_bo_get_format(bo);
932 strides[
i] = KMSDRM_gbm_bo_get_stride_for_plane(bo,
i);
933 handles[
i] = KMSDRM_gbm_bo_get_handle(bo).u32;
934 offsets[
i] = KMSDRM_gbm_bo_get_offset(bo,
i);
951 KMSDRM_gbm_bo_set_user_data(bo, fb_info, KMSDRM_FBDestroyCallback);
979 if (dispdata && dispdata->
crtc) {
981 KMSDRM_drmModeFreeCrtc(dispdata->
crtc->
crtc);
1001 drmModeRes *resources =
NULL;
1002 drmModeEncoder *encoder =
NULL;
1027 viddata->
drm_fd = open(viddata->
devpath, O_RDWR | O_CLOEXEC);
1029 if (viddata->
drm_fd < 0) {
1041 ret = set_client_caps(viddata->
drm_fd);
1051 resources = KMSDRM_drmModeGetResources(viddata->
drm_fd);
1058 for (
i = 0;
i < resources->count_connectors;
i++) {
1059 drmModeConnector *conn = KMSDRM_drmModeGetConnector(viddata->
drm_fd,
1060 resources->connectors[
i]);
1066 if (conn->connection == DRM_MODE_CONNECTED && conn->count_modes) {
1068 conn->connector_id, conn->count_modes);
1074 KMSDRM_drmModeFreeConnector(conn);
1078 ret =
SDL_SetError(
"No currently active connector found.");
1083 for (
i = 0;
i < resources->count_encoders;
i++) {
1084 encoder = KMSDRM_drmModeGetEncoder(viddata->
drm_fd, resources->encoders[
i]);
1090 if (encoder->encoder_id ==
connector->encoder_id) {
1095 KMSDRM_drmModeFreeEncoder(encoder);
1101 for (
i = 0;
i < resources->count_encoders;
i++) {
1102 encoder = KMSDRM_drmModeGetEncoder(viddata->
drm_fd, resources->encoders[
i]);
1109 if (
connector->encoders[
j] == encoder->encoder_id) {
1118 KMSDRM_drmModeFreeEncoder(encoder);
1131 crtc = KMSDRM_drmModeGetCrtc(viddata->
drm_fd, encoder->crtc_id);
1136 for (
i = 0;
i < resources->count_crtcs;
i++) {
1137 if (encoder->possible_crtcs & (1 <<
i)) {
1138 encoder->crtc_id = resources->crtcs[
i];
1139 crtc = KMSDRM_drmModeGetCrtc(viddata->
drm_fd, encoder->crtc_id);
1157 if (
connector->modes[
i].type & DRM_MODE_TYPE_PREFERRED) {
1164 if (
crtc->mode_valid == 0) {
1168 if (dispdata->
mode.hdisplay == 0 || dispdata->
mode.vdisplay == 0 ) {
1169 ret =
SDL_SetError(
"Couldn't get a valid connector videomode.");
1174 dispdata->
crtc->
props = KMSDRM_drmModeObjectGetProperties(viddata->
drm_fd,
1175 crtc->crtc_id, DRM_MODE_OBJECT_CRTC);
1185 for (
i = 0;
i < dispdata->
crtc->
props->count_props;
i++) {
1192 connector->connector_id, DRM_MODE_OBJECT_CONNECTOR);
1218 KMSDRM_drmSetClientCap(viddata->
drm_fd, DRM_CLIENT_CAP_ATOMIC, 0);
1219 KMSDRM_drmSetClientCap(viddata->
drm_fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 0);
1225 KMSDRM_drmModeFreeEncoder(encoder);
1227 KMSDRM_drmModeFreeResources(resources);
1243 KMSDRM_drmModeFreeCrtc(dispdata->
crtc->
crtc);
1246 if (viddata->
drm_fd >= 0) {
1270 viddata->
drm_fd = open(viddata->
devpath, O_RDWR | O_CLOEXEC);
1271 set_client_caps(viddata->
drm_fd);
1274 viddata->
gbm_dev = KMSDRM_gbm_create_device(viddata->
drm_fd);
1283 ret =
SDL_SetError(
"can't find suitable display plane.");
1306 KMSDRM_gbm_device_destroy(viddata->
gbm_dev);
1311 if (viddata->
drm_fd >= 0) {
1330 #if SDL_VIDEO_OPENGL_EGL
1343 plane_info.
src_w = dispdata->
mode.hdisplay;
1344 plane_info.
src_h = dispdata->
mode.vdisplay;
1352 SDL_SetError(
"Failed to issue atomic commit on surfaces destruction.");
1363 KMSDRM_gbm_surface_release_buffer(windata->
gs, windata->
bo);
1368 KMSDRM_gbm_surface_release_buffer(windata->
gs, windata->
next_bo);
1383 #if SDL_VIDEO_OPENGL_EGL
1394 KMSDRM_gbm_surface_destroy(windata->
gs);
1406 uint32_t surface_fmt = GBM_FORMAT_ARGB8888;
1407 uint32_t surface_flags = GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING;
1424 if (!KMSDRM_gbm_device_is_format_supported(viddata->
gbm_dev, surface_fmt, surface_flags)) {
1428 windata->
gs = KMSDRM_gbm_surface_create(viddata->
gbm_dev,
width,
height, surface_fmt, surface_flags);
1434 #if SDL_VIDEO_OPENGL_EGL
1438 SDL_EGL_SetRequiredVisualId(
_this, surface_fmt);
1442 ret =
SDL_SetError(
"Could not create EGL window surface");
1458 KMSDRM_gbm_surface_destroy(windata->
gs);
1481 #if SDL_VIDEO_OPENGL_EGL
1482 if (
_this->egl_data) {
1483 SDL_EGL_UnloadLibrary(
_this);
1488 KMSDRM_GBMDeinit(
_this, dispdata);
1530 windata->
src_w = dispdata->
mode.hdisplay;
1531 windata->
src_h = dispdata->
mode.vdisplay;
1588 if (KMSDRM_DisplayDataInit(
_this, dispdata)) {
1589 ret =
SDL_SetError(
"error getting KMS/DRM information");
1607 get_planes_info(
_this);
1610 #ifdef SDL_INPUT_LINUXEV
1623 if (dispdata->
crtc) {
1644 KMSDRM_DisplayDataDeinit(
_this, dispdata);
1646 #ifdef SDL_INPUT_LINUXEV
1678 for (
i = 0;
i < conn->count_modes;
i++) {
1688 mode.w = conn->modes[
i].hdisplay;
1689 mode.h = conn->modes[
i].vdisplay;
1690 mode.refresh_rate = conn->modes[
i].vrefresh;
1692 mode.driverdata = modedata;
1714 return SDL_SetError(
"Mode doesn't have an associated index");
1749 if ( !(dispdata->
gbm_init) && (!is_vulkan)) {
1753 if ((ret = KMSDRM_GBMInit(
_this, dispdata))) {
1757 #if SDL_VIDEO_OPENGL_EGL
1763 if (!
_this->egl_data) {
1791 windata->
src_w = dispdata->
mode.hdisplay;
1792 windata->
src_h = dispdata->
mode.vdisplay;
1813 window->driverdata = windata;
1816 if ((ret = KMSDRM_CreateSurfaces(
_this,
window))) {
1825 unsigned int new_max_windows = viddata->
max_windows + 1;
1883 SDL_SetError(
"Can't reconfigure window on SetWindowSize.");
1891 SDL_SetError(
"Can't reconfigure window on SetWindowFullscreen.");
1934 SDL_SetError(
"application not compiled with SDL %d.%d\n",
unsigned long long uint64_t
#define SDL_GL_GetCurrentContext
#define SDL_OutOfMemory()
const GLubyte GLuint GLuint GLuint GLuint alpha GLboolean GLboolean GLboolean GLboolean alpha GLint GLint GLsizei GLsizei GLenum type GLenum GLint GLenum GLint GLint GLsizei GLsizei GLint border GLenum GLint GLint GLint GLint GLint GLsizei GLsizei height GLsizei GLsizei GLenum GLenum const GLvoid *pixels GLenum GLint GLint GLint GLint j2 GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble zFar GLenum GLenum GLint *params GLenum GLenum GLint *params GLenum GLenum GLint *params GLenum GLenum GLfloat *params GLenum GLint GLenum GLenum GLvoid *pixels GLenum GLint GLenum GLint *params GLenum GLenum GLint *params GLenum GLsizei const GLvoid *pointer GLenum GLenum const GLint *params GLenum GLfloat GLfloat GLint GLint const GLfloat *points GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat *points GLint GLfloat GLfloat GLint GLfloat GLfloat v2 GLenum GLenum const GLint *params GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble zFar GLenum map
void SDL_SetKeyboardFocus(SDL_Window *window)
int SDL_KMSDRM_LoadSymbols(void)
void SDL_KMSDRM_UnloadSymbols(void)
void KMSDRM_PumpEvents(_THIS)
void KMSDRM_DeinitMouse(_THIS)
void KMSDRM_InitMouse(_THIS)
void KMSDRM_RaiseWindow(_THIS, SDL_Window *window)
int KMSDRM_GLES_SetSwapInterval(_THIS, int interval)
int setup_plane(_THIS, struct plane **plane, uint32_t plane_type)
void KMSDRM_RestoreWindow(_THIS, SDL_Window *window)
int KMSDRM_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
void KMSDRM_SetWindowGrab(_THIS, SDL_Window *window, SDL_bool grabbed)
void KMSDRM_ShowWindow(_THIS, SDL_Window *window)
int KMSDRM_GLES_LoadLibrary(_THIS, const char *path)
void KMSDRM_MaximizeWindow(_THIS, SDL_Window *window)
int drm_atomic_commit(_THIS, SDL_bool blocking)
int KMSDRM_CreateWindow(_THIS, SDL_Window *window)
void KMSDRM_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
void KMSDRM_SetWindowSize(_THIS, SDL_Window *window)
int add_crtc_property(drmModeAtomicReq *req, struct crtc *crtc, const char *name, uint64_t value)
void KMSDRM_SetWindowPosition(_THIS, SDL_Window *window)
void * KMSDRM_GLES_GetProcAddress(_THIS, const char *proc)
void KMSDRM_GLES_DeleteContext(_THIS, SDL_GLContext context)
void drm_atomic_waitpending(_THIS)
void KMSDRM_HideWindow(_THIS, SDL_Window *window)
void KMSDRM_MinimizeWindow(_THIS, SDL_Window *window)
void KMSDRM_SetWindowIcon(_THIS, SDL_Window *window, SDL_Surface *icon)
void KMSDRM_VideoQuit(_THIS)
int KMSDRM_VideoInit(_THIS)
void KMSDRM_SetWindowTitle(_THIS, SDL_Window *window)
SDL_bool KMSDRM_GetWindowWMInfo(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info)
int KMSDRM_CreateWindowFrom(_THIS, SDL_Window *window, const void *data)
SDL_GLContext KMSDRM_GLES_CreateContext(_THIS, SDL_Window *window)
void drm_atomic_set_plane_props(struct KMSDRM_PlaneInfo *info)
void KMSDRM_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *_display, SDL_bool fullscreen)
void KMSDRM_GLES_UnloadLibrary(_THIS)
int add_plane_property(drmModeAtomicReq *req, struct plane *plane, const char *name, uint64_t value)
int KMSDRM_GLES_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context)
int add_connector_property(drmModeAtomicReq *req, struct connector *connector, const char *name, uint64_t value)
KMSDRM_FBInfo * KMSDRM_FBFromBO(_THIS, struct gbm_bo *bo)
int KMSDRM_GLES_GetSwapInterval(_THIS)
void free_plane(struct plane **plane)
int KMSDRM_GLES_SwapWindow(_THIS, SDL_Window *window)
void KMSDRM_DestroyWindow(_THIS, SDL_Window *window)
void SDL_SetMouseFocus(SDL_Window *window)
GLint GLint GLint GLint GLint GLint y
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLint GLint GLsizei width
GLint GLint GLint GLint GLint x
GLint GLint GLsizei GLsizei height
GLuint GLuint GLsizei GLenum type
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
GLsizei const GLuint const GLintptr const GLsizei * strides
GLuint GLsizei const GLuint const GLintptr * offsets
GLenum GLuint GLsizei const GLenum * props
GLuint const GLchar * name
GLuint GLint GLboolean GLint GLenum access
GLsizei const GLfloat * value
GLfloat GLfloat GLfloat GLfloat h
GLubyte GLubyte GLubyte GLubyte w
@ SDL_PIXELFORMAT_ARGB8888
void * SDL_GetDisplayDriverData(int displayIndex)
int SDL_AddVideoDisplay(const SDL_VideoDisplay *display, SDL_bool send_event)
float SDL_ComputeDiagonalDPI(int hpix, int vpix, float hinches, float vinches)
SDL_bool SDL_AddDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode *mode)
SDL_VideoDisplay * SDL_GetDisplayForWindow(SDL_Window *window)
VideoBootStrap KMSDRM_bootstrap
#define SDL_MINOR_VERSION
#define SDL_MAJOR_VERSION
static SDL_VideoDevice * _this
@ SDL_WINDOW_FULLSCREEN_DESKTOP
@ SDL_WINDOWEVENT_RESIZED
int SDL_SendWindowEvent(SDL_Window *window, Uint8 windowevent, int data1, int data2)
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)
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 int in j)
#define EGL_PLATFORM_GBM_MESA
EGLSurface EGLNativeWindowType * window
EGLImageKHR int int * num_planes
static SDL_AudioDeviceID device
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 ®2 endm macro vzip8 reg2 vzip d d ®2 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
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 ®2 endm macro vzip8 reg2 vzip d d ®2 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
drmModeAtomicReq * atomic_req
drmModeModeInfo preferred_mode
struct gbm_bo * cursor_bo
The structure that defines a display mode.
A collection of pixels used in software blitting.
struct gbm_device * gbm_dev
SDL_DisplayMode desktop_mode
SDL_DisplayMode current_mode
The type used to identify a window.
drmModePropertyRes ** props_info
drmModeConnector * connector
drmModeObjectProperties * props
drmModeObjectProperties * props
drmModePropertyRes ** props_info
drmModeObjectProperties * props
drmModePropertyRes ** props_info