Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(490)

Side by Side Diff: ui/ozone/platform/dri/gbm_buffer_base.cc

Issue 400283002: [Ozone-GBM] Migrate GBM buffers to use the ScanoutBuffer interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/ozone/platform/dri/gbm_buffer_base.h ('k') | ui/ozone/platform/dri/gbm_surface.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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 #include "ui/ozone/platform/dri/gbm_buffer_base.h"
6
7 #include <gbm.h>
8
9 #include "base/logging.h"
10 #include "ui/ozone/platform/dri/dri_wrapper.h"
11
12 namespace ui {
13
14 namespace {
15
16 // Pixel configuration for the current buffer format.
17 // TODO(dnicoara) These will need to change once we query the hardware for
18 // supported configurations.
19 const uint8_t kColorDepth = 24;
20 const uint8_t kPixelDepth = 32;
21
22 } // namespace
23
24 GbmBufferBase::GbmBufferBase(DriWrapper* dri, gbm_bo* bo, bool scanout)
25 : dri_(dri), bo_(bo), framebuffer_(0) {
26 if (scanout && !dri_->AddFramebuffer(gbm_bo_get_width(bo),
27 gbm_bo_get_height(bo),
28 kColorDepth,
29 kPixelDepth,
30 gbm_bo_get_stride(bo),
31 gbm_bo_get_handle(bo).u32,
32 &framebuffer_))
33 LOG(ERROR) << "Failed to register buffer";
34 }
35
36 GbmBufferBase::~GbmBufferBase() {
37 if (framebuffer_)
38 dri_->RemoveFramebuffer(framebuffer_);
39 }
40
41 uint32_t GbmBufferBase::GetFramebufferId() const {
42 return framebuffer_;
43 }
44
45 uint32_t GbmBufferBase::GetHandle() const {
46 return gbm_bo_get_handle(bo_).u32;
47 }
48
49 gfx::Size GbmBufferBase::GetSize() const {
50 return gfx::Size(gbm_bo_get_width(bo_), gbm_bo_get_height(bo_));
51 }
52
53 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/dri/gbm_buffer_base.h ('k') | ui/ozone/platform/dri/gbm_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698