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

[XB1] Add device lost handling #4628

Open
wants to merge 1 commit into
base: 24.lts.1+
Choose a base branch
from

Conversation

alexanderbobrovnik
Copy link
Collaborator

@alexanderbobrovnik alexanderbobrovnik commented Dec 27, 2024

This change adds handler function that trigger graphics recreation if EGL_CONTEXT_LOST error occurred.
b/329326128

Copy link

google-cla bot commented Dec 27, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@amurovanyi amurovanyi requested a review from TyHolc January 9, 2025 18:35
@TyHolc TyHolc requested a review from jasonzhangxx January 9, 2025 20:45
@alexanderbobrovnik alexanderbobrovnik marked this pull request as ready for review January 10, 2025 12:44
@TyHolc
Copy link
Contributor

TyHolc commented Jan 10, 2025

@jasonzhangxx Can you take a look at this?

starboard/egl.h Outdated
@@ -62,6 +62,10 @@ typedef void* SbEglSurface;
typedef void* SbEglSync;
typedef uint64_t SbEglTime;

#ifdef HANDLE_EGL_CONTEXT_LOST
void SbHandleEglContextLost();
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a starboard interface change. It would need approval from @y4vor, @kaidokert, @xiaomings. I don't think we should change it at this moment.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@y4vor, @kaidokert, @xiaomings please review this PR. It's extremely important to us, becuase we beleive this fix would really decrease the number of Cobalt crashes on Xboxes

Copy link
Contributor

Choose a reason for hiding this comment

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

You can't do Starboard API changes. Try using a Starboard extension. Take a look at the following example:

https://github.com/youtube/cobalt/blob/25.lts.stable/starboard/extension/socket_receive_multi_msg.h

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've remade the PR using Starboard extension. Please, take a look.

ApplicationUwp::Get()->Inject(
new ApplicationUwp::Event(kSbEventTypeReveal, NULL, NULL));
ApplicationUwp::Get()->Inject(
new ApplicationUwp::Event(kSbEventTypeFocus, NULL, NULL));
Copy link
Contributor

Choose a reason for hiding this comment

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

We've seen regression b/370914120 for a similar change https://lbshell-internal-review.git.corp.google.com/c/cobalt_src/+/281544. Is that a safe way to reset DX11 device?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@jasonzhangxx, unfortunately we don't have access to b/370914120, could you give it us?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I can't guaranty that this approach will not have any issues, however, DX11 device lost renders cobalt completely unfunctional, so that it can't be any worse. And right now, DX11 device lost is not handled at all.

starboard/egl.h Outdated
@@ -62,6 +62,10 @@ typedef void* SbEglSurface;
typedef void* SbEglSync;
typedef uint64_t SbEglTime;

#ifdef HANDLE_EGL_CONTEXT_LOST
void SbHandleEglContextLost();
Copy link
Collaborator

Choose a reason for hiding this comment

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

@y4vor, @kaidokert, @xiaomings please review this PR. It's extremely important to us, becuase we beleive this fix would really decrease the number of Cobalt crashes on Xboxes

@@ -198,6 +198,8 @@ static_library("starboard_platform") {
"shared/configuration.cc",
"shared/configuration.h",
"shared/configuration_constants.cc",
"shared/egl_context_lost_handler.cc",
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added an extension test.

This change adds handler extension that triggers graphics recreation if EGL_CONTEXT_LOST error occurred.

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

Successfully merging this pull request may close these issues.

5 participants