Mir

Merge lp:~alan-griffiths/mir/partial-fix-for-1532202 into lp:mir

Proposed by Alan Griffiths
Status: Work in progress
Proposed branch: lp:~alan-griffiths/mir/partial-fix-for-1532202
Merge into: lp:mir
Diff against target: 23 lines (+4/-2)
1 file modified
src/platforms/android/server/hwc_fallback_gl_renderer.cpp (+4/-2)
To merge this branch: bzr merge lp:~alan-griffiths/mir/partial-fix-for-1532202
Reviewer Review Type Date Requested Status
Daniel van Vugt Needs Fixing
PS Jenkins bot (community) continuous-integration Needs Fixing
Kevin DuBois (community) Needs Fixing
Review via email: mp+282349@code.launchpad.net

Commit message

android: mga::HWCFallbackGLRenderer::render() - Don't use a gl program to do nothing

Description of the change

android: mga::HWCFallbackGLRenderer::render() - Don't use a gl program to do nothing

This isn't a complete solution to the linked bug - the hack mentioned in lp:1532202/comments/12 gets better performance than this. But it gives a noticeable improvement and I'm at EOD.

I'll look further tomorrow, and also try to figure if there's a way to automate testing.

To post a comment you must log in.
Revision history for this message
Kevin DuBois (kdub) wrote :

Clearing the contents appropriately will correct artifacts present in the buffer from previous renders, so we need some way to know whether a clear is needed or not.
So maybe something like:

if (renderlist.empty() && clear) return;
(where clear is a variable that gets set after the first clear, and unset when the renderables are drawn)
would work.

Still thinking what could be the root cause. If the swapping (ie, producing gpu traffic) is slowing us down, maybe its a bus traffic jam issue. (and if thats the case, maybe the n7 wouldn't have the problem)

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

Seems like a partial fix indeed. I'm hesitant to call it a hack because that's really the style of all graphics optimizations.

Although if you're skipping most of the rendering strain, and particularly skipping the call to context.swap_buffers() then you should put the return at the top of the function and so skip the clears too. Because those clears are now unused (their effects are never seen on screen).

Even better, avoid calling render() with an empty list. Because DefaultDisplayBufferCompositor::composite() should be calling renderer->suspend() instead.

review: Needs Fixing

Unmerged revisions

3238. By Alan Griffiths

Don't use a gl program to do nothing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/platforms/android/server/hwc_fallback_gl_renderer.cpp'
2--- src/platforms/android/server/hwc_fallback_gl_renderer.cpp 2015-10-06 02:30:52 +0000
3+++ src/platforms/android/server/hwc_fallback_gl_renderer.cpp 2016-01-12 17:57:14 +0000
4@@ -102,8 +102,6 @@
5 void mga::HWCFallbackGLRenderer::render(
6 RenderableList const& renderlist, geom::Displacement offset, SwappingGLContext const& context) const
7 {
8- glUseProgram(*program);
9-
10 /* NOTE: some HWC implementations rely on the framebuffer target layer
11 * being cleared to transparent black. eg, in mixed-mode composition,
12 * krillin actually arranges the fb_target in the topmost level of its
13@@ -113,6 +111,10 @@
14 glClearColor(0.0, 0.0, 0.0, 0.0);
15 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
16 glClear(GL_COLOR_BUFFER_BIT);
17+
18+ if (renderlist.empty()) return;
19+
20+ glUseProgram(*program);
21 glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
22 glEnableVertexAttribArray(position_attr);
23 glEnableVertexAttribArray(texcoord_attr);

Subscribers

People subscribed via source and target branches