| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_OZONE_PLATFORM_DRI_TEST_MOCK_DRI_WRAPPER_H_ | 5 #ifndef UI_OZONE_PLATFORM_DRI_TEST_MOCK_DRI_WRAPPER_H_ |
| 6 #define UI_OZONE_PLATFORM_DRI_TEST_MOCK_DRI_WRAPPER_H_ | 6 #define UI_OZONE_PLATFORM_DRI_TEST_MOCK_DRI_WRAPPER_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 int get_set_crtc_call_count() const { return set_crtc_call_count_; } | 27 int get_set_crtc_call_count() const { return set_crtc_call_count_; } |
| 28 int get_restore_crtc_call_count() const { return restore_crtc_call_count_; } | 28 int get_restore_crtc_call_count() const { return restore_crtc_call_count_; } |
| 29 int get_add_framebuffer_call_count() const { | 29 int get_add_framebuffer_call_count() const { |
| 30 return add_framebuffer_call_count_; | 30 return add_framebuffer_call_count_; |
| 31 } | 31 } |
| 32 int get_remove_framebuffer_call_count() const { | 32 int get_remove_framebuffer_call_count() const { |
| 33 return remove_framebuffer_call_count_; | 33 return remove_framebuffer_call_count_; |
| 34 } | 34 } |
| 35 int get_page_flip_call_count() const { return page_flip_call_count_; } | 35 int get_page_flip_call_count() const { return page_flip_call_count_; } |
| 36 int get_overlay_flip_call_count() const { return overlay_flip_call_count_; } | 36 int get_overlay_flip_call_count() const { return overlay_flip_call_count_; } |
| 37 int get_handle_events_count() const { return handle_events_count_; } | |
| 38 void fail_init() { fd_ = -1; } | 37 void fail_init() { fd_ = -1; } |
| 39 void set_set_crtc_expectation(bool state) { set_crtc_expectation_ = state; } | 38 void set_set_crtc_expectation(bool state) { set_crtc_expectation_ = state; } |
| 40 void set_page_flip_expectation(bool state) { page_flip_expectation_ = state; } | 39 void set_page_flip_expectation(bool state) { page_flip_expectation_ = state; } |
| 41 void set_add_framebuffer_expectation(bool state) { | 40 void set_add_framebuffer_expectation(bool state) { |
| 42 add_framebuffer_expectation_ = state; | 41 add_framebuffer_expectation_ = state; |
| 43 } | 42 } |
| 44 void set_create_dumb_buffer_expectation(bool state) { | 43 void set_create_dumb_buffer_expectation(bool state) { |
| 45 create_dumb_buffer_expectation_ = state; | 44 create_dumb_buffer_expectation_ = state; |
| 46 } | 45 } |
| 47 | 46 |
| 48 uint32_t current_framebuffer() const { return current_framebuffer_; } | 47 uint32_t current_framebuffer() const { return current_framebuffer_; } |
| 49 | 48 |
| 50 const std::vector<skia::RefPtr<SkSurface> > buffers() const { | 49 const std::vector<skia::RefPtr<SkSurface> > buffers() const { |
| 51 return buffers_; | 50 return buffers_; |
| 52 } | 51 } |
| 53 | 52 |
| 54 // Overwrite the list of controllers used when serving the PageFlip requests. | |
| 55 void set_controllers(const std::queue<CrtcController*>& controllers) { | |
| 56 controllers_ = controllers; | |
| 57 } | |
| 58 | |
| 59 // DriWrapper: | 53 // DriWrapper: |
| 60 ScopedDrmCrtcPtr GetCrtc(uint32_t crtc_id) override; | 54 ScopedDrmCrtcPtr GetCrtc(uint32_t crtc_id) override; |
| 61 bool SetCrtc(uint32_t crtc_id, | 55 bool SetCrtc(uint32_t crtc_id, |
| 62 uint32_t framebuffer, | 56 uint32_t framebuffer, |
| 63 std::vector<uint32_t> connectors, | 57 std::vector<uint32_t> connectors, |
| 64 drmModeModeInfo* mode) override; | 58 drmModeModeInfo* mode) override; |
| 65 bool SetCrtc(drmModeCrtc* crtc, std::vector<uint32_t> connectors) override; | 59 bool SetCrtc(drmModeCrtc* crtc, std::vector<uint32_t> connectors) override; |
| 66 bool DisableCrtc(uint32_t crtc_id) override; | 60 bool DisableCrtc(uint32_t crtc_id) override; |
| 67 ScopedDrmConnectorPtr GetConnector(uint32_t connector_id) override; | 61 ScopedDrmConnectorPtr GetConnector(uint32_t connector_id) override; |
| 68 bool AddFramebuffer(uint32_t width, | 62 bool AddFramebuffer(uint32_t width, |
| 69 uint32_t height, | 63 uint32_t height, |
| 70 uint8_t depth, | 64 uint8_t depth, |
| 71 uint8_t bpp, | 65 uint8_t bpp, |
| 72 uint32_t stride, | 66 uint32_t stride, |
| 73 uint32_t handle, | 67 uint32_t handle, |
| 74 uint32_t* framebuffer) override; | 68 uint32_t* framebuffer) override; |
| 75 bool RemoveFramebuffer(uint32_t framebuffer) override; | 69 bool RemoveFramebuffer(uint32_t framebuffer) override; |
| 76 ScopedDrmFramebufferPtr GetFramebuffer(uint32_t framebuffer) override; | 70 ScopedDrmFramebufferPtr GetFramebuffer(uint32_t framebuffer) override; |
| 77 bool PageFlip(uint32_t crtc_id, uint32_t framebuffer, void* data) override; | 71 bool PageFlip(uint32_t crtc_id, |
| 72 uint32_t framebuffer, |
| 73 const PageFlipCallback& callback) override; |
| 78 bool PageFlipOverlay(uint32_t crtc_id, | 74 bool PageFlipOverlay(uint32_t crtc_id, |
| 79 uint32_t framebuffer, | 75 uint32_t framebuffer, |
| 80 const gfx::Rect& location, | 76 const gfx::Rect& location, |
| 81 const gfx::Rect& source, | 77 const gfx::Rect& source, |
| 82 int overlay_plane) override; | 78 int overlay_plane) override; |
| 83 ScopedDrmPropertyPtr GetProperty(drmModeConnector* connector, | 79 ScopedDrmPropertyPtr GetProperty(drmModeConnector* connector, |
| 84 const char* name) override; | 80 const char* name) override; |
| 85 bool SetProperty(uint32_t connector_id, | 81 bool SetProperty(uint32_t connector_id, |
| 86 uint32_t property_id, | 82 uint32_t property_id, |
| 87 uint64_t value) override; | 83 uint64_t value) override; |
| 88 bool GetCapability(uint64_t capability, uint64_t* value) override; | 84 bool GetCapability(uint64_t capability, uint64_t* value) override; |
| 89 ScopedDrmPropertyBlobPtr GetPropertyBlob(drmModeConnector* connector, | 85 ScopedDrmPropertyBlobPtr GetPropertyBlob(drmModeConnector* connector, |
| 90 const char* name) override; | 86 const char* name) override; |
| 91 bool SetCursor(uint32_t crtc_id, | 87 bool SetCursor(uint32_t crtc_id, |
| 92 uint32_t handle, | 88 uint32_t handle, |
| 93 const gfx::Size& size) override; | 89 const gfx::Size& size) override; |
| 94 bool MoveCursor(uint32_t crtc_id, const gfx::Point& point) override; | 90 bool MoveCursor(uint32_t crtc_id, const gfx::Point& point) override; |
| 95 void HandleEvent(drmEventContext& event) override; | |
| 96 bool CreateDumbBuffer(const SkImageInfo& info, | 91 bool CreateDumbBuffer(const SkImageInfo& info, |
| 97 uint32_t* handle, | 92 uint32_t* handle, |
| 98 uint32_t* stride, | 93 uint32_t* stride, |
| 99 void** pixels) override; | 94 void** pixels) override; |
| 100 void DestroyDumbBuffer(const SkImageInfo& info, | 95 void DestroyDumbBuffer(const SkImageInfo& info, |
| 101 uint32_t handle, | 96 uint32_t handle, |
| 102 uint32_t stride, | 97 uint32_t stride, |
| 103 void* pixels) override; | 98 void* pixels) override; |
| 104 | 99 |
| 105 private: | 100 private: |
| 106 int get_crtc_call_count_; | 101 int get_crtc_call_count_; |
| 107 int set_crtc_call_count_; | 102 int set_crtc_call_count_; |
| 108 int restore_crtc_call_count_; | 103 int restore_crtc_call_count_; |
| 109 int add_framebuffer_call_count_; | 104 int add_framebuffer_call_count_; |
| 110 int remove_framebuffer_call_count_; | 105 int remove_framebuffer_call_count_; |
| 111 int page_flip_call_count_; | 106 int page_flip_call_count_; |
| 112 int overlay_flip_call_count_; | 107 int overlay_flip_call_count_; |
| 113 int handle_events_count_; | |
| 114 | 108 |
| 115 bool set_crtc_expectation_; | 109 bool set_crtc_expectation_; |
| 116 bool add_framebuffer_expectation_; | 110 bool add_framebuffer_expectation_; |
| 117 bool page_flip_expectation_; | 111 bool page_flip_expectation_; |
| 118 bool create_dumb_buffer_expectation_; | 112 bool create_dumb_buffer_expectation_; |
| 119 | 113 |
| 120 uint32_t current_framebuffer_; | 114 uint32_t current_framebuffer_; |
| 121 | 115 |
| 122 std::vector<skia::RefPtr<SkSurface> > buffers_; | 116 std::vector<skia::RefPtr<SkSurface> > buffers_; |
| 123 | 117 |
| 124 std::queue<CrtcController*> controllers_; | |
| 125 | |
| 126 DISALLOW_COPY_AND_ASSIGN(MockDriWrapper); | 118 DISALLOW_COPY_AND_ASSIGN(MockDriWrapper); |
| 127 }; | 119 }; |
| 128 | 120 |
| 129 } // namespace ui | 121 } // namespace ui |
| 130 | 122 |
| 131 #endif // UI_OZONE_PLATFORM_DRI_TEST_MOCK_DRI_WRAPPER_H_ | 123 #endif // UI_OZONE_PLATFORM_DRI_TEST_MOCK_DRI_WRAPPER_H_ |
| OLD | NEW |