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

Side by Side Diff: ui/ozone/platform/drm/gpu/hardware_display_plane.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/hardware_display_plane.h" 5 #include "ui/ozone/platform/drm/gpu/hardware_display_plane.h"
6 6
7 #include <drm_fourcc.h> 7 #include <drm_fourcc.h>
8 #include <drm_mode.h>
8 9
9 #include "base/logging.h" 10 #include "base/logging.h"
10 #include "ui/ozone/platform/drm/gpu/drm_device.h" 11 #include "ui/ozone/platform/drm/gpu/drm_device.h"
11 12
12 #ifndef DRM_PLANE_TYPE_OVERLAY 13 #ifndef DRM_PLANE_TYPE_OVERLAY
13 #define DRM_PLANE_TYPE_OVERLAY 0 14 #define DRM_PLANE_TYPE_OVERLAY 0
14 #endif 15 #endif
15 16
16 #ifndef DRM_PLANE_TYPE_PRIMARY 17 #ifndef DRM_PLANE_TYPE_PRIMARY
17 #define DRM_PLANE_TYPE_PRIMARY 1 18 #define DRM_PLANE_TYPE_PRIMARY 1
(...skipping 29 matching lines...) Expand all
47 : plane_id_(plane_id), possible_crtcs_(possible_crtcs) { 48 : plane_id_(plane_id), possible_crtcs_(possible_crtcs) {
48 } 49 }
49 50
50 HardwareDisplayPlane::~HardwareDisplayPlane() { 51 HardwareDisplayPlane::~HardwareDisplayPlane() {
51 } 52 }
52 53
53 bool HardwareDisplayPlane::CanUseForCrtc(uint32_t crtc_index) { 54 bool HardwareDisplayPlane::CanUseForCrtc(uint32_t crtc_index) {
54 return possible_crtcs_ & (1 << crtc_index); 55 return possible_crtcs_ & (1 << crtc_index);
55 } 56 }
56 57
57 bool HardwareDisplayPlane::Initialize(DrmDevice* drm, 58 bool HardwareDisplayPlane::Initialize(
58 const std::vector<uint32_t>& formats, 59 DrmDevice* drm,
59 bool is_dummy, 60 const std::vector<uint32_t>& formats,
60 bool test_only) { 61 const std::vector<drm_format_modifier>& format_modifiers,
62 bool is_dummy,
63 bool test_only) {
61 supported_formats_ = formats; 64 supported_formats_ = formats;
65 supported_format_modifiers_ = format_modifiers;
62 66
63 if (test_only) 67 if (test_only)
64 return true; 68 return true;
65 69
66 if (is_dummy) { 70 if (is_dummy) {
67 type_ = kDummy; 71 type_ = kDummy;
68 supported_formats_.push_back(DRM_FORMAT_XRGB8888); 72 supported_formats_.push_back(DRM_FORMAT_XRGB8888);
69 supported_formats_.push_back(DRM_FORMAT_XBGR8888); 73 supported_formats_.push_back(DRM_FORMAT_XBGR8888);
70 return true; 74 return true;
71 } 75 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 } 109 }
106 110
107 last_used_format_ = 0; 111 last_used_format_ = 0;
108 return false; 112 return false;
109 } 113 }
110 114
111 const std::vector<uint32_t>& HardwareDisplayPlane::supported_formats() const { 115 const std::vector<uint32_t>& HardwareDisplayPlane::supported_formats() const {
112 return supported_formats_; 116 return supported_formats_;
113 } 117 }
114 118
119 std::vector<uint64_t> HardwareDisplayPlane::ModifiersForFormat(
120 uint32_t format) {
121 std::vector<uint64_t> modifiers;
122
123 uint32_t format_index =
124 std::find(supported_formats_.begin(), supported_formats_.end(), format) -
125 supported_formats_.begin();
126 DCHECK_LT(format_index, supported_formats_.size());
127
128 for (const auto& modifier : supported_format_modifiers_) {
129 if (modifier.formats & (1 << format_index))
130 modifiers.push_back(modifier.modifier);
131 }
132
133 return modifiers;
134 }
135
115 bool HardwareDisplayPlane::InitializeProperties( 136 bool HardwareDisplayPlane::InitializeProperties(
116 DrmDevice* drm, 137 DrmDevice* drm,
117 const ScopedDrmObjectPropertyPtr& plane_props) { 138 const ScopedDrmObjectPropertyPtr& plane_props) {
118 return true; 139 return true;
119 } 140 }
120 141
121 } // namespace ui 142 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/gpu/hardware_display_plane.h ('k') | ui/ozone/platform/drm/gpu/hardware_display_plane_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698