1cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved. 2cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 3cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// found in the LICENSE file. 4cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 5cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include "ui/ozone/platform/dri/gbm_surface_factory.h" 6cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 76d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)#include <gbm.h> 8cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 91320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#include "base/command_line.h" 10cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include "base/files/file_path.h" 115f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#include "third_party/khronos/EGL/egl.h" 121320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#include "ui/ozone/platform/dri/dri_window_delegate_impl.h" 131320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#include "ui/ozone/platform/dri/dri_window_delegate_manager.h" 14116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#include "ui/ozone/platform/dri/gbm_buffer.h" 15cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include "ui/ozone/platform/dri/gbm_surface.h" 165f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#include "ui/ozone/platform/dri/gbm_surfaceless.h" 17cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include "ui/ozone/platform/dri/screen_manager.h" 18116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#include "ui/ozone/public/native_pixmap.h" 191320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#include "ui/ozone/public/overlay_candidates_ozone.h" 201320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#include "ui/ozone/public/ozone_switches.h" 216d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)#include "ui/ozone/public/surface_ozone_egl.h" 22cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 23cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)namespace ui { 241320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tuccinamespace { 251320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 261320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucciclass SingleOverlay : public OverlayCandidatesOzone { 271320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci public: 281320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci SingleOverlay() {} 291320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci virtual ~SingleOverlay() {} 301320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 311320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci virtual void CheckOverlaySupport( 321320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci OverlaySurfaceCandidateList* candidates) OVERRIDE { 331320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci if (candidates->size() == 2) { 341320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci OverlayCandidatesOzone::OverlaySurfaceCandidate* first = 351320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci &(*candidates)[0]; 361320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci OverlayCandidatesOzone::OverlaySurfaceCandidate* second = 371320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci &(*candidates)[1]; 381320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci OverlayCandidatesOzone::OverlaySurfaceCandidate* overlay; 391320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci if (first->plane_z_order == 0) { 401320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci overlay = second; 411320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci } else if (second->plane_z_order == 0) { 421320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci overlay = first; 431320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci } else { 441320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci NOTREACHED(); 451320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci return; 461320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci } 471320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci if (overlay->plane_z_order > 0 && 481320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci IsTransformSupported(overlay->transform)) { 491320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci overlay->overlay_handled = true; 501320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci } 511320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci } 521320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci } 531320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 541320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci private: 551320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci bool IsTransformSupported(gfx::OverlayTransform transform) { 561320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci switch (transform) { 571320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci case gfx::OVERLAY_TRANSFORM_NONE: 581320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci return true; 591320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci default: 601320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci return false; 611320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci } 621320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci } 631320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 641320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci DISALLOW_COPY_AND_ASSIGN(SingleOverlay); 651320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci}; 661320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 671320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci} // namespace 68cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 69116680a4aac90f2aa7413d9095a592090648e557Ben MurdochGbmSurfaceFactory::GbmSurfaceFactory(bool allow_surfaceless) 701320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci : DriSurfaceFactory(NULL, NULL, NULL), 71116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch device_(NULL), 72116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch allow_surfaceless_(allow_surfaceless) { 73116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch} 74cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 75cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)GbmSurfaceFactory::~GbmSurfaceFactory() {} 76cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 77116680a4aac90f2aa7413d9095a592090648e557Ben Murdochvoid GbmSurfaceFactory::InitializeGpu( 781320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci DriWrapper* dri, 791320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci gbm_device* device, 801320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci ScreenManager* screen_manager, 811320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci DriWindowDelegateManager* window_manager) { 82116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch drm_ = dri; 83116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch device_ = device; 84116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch screen_manager_ = screen_manager; 851320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci window_manager_ = window_manager; 86116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch} 87116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch 88cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)intptr_t GbmSurfaceFactory::GetNativeDisplay() { 895f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) DCHECK(state_ == INITIALIZED); 90cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) return reinterpret_cast<intptr_t>(device_); 91cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)} 92cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 93cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)const int32* GbmSurfaceFactory::GetEGLSurfaceProperties( 94cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) const int32* desired_list) { 95cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) static const int32 kConfigAttribs[] = { 96cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) EGL_BUFFER_SIZE, 32, 97cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) EGL_ALPHA_SIZE, 8, 98cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) EGL_BLUE_SIZE, 8, 99cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) EGL_GREEN_SIZE, 8, 100cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) EGL_RED_SIZE, 8, 101cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, 102cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) EGL_SURFACE_TYPE, EGL_WINDOW_BIT, 103cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) EGL_NONE 104cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) }; 105cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 106cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) return kConfigAttribs; 107cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)} 108cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 109cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)bool GbmSurfaceFactory::LoadEGLGLES2Bindings( 110cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) AddGLLibraryCallback add_gl_library, 111cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) SetGLGetProcAddressProcCallback set_gl_get_proc_address) { 112cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) base::NativeLibraryLoadError error; 113cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) base::NativeLibrary gles_library = base::LoadNativeLibrary( 114cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) base::FilePath("libGLESv2.so.2"), 115cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) &error); 116cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) if (!gles_library) { 117cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) LOG(WARNING) << "Failed to load GLES library: " << error.ToString(); 118cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) return false; 119cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) } 120cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 121cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) base::NativeLibrary egl_library = base::LoadNativeLibrary( 122cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) base::FilePath("libEGL.so.1"), 123cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) &error); 124cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) if (!egl_library) { 125cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) LOG(WARNING) << "Failed to load EGL library: " << error.ToString(); 126cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) base::UnloadNativeLibrary(gles_library); 127cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) return false; 128cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) } 129cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 130cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) GLGetProcAddressProc get_proc_address = 131cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) reinterpret_cast<GLGetProcAddressProc>( 132cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) base::GetFunctionPointerFromNativeLibrary( 133cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) egl_library, "eglGetProcAddress")); 134cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) if (!get_proc_address) { 135cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) LOG(ERROR) << "eglGetProcAddress not found."; 136cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) base::UnloadNativeLibrary(egl_library); 137cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) base::UnloadNativeLibrary(gles_library); 138cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) return false; 139cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) } 140cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 141cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) set_gl_get_proc_address.Run(get_proc_address); 142cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) add_gl_library.Run(egl_library); 143cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) add_gl_library.Run(gles_library); 144cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 145cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) return true; 146cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)} 147cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 1485f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)scoped_ptr<SurfaceOzoneEGL> GbmSurfaceFactory::CreateEGLSurfaceForWidget( 1495f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) gfx::AcceleratedWidget widget) { 1505f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) DCHECK(state_ == INITIALIZED); 1515f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) 1521320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci DriWindowDelegate* delegate = GetOrCreateWindowDelegate(widget); 1531320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 1541320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci scoped_ptr<GbmSurface> surface(new GbmSurface(delegate, device_, drm_)); 15503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) if (!surface->Initialize()) 15603b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return scoped_ptr<SurfaceOzoneEGL>(); 15703b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 15803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return surface.PassAs<SurfaceOzoneEGL>(); 15903b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)} 16003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 16103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)scoped_ptr<SurfaceOzoneEGL> 16203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)GbmSurfaceFactory::CreateSurfacelessEGLSurfaceForWidget( 16303b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) gfx::AcceleratedWidget widget) { 16403b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) if (!allow_surfaceless_) 16503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return scoped_ptr<SurfaceOzoneEGL>(); 1661320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 1671320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci DriWindowDelegate* delegate = GetOrCreateWindowDelegate(widget); 1681320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci return scoped_ptr<SurfaceOzoneEGL>(new GbmSurfaceless(delegate)); 169cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)} 170cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 171116680a4aac90f2aa7413d9095a592090648e557Ben Murdochscoped_refptr<ui::NativePixmap> GbmSurfaceFactory::CreateNativePixmap( 1726d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) gfx::Size size, 1736d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) BufferFormat format) { 1745f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) scoped_refptr<GbmBuffer> buffer = GbmBuffer::CreateBuffer( 1755f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) drm_, device_, format, size, true); 1761320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci if (!buffer.get()) 177116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch return NULL; 1785f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) 1795f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) return scoped_refptr<GbmPixmap>(new GbmPixmap(buffer)); 180116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch} 1816d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) 1821320f92c476a1ad9d19dba2a48c72b75566198e9Primiano TucciOverlayCandidatesOzone* GbmSurfaceFactory::GetOverlayCandidates( 1831320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci gfx::AcceleratedWidget w) { 1841320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci if (CommandLine::ForCurrentProcess()->HasSwitch( 1851320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci switches::kOzoneTestSingleOverlaySupport)) 1861320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci return new SingleOverlay(); 1871320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci return NULL; 1881320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci} 1891320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 1906e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)bool GbmSurfaceFactory::ScheduleOverlayPlane( 1916e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) gfx::AcceleratedWidget widget, 1926e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) int plane_z_order, 1936e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) gfx::OverlayTransform plane_transform, 1946e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) scoped_refptr<NativePixmap> buffer, 1956e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) const gfx::Rect& display_bounds, 1966e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) const gfx::RectF& crop_rect) { 1976e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) scoped_refptr<GbmPixmap> pixmap = static_cast<GbmPixmap*>(buffer.get()); 1981320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci if (!pixmap.get()) { 1996e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) LOG(ERROR) << "ScheduleOverlayPlane passed NULL buffer."; 2006e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) return false; 2016e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) } 2021320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci HardwareDisplayController* hdc = 2031320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci window_manager_->GetWindowDelegate(widget)->GetController(); 2046e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) if (!hdc) 2056e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) return true; 2061320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 2076e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) hdc->QueueOverlayPlane(OverlayPlane(pixmap->buffer(), 2086e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) plane_z_order, 2096e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) plane_transform, 2106e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) display_bounds, 2116e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) crop_rect)); 2126e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) return true; 2136e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)} 2146e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) 215116680a4aac90f2aa7413d9095a592090648e557Ben Murdochbool GbmSurfaceFactory::CanShowPrimaryPlaneAsOverlay() { 216116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch return allow_surfaceless_; 2176d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)} 2186d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) 2191320f92c476a1ad9d19dba2a48c72b75566198e9Primiano TucciDriWindowDelegate* GbmSurfaceFactory::GetOrCreateWindowDelegate( 2201320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci gfx::AcceleratedWidget widget) { 2211320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci if (!window_manager_->HasWindowDelegate(widget)) { 2221320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci scoped_ptr<DriWindowDelegate> delegate( 2231320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci new DriWindowDelegateImpl(widget, screen_manager_)); 2241320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci delegate->Initialize(); 2251320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci window_manager_->AddWindowDelegate(widget, delegate.Pass()); 2261320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci } 2271320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 2281320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci return window_manager_->GetWindowDelegate(widget); 2291320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci} 2301320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 231cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)} // namespace ui 232