| OLD | NEW |
| 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" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 uint32_t strides[4] = {0}; | 33 uint32_t strides[4] = {0}; |
| 34 strides[0] = gbm_bo_get_stride(bo); | 34 strides[0] = gbm_bo_get_stride(bo); |
| 35 uint32_t offsets[4] = {0}; | 35 uint32_t offsets[4] = {0}; |
| 36 uint64_t modifiers[4] = {0}; | 36 uint64_t modifiers[4] = {0}; |
| 37 modifiers[0] = modifier; | 37 modifiers[0] = modifier; |
| 38 | 38 |
| 39 // AddFramebuffer2 only considers the modifiers if addfb_flags has | 39 // AddFramebuffer2 only considers the modifiers if addfb_flags has |
| 40 // DRM_MODE_FB_MODIFIERS set. We only set that when we've created | 40 // DRM_MODE_FB_MODIFIERS set. We only set that when we've created |
| 41 // a bo with modifiers, otherwise, we rely on the "no modifiers" | 41 // a bo with modifiers, otherwise, we rely on the "no modifiers" |
| 42 // behavior doing the right thing. | 42 // behavior doing the right thing. |
| 43 if (!drm_->AddFramebuffer2(gbm_bo_get_width(bo), gbm_bo_get_height(bo), | 43 drm_->AddFramebuffer2(gbm_bo_get_width(bo), gbm_bo_get_height(bo), |
| 44 framebuffer_pixel_format_, handles, strides, | 44 framebuffer_pixel_format_, handles, strides, offsets, |
| 45 offsets, modifiers, &framebuffer_, | 45 modifiers, &framebuffer_, addfb_flags); |
| 46 addfb_flags)) { | |
| 47 PLOG(ERROR) << "Failed to register buffer"; | |
| 48 return; | |
| 49 } | |
| 50 } | 46 } |
| 51 } | 47 } |
| 52 | 48 |
| 53 GbmBufferBase::~GbmBufferBase() { | 49 GbmBufferBase::~GbmBufferBase() { |
| 54 if (framebuffer_) | 50 if (framebuffer_) |
| 55 drm_->RemoveFramebuffer(framebuffer_); | 51 drm_->RemoveFramebuffer(framebuffer_); |
| 56 } | 52 } |
| 57 | 53 |
| 58 uint32_t GbmBufferBase::GetFramebufferId() const { | 54 uint32_t GbmBufferBase::GetFramebufferId() const { |
| 59 return framebuffer_; | 55 return framebuffer_; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 74 | 70 |
| 75 const DrmDevice* GbmBufferBase::GetDrmDevice() const { | 71 const DrmDevice* GbmBufferBase::GetDrmDevice() const { |
| 76 return drm_.get(); | 72 return drm_.get(); |
| 77 } | 73 } |
| 78 | 74 |
| 79 bool GbmBufferBase::RequiresGlFinish() const { | 75 bool GbmBufferBase::RequiresGlFinish() const { |
| 80 return !drm_->is_primary_device(); | 76 return !drm_->is_primary_device(); |
| 81 } | 77 } |
| 82 | 78 |
| 83 } // namespace ui | 79 } // namespace ui |
| OLD | NEW |