~albaguirre/mir/backport-fixes-to-0.11

« back to all changes in this revision

Viewing changes to src/platforms/android/server/display_buffer.cpp

  • Committer: Tarmac
  • Author(s): Kevin DuBois
  • Date: 2015-01-29 16:35:31 UTC
  • mfrom: (2215.3.26 pull-list-from-device)
  • Revision ID: tarmac-20150129163531-oklyqevk921mxuq3
android: pull the mga::LayerList instance from the mga::HwcDevice to the mga::DisplayBuffer.

Approved by Alan Griffiths, Alexandros Frantzis, PS Jenkins bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#include "framebuffer_bundle.h"
20
20
#include "display_buffer.h"
21
21
#include "display_device.h"
 
22
#include "hwc_layerlist.h"
22
23
 
23
24
#include <functional>
24
25
#include <boost/throw_exception.hpp>
31
32
namespace geom=mir::geometry;
32
33
 
33
34
mga::DisplayBuffer::DisplayBuffer(
 
35
    std::unique_ptr<LayerList> layer_list,
34
36
    std::shared_ptr<FramebufferBundle> const& fb_bundle,
35
37
    std::shared_ptr<DisplayDevice> const& display_device,
36
38
    std::shared_ptr<ANativeWindow> const& native_window,
38
40
    mg::GLProgramFactory const& program_factory,
39
41
    MirOrientation orientation,
40
42
    mga::OverlayOptimization overlay_option)
41
 
    : fb_bundle{fb_bundle},
 
43
    : layer_list(std::move(layer_list)),
 
44
      fb_bundle{fb_bundle},
42
45
      display_device{display_device},
43
46
      native_window{native_window},
44
47
      gl_context{shared_gl_context, fb_bundle, native_window},
72
75
 
73
76
bool mga::DisplayBuffer::post_renderables_if_optimizable(RenderableList const& renderlist)
74
77
{
75
 
    if (!overlay_enabled)
76
 
        return false;
77
 
 
78
 
    return display_device->post_overlays(gl_context, renderlist, overlay_program);
 
78
    if (!overlay_enabled || !display_device->compatible_renderlist(renderlist))
 
79
        return false;
 
80
 
 
81
    layer_list->update_list(renderlist);
 
82
 
 
83
    bool needs_commit{false};
 
84
    for (auto& layer : *layer_list)
 
85
        needs_commit |= layer.needs_commit;
 
86
    if (!needs_commit)
 
87
        return false;
 
88
 
 
89
    display_device->commit(mga::DisplayName::primary, *layer_list, gl_context, overlay_program);
 
90
    return true;
79
91
}
80
92
 
81
93
void mga::DisplayBuffer::gl_swap_buffers()
82
94
{
83
 
    display_device->post_gl(gl_context);
 
95
    layer_list->update_list({});
 
96
    display_device->commit(mga::DisplayName::primary, *layer_list, gl_context, overlay_program);
84
97
}
85
98
 
86
99
void mga::DisplayBuffer::flip()