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/gpu/gbm_surface_factory.h" | 5 #include "ui/ozone/platform/drm/gpu/gbm_surface_factory.h" |
6 | 6 |
7 #include <gbm.h> | 7 #include <gbm.h> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "third_party/khronos/EGL/egl.h" | 10 #include "third_party/khronos/EGL/egl.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 } | 32 } |
33 | 33 |
34 void GbmSurfaceFactory::InitializeGpu(DrmDeviceManager* drm_device_manager, | 34 void GbmSurfaceFactory::InitializeGpu(DrmDeviceManager* drm_device_manager, |
35 ScreenManager* screen_manager) { | 35 ScreenManager* screen_manager) { |
36 drm_device_manager_ = drm_device_manager; | 36 drm_device_manager_ = drm_device_manager; |
37 screen_manager_ = screen_manager; | 37 screen_manager_ = screen_manager; |
38 } | 38 } |
39 | 39 |
40 intptr_t GbmSurfaceFactory::GetNativeDisplay() { | 40 intptr_t GbmSurfaceFactory::GetNativeDisplay() { |
41 DCHECK(thread_checker_.CalledOnValidThread()); | 41 DCHECK(thread_checker_.CalledOnValidThread()); |
42 auto primary_device = drm_device_manager_->GetDrmDevice( | 42 // If using gbm surfaces, must return here the gbm device that corresponds |
43 gfx::kNullAcceleratedWidget); | 43 // to the primary drm device. |
44 DCHECK(primary_device.get()); | 44 // Using surfaceless is convenient because we don't need to ensure the primary |
45 auto gbm_device = static_cast<GbmDevice*>(primary_device.get()); | 45 // drm device has been added by the host at the time this is called. |
46 return reinterpret_cast<EGLNativeDisplayType>(gbm_device->device()); | 46 return EGL_DEFAULT_DISPLAY; |
47 } | 47 } |
48 | 48 |
49 const int32* GbmSurfaceFactory::GetEGLSurfaceProperties( | 49 const int32* GbmSurfaceFactory::GetEGLSurfaceProperties( |
50 const int32* desired_list) { | 50 const int32* desired_list) { |
51 DCHECK(thread_checker_.CalledOnValidThread()); | 51 DCHECK(thread_checker_.CalledOnValidThread()); |
52 static const int32 kConfigAttribs[] = {EGL_BUFFER_SIZE, | 52 static const int32 kConfigAttribs[] = {EGL_BUFFER_SIZE, |
53 32, | 53 32, |
54 EGL_ALPHA_SIZE, | 54 EGL_ALPHA_SIZE, |
55 8, | 55 8, |
56 EGL_BLUE_SIZE, | 56 EGL_BLUE_SIZE, |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 return false; | 149 return false; |
150 } | 150 } |
151 | 151 |
152 scoped_refptr<GbmDevice> GbmSurfaceFactory::GetGbmDevice( | 152 scoped_refptr<GbmDevice> GbmSurfaceFactory::GetGbmDevice( |
153 gfx::AcceleratedWidget widget) { | 153 gfx::AcceleratedWidget widget) { |
154 return static_cast<GbmDevice*>( | 154 return static_cast<GbmDevice*>( |
155 drm_device_manager_->GetDrmDevice(widget).get()); | 155 drm_device_manager_->GetDrmDevice(widget).get()); |
156 } | 156 } |
157 | 157 |
158 } // namespace ui | 158 } // namespace ui |
OLD | NEW |