-
-
Notifications
You must be signed in to change notification settings - Fork 477
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
EGL: Implement interfaces for EGL_EXT_device_drm
#1691
Conversation
7b995a5
to
9cd6d4c
Compare
glutin/src/api/egl/device.rs
Outdated
// SAFETY: We pass a valid EGLDevice pointer, and validated that the enum name | ||
// is valid because the extension is present. | ||
unsafe { Self::query_string(self.raw_device(), EGL_DRM_RENDER_NODE_PATH_EXT) } | ||
.map(PathBuf::from) |
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.
Should we let query_string
return a &'static CStr
or &'static OsStr
since eglQueryDeviceStringEXT()
is guaranteed to return a static string (which would disappear if the implementation library is unloaded...)?
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.
Well, you can not unload the library and keep using anything created by glutin, since we never unload.
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.
Good point (but the user could hold on to the 'static
str). Perhaps I'll refactor it to return '_
for both query_string()
and &Path
here.
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.
Done now, it's returning a lifetime constrained by &self
.
By the way, for Device::from_ptr()
is there a reason we pass a borrow of EGL
when self::query_string()
also borrows that global already?
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.
Or right, since we have static EGL: Lazy
this could actually be 'static
?
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.
We already did this for extensions_from_ptr()
anyway :)
The |
9cd6d4c
to
56b6d2c
Compare
db35034
to
e095242
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.
From what I can see, it doesn't have any breaking changes, since static
is more broad lifetime here?
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Also, we don't really have to add |
This comment was marked as resolved.
This comment was marked as resolved.
That is true, do you think we'll ever unload or replace the library? |
I'm not sure about this, probably not, but having Like if someone has a need for |
More restrictive to what we can do, but less restrictive to what the caller can do with it once we've given a borrow to them. So yeah, I think having these names behave the same as the string borrows would be nice/consistent? |
This extension (together with the optional `EGL_EXT_device_drm_render_node` extension) allows querying the DRM primary and render device node filenames from `EGLDevice`, to help associating them with DRM devices. Additionally a platform display _can_ be created with a DRM file descriptor with master permissions, but this is only useful in situations where EGL might fail to open a file descriptor itself or will fail to acquire master permissions (which are only required when the implementation needs to "modify output attributes": but no behaviour is defined by this extension that requires this). This file descriptor will be duplicated by the implementation if it needs to use it beyond the call to `eglGetPlatformDisplayEXT()`, and does not need to be kept alive by the caller. Note that `EGL_EXT_output_drm` is omitted for now, because it relies on the equally unimplemented `EGL_EXT_output_base` extension.
e095242
to
eb08a28
Compare
This extension (together with the optional
EGL_EXT_device_drm_render_node
extension) allows querying the DRM primary and render device node filenames fromEGLDevice
, to help associating them with DRM devices.Additionally a platform display can be created with a DRM file descriptor with master permissions, but this is only useful in situations where EGL might fail to open a file descriptor itself or will fail to acquire master permissions (which are only required when the implementation needs to "modify output attributes": but no behaviour is defined by this extension that requires this).
This file descriptor will be duplicated by the implementation if it needs to use it beyond the call to
eglGetPlatformDisplayEXT()
, and does not need to be kept alive by the caller.Note that
EGL_EXT_output_drm
is omitted for now, because it relies on the equally unimplementedEGL_EXT_output_base
extension (neither of which are available on my hardware for testing).CHANGELOG.md
if knowledge of this change could be valuable to users