| 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 13 matching lines...) Expand all Loading... |
| 24 // be converted to one without it. | 24 // be converted to one without it. |
| 25 framebuffer_pixel_format_ = | 25 framebuffer_pixel_format_ = |
| 26 GetFourCCFormatForFramebuffer(GetBufferFormatFromFourCCFormat(format)); | 26 GetFourCCFormatForFramebuffer(GetBufferFormatFromFourCCFormat(format)); |
| 27 | 27 |
| 28 // TODO(dcastagna): Add multi-planar support. | 28 // TODO(dcastagna): Add multi-planar support. |
| 29 uint32_t handles[4] = {0}; | 29 uint32_t handles[4] = {0}; |
| 30 handles[0] = gbm_bo_get_handle(bo).u32; | 30 handles[0] = gbm_bo_get_handle(bo).u32; |
| 31 uint32_t strides[4] = {0}; | 31 uint32_t strides[4] = {0}; |
| 32 strides[0] = gbm_bo_get_stride(bo); | 32 strides[0] = gbm_bo_get_stride(bo); |
| 33 uint32_t offsets[4] = {0}; | 33 uint32_t offsets[4] = {0}; |
| 34 uint64_t modifiers[4] = {0}; |
| 35 modifiers[0] = gbm_bo_get_format_modifier(bo); |
| 34 | 36 |
| 35 if (!drm_->AddFramebuffer2(gbm_bo_get_width(bo), gbm_bo_get_height(bo), | 37 if (!drm_->AddFramebuffer2(gbm_bo_get_width(bo), gbm_bo_get_height(bo), |
| 36 framebuffer_pixel_format_, handles, strides, | 38 framebuffer_pixel_format_, handles, strides, |
| 37 offsets, &framebuffer_, 0)) { | 39 offsets, modifiers, &framebuffer_, |
| 40 DRM_MODE_FB_MODIFIERS)) { |
| 38 PLOG(ERROR) << "Failed to register buffer"; | 41 PLOG(ERROR) << "Failed to register buffer"; |
| 39 return; | 42 return; |
| 40 } | 43 } |
| 41 } | 44 } |
| 42 } | 45 } |
| 43 | 46 |
| 44 GbmBufferBase::~GbmBufferBase() { | 47 GbmBufferBase::~GbmBufferBase() { |
| 45 if (framebuffer_) | 48 if (framebuffer_) |
| 46 drm_->RemoveFramebuffer(framebuffer_); | 49 drm_->RemoveFramebuffer(framebuffer_); |
| 47 } | 50 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 65 | 68 |
| 66 const DrmDevice* GbmBufferBase::GetDrmDevice() const { | 69 const DrmDevice* GbmBufferBase::GetDrmDevice() const { |
| 67 return drm_.get(); | 70 return drm_.get(); |
| 68 } | 71 } |
| 69 | 72 |
| 70 bool GbmBufferBase::RequiresGlFinish() const { | 73 bool GbmBufferBase::RequiresGlFinish() const { |
| 71 return !drm_->is_primary_device(); | 74 return !drm_->is_primary_device(); |
| 72 } | 75 } |
| 73 | 76 |
| 74 } // namespace ui | 77 } // namespace ui |
| OLD | NEW |