Skip to content
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

Implement priority hints for EGL #1700

Merged
merged 2 commits into from
Nov 13, 2024

Conversation

valaphee
Copy link
Contributor

@valaphee valaphee commented Sep 15, 2024

Fixes #1645
Fixes #1694

This PR adds a way to specify the priority for contexts. I mostly used the term hint, as its not guaranteed for various reasons that the context actually gets the priority.

Don't know if it makes sense to guarantee the priority. In Chromium it's also only used as a hint.

I also probably should extend the extension check as it is not correctly reported on Android.
https://github.com/chromium/chromium/blob/main/ui/gl/gl_display.cc#L814

Theoretically the extension also exists for GLX but Mesa for example doesn't support it.

  • Tested on all platforms changed
  • Added an entry to CHANGELOG.md if knowledge of this change could be valuable to users
  • Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior
  • Created or updated an example program if it would help users understand this functionality

@valaphee valaphee force-pushed the context-priority branch 2 times, most recently from 2625fe2 to c63d6a8 Compare September 15, 2024 12:51
glutin/src/context.rs Outdated Show resolved Hide resolved
glutin/src/context.rs Outdated Show resolved Hide resolved
glutin/src/api/egl/context.rs Outdated Show resolved Hide resolved
@kchibisov
Copy link
Member

You need to add a CHANGELOG entry, since you change the public API.

@kchibisov
Copy link
Member

I also probably should extend the extension check as it is not correctly reported on Android.
https://github.com/chromium/chromium/blob/main/ui/gl/gl_display.cc#L814

I'm fine with adding such a check just for android target.

Add `GlContext::priority` and `ContextAttributesBuilder::with_priority`
to get and set context priority respectively.

Fixes rust-windowing#1694.
Fixes rust-windowing#1645.
@kchibisov
Copy link
Member

I've rabased it and added a getter, which could be used to log what level of priority context is using.

@kchibisov kchibisov merged commit 2c09d89 into rust-windowing:master Nov 13, 2024
43 checks passed
@kchibisov
Copy link
Member

Thanks.

Copy link
Member

@MarijnS95 MarijnS95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, sorry I was late to the review request and only have one minor nit that doesn't need to be addressed.

Comment on lines +137 to +141
#[cfg(android_platform)]
let android = extensions.contains("EGL_ANDROID_front_buffer_auto_refresh")
&& extensions.contains("EGL_ANDROID_create_native_client_buffer");
#[cfg(not(android_platform))]
let android = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We wanted less #[cfg] conditional compilation, perhaps this could have been let android = cfg!(android_platform) && ...;?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about that, and decided to do it that way for now, since we already do things like that...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

egl: NV_context_priority_realtime support Context priority
3 participants