| 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" |
| 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, | 19 uint64_t modifier, |
| 20 uint32_t addfb_flags) | 20 uint32_t addfb_flags) |
| 21 : drm_(drm), bo_(bo) { | 21 : drm_(drm), bo_(bo) { |
| 22 if (flags & GBM_BO_USE_SCANOUT) { | 22 if (flags & GBM_BO_USE_SCANOUT) { |
| 23 DCHECK(bo_); | 23 DCHECK(bo_); |
| 24 // The framebuffer format might be different than the format: | 24 // The framebuffer format might be different than the format: |
| 25 // drm supports 24 bit color depth and formats with alpha will | 25 // drm supports 24 bit color depth and formats with alpha will |
| 26 // be converted to one without it. | 26 // be converted to one without it. |
| 27 framebuffer_pixel_format_ = | 27 framebuffer_pixel_format_ = format; |
| 28 GetFourCCFormatForFramebuffer(GetBufferFormatFromFourCCFormat(format)); | 28 // GetFourCCFormatForFramebuffer(GetBufferFormatFromFourCCFormat(form
at)); |
| 29 | 29 |
| 30 // TODO(dcastagna): Add multi-planar support. | 30 // TODO(dcastagna): Add multi-planar support. |
| 31 uint32_t handles[4] = {0}; | 31 uint32_t handles[4] = {0}; |
| 32 handles[0] = gbm_bo_get_handle(bo).u32; | 32 handles[0] = gbm_bo_get_handle(bo).u32; |
| 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 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 70 |
| 71 const DrmDevice* GbmBufferBase::GetDrmDevice() const { | 71 const DrmDevice* GbmBufferBase::GetDrmDevice() const { |
| 72 return drm_.get(); | 72 return drm_.get(); |
| 73 } | 73 } |
| 74 | 74 |
| 75 bool GbmBufferBase::RequiresGlFinish() const { | 75 bool GbmBufferBase::RequiresGlFinish() const { |
| 76 return !drm_->is_primary_device(); | 76 return !drm_->is_primary_device(); |
| 77 } | 77 } |
| 78 | 78 |
| 79 } // namespace ui | 79 } // namespace ui |
| OLD | NEW |