Mir

Merge lp:~robertcarr/mir/alpha-for-nested-servers into lp:mir

Proposed by Robert Carr
Status: Rejected
Rejected by: Robert Carr
Proposed branch: lp:~robertcarr/mir/alpha-for-nested-servers
Merge into: lp:mir
Diff against target: 41 lines (+5/-5)
1 file modified
src/server/graphics/nested/nested_display.cpp (+5/-5)
To merge this branch: bzr merge lp:~robertcarr/mir/alpha-for-nested-servers
Reviewer Review Type Date Requested Status
Alan Griffiths Needs Fixing
Daniel van Vugt Needs Fixing
Alexandros Frantzis (community) Needs Information
PS Jenkins bot (community) continuous-integration Approve
Kevin DuBois (community) Needs Fixing
Michael Terry (community) Approve
Review via email: mp+193162@code.launchpad.net

Commit message

Enable alpha channel for nested server surfaces.

Description of the change

Enable alpha channel for nested server surfaces. This is required by the split-out greeter.

To post a comment you must log in.
Revision history for this message
Michael Terry (mterry) wrote :

Looks sensible to me, and I saw the positive results of your branch. But still, I feel like someone more familiar with Mir internals should do the actual blessing of this branch.

review: Approve
Revision history for this message
Kevin DuBois (kdub) wrote :

yes, overall, its sensible to me too.. no test though? :)

in deciding "find_transparent_surface_format", what about geom::PixelFormat::bgr_888?

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

1. You forgot mir_pixel_format_bgr_888. See also bug 1236254.
19 + if (*f != mir_pixel_format_xbgr_8888 &&
20 + *f != mir_pixel_format_xrgb_8888)

2. I assuming the nesting and/or alpha blending is disabled after login? Otherwise the performance overhead would be quite high.

review: Needs Fixing
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Re #2: I'm not talking about nesting latency concerns. Just the performance overhead of blending.

During regular composition we rely on most surfaces to not be alpha, so they are candidates for bypass and occlusion culling. We also optimize the GL renderer for non-blendable surfaces, because it makes a performance difference.

So while blending is cool and great to use during various effects, I just want to make sure we're not blending still after login. Because that would be bad.

Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

> Enable alpha channel for nested server surfaces. This is required by the split-out greeter.

What exactly does the greeter need to do?
Is per-surface opacity not enough for our use case?

review: Needs Information
Revision history for this message
Michael Terry (mterry) wrote :

> What exactly does the greeter need to do?
> Is per-surface opacity not enough for our use case?

The greeter wants to be able to show parts of the session behind it. (i.e. you swipe greeter away from the right, you see your session waiting for you) It's likely the greeter will be implemented as a mirserver. If it was just a mirclient, per-surface opacity would be enough. But each mirserver draws its back as black, so you can't stack mirservers with partial opacity.

Revision history for this message
Michael Terry (mterry) wrote :

> I assuming the nesting and/or alpha blending is disabled after login? Otherwise the performance overhead would be quite high.

The unity8 shell session will not take advantage of this background opacity. It will always just fill the screen with its dash. I assume if the background is filled with a surface, there isn't a performance overhead?

The greeter won't use any clever blending or blurring effects for the first go, just have some 0-opacity parts of the screen. Later on, we want to add some blurring, but that would of course go away after you log in.

Revision history for this message
Kevin DuBois (kdub) wrote :

Daniel makes a good point about the performance impact...

> The unity8 shell session will not take advantage of this background opacity.
> It will always just fill the screen with its dash. I assume if the background
> is filled with a surface, there isn't a performance overhead?

the final frame is the same, more work is done with alpha blending turned on

with blending off,
read src, write to dst

with blending on
read src, read dst, alpha blend operation, write to dst

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

I'm told the Unity8 shell is implemented using alpha right now. Partly because Mir didn't have surface resizing implemented (yet). So I guess as soon as we can, we should make sure Unity8 uses non-alpha pixel formats (where possible). XMir already does.

As for the whole nested display... I think we need to default to opaque surface formats for performance, not:
38 + egl_pixel_format{find_transparent_surface_format(*connection)},
Although obviously to suit greeter needs, that should be configurable as transparent. Which is fine if it only occurs while the greeter is visible.

I'm basing this on assumptions about how nesting actually works, so need some guidance as to whether my concerns are realistic at all... So if the greeter's on top of a session, is it composited with the existing compositing logic or something new?

review: Needs Information
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

P.S. If you only require a constant level of alpha transparency across the whole surface, then you can still use RGBX/XRGB etc. And then set the surface alpha property. It's only necessary to use an alpha pixel format if you intend to define shape and varying levels of transparency across the surface.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Needs information but also still needs fixing (mir_pixel_format_bgr_888).

review: Needs Fixing
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

I can imagine that we might sometimes want alpha on a nested "FB", but always seems wrong.

Can I paraphrase what I think is being said:

The host will have surfaces for nested sessions for example unity8 and greeter.

There's no value (and cost) to alpha for the unity8 surface.

The idea is that the greeter surface can overlay the unity8 surface using transparency. Is this alpha varied across the surface? (For shapes? Or gradations?)

