| 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/drm/gbm_surface_factory.h" | 5 #include "ui/ozone/platform/drm/gbm_surface_factory.h" |
| 6 | 6 |
| 7 #include <gbm.h> | 7 #include <gbm.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 GbmSurfaceFactory::~GbmSurfaceFactory() { | 76 GbmSurfaceFactory::~GbmSurfaceFactory() { |
| 77 } | 77 } |
| 78 | 78 |
| 79 void GbmSurfaceFactory::InitializeGpu(DrmDeviceManager* drm_device_manager, | 79 void GbmSurfaceFactory::InitializeGpu(DrmDeviceManager* drm_device_manager, |
| 80 ScreenManager* screen_manager) { | 80 ScreenManager* screen_manager) { |
| 81 drm_device_manager_ = drm_device_manager; | 81 drm_device_manager_ = drm_device_manager; |
| 82 screen_manager_ = screen_manager; | 82 screen_manager_ = screen_manager; |
| 83 } | 83 } |
| 84 | 84 |
| 85 intptr_t GbmSurfaceFactory::GetNativeDisplay() { | 85 intptr_t GbmSurfaceFactory::GetNativeDisplay() { |
| 86 #if defined(USE_MESA_PLATFORM_NULL) | |
| 87 return EGL_DEFAULT_DISPLAY; | 86 return EGL_DEFAULT_DISPLAY; |
| 88 #else | |
| 89 scoped_refptr<GbmDevice> gbm = GetGbmDevice(gfx::kNullAcceleratedWidget); | |
| 90 DCHECK(gbm); | |
| 91 return reinterpret_cast<intptr_t>(gbm->device()); | |
| 92 #endif | |
| 93 } | 87 } |
| 94 | 88 |
| 95 const int32* GbmSurfaceFactory::GetEGLSurfaceProperties( | 89 const int32* GbmSurfaceFactory::GetEGLSurfaceProperties( |
| 96 const int32* desired_list) { | 90 const int32* desired_list) { |
| 97 static const int32 kConfigAttribs[] = {EGL_BUFFER_SIZE, | 91 static const int32 kConfigAttribs[] = {EGL_BUFFER_SIZE, |
| 98 32, | 92 32, |
| 99 EGL_ALPHA_SIZE, | 93 EGL_ALPHA_SIZE, |
| 100 8, | 94 8, |
| 101 EGL_BLUE_SIZE, | 95 EGL_BLUE_SIZE, |
| 102 8, | 96 8, |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 return false; | 211 return false; |
| 218 } | 212 } |
| 219 | 213 |
| 220 scoped_refptr<GbmDevice> GbmSurfaceFactory::GetGbmDevice( | 214 scoped_refptr<GbmDevice> GbmSurfaceFactory::GetGbmDevice( |
| 221 gfx::AcceleratedWidget widget) { | 215 gfx::AcceleratedWidget widget) { |
| 222 return static_cast<GbmDevice*>( | 216 return static_cast<GbmDevice*>( |
| 223 drm_device_manager_->GetDrmDevice(widget).get()); | 217 drm_device_manager_->GetDrmDevice(widget).get()); |
| 224 } | 218 } |
| 225 | 219 |
| 226 } // namespace ui | 220 } // namespace ui |
| OLD | NEW |