Fix search results being clipped in app list.
[chromium-blink-merge.git] / ui / ozone / platform / drm / gpu / drm_buffer.h
blob18ad9af700ecbfb4a8eeff313dc0d2a6847d8dbd
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
3 // found in the LICENSE file.
5 #ifndef UI_OZONE_PLATFORM_DRM_GPU_DRM_BUFFER_H_
6 #define UI_OZONE_PLATFORM_DRM_GPU_DRM_BUFFER_H_
8 #include "base/macros.h"
9 #include "skia/ext/refptr.h"
10 #include "third_party/skia/include/core/SkSurface.h"
11 #include "ui/ozone/ozone_export.h"
12 #include "ui/ozone/platform/drm/gpu/scanout_buffer.h"
14 namespace ui {
16 class DrmDevice;
18 // Wrapper for a DRM allocated buffer. Keeps track of the native properties of
19 // the buffer and wraps the pixel memory into a SkSurface which can be used to
20 // draw into using Skia.
21 class OZONE_EXPORT DrmBuffer : public ScanoutBuffer {
22 public:
23 DrmBuffer(const scoped_refptr<DrmDevice>& drm);
25 // Allocates the backing pixels and wraps them in |surface_|. |info| is used
26 // to describe the buffer characteristics (size, color format).
27 // |should_register_framebuffer| is used to distinguish the buffers that are
28 // used for modesetting.
29 bool Initialize(const SkImageInfo& info, bool should_register_framebuffer);
31 SkCanvas* GetCanvas() const;
33 // ScanoutBuffer:
34 uint32_t GetFramebufferId() const override;
35 uint32_t GetHandle() const override;
36 gfx::Size GetSize() const override;
38 protected:
39 ~DrmBuffer() override;
41 scoped_refptr<DrmDevice> drm_;
43 // Wrapper around the native pixel memory.
44 skia::RefPtr<SkSurface> surface_;
46 // Length of a row of pixels.
47 uint32_t stride_;
49 // Buffer handle used by the DRM allocator.
50 uint32_t handle_;
52 // Buffer ID used by the DRM modesettings API. This is set when the buffer is
53 // registered with the CRTC.
54 uint32_t framebuffer_;
56 DISALLOW_COPY_AND_ASSIGN(DrmBuffer);
59 class OZONE_EXPORT DrmBufferGenerator : public ScanoutBufferGenerator {
60 public:
61 DrmBufferGenerator();
62 ~DrmBufferGenerator() override;
64 // ScanoutBufferGenerator:
65 scoped_refptr<ScanoutBuffer> Create(const scoped_refptr<DrmDevice>& drm,
66 const gfx::Size& size) override;
68 private:
69 DISALLOW_COPY_AND_ASSIGN(DrmBufferGenerator);
72 } // namespace ui
74 #endif // UI_OZONE_PLATFORM_DRM_GPU_DRM_BUFFER_H_