If we need variable opacity across the surface then the greeter needs to be able to request a surface with alpha. If not, then perhaps there are alternative options.

review: Needs Information
Revision history for this message
Michael Terry (mterry) wrote :

> The idea is that the greeter surface can overlay the unity8 surface using transparency. Is this alpha varied across the surface? (For shapes? Or gradations?)

For now, no variation. Eventually, we'd like to add some sort of blurring effect, performance willing.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

> For now, no variation. Eventually, we'd like to add some sort of blurring
> effect, performance willing.

In that case it sounds like the proposal should be rejected. And instead we need to expose something::Surface::set_alpha() so the greeter can vary its transparency.

Revision history for this message
Michael Terry (mterry) wrote :

> In that case it sounds like the proposal should be rejected. And instead we need to expose something::Surface::set_alpha() so the greeter can vary its transparency.

Well, and color, eh? Why not just have the background always be full transparency, and the greeter can add a layer that is semi-transparent if it wants?

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Always transparent is unacceptable. See the performance discussion above.

Also, needs fixing; mir_pixel_format_bgr_888. But ignoring that, I think this is overall the wrong approach. We need to at least propose a solution that doesn't bind us to being stuck with only one code path which impacts performance too much.

If you just need a consistent level of transparency (and later, blur), then please reject this proposal and replace it with something that sets the surface alpha value instead.

If you need varying transparency then please rewrite this proposal so that it does not default to blending always-on.

review: Needs Fixing
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> Always transparent is unacceptable. See the performance discussion above.
>
> Also, needs fixing; mir_pixel_format_bgr_888. But ignoring that, I think this
> is overall the wrong approach. We need to at least propose a solution that
> doesn't bind us to being stuck with only one code path which impacts
> performance too much.
>
> If you just need a consistent level of transparency (and later, blur), then
> please reject this proposal and replace it with something that sets the
> surface alpha value instead.
>
> If you need varying transparency then please rewrite this proposal so that it
> does not default to blending always-on.

+1

review: Needs Fixing
Revision history for this message
Robert Carr (robertcarr) wrote :

I wonder if surface opacity is really enough for the greeter. How does the panel fit in. Michael?

Perhaps we should expose it is as a server configuration (build time) option so the greeter can use alpha but Unity will not have to.

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> Perhaps we should expose it is as a server configuration (build time) option
> so the greeter can use alpha but Unity will not have to.

Why not make it a run time configuration option?

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Can anyone point to an image or mockup from design to show what the intended greater appearance is?

Revision history for this message
Robert Carr (robertcarr) wrote :

Having trouble describing the option well

--nested-use-transparent-framebuffer
--nested-pixel-formats="argb888,abgr888"

etc...

Revision history for this message
Robert Carr (robertcarr) wrote :

Seems like this doesn't matter right now

Unmerged revisions

1177. By Robert Carr

Fix

1176. By Robert Carr

Yeah. Alpha and stuff

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/server/graphics/nested/nested_display.cpp'
--- src/server/graphics/nested/nested_display.cpp 2013-10-25 09:40:26 +0000
+++ src/server/graphics/nested/nested_display.cpp 2013-10-29 23:42:16 +0000
@@ -36,7 +36,7 @@
36namespace36namespace
37{37{
3838
39MirPixelFormat find_opaque_surface_format(MirConnection* connection)39MirPixelFormat find_transparent_surface_format(MirConnection* connection)
40{40{
41 static unsigned const max_formats = 32;41 static unsigned const max_formats = 32;
42 MirPixelFormat formats[max_formats];42 MirPixelFormat formats[max_formats];
@@ -48,8 +48,8 @@
48 // Find an opaque surface format48 // Find an opaque surface format
49 for (auto f = formats; f != formats+valid_formats; ++f)49 for (auto f = formats; f != formats+valid_formats; ++f)
50 {50 {
51 if (*f == mir_pixel_format_xbgr_8888 ||51 if (*f != mir_pixel_format_xbgr_8888 &&
52 *f == mir_pixel_format_xrgb_8888)52 *f != mir_pixel_format_xrgb_8888)
53 {53 {
54 return *f;54 return *f;
55 }55 }
@@ -66,7 +66,7 @@
66 EGL_RED_SIZE, 8,66 EGL_RED_SIZE, 8,
67 EGL_GREEN_SIZE, 8,67 EGL_GREEN_SIZE, 8,
68 EGL_BLUE_SIZE, 8,68 EGL_BLUE_SIZE, 8,
69 EGL_ALPHA_SIZE, 0,69 EGL_ALPHA_SIZE, 8,
70 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,70 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
71 EGL_NONE71 EGL_NONE
72};72};
@@ -153,7 +153,7 @@
153 event_handler{event_handler},153 event_handler{event_handler},
154 display_report{display_report},154 display_report{display_report},
155 egl_display{*connection},155 egl_display{*connection},
156 egl_pixel_format{find_opaque_surface_format(*connection)},156 egl_pixel_format{find_transparent_surface_format(*connection)},
157 outputs{}157 outputs{}
158{158{
159 egl_display.initialize();159 egl_display.initialize();

Subscribers

People subscribed via source and target branches