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_CONSOLE_BUFFER_H_
6 #define UI_OZONE_PLATFORM_DRM_GPU_DRM_CONSOLE_BUFFER_H_
8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h"
10 #include "skia/ext/refptr.h"
11 #include "third_party/skia/include/core/SkSurface.h"
19 // Wrapper for the console buffer. This is the buffer that is allocated by
20 // default by the system and is used when no application is controlling the
21 // CRTC. Keeps track of the native properties of the buffer and wraps the pixel
22 // memory into a SkSurface which can be used to draw into using Skia.
23 class DrmConsoleBuffer
{
25 DrmConsoleBuffer(const scoped_refptr
<DrmDevice
>& drm
, uint32_t framebuffer
);
28 SkCanvas
* canvas() { return surface_
->getCanvas(); }
29 skia::RefPtr
<SkImage
> image() {
30 return skia::AdoptRef(surface_
->newImageSnapshot());
33 // Memory map the backing pixels and wrap them in |surface_|.
37 scoped_refptr
<DrmDevice
> drm_
;
39 // Wrapper around the native pixel memory.
40 skia::RefPtr
<SkSurface
> surface_
;
42 // Length of a row of pixels.
45 // Buffer handle used by the DRM allocator.
48 // Buffer ID used by the DRM modesettings API.
49 uint32_t framebuffer_
;
51 // Memory map base address.
57 DISALLOW_COPY_AND_ASSIGN(DrmConsoleBuffer
);
62 #endif // UI_OZONE_PLATFORM_DRM_GPU_DRM_CONSOLE_BUFFER_H_