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 #include "ui/ozone/platform/dri/gbm_surface_factory.h" | 5 #include "ui/ozone/platform/dri/gbm_surface_factory.h" |
6 | 6 |
7 #include <EGL/egl.h> | 7 #include <EGL/egl.h> |
8 #include <gbm.h> | 8 #include <gbm.h> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 68 |
69 return false; | 69 return false; |
70 } | 70 } |
71 | 71 |
72 scoped_ptr<gfx::VSyncProvider> GbmSurfaceAdapter::CreateVSyncProvider() { | 72 scoped_ptr<gfx::VSyncProvider> GbmSurfaceAdapter::CreateVSyncProvider() { |
73 return scoped_ptr<gfx::VSyncProvider>(new DriVSyncProvider(controller_)); | 73 return scoped_ptr<gfx::VSyncProvider>(new DriVSyncProvider(controller_)); |
74 } | 74 } |
75 | 75 |
76 } // namespace | 76 } // namespace |
77 | 77 |
78 GbmSurfaceFactory::GbmSurfaceFactory(DriWrapper* dri, | 78 GbmSurfaceFactory::GbmSurfaceFactory() |
79 gbm_device* device, | 79 : DriSurfaceFactory(NULL, NULL), |
80 ScreenManager* screen_manager) | 80 device_(NULL) {} |
81 : DriSurfaceFactory(dri, screen_manager), | |
82 device_(device) {} | |
83 | 81 |
84 GbmSurfaceFactory::~GbmSurfaceFactory() {} | 82 GbmSurfaceFactory::~GbmSurfaceFactory() {} |
85 | 83 |
| 84 void GbmSurfaceFactory::InitializeGpu( |
| 85 DriWrapper* dri, gbm_device* device, ScreenManager* screen_manager) { |
| 86 drm_ = dri; |
| 87 device_ = device; |
| 88 screen_manager_ = screen_manager; |
| 89 } |
| 90 |
86 intptr_t GbmSurfaceFactory::GetNativeDisplay() { | 91 intptr_t GbmSurfaceFactory::GetNativeDisplay() { |
87 CHECK(state_ == INITIALIZED); | 92 CHECK(state_ == INITIALIZED); |
88 return reinterpret_cast<intptr_t>(device_); | 93 return reinterpret_cast<intptr_t>(device_); |
89 } | 94 } |
90 | 95 |
91 const int32* GbmSurfaceFactory::GetEGLSurfaceProperties( | 96 const int32* GbmSurfaceFactory::GetEGLSurfaceProperties( |
92 const int32* desired_list) { | 97 const int32* desired_list) { |
93 static const int32 kConfigAttribs[] = { | 98 static const int32 kConfigAttribs[] = { |
94 EGL_BUFFER_SIZE, 32, | 99 EGL_BUFFER_SIZE, 32, |
95 EGL_ALPHA_SIZE, 8, | 100 EGL_ALPHA_SIZE, 8, |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 if (!buffer_object) | 183 if (!buffer_object) |
179 return 0; | 184 return 0; |
180 | 185 |
181 BufferData* data = BufferData::CreateData(drm_, buffer_object); | 186 BufferData* data = BufferData::CreateData(drm_, buffer_object); |
182 DCHECK(data) << "Failed to associate the buffer with the controller"; | 187 DCHECK(data) << "Failed to associate the buffer with the controller"; |
183 | 188 |
184 return reinterpret_cast<ui::NativeBufferOzone>(buffer_object); | 189 return reinterpret_cast<ui::NativeBufferOzone>(buffer_object); |
185 } | 190 } |
186 | 191 |
187 } // namespace ui | 192 } // namespace ui |
OLD | NEW |