mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-16 11:06:49 +01:00
kmsdrm: Always use spaces for indentation. Always use SDL_calloc() for calloc.
This commit is contained in:
parent
cfc1362011
commit
87a86675ed
@ -117,7 +117,9 @@ KMSDRM_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y)
|
||||
SDL_assert(surface->format->format == SDL_PIXELFORMAT_ARGB8888);
|
||||
SDL_assert(surface->pitch == surface->w * 4);
|
||||
|
||||
if (!KMSDRM_gbm_device_is_format_supported(viddata->gbm_dev, GBM_FORMAT_ARGB8888, GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE)) {
|
||||
if (!KMSDRM_gbm_device_is_format_supported(viddata->gbm_dev, GBM_FORMAT_ARGB8888,
|
||||
GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE))
|
||||
{
|
||||
SDL_SetError("Unsupported pixel format for cursor");
|
||||
return NULL;
|
||||
}
|
||||
@ -136,7 +138,8 @@ KMSDRM_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y)
|
||||
|
||||
/* Find out what GBM cursor size is recommended by the driver. */
|
||||
if (KMSDRM_drmGetCap(viddata->drm_fd, DRM_CAP_CURSOR_WIDTH, &usable_cursor_w) ||
|
||||
KMSDRM_drmGetCap(viddata->drm_fd, DRM_CAP_CURSOR_HEIGHT, &usable_cursor_h)) {
|
||||
KMSDRM_drmGetCap(viddata->drm_fd, DRM_CAP_CURSOR_HEIGHT, &usable_cursor_h))
|
||||
{
|
||||
SDL_SetError("Could not get the recommended GBM cursor size");
|
||||
goto cleanup;
|
||||
}
|
||||
@ -152,8 +155,8 @@ KMSDRM_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y)
|
||||
curdata->w = usable_cursor_w;
|
||||
curdata->h = usable_cursor_h;
|
||||
|
||||
curdata->bo = KMSDRM_gbm_bo_create(viddata->gbm_dev, usable_cursor_w, usable_cursor_h, GBM_FORMAT_ARGB8888,
|
||||
GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE);
|
||||
curdata->bo = KMSDRM_gbm_bo_create(viddata->gbm_dev, usable_cursor_w, usable_cursor_h,
|
||||
GBM_FORMAT_ARGB8888, GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE);
|
||||
|
||||
if (!curdata->bo) {
|
||||
SDL_SetError("Could not create GBM cursor BO");
|
||||
@ -372,11 +375,9 @@ KMSDRM_WarpMouseGlobal(int x, int y)
|
||||
/* And now update the cursor graphic position on screen. */
|
||||
curdata = (KMSDRM_CursorData *) mouse->cur_cursor->driverdata;
|
||||
if (curdata->bo) {
|
||||
|
||||
if (drm_atomic_movecursor(curdata, x, y)) {
|
||||
return SDL_SetError("drm_atomic_movecursor() failed.");
|
||||
}
|
||||
|
||||
} else {
|
||||
return SDL_SetError("Cursor not initialized properly.");
|
||||
}
|
||||
|
@ -94,8 +94,9 @@ static EGLSyncKHR create_fence(int fd, _THIS)
|
||||
EGL_SYNC_NATIVE_FENCE_FD_ANDROID, fd,
|
||||
EGL_NONE,
|
||||
};
|
||||
EGLSyncKHR fence = _this->egl_data->eglCreateSyncKHR(_this->egl_data->egl_display,
|
||||
EGL_SYNC_NATIVE_FENCE_ANDROID, attrib_list);
|
||||
EGLSyncKHR fence = _this->egl_data->eglCreateSyncKHR
|
||||
(_this->egl_data->egl_display, EGL_SYNC_NATIVE_FENCE_ANDROID, attrib_list);
|
||||
|
||||
assert(fence);
|
||||
return fence;
|
||||
}
|
||||
@ -132,6 +133,7 @@ KMSDRM_GLES_SwapWindowFenced(_THIS, SDL_Window * window)
|
||||
if (! _this->egl_data->eglSwapBuffers(_this->egl_data->egl_display, windata->egl_surface)) {
|
||||
return SDL_EGL_SetError("Failed to swap EGL buffers", "eglSwapBuffers");
|
||||
}
|
||||
|
||||
/******************************************************************/
|
||||
/* EXPORT the GPU-side FENCE OBJECT to the fence INPUT FD, so we */
|
||||
/* can pass it into the kernel. Atomic ioctl will pass the */
|
||||
@ -144,8 +146,8 @@ KMSDRM_GLES_SwapWindowFenced(_THIS, SDL_Window * window)
|
||||
/* in the CMDSTREAM to be lifted when the CMDSTREAM to this point */
|
||||
/* is completed). */
|
||||
/******************************************************************/
|
||||
dispdata->kms_in_fence_fd = _this->egl_data->eglDupNativeFenceFDANDROID
|
||||
(_this->egl_data->egl_display, dispdata->gpu_fence);
|
||||
dispdata->kms_in_fence_fd = _this->egl_data->eglDupNativeFenceFDANDROID (_this->egl_data->egl_display,
|
||||
dispdata->gpu_fence);
|
||||
|
||||
_this->egl_data->eglDestroySyncKHR(_this->egl_data->egl_display, dispdata->gpu_fence);
|
||||
assert(dispdata->kms_in_fence_fd != -1);
|
||||
@ -205,8 +207,9 @@ KMSDRM_GLES_SwapWindowFenced(_THIS, SDL_Window * window)
|
||||
/* Do we have a pending modesetting? If so, set the necessary
|
||||
props so it's included in the incoming atomic commit. */
|
||||
if (dispdata->modeset_pending) {
|
||||
SDL_VideoData *viddata = (SDL_VideoData *)_this->driverdata;
|
||||
uint32_t blob_id;
|
||||
SDL_VideoData *viddata = (SDL_VideoData *)_this->driverdata;
|
||||
|
||||
dispdata->atomic_flags |= DRM_MODE_ATOMIC_ALLOW_MODESET;
|
||||
add_connector_property(dispdata->atomic_req, dispdata->connector, "CRTC_ID", dispdata->crtc->crtc->crtc_id);
|
||||
KMSDRM_drmModeCreatePropertyBlob(viddata->drm_fd, &dispdata->mode, sizeof(dispdata->mode), &blob_id);
|
||||
@ -352,7 +355,8 @@ KMSDRM_GLES_SwapWindow(_THIS, SDL_Window * window)
|
||||
if (windata->swap_window == NULL) {
|
||||
/* We want the fenced version by default, but it needs extensions. */
|
||||
if ( (SDL_GetHintBoolean(SDL_HINT_VIDEO_DOUBLE_BUFFER, SDL_FALSE)) ||
|
||||
(!SDL_EGL_HasExtension(_this, SDL_EGL_DISPLAY_EXTENSION, "EGL_ANDROID_native_fence_sync")) ) {
|
||||
(!SDL_EGL_HasExtension(_this, SDL_EGL_DISPLAY_EXTENSION, "EGL_ANDROID_native_fence_sync")) )
|
||||
{
|
||||
windata->swap_window = KMSDRM_GLES_SwapWindowDoubleBuffered;
|
||||
} else {
|
||||
windata->swap_window = KMSDRM_GLES_SwapWindowFenced;
|
||||
|
@ -157,11 +157,16 @@ static dumb_buffer *KMSDRM_CreateDumbBuffer(_THIS)
|
||||
SDL_VideoData *viddata = ((SDL_VideoData *)_this->driverdata);
|
||||
SDL_DisplayData *dispdata = (SDL_DisplayData *)SDL_GetDisplayDriverData(0);
|
||||
|
||||
dumb_buffer *ret = calloc(1, sizeof(*ret));
|
||||
struct drm_mode_create_dumb create;
|
||||
struct drm_mode_map_dumb map;
|
||||
struct drm_mode_destroy_dumb destroy;
|
||||
|
||||
dumb_buffer *ret = SDL_calloc(1, sizeof(*ret));
|
||||
if (!ret)
|
||||
SDL_OutOfMemory();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* The create ioctl uses the combination of depth and bpp to infer
|
||||
* a format; 24/32 refers to DRM_FORMAT_XRGB8888 as defined in
|
||||
@ -499,8 +504,8 @@ static int get_plane_id(_THIS, uint32_t plane_type)
|
||||
/* See if the current CRTC is available for this plane. */
|
||||
if (plane->possible_crtcs & (1 << crtc_index)) {
|
||||
|
||||
drmModeObjectPropertiesPtr props = KMSDRM_drmModeObjectGetProperties(viddata->drm_fd,
|
||||
plane_id, DRM_MODE_OBJECT_PLANE);
|
||||
drmModeObjectPropertiesPtr props = KMSDRM_drmModeObjectGetProperties(
|
||||
viddata->drm_fd, plane_id, DRM_MODE_OBJECT_PLANE);
|
||||
ret = plane_id;
|
||||
|
||||
/* Iterate on the plane props to find the type of the plane,
|
||||
@ -510,8 +515,7 @@ static int get_plane_id(_THIS, uint32_t plane_type)
|
||||
drmModePropertyPtr p = KMSDRM_drmModeGetProperty(viddata->drm_fd,
|
||||
props->props[j]);
|
||||
|
||||
if ((strcmp(p->name, "type") == 0) &&
|
||||
(props->prop_values[j] == plane_type)) {
|
||||
if ((strcmp(p->name, "type") == 0) && (props->prop_values[j] == plane_type)) {
|
||||
/* found our plane, use that: */
|
||||
found = 1;
|
||||
}
|
||||
@ -1133,9 +1137,9 @@ KMSDRM_VideoInit(_THIS)
|
||||
SDL_VideoDisplay display = {0};
|
||||
|
||||
dispdata = (SDL_DisplayData *) SDL_calloc(1, sizeof(SDL_DisplayData));
|
||||
dispdata->display_plane = calloc(1, sizeof(*dispdata->display_plane));
|
||||
dispdata->crtc = calloc(1, sizeof(*dispdata->crtc));
|
||||
dispdata->connector = calloc(1, sizeof(*dispdata->connector));
|
||||
dispdata->display_plane = SDL_calloc(1, sizeof(*dispdata->display_plane));
|
||||
dispdata->crtc = SDL_calloc(1, sizeof(*dispdata->crtc));
|
||||
dispdata->connector = SDL_calloc(1, sizeof(*dispdata->connector));
|
||||
|
||||
dispdata->atomic_flags = 0;
|
||||
dispdata->atomic_req = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user