~alan-griffiths/mir/workaround-lp1602199

« back to all changes in this revision

Viewing changes to src/server/compositor/buffer_stream_factory.cpp

  • Committer: Tarmac
  • Author(s): Kevin DuBois
  • Date: 2016-05-03 09:49:54 UTC
  • mfrom: (3369.2.31 server-side-alloc)
  • Revision ID: tarmac-20160503094954-6l9jtr20mydxs3l7
server: Change point of frontend-facing buffer allocation from the mf::BufferStream to the msc::Session to prepare for NBS connection-allocated buffers.

We were previously allocating from the streams, but to accommodate mir_connection_allocate_buffer(), we will have to allocate via msc::Session.

This exposes mf::ClientBuffers(), as the streams need to reflect that buffers came from the same Session/connection. (cross-connection/cross-process mirclient-allocated-buffers are not supported). render_surfaces has an example of a 'floating' shell buffer stream that didn't originate from IPC.

Approved by mir-ci-bot, Cemil Azizoglu, Chris Halse Rogers.

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
 
54
54
 
55
55
std::shared_ptr<mc::BufferStream> mc::BufferStreamFactory::create_buffer_stream(
56
 
    mf::BufferStreamId id, std::shared_ptr<mf::BufferSink> const& sink,
 
56
    mf::BufferStreamId id, std::shared_ptr<mf::ClientBuffers> const& buffers,
57
57
    mg::BufferProperties const& buffer_properties)
58
58
{
59
 
    return create_buffer_stream(id, sink, nbuffers, buffer_properties);
 
59
    return create_buffer_stream(id, buffers, nbuffers, buffer_properties);
60
60
}
61
61
 
62
62
std::shared_ptr<mc::BufferStream> mc::BufferStreamFactory::create_buffer_stream(
63
 
    mf::BufferStreamId id, std::shared_ptr<mf::BufferSink> const& sink,
 
63
    mf::BufferStreamId, std::shared_ptr<mf::ClientBuffers> const& buffers,
64
64
    int nbuffers, mg::BufferProperties const& buffer_properties)
65
65
{
66
66
    if (nbuffers == 0)
67
67
    {
68
68
        return std::make_shared<mc::Stream>(
69
69
            *policy_factory,
70
 
            std::make_unique<mc::BufferMap>(id, sink, gralloc),
 
70
            buffers,
71
71
            buffer_properties.size, buffer_properties.format);
72
72
    }
73
73
    else
77
77
        return std::make_shared<mc::BufferStreamSurfaces>(switching_bundle);
78
78
    }
79
79
}
 
80
 
 
81
std::shared_ptr<mf::ClientBuffers> mc::BufferStreamFactory::create_buffer_map(
 
82
        std::shared_ptr<mf::BufferSink> const& sink)
 
83
{
 
84
    return std::make_shared<mc::BufferMap>(sink, gralloc);
 
85
}