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
Add DRM sources to sfml-window #2259
Conversation
Here's a sneak peak of the errors we get when trying to build this C code as C++.
Fixing the compound literals is easy if we could use C++11's |
I expanded the scope of this PR to also include all of the refactoring required to make this code match the rest of SFML. |
@substring @oomek Can you try this out and make sure I didn't break anything? Thanks! |
@ChrisThrasher Sorry, I'm a bit preoccupied by the bathroom renovation, I'll check as soon as I can. Thank you very much for getting your hands dirty. |
d2d07e0
to
c43e9e3
Compare
c43e9e3
to
4134e35
Compare
We've stumbled upon some very rare cases where that part would fail SFML/src/SFML/Window/DRM/DRMContext.cpp Lines 107 to 118 in 4134e35
Can you just keep L109->116 from that block ? Let's always trigger the Beside that case, tests were good so far. I'll let @oomek comment further if he wishes |
Is this a bug I introduced in this PR? EDIT: I pushed an additional commit for this change. Let me know if it helps. |
ba0e928
to
78555c0
Compare
ae3f710
to
8931f17
Compare
It's not strictly a bug, but an optimization added by @substring that does not play nicely when the drm app is launched from linux session in VirtualBox. It resulted in a black screen, no console visible upon exiting the app, so it's better to remove it until further investigation. Thanks for the commit reverting it, and your overall involvement in SFML-ifying the common drm functions. I had a chance to test it this evening and all seems to be working as expected. |
e4ac09d
to
972279f
Compare
7c82048
to
bf8fb77
Compare
3da585d
to
e9964f5
Compare
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.
Feels like we're at diminishing returns style improvement wise. I can't see any obvious issues so I reckon it's ready
@substring @oomek I made substantial changes since I last pinged you about this PR but have since finished everything I wanted to do. If possible I'd really appreciate you give this a review and test it out on your end so we can get this merged. I think this will help speed up all future work on DRM code. Thanks! |
Just tested. All looking good. Sorry for the late response. |
LGTM |
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.
Given that others having given an approval this is basically good to go, just three small thingies 😄
src/SFML/Window/DRM/DRMContext.cpp
Outdated
return -1; | ||
} | ||
|
||
int 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.
I vote for int fileDescriptor
src/SFML/Window/DRM/DRMContext.cpp
Outdated
for (int i = 0; i < numDevices; ++i) | ||
{ | ||
drmDevicePtr device = devices[i]; | ||
int ret; |
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.
returnCode
or just result
e9964f5
to
cbcdf46
Compare
Description
This moves the 3rd party DRM sources into SFML itself since we need to regularly modify these files. Note that we can't immediately start building this as C++ code since it uses C features or extensions that don't work in C++. That transition will require some extra work.
Addresses #2252
While I was working on this I realized there was no cache variable for
SFML_USE_DRM
so I added that. This means you can edit the CMakeCache to enable or disable this setting without having to reconfigure the project.How far do we want to take this? Do we want to refactor this as C++ code and do some modest style fixes in the same PR that moves the code or do we tackle this in smaller pieces?
EDT: I expanded the scope of this PR to also include all of the refactoring required to make this code match the rest of SFML.