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

Side by Side Diff: ui/ozone/platform/drm/gpu/gbm_buffer_base.cc

Issue 2627193003: ozone: Allocate scanout buffers according to KMS modifiers. (Closed)
Patch Set: Created 3 years, 11 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/ozone/platform/drm/gpu/gbm_buffer_base.h" 5 #include "ui/ozone/platform/drm/gpu/gbm_buffer_base.h"
6 6
7 #include <gbm.h> 7 #include <gbm.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "ui/ozone/platform/drm/common/drm_util.h" 10 #include "ui/ozone/platform/drm/common/drm_util.h"
11 #include "ui/ozone/platform/drm/gpu/gbm_device.h" 11 #include "ui/ozone/platform/drm/gpu/gbm_device.h"
12 12
13 namespace ui { 13 namespace ui {
14 14
15 GbmBufferBase::GbmBufferBase(const scoped_refptr<GbmDevice>& drm, 15 GbmBufferBase::GbmBufferBase(const scoped_refptr<GbmDevice>& drm,
16 gbm_bo* bo, 16 gbm_bo* bo,
17 uint32_t format, 17 uint32_t format,
18 uint32_t flags) 18 uint32_t flags,
19 uint64_t modifier,
20 uint32_t addfb_flags)
19 : drm_(drm), bo_(bo) { 21 : drm_(drm), bo_(bo) {
20 if (flags & GBM_BO_USE_SCANOUT) { 22 if (flags & GBM_BO_USE_SCANOUT) {
21 DCHECK(bo_); 23 DCHECK(bo_);
22 framebuffer_pixel_format_ = format; 24 framebuffer_pixel_format_ = format;
23 25
24 // TODO(dcastagna): Add multi-planar support. 26 // TODO(dcastagna): Add multi-planar support.
25 uint32_t handles[4] = {0}; 27 uint32_t handles[4] = {0};
26 handles[0] = gbm_bo_get_handle(bo).u32; 28 handles[0] = gbm_bo_get_handle(bo).u32;
27 uint32_t strides[4] = {0}; 29 uint32_t strides[4] = {0};
28 strides[0] = gbm_bo_get_stride(bo); 30 strides[0] = gbm_bo_get_stride(bo);
29 uint32_t offsets[4] = {0}; 31 uint32_t offsets[4] = {0};
32 uint64_t modifiers[4] = {0};
33 modifiers[0] = modifier;
30 34
35 // AddFramebuffer2 only considers the modifiers if addfb_flags has
36 // DRM_MODE_FB_MODIFIERS set. We only set that when we've created
37 // a bo with modifiers, otherwise, we rely on the "no modifiers"
38 // behavior doing the right thing.
31 if (!drm_->AddFramebuffer2(gbm_bo_get_width(bo), gbm_bo_get_height(bo), 39 if (!drm_->AddFramebuffer2(gbm_bo_get_width(bo), gbm_bo_get_height(bo),
32 framebuffer_pixel_format_, handles, strides, 40 framebuffer_pixel_format_, handles, strides,
33 offsets, &framebuffer_, 0)) { 41 offsets, modifiers, &framebuffer_,
42 addfb_flags)) {
34 PLOG(ERROR) << "Failed to register buffer"; 43 PLOG(ERROR) << "Failed to register buffer";
35 return; 44 return;
36 } 45 }
37 } 46 }
38 } 47 }
39 48
40 GbmBufferBase::~GbmBufferBase() { 49 GbmBufferBase::~GbmBufferBase() {
41 if (framebuffer_) 50 if (framebuffer_)
42 drm_->RemoveFramebuffer(framebuffer_); 51 drm_->RemoveFramebuffer(framebuffer_);
43 } 52 }
(...skipping 17 matching lines...) Expand all
61 70
62 const DrmDevice* GbmBufferBase::GetDrmDevice() const { 71 const DrmDevice* GbmBufferBase::GetDrmDevice() const {
63 return drm_.get(); 72 return drm_.get();
64 } 73 }
65 74
66 bool GbmBufferBase::RequiresGlFinish() const { 75 bool GbmBufferBase::RequiresGlFinish() const {
67 return !drm_->is_primary_device(); 76 return !drm_->is_primary_device();
68 } 77 }
69 78
70 } // namespace ui 79 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/gpu/gbm_buffer_base.h ('k') | ui/ozone/platform/drm/gpu/hardware_display_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698