Commit 3a8f8d2d authored by Sergey Ulanov's avatar Sergey Ulanov Committed by Commit Bot

Pass VkDevice to SurfaceFactoryOzone::CreateNativePixmap()

CreateNativePixmap() will need to get VkDevice to be able to allocate
buffers compatible with the target device.

Bug: 852011
Change-Id: I7294fbd48d93c0614f78440b023f63a84b01bae9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1570534
Commit-Queue: Sergey Ulanov <sergeyu@chromium.org>
Reviewed-by: default avatarMichael Spang <spang@chromium.org>
Reviewed-by: default avatarDaniele Castagna <dcastagna@chromium.org>
Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#652897}
parent 30e95af7
...@@ -165,9 +165,9 @@ ProtectedBufferManager::ProtectedNativePixmap::Create( ...@@ -165,9 +165,9 @@ ProtectedBufferManager::ProtectedNativePixmap::Create(
ui::OzonePlatform* platform = ui::OzonePlatform::GetInstance(); ui::OzonePlatform* platform = ui::OzonePlatform::GetInstance();
ui::SurfaceFactoryOzone* factory = platform->GetSurfaceFactoryOzone(); ui::SurfaceFactoryOzone* factory = platform->GetSurfaceFactoryOzone();
protected_pixmap->native_pixmap_ = protected_pixmap->native_pixmap_ = factory->CreateNativePixmap(
factory->CreateNativePixmap(gfx::kNullAcceleratedWidget, size, format, gfx::kNullAcceleratedWidget, VK_NULL_HANDLE, size, format,
gfx::BufferUsage::SCANOUT_VDA_WRITE); gfx::BufferUsage::SCANOUT_VDA_WRITE);
if (!protected_pixmap->native_pixmap_) { if (!protected_pixmap->native_pixmap_) {
VLOGF(1) << "Failed allocating a native pixmap"; VLOGF(1) << "Failed allocating a native pixmap";
......
...@@ -65,8 +65,8 @@ TEST_F(DisplayTest, DISABLED_CreateLinuxDMABufBuffer) { ...@@ -65,8 +65,8 @@ TEST_F(DisplayTest, DISABLED_CreateLinuxDMABufBuffer) {
scoped_refptr<gfx::NativePixmap> pixmap = scoped_refptr<gfx::NativePixmap> pixmap =
ui::OzonePlatform::GetInstance() ui::OzonePlatform::GetInstance()
->GetSurfaceFactoryOzone() ->GetSurfaceFactoryOzone()
->CreateNativePixmap(gfx::kNullAcceleratedWidget, buffer_size, ->CreateNativePixmap(gfx::kNullAcceleratedWidget, VK_NULL_HANDLE,
gfx::BufferFormat::RGBA_8888, buffer_size, gfx::BufferFormat::RGBA_8888,
gfx::BufferUsage::GPU_READ); gfx::BufferUsage::GPU_READ);
gfx::NativePixmapHandle native_pixmap_handle = pixmap->ExportHandle(); gfx::NativePixmapHandle native_pixmap_handle = pixmap->ExportHandle();
std::unique_ptr<Buffer> buffer1 = display->CreateLinuxDMABufBuffer( std::unique_ptr<Buffer> buffer1 = display->CreateLinuxDMABufBuffer(
......
...@@ -136,8 +136,6 @@ GpuServiceImpl::GpuServiceImpl( ...@@ -136,8 +136,6 @@ GpuServiceImpl::GpuServiceImpl(
: main_runner_(base::ThreadTaskRunnerHandle::Get()), : main_runner_(base::ThreadTaskRunnerHandle::Get()),
io_runner_(std::move(io_runner)), io_runner_(std::move(io_runner)),
watchdog_thread_(std::move(watchdog_thread)), watchdog_thread_(std::move(watchdog_thread)),
gpu_memory_buffer_factory_(
gpu::GpuMemoryBufferFactory::CreateNativeType()),
gpu_preferences_(gpu_preferences), gpu_preferences_(gpu_preferences),
gpu_info_(gpu_info), gpu_info_(gpu_info),
gpu_feature_info_(gpu_feature_info), gpu_feature_info_(gpu_feature_info),
...@@ -165,6 +163,9 @@ GpuServiceImpl::GpuServiceImpl( ...@@ -165,6 +163,9 @@ GpuServiceImpl::GpuServiceImpl(
} }
#endif #endif
gpu_memory_buffer_factory_ =
gpu::GpuMemoryBufferFactory::CreateNativeType(vulkan_context_provider());
weak_ptr_ = weak_ptr_factory_.GetWeakPtr(); weak_ptr_ = weak_ptr_factory_.GetWeakPtr();
} }
......
...@@ -274,8 +274,6 @@ class VIZ_SERVICE_EXPORT GpuServiceImpl : public gpu::GpuChannelManagerDelegate, ...@@ -274,8 +274,6 @@ class VIZ_SERVICE_EXPORT GpuServiceImpl : public gpu::GpuChannelManagerDelegate,
std::unique_ptr<gpu::GpuWatchdogThread> watchdog_thread_; std::unique_ptr<gpu::GpuWatchdogThread> watchdog_thread_;
std::unique_ptr<gpu::GpuMemoryBufferFactory> gpu_memory_buffer_factory_;
const gpu::GpuPreferences gpu_preferences_; const gpu::GpuPreferences gpu_preferences_;
// Information about the GPU, such as device and vendor ID. // Information about the GPU, such as device and vendor ID.
...@@ -309,6 +307,8 @@ class VIZ_SERVICE_EXPORT GpuServiceImpl : public gpu::GpuChannelManagerDelegate, ...@@ -309,6 +307,8 @@ class VIZ_SERVICE_EXPORT GpuServiceImpl : public gpu::GpuChannelManagerDelegate,
scoped_refptr<VulkanContextProvider> vulkan_context_provider_; scoped_refptr<VulkanContextProvider> vulkan_context_provider_;
#endif #endif
std::unique_ptr<gpu::GpuMemoryBufferFactory> gpu_memory_buffer_factory_;
// An event that will be signalled when we shutdown. On some platforms it // An event that will be signalled when we shutdown. On some platforms it
// comes from external sources. // comes from external sources.
std::unique_ptr<base::WaitableEvent> owned_shutdown_event_; std::unique_ptr<base::WaitableEvent> owned_shutdown_event_;
......
...@@ -226,7 +226,7 @@ GLManager::Options::Options() = default; ...@@ -226,7 +226,7 @@ GLManager::Options::Options() = default;
GLManager::GLManager() GLManager::GLManager()
: gpu_memory_buffer_factory_( : gpu_memory_buffer_factory_(
gpu::GpuMemoryBufferFactory::CreateNativeType()) { gpu::GpuMemoryBufferFactory::CreateNativeType(nullptr)) {
SetupBaseContext(); SetupBaseContext();
} }
......
...@@ -59,7 +59,8 @@ class RasterInProcessCommandBufferTest : public ::testing::Test { ...@@ -59,7 +59,8 @@ class RasterInProcessCommandBufferTest : public ::testing::Test {
void SetUp() override { void SetUp() override {
if (!RasterInProcessContext::SupportedInTest()) if (!RasterInProcessContext::SupportedInTest())
return; return;
gpu_memory_buffer_factory_ = GpuMemoryBufferFactory::CreateNativeType(); gpu_memory_buffer_factory_ =
GpuMemoryBufferFactory::CreateNativeType(nullptr);
gpu_memory_buffer_manager_ = gpu_memory_buffer_manager_ =
std::make_unique<viz::TestGpuMemoryBufferManager>(); std::make_unique<viz::TestGpuMemoryBufferManager>();
gpu_thread_holder_.GetGpuPreferences()->texture_target_exception_list = gpu_thread_holder_.GetGpuPreferences()->texture_target_exception_list =
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include "gpu/ipc/common/gpu_memory_buffer_impl_native_pixmap.h" #include "gpu/ipc/common/gpu_memory_buffer_impl_native_pixmap.h"
#include <vulkan/vulkan.h>
#include <utility> #include <utility>
#include "base/bind.h" #include "base/bind.h"
...@@ -71,8 +73,8 @@ base::OnceClosure GpuMemoryBufferImplNativePixmap::AllocateForTesting( ...@@ -71,8 +73,8 @@ base::OnceClosure GpuMemoryBufferImplNativePixmap::AllocateForTesting(
scoped_refptr<gfx::NativePixmap> pixmap = scoped_refptr<gfx::NativePixmap> pixmap =
ui::OzonePlatform::GetInstance() ui::OzonePlatform::GetInstance()
->GetSurfaceFactoryOzone() ->GetSurfaceFactoryOzone()
->CreateNativePixmap(gfx::kNullAcceleratedWidget, size, format, ->CreateNativePixmap(gfx::kNullAcceleratedWidget, VK_NULL_HANDLE,
usage); size, format, usage);
handle->native_pixmap_handle = pixmap->ExportHandle(); handle->native_pixmap_handle = pixmap->ExportHandle();
#else #else
// TODO(j.isorce): use gbm_bo_create / gbm_bo_get_fd from system libgbm. // TODO(j.isorce): use gbm_bo_create / gbm_bo_get_fd from system libgbm.
......
...@@ -2,6 +2,7 @@ include_rules = [ ...@@ -2,6 +2,7 @@ include_rules = [
"+cc/paint", "+cc/paint",
"+components/crash/core/common/crash_key.h", "+components/crash/core/common/crash_key.h",
"+components/viz/common/features.h", "+components/viz/common/features.h",
"+components/viz/common/gpu/vulkan_context_provider.h",
"+components/viz/common/resources/resource_format.h", "+components/viz/common/resources/resource_format.h",
"+third_party/skia", "+third_party/skia",
"+ui/accelerated_widget_mac", "+ui/accelerated_widget_mac",
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
#include "gpu/ipc/service/gpu_memory_buffer_factory.h" #include "gpu/ipc/service/gpu_memory_buffer_factory.h"
#include "base/logging.h" #include <memory>
#include "base/memory/ptr_util.h"
#include "build/build_config.h" #include "build/build_config.h"
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
...@@ -28,15 +28,17 @@ namespace gpu { ...@@ -28,15 +28,17 @@ namespace gpu {
// static // static
std::unique_ptr<GpuMemoryBufferFactory> std::unique_ptr<GpuMemoryBufferFactory>
GpuMemoryBufferFactory::CreateNativeType() { GpuMemoryBufferFactory::CreateNativeType(
viz::VulkanContextProvider* vulkan_context_provider) {
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
return base::WrapUnique(new GpuMemoryBufferFactoryIOSurface); return std::make_unique<GpuMemoryBufferFactoryIOSurface>();
#elif defined(OS_ANDROID) #elif defined(OS_ANDROID)
return base::WrapUnique(new GpuMemoryBufferFactoryAndroidHardwareBuffer); return std::make_unique<GpuMemoryBufferFactoryAndroidHardwareBuffer>();
#elif defined(OS_LINUX) || defined(OS_FUCHSIA) #elif defined(OS_LINUX) || defined(OS_FUCHSIA)
return base::WrapUnique(new GpuMemoryBufferFactoryNativePixmap); return std::make_unique<GpuMemoryBufferFactoryNativePixmap>(
vulkan_context_provider);
#elif defined(OS_WIN) #elif defined(OS_WIN)
return base::WrapUnique(new GpuMemoryBufferFactoryDXGI); return std::make_unique<GpuMemoryBufferFactoryDXGI>();
#else #else
return nullptr; return nullptr;
#endif #endif
......
...@@ -15,6 +15,10 @@ ...@@ -15,6 +15,10 @@
#include "ui/gfx/geometry/size.h" #include "ui/gfx/geometry/size.h"
#include "ui/gfx/gpu_memory_buffer.h" #include "ui/gfx/gpu_memory_buffer.h"
namespace viz {
class VulkanContextProvider;
} // namespace viz
namespace gpu { namespace gpu {
class ImageFactory; class ImageFactory;
...@@ -25,7 +29,8 @@ class GPU_IPC_SERVICE_EXPORT GpuMemoryBufferFactory { ...@@ -25,7 +29,8 @@ class GPU_IPC_SERVICE_EXPORT GpuMemoryBufferFactory {
// Creates a new factory instance for native GPU memory buffers. Returns null // Creates a new factory instance for native GPU memory buffers. Returns null
// if native buffers are not supported. // if native buffers are not supported.
static std::unique_ptr<GpuMemoryBufferFactory> CreateNativeType(); static std::unique_ptr<GpuMemoryBufferFactory> CreateNativeType(
viz::VulkanContextProvider* vulkan_context_provider);
// Creates a new GPU memory buffer instance. A valid handle is returned on // Creates a new GPU memory buffer instance. A valid handle is returned on
// success. It can be called on any thread. // success. It can be called on any thread.
......
...@@ -4,7 +4,9 @@ ...@@ -4,7 +4,9 @@
#include "gpu/ipc/service/gpu_memory_buffer_factory_native_pixmap.h" #include "gpu/ipc/service/gpu_memory_buffer_factory_native_pixmap.h"
#include "components/viz/common/gpu/vulkan_context_provider.h"
#include "gpu/command_buffer/common/gpu_memory_buffer_support.h" #include "gpu/command_buffer/common/gpu_memory_buffer_support.h"
#include "gpu/vulkan/vulkan_device_queue.h"
#include "ui/gfx/buffer_format_util.h" #include "ui/gfx/buffer_format_util.h"
#include "ui/gfx/client_native_pixmap.h" #include "ui/gfx/client_native_pixmap.h"
#include "ui/gfx/linux/native_pixmap_dmabuf.h" #include "ui/gfx/linux/native_pixmap_dmabuf.h"
...@@ -20,8 +22,12 @@ ...@@ -20,8 +22,12 @@
namespace gpu { namespace gpu {
GpuMemoryBufferFactoryNativePixmap::GpuMemoryBufferFactoryNativePixmap() = GpuMemoryBufferFactoryNativePixmap::GpuMemoryBufferFactoryNativePixmap()
default; : vulkan_context_provider_(nullptr) {}
GpuMemoryBufferFactoryNativePixmap::GpuMemoryBufferFactoryNativePixmap(
viz::VulkanContextProvider* vulkan_context_provider)
: vulkan_context_provider_(vulkan_context_provider) {}
GpuMemoryBufferFactoryNativePixmap::~GpuMemoryBufferFactoryNativePixmap() = GpuMemoryBufferFactoryNativePixmap::~GpuMemoryBufferFactoryNativePixmap() =
default; default;
...@@ -38,7 +44,8 @@ GpuMemoryBufferFactoryNativePixmap::CreateGpuMemoryBuffer( ...@@ -38,7 +44,8 @@ GpuMemoryBufferFactoryNativePixmap::CreateGpuMemoryBuffer(
scoped_refptr<gfx::NativePixmap> pixmap = scoped_refptr<gfx::NativePixmap> pixmap =
ui::OzonePlatform::GetInstance() ui::OzonePlatform::GetInstance()
->GetSurfaceFactoryOzone() ->GetSurfaceFactoryOzone()
->CreateNativePixmap(surface_handle, size, format, usage); ->CreateNativePixmap(surface_handle, GetVulkanDevice(), size, format,
usage);
if (!pixmap.get()) { if (!pixmap.get()) {
DLOG(ERROR) << "Failed to create pixmap " << size.ToString() << ", " DLOG(ERROR) << "Failed to create pixmap " << size.ToString() << ", "
<< gfx::BufferFormatToString(format) << ", usage " << gfx::BufferFormatToString(format) << ", usage "
...@@ -144,10 +151,10 @@ GpuMemoryBufferFactoryNativePixmap::CreateAnonymousImage( ...@@ -144,10 +151,10 @@ GpuMemoryBufferFactoryNativePixmap::CreateAnonymousImage(
bool* is_cleared) { bool* is_cleared) {
scoped_refptr<gfx::NativePixmap> pixmap; scoped_refptr<gfx::NativePixmap> pixmap;
#if defined(USE_OZONE) #if defined(USE_OZONE)
pixmap = pixmap = ui::OzonePlatform::GetInstance()
ui::OzonePlatform::GetInstance() ->GetSurfaceFactoryOzone()
->GetSurfaceFactoryOzone() ->CreateNativePixmap(gpu::kNullSurfaceHandle, GetVulkanDevice(),
->CreateNativePixmap(gpu::kNullSurfaceHandle, size, format, usage); size, format, usage);
#else #else
NOTIMPLEMENTED(); NOTIMPLEMENTED();
#endif #endif
...@@ -170,4 +177,10 @@ unsigned GpuMemoryBufferFactoryNativePixmap::RequiredTextureType() { ...@@ -170,4 +177,10 @@ unsigned GpuMemoryBufferFactoryNativePixmap::RequiredTextureType() {
return GL_TEXTURE_2D; return GL_TEXTURE_2D;
} }
VkDevice GpuMemoryBufferFactoryNativePixmap::GetVulkanDevice() {
return vulkan_context_provider_
? vulkan_context_provider_->GetDeviceQueue()->GetVulkanDevice()
: VK_NULL_HANDLE;
}
} // namespace gpu } // namespace gpu
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#ifndef GPU_IPC_SERVICE_GPU_MEMORY_BUFFER_FACTORY_NATIVE_PIXMAP_H_ #ifndef GPU_IPC_SERVICE_GPU_MEMORY_BUFFER_FACTORY_NATIVE_PIXMAP_H_
#define GPU_IPC_SERVICE_GPU_MEMORY_BUFFER_FACTORY_NATIVE_PIXMAP_H_ #define GPU_IPC_SERVICE_GPU_MEMORY_BUFFER_FACTORY_NATIVE_PIXMAP_H_
#include <vulkan/vulkan.h>
#include <unordered_map> #include <unordered_map>
#include <utility> #include <utility>
...@@ -27,6 +29,8 @@ class GPU_IPC_SERVICE_EXPORT GpuMemoryBufferFactoryNativePixmap ...@@ -27,6 +29,8 @@ class GPU_IPC_SERVICE_EXPORT GpuMemoryBufferFactoryNativePixmap
public ImageFactory { public ImageFactory {
public: public:
GpuMemoryBufferFactoryNativePixmap(); GpuMemoryBufferFactoryNativePixmap();
explicit GpuMemoryBufferFactoryNativePixmap(
viz::VulkanContextProvider* vulkan_context_provider);
~GpuMemoryBufferFactoryNativePixmap() override; ~GpuMemoryBufferFactoryNativePixmap() override;
// Overridden from GpuMemoryBufferFactory: // Overridden from GpuMemoryBufferFactory:
...@@ -61,6 +65,11 @@ class GPU_IPC_SERVICE_EXPORT GpuMemoryBufferFactoryNativePixmap ...@@ -61,6 +65,11 @@ class GPU_IPC_SERVICE_EXPORT GpuMemoryBufferFactoryNativePixmap
using NativePixmapMap = std::unordered_map<NativePixmapMapKey, using NativePixmapMap = std::unordered_map<NativePixmapMapKey,
scoped_refptr<gfx::NativePixmap>, scoped_refptr<gfx::NativePixmap>,
NativePixmapMapKeyHash>; NativePixmapMapKeyHash>;
VkDevice GetVulkanDevice();
scoped_refptr<viz::VulkanContextProvider> vulkan_context_provider_;
NativePixmapMap native_pixmaps_; NativePixmapMap native_pixmaps_;
base::Lock native_pixmaps_lock_; base::Lock native_pixmaps_lock_;
......
...@@ -37,8 +37,9 @@ scoped_refptr<VideoFrame> CreateVideoFrameOzone(VideoPixelFormat pixel_format, ...@@ -37,8 +37,9 @@ scoped_refptr<VideoFrame> CreateVideoFrameOzone(VideoPixelFormat pixel_format,
gfx::BufferFormat buffer_format = gfx::BufferFormat buffer_format =
VideoPixelFormatToGfxBufferFormat(pixel_format); VideoPixelFormatToGfxBufferFormat(pixel_format);
auto pixmap = factory->CreateNativePixmap( auto pixmap =
gfx::kNullAcceleratedWidget, coded_size, buffer_format, buffer_usage); factory->CreateNativePixmap(gfx::kNullAcceleratedWidget, VK_NULL_HANDLE,
coded_size, buffer_format, buffer_usage);
const size_t num_planes = VideoFrame::NumPlanes(pixel_format); const size_t num_planes = VideoFrame::NumPlanes(pixel_format);
std::vector<VideoFrameLayout::Plane> planes(num_planes); std::vector<VideoFrameLayout::Plane> planes(num_planes);
......
...@@ -97,9 +97,9 @@ bool VaapiPictureNativePixmapOzone::Allocate(gfx::BufferFormat format) { ...@@ -97,9 +97,9 @@ bool VaapiPictureNativePixmapOzone::Allocate(gfx::BufferFormat format) {
ui::OzonePlatform* platform = ui::OzonePlatform::GetInstance(); ui::OzonePlatform* platform = ui::OzonePlatform::GetInstance();
ui::SurfaceFactoryOzone* factory = platform->GetSurfaceFactoryOzone(); ui::SurfaceFactoryOzone* factory = platform->GetSurfaceFactoryOzone();
pixmap_ = pixmap_ = factory->CreateNativePixmap(gfx::kNullAcceleratedWidget,
factory->CreateNativePixmap(gfx::kNullAcceleratedWidget, size_, format, VK_NULL_HANDLE, size_, format,
gfx::BufferUsage::SCANOUT_VDA_WRITE); gfx::BufferUsage::SCANOUT_VDA_WRITE);
if (!pixmap_) { if (!pixmap_) {
LOG(ERROR) << "Failed allocating a pixmap"; LOG(ERROR) << "Failed allocating a pixmap";
return false; return false;
......
...@@ -115,7 +115,8 @@ bool SurfacelessSkiaGlRenderer::BufferWrapper::Initialize( ...@@ -115,7 +115,8 @@ bool SurfacelessSkiaGlRenderer::BufferWrapper::Initialize(
scoped_refptr<gfx::NativePixmap> pixmap = scoped_refptr<gfx::NativePixmap> pixmap =
OzonePlatform::GetInstance() OzonePlatform::GetInstance()
->GetSurfaceFactoryOzone() ->GetSurfaceFactoryOzone()
->CreateNativePixmap(widget, size, format, gfx::BufferUsage::SCANOUT); ->CreateNativePixmap(widget, nullptr, size, format,
gfx::BufferUsage::SCANOUT);
auto image = base::MakeRefCounted<gl::GLImageNativePixmap>(size, format); auto image = base::MakeRefCounted<gl::GLImageNativePixmap>(size, format);
if (!image->Initialize(std::move(pixmap))) { if (!image->Initialize(std::move(pixmap))) {
LOG(ERROR) << "Failed to create GLImage"; LOG(ERROR) << "Failed to create GLImage";
......
...@@ -86,7 +86,8 @@ bool SurfacelessGlRenderer::BufferWrapper::Initialize( ...@@ -86,7 +86,8 @@ bool SurfacelessGlRenderer::BufferWrapper::Initialize(
scoped_refptr<gfx::NativePixmap> pixmap = scoped_refptr<gfx::NativePixmap> pixmap =
OzonePlatform::GetInstance() OzonePlatform::GetInstance()
->GetSurfaceFactoryOzone() ->GetSurfaceFactoryOzone()
->CreateNativePixmap(widget, size, format, gfx::BufferUsage::SCANOUT); ->CreateNativePixmap(widget, nullptr, size, format,
gfx::BufferUsage::SCANOUT);
auto image = base::MakeRefCounted<gl::GLImageNativePixmap>(size, format); auto image = base::MakeRefCounted<gl::GLImageNativePixmap>(size, format);
if (!image->Initialize(std::move(pixmap))) { if (!image->Initialize(std::move(pixmap))) {
LOG(ERROR) << "Failed to create GLImage"; LOG(ERROR) << "Failed to create GLImage";
......
...@@ -34,8 +34,8 @@ class GLImageNativePixmapTestDelegate : public GLImageTestDelegateBase { ...@@ -34,8 +34,8 @@ class GLImageNativePixmapTestDelegate : public GLImageTestDelegateBase {
ui::SurfaceFactoryOzone* surface_factory = ui::SurfaceFactoryOzone* surface_factory =
ui::OzonePlatform::GetInstance()->GetSurfaceFactoryOzone(); ui::OzonePlatform::GetInstance()->GetSurfaceFactoryOzone();
scoped_refptr<gfx::NativePixmap> pixmap = scoped_refptr<gfx::NativePixmap> pixmap =
surface_factory->CreateNativePixmap(gfx::kNullAcceleratedWidget, size, surface_factory->CreateNativePixmap(gfx::kNullAcceleratedWidget,
format, usage); nullptr, size, format, usage);
DCHECK(pixmap); DCHECK(pixmap);
if (usage == gfx::BufferUsage::GPU_READ_CPU_READ_WRITE || if (usage == gfx::BufferUsage::GPU_READ_CPU_READ_WRITE ||
usage == gfx::BufferUsage::SCANOUT_CAMERA_READ_WRITE) { usage == gfx::BufferUsage::SCANOUT_CAMERA_READ_WRITE) {
......
...@@ -120,6 +120,7 @@ std::unique_ptr<SurfaceOzoneCanvas> SurfaceFactoryCast::CreateCanvasForWidget( ...@@ -120,6 +120,7 @@ std::unique_ptr<SurfaceOzoneCanvas> SurfaceFactoryCast::CreateCanvasForWidget(
scoped_refptr<gfx::NativePixmap> SurfaceFactoryCast::CreateNativePixmap( scoped_refptr<gfx::NativePixmap> SurfaceFactoryCast::CreateNativePixmap(
gfx::AcceleratedWidget widget, gfx::AcceleratedWidget widget,
VkDevice vk_device,
gfx::Size size, gfx::Size size,
gfx::BufferFormat format, gfx::BufferFormat format,
gfx::BufferUsage usage) { gfx::BufferUsage usage) {
......
...@@ -35,6 +35,7 @@ class SurfaceFactoryCast : public SurfaceFactoryOzone { ...@@ -35,6 +35,7 @@ class SurfaceFactoryCast : public SurfaceFactoryOzone {
gfx::AcceleratedWidget widget) override; gfx::AcceleratedWidget widget) override;
scoped_refptr<gfx::NativePixmap> CreateNativePixmap( scoped_refptr<gfx::NativePixmap> CreateNativePixmap(
gfx::AcceleratedWidget widget, gfx::AcceleratedWidget widget,
VkDevice vk_device,
gfx::Size size, gfx::Size size,
gfx::BufferFormat format, gfx::BufferFormat format,
gfx::BufferUsage usage) override; gfx::BufferUsage usage) override;
......
...@@ -224,6 +224,7 @@ std::unique_ptr<SurfaceOzoneCanvas> GbmSurfaceFactory::CreateCanvasForWidget( ...@@ -224,6 +224,7 @@ std::unique_ptr<SurfaceOzoneCanvas> GbmSurfaceFactory::CreateCanvasForWidget(
scoped_refptr<gfx::NativePixmap> GbmSurfaceFactory::CreateNativePixmap( scoped_refptr<gfx::NativePixmap> GbmSurfaceFactory::CreateNativePixmap(
gfx::AcceleratedWidget widget, gfx::AcceleratedWidget widget,
VkDevice vk_device,
gfx::Size size, gfx::Size size,
gfx::BufferFormat format, gfx::BufferFormat format,
gfx::BufferUsage usage) { gfx::BufferUsage usage) {
......
...@@ -56,6 +56,7 @@ class GbmSurfaceFactory : public SurfaceFactoryOzone { ...@@ -56,6 +56,7 @@ class GbmSurfaceFactory : public SurfaceFactoryOzone {
gfx::AcceleratedWidget widget) override; gfx::AcceleratedWidget widget) override;
scoped_refptr<gfx::NativePixmap> CreateNativePixmap( scoped_refptr<gfx::NativePixmap> CreateNativePixmap(
gfx::AcceleratedWidget widget, gfx::AcceleratedWidget widget,
VkDevice vk_device,
gfx::Size size, gfx::Size size,
gfx::BufferFormat format, gfx::BufferFormat format,
gfx::BufferUsage usage) override; gfx::BufferUsage usage) override;
......
...@@ -191,6 +191,7 @@ HeadlessSurfaceFactory::CreateCanvasForWidget(gfx::AcceleratedWidget widget) { ...@@ -191,6 +191,7 @@ HeadlessSurfaceFactory::CreateCanvasForWidget(gfx::AcceleratedWidget widget) {
scoped_refptr<gfx::NativePixmap> HeadlessSurfaceFactory::CreateNativePixmap( scoped_refptr<gfx::NativePixmap> HeadlessSurfaceFactory::CreateNativePixmap(
gfx::AcceleratedWidget widget, gfx::AcceleratedWidget widget,
VkDevice vk_device,
gfx::Size size, gfx::Size size,
gfx::BufferFormat format, gfx::BufferFormat format,
gfx::BufferUsage usage) { gfx::BufferUsage usage) {
......
...@@ -29,6 +29,7 @@ class HeadlessSurfaceFactory : public SurfaceFactoryOzone { ...@@ -29,6 +29,7 @@ class HeadlessSurfaceFactory : public SurfaceFactoryOzone {
gfx::AcceleratedWidget widget) override; gfx::AcceleratedWidget widget) override;
scoped_refptr<gfx::NativePixmap> CreateNativePixmap( scoped_refptr<gfx::NativePixmap> CreateNativePixmap(
gfx::AcceleratedWidget widget, gfx::AcceleratedWidget widget,
VkDevice vk_device,
gfx::Size size, gfx::Size size,
gfx::BufferFormat format, gfx::BufferFormat format,
gfx::BufferUsage usage) override; gfx::BufferUsage usage) override;
......
...@@ -156,6 +156,7 @@ std::unique_ptr<SurfaceOzoneCanvas> ScenicSurfaceFactory::CreateCanvasForWidget( ...@@ -156,6 +156,7 @@ std::unique_ptr<SurfaceOzoneCanvas> ScenicSurfaceFactory::CreateCanvasForWidget(
scoped_refptr<gfx::NativePixmap> ScenicSurfaceFactory::CreateNativePixmap( scoped_refptr<gfx::NativePixmap> ScenicSurfaceFactory::CreateNativePixmap(
gfx::AcceleratedWidget widget, gfx::AcceleratedWidget widget,
VkDevice vk_device,
gfx::Size size, gfx::Size size,
gfx::BufferFormat format, gfx::BufferFormat format,
gfx::BufferUsage usage) { gfx::BufferUsage usage) {
......
...@@ -39,6 +39,7 @@ class ScenicSurfaceFactory : public SurfaceFactoryOzone { ...@@ -39,6 +39,7 @@ class ScenicSurfaceFactory : public SurfaceFactoryOzone {
gfx::AcceleratedWidget widget) override; gfx::AcceleratedWidget widget) override;
scoped_refptr<gfx::NativePixmap> CreateNativePixmap( scoped_refptr<gfx::NativePixmap> CreateNativePixmap(
gfx::AcceleratedWidget widget, gfx::AcceleratedWidget widget,
VkDevice vk_device,
gfx::Size size, gfx::Size size,
gfx::BufferFormat format, gfx::BufferFormat format,
gfx::BufferUsage usage) override; gfx::BufferUsage usage) override;
......
...@@ -172,6 +172,7 @@ GLOzone* WaylandSurfaceFactory::GetGLOzone( ...@@ -172,6 +172,7 @@ GLOzone* WaylandSurfaceFactory::GetGLOzone(
scoped_refptr<gfx::NativePixmap> WaylandSurfaceFactory::CreateNativePixmap( scoped_refptr<gfx::NativePixmap> WaylandSurfaceFactory::CreateNativePixmap(
gfx::AcceleratedWidget widget, gfx::AcceleratedWidget widget,
VkDevice vk_device,
gfx::Size size, gfx::Size size,
gfx::BufferFormat format, gfx::BufferFormat format,
gfx::BufferUsage usage) { gfx::BufferUsage usage) {
......
...@@ -40,6 +40,7 @@ class WaylandSurfaceFactory : public SurfaceFactoryOzone { ...@@ -40,6 +40,7 @@ class WaylandSurfaceFactory : public SurfaceFactoryOzone {
gfx::AcceleratedWidget widget) override; gfx::AcceleratedWidget widget) override;
scoped_refptr<gfx::NativePixmap> CreateNativePixmap( scoped_refptr<gfx::NativePixmap> CreateNativePixmap(
gfx::AcceleratedWidget widget, gfx::AcceleratedWidget widget,
VkDevice vk_device,
gfx::Size size, gfx::Size size,
gfx::BufferFormat format, gfx::BufferFormat format,
gfx::BufferUsage usage) override; gfx::BufferUsage usage) override;
......
...@@ -71,6 +71,7 @@ std::unique_ptr<SurfaceOzoneCanvas> SurfaceFactoryOzone::CreateCanvasForWidget( ...@@ -71,6 +71,7 @@ std::unique_ptr<SurfaceOzoneCanvas> SurfaceFactoryOzone::CreateCanvasForWidget(
scoped_refptr<gfx::NativePixmap> SurfaceFactoryOzone::CreateNativePixmap( scoped_refptr<gfx::NativePixmap> SurfaceFactoryOzone::CreateNativePixmap(
gfx::AcceleratedWidget widget, gfx::AcceleratedWidget widget,
VkDevice vk_device,
gfx::Size size, gfx::Size size,
gfx::BufferFormat format, gfx::BufferFormat format,
gfx::BufferUsage usage) { gfx::BufferUsage usage) {
......
...@@ -116,6 +116,7 @@ class OZONE_BASE_EXPORT SurfaceFactoryOzone { ...@@ -116,6 +116,7 @@ class OZONE_BASE_EXPORT SurfaceFactoryOzone {
// It can be called on any thread. // It can be called on any thread.
virtual scoped_refptr<gfx::NativePixmap> CreateNativePixmap( virtual scoped_refptr<gfx::NativePixmap> CreateNativePixmap(
gfx::AcceleratedWidget widget, gfx::AcceleratedWidget widget,
VkDevice vk_device,
gfx::Size size, gfx::Size size,
gfx::BufferFormat format, gfx::BufferFormat format,
gfx::BufferUsage usage); gfx::BufferUsage usage);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment