blob: 891c40eedb8ecff3eac0a3cd84930e28ec2e7b15 [file] [log] [blame]
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <memory>
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "ui/ozone/platform/drm/gpu/drm_thread.h"
namespace ui {
class DrmWindowProxy;
class InterThreadMessagingProxy;
// Mediates the communication between GPU main/IO threads and the DRM thread. It
// serves proxy objects that are safe to call on the GPU threads. The proxy
// objects then deal with safely posting the messages to the DRM thread.
class DrmThreadProxy {
explicit DrmThreadProxy();
void BindThreadIntoMessagingProxy(InterThreadMessagingProxy* messaging_proxy);
std::unique_ptr<DrmWindowProxy> CreateDrmWindowProxy(
gfx::AcceleratedWidget widget);
scoped_refptr<GbmBuffer> CreateBuffer(gfx::AcceleratedWidget widget,
const gfx::Size& size,
gfx::BufferFormat format,
gfx::BufferUsage usage);
scoped_refptr<GbmBuffer> CreateBufferFromFds(
const gfx::Size& size,
gfx::BufferFormat format,
std::vector<base::ScopedFD>&& fds,
std::vector<int> strides,
std::vector<int> offsets);
void GetScanoutFormats(gfx::AcceleratedWidget widget,
std::vector<gfx::BufferFormat>* scanout_formats);
DrmThread drm_thread_;
} // namespace ui