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

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: Created 5 years, 4 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.h> 7 #include <drm.h>
8 #include <gbm.h>
dnicoara 2015/08/25 19:27:16 The bots are not going to like this include since
kalyank 2015/08/26 08:42:42 Done.
kalyank 2015/08/26 08:42:42 GBM_BO_FORMAT_* are enum values. We have GBM_FORMA
9 #include <drm/drm_fourcc.h>
8 #include <xf86drm.h> 10 #include <xf86drm.h>
9 11
10 #include "base/logging.h" 12 #include "base/logging.h"
11 #include "ui/gfx/geometry/rect.h" 13 #include "ui/gfx/geometry/rect.h"
12 #include "ui/ozone/platform/drm/gpu/drm_device.h" 14 #include "ui/ozone/platform/drm/gpu/drm_device.h"
13 15
14 namespace ui { 16 namespace ui {
15 17
16 HardwareDisplayPlane::HardwareDisplayPlane(uint32_t plane_id, 18 HardwareDisplayPlane::HardwareDisplayPlane(uint32_t plane_id,
17 uint32_t possible_crtcs) 19 uint32_t possible_crtcs)
18 : plane_id_(plane_id), possible_crtcs_(possible_crtcs) { 20 : plane_id_(plane_id), possible_crtcs_(possible_crtcs) {
19 } 21 }
20 22
21 HardwareDisplayPlane::~HardwareDisplayPlane() { 23 HardwareDisplayPlane::~HardwareDisplayPlane() {
22 } 24 }
23 25
24 bool HardwareDisplayPlane::CanUseForCrtc(uint32_t crtc_index) { 26 bool HardwareDisplayPlane::CanUseForCrtc(uint32_t crtc_index) {
25 return possible_crtcs_ & (1 << crtc_index); 27 return possible_crtcs_ & (1 << crtc_index);
26 } 28 }
27 29
28 bool HardwareDisplayPlane::Initialize(DrmDevice* drm, 30 bool HardwareDisplayPlane::Initialize(DrmDevice* drm,
29 const std::vector<uint32_t>& formats) { 31 const std::vector<uint32_t>& formats) {
30 return true; 32 return true;
31 } 33 }
32 34
33 bool HardwareDisplayPlane::IsSupportedFormat(uint32_t format) const { 35 bool HardwareDisplayPlane::IsSupportedFormat(uint32_t format) const {
34 return true; 36 uint32_t format_type = 0;
kalyank 2015/08/24 17:22:00 Depends on https://codereview.chromium.org/1294113
37 switch (format) {
38 case GBM_BO_FORMAT_ARGB8888: {
39 // We create a FB of 24 bit color depth.
40 format_type = DRM_FORMAT_XRGB8888;
41 break;
42 }
43 case GBM_BO_FORMAT_XRGB8888: {
44 format_type = DRM_FORMAT_XRGB8888;
45 break;
46 }
47 default:
48 NOTREACHED();
49 return false;
dnicoara 2015/08/25 19:27:16 drm_buffer.cc needs to also be updated to return t
kalyank 2015/08/26 08:42:42 Done.
50 }
51
52 for (auto& element : supported_formats_) {
53 if (element == format_type)
54 return true;
55 }
56
57 return false;
35 } 58 }
36 59
37 } // namespace ui 60 } // 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_atomic.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698