| 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 <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 scoped_refptr<gl::GLSurface> CreateOffscreenGLSurface( | 57 scoped_refptr<gl::GLSurface> CreateOffscreenGLSurface( |
| 58 const gfx::Size& size) override { | 58 const gfx::Size& size) override { |
| 59 DCHECK_EQ(size.width(), 0); | 59 DCHECK_EQ(size.width(), 0); |
| 60 DCHECK_EQ(size.height(), 0); | 60 DCHECK_EQ(size.height(), 0); |
| 61 return gl::InitializeGLSurface(new gl::SurfacelessEGL(size)); | 61 return gl::InitializeGLSurface(new gl::SurfacelessEGL(size)); |
| 62 } | 62 } |
| 63 | 63 |
| 64 protected: | 64 protected: |
| 65 intptr_t GetNativeDisplay() override { return EGL_DEFAULT_DISPLAY; } | 65 intptr_t GetNativeDisplay() override { return EGL_DEFAULT_DISPLAY; } |
| 66 | 66 |
| 67 bool LoadGLES2Bindings() override { return LoadDefaultEGLGLES2Bindings(); } | 67 bool LoadGLES2Bindings(gl::GLImplementation impl) override { |
| 68 return LoadDefaultEGLGLES2Bindings(impl); |
| 69 } |
| 68 | 70 |
| 69 private: | 71 private: |
| 70 GbmSurfaceFactory* surface_factory_; | 72 GbmSurfaceFactory* surface_factory_; |
| 71 DrmThreadProxy* drm_thread_proxy_; | 73 DrmThreadProxy* drm_thread_proxy_; |
| 72 | 74 |
| 73 DISALLOW_COPY_AND_ASSIGN(GLOzoneEGLGbm); | 75 DISALLOW_COPY_AND_ASSIGN(GLOzoneEGLGbm); |
| 74 }; | 76 }; |
| 75 | 77 |
| 76 } // namespace | 78 } // namespace |
| 77 | 79 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 101 DCHECK(thread_checker_.CalledOnValidThread()); | 103 DCHECK(thread_checker_.CalledOnValidThread()); |
| 102 auto it = widget_to_surface_map_.find(widget); | 104 auto it = widget_to_surface_map_.find(widget); |
| 103 DCHECK(it != widget_to_surface_map_.end()); | 105 DCHECK(it != widget_to_surface_map_.end()); |
| 104 return it->second; | 106 return it->second; |
| 105 } | 107 } |
| 106 | 108 |
| 107 std::vector<gl::GLImplementation> | 109 std::vector<gl::GLImplementation> |
| 108 GbmSurfaceFactory::GetAllowedGLImplementations() { | 110 GbmSurfaceFactory::GetAllowedGLImplementations() { |
| 109 DCHECK(thread_checker_.CalledOnValidThread()); | 111 DCHECK(thread_checker_.CalledOnValidThread()); |
| 110 return std::vector<gl::GLImplementation>{gl::kGLImplementationEGLGLES2, | 112 return std::vector<gl::GLImplementation>{gl::kGLImplementationEGLGLES2, |
| 111 gl::kGLImplementationOSMesaGL}; | 113 gl::kGLImplementationOSMesaGL, |
| 114 gl::kGLImplementationSwiftShaderGL}; |
| 112 } | 115 } |
| 113 | 116 |
| 114 GLOzone* GbmSurfaceFactory::GetGLOzone(gl::GLImplementation implementation) { | 117 GLOzone* GbmSurfaceFactory::GetGLOzone(gl::GLImplementation implementation) { |
| 115 DCHECK(thread_checker_.CalledOnValidThread()); | 118 DCHECK(thread_checker_.CalledOnValidThread()); |
| 116 switch (implementation) { | 119 switch (implementation) { |
| 117 case gl::kGLImplementationEGLGLES2: | 120 case gl::kGLImplementationEGLGLES2: |
| 118 return egl_implementation_.get(); | 121 return egl_implementation_.get(); |
| 119 case gl::kGLImplementationOSMesaGL: | 122 case gl::kGLImplementationOSMesaGL: |
| 120 return osmesa_implementation_.get(); | 123 return osmesa_implementation_.get(); |
| 121 default: | 124 default: |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 } | 182 } |
| 180 | 183 |
| 181 scoped_refptr<GbmBuffer> buffer = drm_thread_proxy_->CreateBufferFromFds( | 184 scoped_refptr<GbmBuffer> buffer = drm_thread_proxy_->CreateBufferFromFds( |
| 182 widget, size, format, std::move(scoped_fds), planes); | 185 widget, size, format, std::move(scoped_fds), planes); |
| 183 if (!buffer) | 186 if (!buffer) |
| 184 return nullptr; | 187 return nullptr; |
| 185 return make_scoped_refptr(new GbmPixmap(this, buffer)); | 188 return make_scoped_refptr(new GbmPixmap(this, buffer)); |
| 186 } | 189 } |
| 187 | 190 |
| 188 } // namespace ui | 191 } // namespace ui |
| OLD | NEW |