~kdub/mir/mali-client-render-support

« back to all changes in this revision

Viewing changes to src/server/compositor/switching_bundle.h

  • Committer: Kevin DuBois
  • Date: 2013-11-05 21:44:14 UTC
  • mfrom: (1062.1.137 dev)
  • Revision ID: kevin.dubois@canonical.com-20131105214414-d32r52joqrs8tsmo
merge dev branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
class SwitchingBundle : public BufferBundle 
39
39
{
40
40
public:
 
41
    enum {min_buffers = 1, max_buffers = 5};
 
42
 
41
43
    SwitchingBundle(int nbuffers,
42
44
                    const std::shared_ptr<graphics::GraphicBufferAllocator> &,
43
45
                    const graphics::BufferProperties &);
55
57
    void allow_framedropping(bool dropping_allowed);
56
58
    bool framedropping_allowed() const;
57
59
 
 
60
    /**
 
61
     * Change the dimensions of the buffers contained in the bundle. For
 
62
     * client_acquire, the change is guaranteed to be immediate. For
 
63
     * compositors and snapshotters however, the change may be delayed by
 
64
     * nbuffers frames while old frames of the old size are consumed.
 
65
     */
 
66
    void resize(const geometry::Size &newsize) override;
 
67
 
58
68
private:
59
69
    graphics::BufferProperties bundle_properties;
60
70
    std::shared_ptr<graphics::GraphicBufferAllocator> gralloc;
68
78
 
69
79
    const std::shared_ptr<graphics::Buffer> &alloc_buffer(int slot);
70
80
 
71
 
    enum {MAX_NBUFFERS = 5};
72
81
    struct SharedBuffer
73
82
    {
74
83
        std::shared_ptr<graphics::Buffer> buf;
75
84
        int users = 0; // presently just a count of compositors sharing the buf
76
85
    };
77
 
    SharedBuffer ring[MAX_NBUFFERS];
 
86
    SharedBuffer ring[max_buffers];
78
87
 
79
88
    const int nbuffers;
80
89
    int first_compositor;
86
95
    int snapshot;
87
96
    int nsnapshotters;
88
97
 
89
 
    std::mutex guard;
 
98
    mutable std::mutex guard;
90
99
    std::condition_variable cond;
91
100
 
92
101
    unsigned long last_consumed;