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

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

Issue 1314553002: Move Format checks to HardwareDisplayPlane (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: InitTest Created 5 years, 3 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 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "ui/ozone/platform/drm/gpu/drm_device.h" 10 #include "ui/ozone/platform/drm/gpu/drm_device.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 HardwareDisplayPlane::~HardwareDisplayPlane() { 50 HardwareDisplayPlane::~HardwareDisplayPlane() {
51 } 51 }
52 52
53 bool HardwareDisplayPlane::CanUseForCrtc(uint32_t crtc_index) { 53 bool HardwareDisplayPlane::CanUseForCrtc(uint32_t crtc_index) {
54 return possible_crtcs_ & (1 << crtc_index); 54 return possible_crtcs_ & (1 << crtc_index);
55 } 55 }
56 56
57 bool HardwareDisplayPlane::Initialize(DrmDevice* drm, 57 bool HardwareDisplayPlane::Initialize(DrmDevice* drm,
58 const std::vector<uint32_t>& formats, 58 const std::vector<uint32_t>& formats,
59 bool is_dummy) { 59 bool is_dummy,
60 bool test_only) {
61 supported_formats_ = formats;
62
63 if (test_only)
64 return true;
65
60 if (is_dummy) { 66 if (is_dummy) {
61 type_ = kDummy; 67 type_ = kDummy;
62 supported_formats_.push_back(DRM_FORMAT_XRGB8888); 68 if (supported_formats_.empty())
dnicoara 2015/08/27 13:21:56 Could you just drop this if-statement and pass in
kalyank 2015/08/27 16:07:10 Done.
69 supported_formats_.push_back(DRM_FORMAT_XRGB8888);
70
63 return true; 71 return true;
64 } 72 }
65 73
66 supported_formats_ = formats;
67
68 ScopedDrmObjectPropertyPtr plane_props(drmModeObjectGetProperties( 74 ScopedDrmObjectPropertyPtr plane_props(drmModeObjectGetProperties(
69 drm->get_fd(), plane_id_, DRM_MODE_OBJECT_PLANE)); 75 drm->get_fd(), plane_id_, DRM_MODE_OBJECT_PLANE));
70 if (!plane_props) { 76 if (!plane_props) {
71 PLOG(ERROR) << "Unable to get plane properties."; 77 PLOG(ERROR) << "Unable to get plane properties.";
72 return false; 78 return false;
73 } 79 }
74 80
75 uint32_t count_props = plane_props->count_props; 81 uint32_t count_props = plane_props->count_props;
76 for (uint32_t i = 0; i < count_props; i++) { 82 for (uint32_t i = 0; i < count_props; i++) {
77 ScopedDrmPropertyPtr property( 83 ScopedDrmPropertyPtr property(
78 drmModeGetProperty(drm->get_fd(), plane_props->props[i])); 84 drmModeGetProperty(drm->get_fd(), plane_props->props[i]));
79 if (property && !strcmp(property->name, kTypePropName)) { 85 if (property && !strcmp(property->name, kTypePropName)) {
80 type_ = GetPlaneType(plane_props->prop_values[i]); 86 type_ = GetPlaneType(plane_props->prop_values[i]);
81 } 87 }
82 } 88 }
83 89
84 return InitializeProperties(drm, plane_props); 90 return InitializeProperties(drm, plane_props);
85 } 91 }
86 92
87 bool HardwareDisplayPlane::IsSupportedFormat(uint32_t format) const { 93 bool HardwareDisplayPlane::IsSupportedFormat(uint32_t format) {
88 return true; 94 if (!format)
95 return false;
96
97 if (last_used_format_ == format)
98 return true;
99
100 for (auto& element : supported_formats_) {
101 if (element == format) {
102 last_used_format_ = format;
103 return true;
104 }
105 }
106
107 last_used_format_ = 0;
108 return false;
89 } 109 }
90 110
91 bool HardwareDisplayPlane::InitializeProperties( 111 bool HardwareDisplayPlane::InitializeProperties(
92 DrmDevice* drm, 112 DrmDevice* drm,
93 const ScopedDrmObjectPropertyPtr& plane_props) { 113 const ScopedDrmObjectPropertyPtr& plane_props) {
94 return true; 114 return true;
95 } 115 }
96 116
97 } // namespace ui 117 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698