Skip to content

Commit

Permalink
[PS4] Repeat submitDone callbacks during suspension
Browse files Browse the repository at this point in the history
b/228112148

Change-Id: I795325a38d330d3f5ddc0a7cf96c96f1eb90d7ee
  • Loading branch information
niranjanyardi committed Apr 20, 2022
1 parent 5d5624d commit f459240
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
13 changes: 10 additions & 3 deletions glimp/egl/display.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,22 @@ namespace egl {
// the app in foreground)
const SbTime kSubmitDoneDelay = kSbTimeSecond / 60;

// Don't repeat the submitDone callback during suspension
// until specified by eglTerminate.
bool Display::repeat_submit_done_during_suspend = false;

namespace {
void ScheduleSubmitDoneCallback(void* context) {
DisplayImpl::CallSubmitDone();
if (Display::repeat_submit_done_during_suspend) {
DisplayImpl::CallSubmitDone();
Display::RepeatSubmitDoneDuringSuspend();
}
}
} // namespace

void Display::RepeatSubmitDoneDuringSuspend(bool repeat) {
void Display::RepeatSubmitDoneDuringSuspend() {
static SbEventId submit_done_repeating_callback_event = kSbEventIdInvalid;
if (repeat) {
if (Display::repeat_submit_done_during_suspend) {
submit_done_repeating_callback_event =
SbEventSchedule(&ScheduleSubmitDoneCallback, NULL, kSubmitDoneDelay);
} else {
Expand Down
3 changes: 2 additions & 1 deletion glimp/egl/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ namespace egl {
// upon construction.
class Display {
public:
static void RepeatSubmitDoneDuringSuspend(bool repeat);
static void RepeatSubmitDoneDuringSuspend();
static bool repeat_submit_done_during_suspend;

// In order to create a display, it must have a platform-specific
// implementation injected into it, where many methods will forward to.
Expand Down
6 changes: 4 additions & 2 deletions glimp/entry_points/egl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy,
display->GetVersionInfo(major, minor);

egl::SetError(EGL_SUCCESS);
egl::Display::RepeatSubmitDoneDuringSuspend(false);
egl::Display::repeat_submit_done_during_suspend = false;
egl::Display::RepeatSubmitDoneDuringSuspend();
return true;
}

Expand Down Expand Up @@ -265,7 +266,8 @@ EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy) {
egl::DisplayRegistry::TerminateDisplay(dpy);

egl::SetError(EGL_SUCCESS);
egl::Display::RepeatSubmitDoneDuringSuspend(true);
egl::Display::repeat_submit_done_during_suspend = true;
egl::Display::RepeatSubmitDoneDuringSuspend();
return true;
}

Expand Down

0 comments on commit f459240

Please sign in to comment.