1 // Copyright 2013 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_GFX_OZONE_DRI_DRI_SKBITMAP_H_
6 #define UI_GFX_OZONE_DRI_DRI_SKBITMAP_H_
8 #include "base/basictypes.h"
9 #include "third_party/skia/include/core/SkBitmap.h"
10 #include "ui/gfx/gfx_export.h"
14 // Extend the SkBitmap interface to keep track of additional parameters used by
15 // the DRM stack when allocating buffers.
16 class GFX_EXPORT DriSkBitmap : public SkBitmap {
19 virtual ~DriSkBitmap();
21 // Allocates the backing pixels using DRI.
22 // Return true on success, false otherwise.
23 virtual bool Initialize(const SkImageInfo& info);
25 void set_handle(uint32_t handle) { handle_ = handle; };
27 uint32_t get_handle() const { return handle_; };
29 uint32_t get_framebuffer() const { return framebuffer_; };
31 int get_fd() const { return fd_; };
33 // Return the color depth of a pixel in this buffer.
34 uint8_t GetColorDepth() const;
37 friend class HardwareDisplayController;
39 void set_framebuffer(uint32_t framebuffer) { framebuffer_ = framebuffer; };
41 // File descriptor used by the DRI allocator to request buffers from the DRI
45 // Buffer handle used by the DRI allocator.
48 // Buffer ID used by the DRI modesettings API. This is set when the buffer is
49 // registered with the CRTC.
50 uint32_t framebuffer_;
52 DISALLOW_COPY_AND_ASSIGN(DriSkBitmap);
57 #endif // UI_GFX_OZONE_DRI_DRI_SKBITMAP_H_