1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_OZONE_PLATFORM_FLATLAND_FLATLAND_SYSMEM_NATIVE_PIXMAP_H_
#define UI_OZONE_PLATFORM_FLATLAND_FLATLAND_SYSMEM_NATIVE_PIXMAP_H_
#include "ui/gfx/native_pixmap.h"
#include "ui/ozone/platform/flatland/flatland_sysmem_buffer_collection.h"
namespace ui {
class FlatlandSysmemNativePixmap : public gfx::NativePixmap {
public:
FlatlandSysmemNativePixmap(
scoped_refptr<FlatlandSysmemBufferCollection> collection,
gfx::NativePixmapHandle handle,
gfx::Size size);
FlatlandSysmemNativePixmap(const FlatlandSysmemNativePixmap&) = delete;
FlatlandSysmemNativePixmap& operator=(const FlatlandSysmemNativePixmap&) =
delete;
// gfx::NativePixmap implementation.
bool AreDmaBufFdsValid() const override;
int GetDmaBufFd(size_t plane) const override;
uint32_t GetDmaBufPitch(size_t plane) const override;
size_t GetDmaBufOffset(size_t plane) const override;
size_t GetDmaBufPlaneSize(size_t plane) const override;
size_t GetNumberOfPlanes() const override;
bool SupportsZeroCopyWebGPUImport() const override;
uint64_t GetBufferFormatModifier() const override;
gfx::BufferFormat GetBufferFormat() const override;
gfx::Size GetBufferSize() const override;
uint32_t GetUniqueId() const override;
bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
const gfx::OverlayPlaneData& overlay_plane_data,
std::vector<gfx::GpuFence> acquire_fences,
std::vector<gfx::GpuFence> release_fences) override;
gfx::NativePixmapHandle ExportHandle() const override;
FlatlandSysmemBufferCollection* sysmem_buffer_collection() const {
return collection_.get();
}
const gfx::NativePixmapHandle& PeekHandle() const;
// Returns true if overlay planes are supported.
bool SupportsOverlayPlane() const;
private:
~FlatlandSysmemNativePixmap() override;
// Keep reference to the collection to make sure it outlives the pixmap.
scoped_refptr<FlatlandSysmemBufferCollection> collection_;
gfx::NativePixmapHandle handle_;
gfx::Size size_;
};
} // namespace ui
#endif // UI_OZONE_PLATFORM_FLATLAND_FLATLAND_SYSMEM_NATIVE_PIXMAP_H_
|