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. 4 5#ifndef UI_OZONE_PLATFORM_DRI_GBM_BUFFER_BASE_H_ 6#define UI_OZONE_PLATFORM_DRI_GBM_BUFFER_BASE_H_ 7 8#include "ui/ozone/platform/dri/scanout_buffer.h" 9 10struct gbm_bo; 11 12namespace ui { 13 14class DriWrapper; 15 16// Wrapper for a GBM buffer. The base class provides common functionality 17// required to prepare the buffer for scanout. It does not provide any ownership 18// of the buffer. Implementations of this base class should deal with buffer 19// ownership. 20class GbmBufferBase : public ScanoutBuffer { 21 public: 22 gbm_bo* bo() const { return bo_; } 23 24 // ScanoutBuffer: 25 virtual uint32_t GetFramebufferId() const OVERRIDE; 26 virtual uint32_t GetHandle() const OVERRIDE; 27 virtual gfx::Size GetSize() const OVERRIDE; 28 29 protected: 30 GbmBufferBase(DriWrapper* dri, gbm_bo* bo, bool scanout); 31 virtual ~GbmBufferBase(); 32 33 private: 34 DriWrapper* dri_; 35 gbm_bo* bo_; 36 uint32_t framebuffer_; 37 38 DISALLOW_COPY_AND_ASSIGN(GbmBufferBase); 39}; 40 41} // namespace ui 42 43#endif // UI_OZONE_PLATFORM_DRI_GBM_BUFFER_BASE_H_ 44