-
Notifications
You must be signed in to change notification settings - Fork 326
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
Replay frame delimiters for EGL #2708
Conversation
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.
I am very worried that this will cause issues for regular replays. As we've not been replaying any EGL calls, we are not remapping the EGLDisplay, nor the EGLSurface. Simply using the pointers that the application had received at trace time during replay seems dangerous and I suspect would cause the replay to crash on some drivers.
I would recommend that instead we add a synthetic call that will do the eglSwapBuffers call on the replay surface. This way, we also would have the additional benefit of being able to only add the calls when we need them and not on every replay.
OK, starting to replay some EGL calls may cause mayhem in the replay. I will have a go at writing synthetic calls later as I focus on testing now. Thanks for the feedback! |
8f82536
to
7ab8c36
Compare
@pmuetschard can you tell me if this is the right direction? I'm not sure if you meant to have synthetics for the actual EGL calls, or for other made-up commands that would replace the EGL SwapBuffers calls? |
Yes, this is getting there. However, you still need to actually have the replayer call eglSwapBuffers, otherwhise this will not do anything. To do that add a swapBuffers method to the renderer and have the synthetic function call it. Also, consider making the synthetic a separate API function and have the API call it. Similar to how the eglMakeCurrent calls the bindRenderer synthetic. I'm not certain, however, if that is necessary/the right thing, but please consider it and decide. |
Let me try to wrap up a chat with Ben:
(i) may be an issue as we basically modify the trace to replace an EGL call by a different GL call which may have impact on various things. Also, A solution is to byte the bullet and do tracing and replay of all EGL-related things -- that will take some time. In the meantime, shall we go with option (2)? |
A few other comments:
a) While you *may* attempt to call eglSwapBuffers, we do not have all the
info required to call it 'correctly' (surface, display are ?) This seems to
me to be a Bad Idea.
b) glFinish is *typically* a noop as drivers think they always know best.
That said, I don't think it's a good idea to go emitting these all the
time. This might change behavior / performance.
c) the gapidFrameDelimiter suggestion is to expose this function via
eglGetProcAddress
d) once this function is called, there's a question of what GAPII should do
with it. Do we encode a new synthetic API command to the stream?
e) if we're making a new API command, it might be tempting to try to fold
(c) and (d) together (as in pick up the new API function from
eglGetProcAddress). However, this is unlikely to 'just work', and I'm not
sure how/if it would work with the new gles layers.
…On Thu, Apr 25, 2019, 2:31 PM Hugues Evrard ***@***.***> wrote:
Let me try to wrap up a chat with Ben:
- GAPIR needs to make a call to signal a frame delimiter
- GAPII needs to intercept that call as a frame delimiter
- This call *may* be eglSwapBuffers, but it can also be:
i. an other API call (e.g. glFinish), such that it can be replayed by
the driver with minimal impact and without having to deal with EGL
ii. a new made-up API call implemented by GAPII, e.g.
gapidFrameDelimiter, which acts as a delimiter when intercepted, but
which is not passed onto the driver
(i) may be an issue as we basically modify the trace to replace an EGL
call by a different GL call which may have impact on various things. Also,
glFinish would need to be marked as a frame delimiter, which may create
weird frames delimitations in applications that expect frame delimiters to
be only at EGLSwapBuffers.
(ii) may be an issue for tools other than GAPID, which will not recognize
gapidFrameDelimiter
A solution is to byte the bullet and do tracing and replay of all
EGL-related things -- that will take some time.
In the meantime, shall we go with option (2)?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2708 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACXY4VDGKQLXL2RFG4B7HJDPSGXDXANCNFSM4HD6TYMQ>
.
|
Following up on @ben-clayton's comment. glFinish should cause a flush of the GPU, meaning we would be introducing stalls into the pipeline, so that is not an ideal option. gapidFrameDelimiter may work, but has an the problem that we will still be changing the behavior of the program. Ignoring swap may have unintended side-effects. However this may work if we just want to be able to trace a replay for debug purposes (rather than performance purposes). |
I'd say we simplify it all and simply call swap buffers on the currently bound renderer (which has a display and a single surface). Isn't that what we are assuming already anyways? I mean, how are we currently associating an Maybe there will be that one app that'll swap buffers from a different thread, but it won't hurt to then just ignore it in the replay if there is no renderer bound on the current thread. |
@pmuetschard I think I implemented what you had in mind, and now tracing replay on GLES seems to work! Could you have a look and let me know what you think? A few comments:
|
1a65b93
to
3dc7eab
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.
LGTM
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.
a few nits, and a simple change.
Please squash when you commit, as there is some back-and-forth in this PR.
Thanks @pmuetschard for the review! Could you also let me know what you think on these points?
|
i don't think so.
Only Android for now is fine with me.
For now, unless we find a reason not to replay them, let's keep it as you have implemented it. |
EGL frame delimiters need to be replayed to enable frame limit detection, used in both: - tracing of a replay - profiling: some counters are (re-)set at frame boundaries The replay of EGL Swap Buffers is implemented using @Custom which calls a @Synthetic primitive. Only Android platform actually replay this call for now.
8f259f4
to
3ebf6c5
Compare
When export_replay creates a standalone APK to replay a trace, we want
to be able to trace the replay itself, and we want to detect frame
delimiters during this tracing. Hence the replay of EGL frame
delimiters.