-
Notifications
You must be signed in to change notification settings - Fork 165
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
Refactor drm backend (v3) #116
Conversation
6a13ed2
to
4a292f9
Compare
- Remove gbm code - rename EGLWaylandExtensions to EGLGraphicsBackend - remove OpenGL specific code where possible
- Move parts of glium & egl module into own module - Add raw GL loader as an alternative
- Don't let backend depend on `CursorBackend` (used to be `GraphicsBackend`) anymore
- Do not open devices for `UdevHandler` anymore - `UdevBackend` does not require `LoopHandle` or `Session` anymore - Type of the created device can be choosed freely by the handler - `UdevBackendObserver` is not needed anymore
- Split `DrmDevice` into `LegacyDrmDevice`, `GbmDevice` and `EglDevice` - Provide common `Device` and `RawDevice` traits - Change `DrmBackend` into `Surface` (and `RawSurface`) implementations of each `Device` (or `RawDevice`)
b5782d9
to
cd2de8a
Compare
b929784
to
8d64999
Compare
8d64999
to
a8343ed
Compare
/// | ||
/// This remains valid as long as the underlying `GLGraphicsBackend` is alive | ||
/// and may only be used in combination with the backend. Using this with any | ||
/// other gl context *may* cause undefined behavior. |
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.
Can't there be some link between the backend and the returned Gles2
? Maybe adding a PhantomData
lifetime to Gles2
?
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.
Sadly not. This is auto-generated code from gl_generator
and it would probably also cause a lot of inconveniences for the user. GL Contexts are weird and many gl functions are unsafe anyway. If you want a safe alternative there is glium
.
Co-Authored-By: Drakulix <[email protected]>
b9459a0
to
c1944ed
Compare
c1944ed
to
a1b8d2b
Compare
Still work in progress (docs and anvil support as well as some new examples are missing).
Ready for a first review.
The biggest change is the split of the
DrmDevice
andDrmBackend
intoLegacyDrmDevice
andLegacyDrmSurface
GbmDevice
andGbmSurface
EglDevice
andEglSurface
To be able to do this clean seperation new traits have been added.
Most importantly
Device
andSurface
, describing drm devices in generalRawDevice
andRawSurface
providing the lowest layer and modesetting support, while the higher-level devices rely on other means of swapping buffers.LegacyDrm*
implements theRaw*
-traits,Gbm*
requires aRaw*
-object as it provides buffer management, but itself does not provideRaw*
-implementations anymore, but instead the more high-levelpage_flip
,recreate
andunlock_buffer
functions.EglDevice
can wrap anyDevice
that also implements egl'sNativeDisplay
trait (and where it's surface also implementsNativeSurface
), which is provided by theGbmDevice
(andGbmSurface
), through the methods listed above.This provides very high composability, as the usual (and currently only viable) chain of an egl-gbm-drm-device, is not dictated anymore by the implementation, but by public-accessible traits.
In future this will allow us to add the following implementations easily:
AtomicDrmDevice
to support atomic modesetting (once drm-rs current refactor is done)EglStreamDevice
to support nVidia's buffer mangementVulkanDevice
to support Vulkan instead of OpenGL as a rendering apiDuring the refactor some additional changes have been made:
EventedFd
instead ofEventedRawFd
GraphicsBackend
to the more fittingCursorBackend
CursorBackend
anymore