Mir
kms_page_flipper.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2013 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU Lesser General Public License version 3,
6  * as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
17  */
18 
19 #ifndef MIR_GRAPHICS_MESA_KMS_PAGE_FLIPPER_H_
20 #define MIR_GRAPHICS_MESA_KMS_PAGE_FLIPPER_H_
21 
22 #include "page_flipper.h"
23 
24 #include <unordered_map>
25 #include <chrono>
26 #include <mutex>
27 #include <condition_variable>
28 #include <thread>
29 
30 #include <sys/time.h>
31 
32 namespace mir
33 {
34 namespace graphics
35 {
36 
37 class DisplayReport;
38 
39 namespace mesa
40 {
41 
42 class KMSPageFlipper;
44 {
45  uint32_t crtc_id;
47 };
48 
50 {
51 public:
52  KMSPageFlipper(int drm_fd, std::shared_ptr<DisplayReport> const& report);
53 
54  bool schedule_flip(uint32_t crtc_id, uint32_t fb_id) override;
55  void wait_for_flip(uint32_t crtc_id) override;
56 
57  std::thread::id debug_get_worker_tid();
58 
59  void notify_page_flip(uint32_t crtc_id);
60 private:
61  bool page_flip_is_done(uint32_t crtc_id);
62 
63  int const drm_fd;
64  std::shared_ptr<DisplayReport> const report;
65  std::unordered_map<uint32_t,PageFlipEventData> pending_page_flips;
66  std::mutex pf_mutex;
67  std::condition_variable pf_cv;
68  std::thread::id worker_tid;
69 };
70 
71 }
72 }
73 }
74 
75 #endif /* MIR_GRAPHICS_MESA_KMS_PAGE_FLIPPER_H_ */
All things Mir.
Definition: atomic_callback.h:25
Definition: kms_page_flipper.h:49
Definition: page_flipper.h:31
KMSPageFlipper * flipper
Definition: kms_page_flipper.h:46
uint32_t crtc_id
Definition: kms_page_flipper.h:45
Definition: kms_page_flipper.h:43

Copyright © 2012-2015 Canonical Ltd.
Generated on Thu Sep 8 14:50:19 UTC 2016