Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 
43 {
44  std::unordered_map<uint32_t,PageFlipEventData>* pending;
45  uint32_t crtc_id;
46 };
47 
49 {
50 public:
51  KMSPageFlipper(int drm_fd);
52 
53  bool schedule_flip(uint32_t crtc_id, uint32_t fb_id);
54  void wait_for_flip(uint32_t crtc_id);
55 
56  std::thread::id debug_get_worker_tid();
57 
58 private:
59  bool page_flip_is_done(uint32_t crtc_id);
60 
61  int const drm_fd;
62  std::unordered_map<uint32_t,PageFlipEventData> pending_page_flips;
63  std::mutex pf_mutex;
64  std::condition_variable pf_cv;
65  std::thread::id worker_tid;
66 };
67 
68 }
69 }
70 }
71 
72 #endif /* MIR_GRAPHICS_MESA_KMS_PAGE_FLIPPER_H_ */
All things Mir.
Definition: aging_buffer.h:24
Definition: kms_page_flipper.h:48
Definition: page_flipper.h:31
uint32_t crtc_id
Definition: kms_page_flipper.h:45
KMSPageFlipper(int drm_fd)
Definition: kms_page_flipper.cpp:45
Definition: kms_page_flipper.h:42
bool schedule_flip(uint32_t crtc_id, uint32_t fb_id)
Definition: kms_page_flipper.cpp:52
void wait_for_flip(uint32_t crtc_id)
Definition: kms_page_flipper.cpp:71
std::unordered_map< uint32_t, PageFlipEventData > * pending
Definition: kms_page_flipper.h:44
std::thread::id debug_get_worker_tid()
Definition: kms_page_flipper.cpp:145

Copyright © 2012,2013 Canonical Ltd.
Generated on Fri Oct 10 14:07:14 UTC 2014