-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kmsdrm: Restore atomic support. #11511
base: main
Are you sure you want to change the base?
Conversation
/* frame.(KMS will have to wait on it before doing a pageflip.) */ | ||
/******************************************************************/ | ||
dispdata->gpu_fence = create_fence(_this, EGL_NO_NATIVE_FENCE_FD_ANDROID); | ||
SDL_assert(dispdata->gpu_fence); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the preceding comment:
Also, DON'T remove the asserts: if a fence-related call fails, it's better that program exits immediately, or we could leave KMS waiting for a failed/missing fence forever.
this should be SDL_assert_always(), or the asserts will be compiled out in release builds.
SDL_assert(dispdata->gpu_fence); | |
SDL_assert_always(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); | ||
SDL_assert(dispdata->kms_in_fence_fd != -1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here:
SDL_assert(dispdata->kms_in_fence_fd != -1); | |
SDL_assert_always(dispdata->kms_in_fence_fd != -1); |
/* KMS-side FENCE OBJECT so we can use use it to fence the GPU. */ | ||
/****************************************************************/ | ||
dispdata->kms_fence = create_fence(_this, dispdata->kms_out_fence_fd); | ||
SDL_assert(dispdata->kms_fence); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more time:
SDL_assert(dispdata->kms_fence); | |
SDL_assert_always(dispdata->kms_fence); |
Co-authored-by: Frank Praznik <[email protected]>
I'm not sure we should get into the business of promising to crash the entire process if something goes wrong, by adding assert_always to this. |
Agreed. Gamers get very unhappy if they lose several hours progress without getting a chance to save. :) |
This is an attempt to restore the ATOMIC support to the kmsdrm backend.
This was done by merging @vanfanel's final atomic work from SDL2 into the latest from SDL3. This wasn't a trivial effort, as a lot had changed in both kmsdrm specifically and SDL3 generally, so I expect there are issues to resolve in this PR still. It's at the "it compiles" stage; I'll be trying it on a Raspberry Pi 5 soon and fixing obvious issues that pop up.
There isn't a separate atomic and non-atomic version of the kmsdrm backend in this PR; it's now one codebase that will decide to use the atomic features if it can set the
DRM_CLIENT_CAP_ATOMIC
andDRM_CLIENT_CAP_UNIVERSAL_PLANES
client capabilities. If not, it'll use the "legacy" codepaths. Before merging, we should probably add an SDL hint to let people turn off atomic support even if the system would otherwise support it, as a failsafe.Note a few FIXMEs in this PR; these were pieces I couldn't decide how to correctly adapt, but I made a reasonable attempt anyhow.
Reference Issue #4984.