Merge lp://qastaging/~kaihengfeng/unity/lp1292830 into lp://qastaging/unity

Proposed by Kai-Heng Feng
Status: Rejected
Rejected by: Marco Trevisan (Treviño)
Proposed branch: lp://qastaging/~kaihengfeng/unity/lp1292830
Merge into: lp://qastaging/unity
Diff against target: 200 lines (+57/-7)
8 files modified
decorations/DecoratedWindow.cpp (+25/-2)
decorations/DecorationsDataPool.h (+2/-2)
decorations/DecorationsManager.cpp (+18/-0)
decorations/DecorationsManager.h (+2/-0)
decorations/DecorationsPriv.h (+4/-0)
decorations/DecorationsTitle.h (+2/-1)
decorations/DecorationsWindowButton.h (+2/-2)
plugins/unityshell/src/unityshell.cpp (+2/-0)
To merge this branch: bzr merge lp://qastaging/~kaihengfeng/unity/lp1292830
Reviewer Review Type Date Requested Status
Andrea Azzarone (community) Needs Fixing
Review via email: mp+319387@code.qastaging.launchpad.net
To post a comment you must log in.
Revision history for this message
Andrea Azzarone (azzar1) wrote :

The fix looks good to be but I would prefer to not use friends class and just expose a public method, e.g. just make WindowButton::UpdateTexture public.

review: Needs Fixing
4227. By Kai-Heng Feng

Updates textures after resume from suspend. (LP: #1292830)

The Nvidia driver does not make resources in video memory persistent across S3
[1], hence applications need to update texture in vram itself.

Currently, these three decoration components require texture update:
1. Shadow.
2. Title.
3. Button.

Fortunately, Nvidia intends to fix it in the future [1]. Once the issue is
addressed, this commit can be fully reverted.

Revision history for this message
Kai-Heng Feng (kaihengfeng) wrote :

Force pushed a new version to address the issue.

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

I'm, I see the approach here, but I'm not much a fan of some things...

You told me that instead of recalling set-texture on any element, just damaging its area isn't enough? What's the problem here?
Is this due to the fact that since the texture is saved as xrandr format, then the driver just deletes that on S3?

In any case I'd prefer that this thing would be done at DecorationsWidgets level so that it can be esily applied to all elements, and not just per item.

Let me know what's feasible, and I'll try to figure out the best approach, avoiding to be too much specific.

Revision history for this message
Kai-Heng Feng (kaihengfeng) wrote :

> I'm, I see the approach here, but I'm not much a fan of some things...
>
> You told me that instead of recalling set-texture on any element, just
> damaging its area isn't enough? What's the problem here?

https://www.khronos.org/registry/OpenGL/extensions/NV/NV_robustness_video_memory_purge.txt

Looks like the link in the commit log was mistakenly deleted when I did force push, here's the excerpt:

    The NVIDIA OpenGL driver architecture on Linux has a limitation:
    resources located in video memory are not persistent across certain
    events. VT switches, suspend/resume events, and mode switching
    events may erase the contents of video memory. Any resource that
    is located exclusively in video memory, such as framebuffer objects
    (FBOs), will be lost. As the OpenGL specification makes no mention
    of events where the video memory is allowed to be cleared, the
    driver attempts to hide this fact from the application, but cannot
    do it for all resources.

> Is this due to the fact that since the texture is saved as xrandr format, then
> the driver just deletes that on S3?

This I can't answer, but I think the excerpt above should've explained it.

> In any case I'd prefer that this thing would be done at DecorationsWidgets
> level so that it can be esily applied to all elements, and not just per item.
>
> Let me know what's feasible, and I'll try to figure out the best approach,
> avoiding to be too much specific.

The link gives a super simple example:

    create_gl_context();
    create_resources();
    while (1) {
        update_world();
        if (GetGraphicsResetStatusARB() == PURGED_CONTEXT_RESET_NV) {
            delete_resources();
            create_resources();
        }
        render_frame();
    }

I am not sure if it's feasible in current architecture though - maybe logind signal is the only way to go?

Revision history for this message
Andrea Azzarone (azzar1) wrote :

> > I'm, I see the approach here, but I'm not much a fan of some things...
> >
> > You told me that instead of recalling set-texture on any element, just
> > damaging its area isn't enough? What's the problem here?
>
> https://www.khronos.org/registry/OpenGL/extensions/NV/NV_robustness_video_memo
> ry_purge.txt
>
> Looks like the link in the commit log was mistakenly deleted when I did force
> push, here's the excerpt:
>
> The NVIDIA OpenGL driver architecture on Linux has a limitation:
> resources located in video memory are not persistent across certain
> events. VT switches, suspend/resume events, and mode switching
> events may erase the contents of video memory. Any resource that
> is located exclusively in video memory, such as framebuffer objects
> (FBOs), will be lost. As the OpenGL specification makes no mention
> of events where the video memory is allowed to be cleared, the
> driver attempts to hide this fact from the application, but cannot
> do it for all resources.
>
> > Is this due to the fact that since the texture is saved as xrandr format,
> then
> > the driver just deletes that on S3?
>
> This I can't answer, but I think the excerpt above should've explained it.
>
> > In any case I'd prefer that this thing would be done at DecorationsWidgets
> > level so that it can be esily applied to all elements, and not just per
> item.
> >
> > Let me know what's feasible, and I'll try to figure out the best approach,
> > avoiding to be too much specific.
>
> The link gives a super simple example:
>
> create_gl_context();
> create_resources();
> while (1) {
> update_world();
> if (GetGraphicsResetStatusARB() == PURGED_CONTEXT_RESET_NV) {
> delete_resources();
> create_resources();
> }
> render_frame();
> }
>
> I am not sure if it's feasible in current architecture though - maybe logind
> signal is the only way to go?

I would not rely on an extension that might not be available. Btw I guess Marco he's suggesting to apply the fix inside TexturedWindow, so removiong the logic from the *Manager class. You just need a way to get the "onResume" signal there.

Revision history for this message
Kai-Heng Feng (kaihengfeng) wrote :

Nvidia put the fixes back to 375 series [1], so we no longer need this merge proposal:

"Fixed a regression that caused corruption in certain applications, such as window border shadows in Unity, after resuming from suspend."

[1] https://devtalk.nvidia.com/default/topic/1007268/b/t/post/5141478

Unmerged revisions

4227. By Kai-Heng Feng

Updates textures after resume from suspend. (LP: #1292830)

The Nvidia driver does not make resources in video memory persistent across S3
[1], hence applications need to update texture in vram itself.

Currently, these three decoration components require texture update:
1. Shadow.
2. Title.
3. Button.

Fortunately, Nvidia intends to fix it in the future [1]. Once the issue is
addressed, this commit can be fully reverted.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.