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.h" | 5 #include "ui/ozone/platform/drm/gpu/gbm_buffer.h" |
6 | 6 |
7 #include <drm.h> | 7 #include <drm.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <gbm.h> | 9 #include <gbm.h> |
10 #include <xf86drm.h> | 10 #include <xf86drm.h> |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 } | 106 } |
107 | 107 |
108 int GbmPixmap::GetDmaBufFd() { | 108 int GbmPixmap::GetDmaBufFd() { |
109 return dma_buf_; | 109 return dma_buf_; |
110 } | 110 } |
111 | 111 |
112 int GbmPixmap::GetDmaBufPitch() { | 112 int GbmPixmap::GetDmaBufPitch() { |
113 return gbm_bo_get_stride(buffer_->bo()); | 113 return gbm_bo_get_stride(buffer_->bo()); |
114 } | 114 } |
115 | 115 |
| 116 gfx::BufferFormat GbmPixmap::GetPixelFormat() { |
| 117 return GetBufferFormatFromFourCCFormat(buffer_->GetFramebufferPixelFormat()); |
| 118 } |
| 119 |
116 bool GbmPixmap::ScheduleOverlayPlane(gfx::AcceleratedWidget widget, | 120 bool GbmPixmap::ScheduleOverlayPlane(gfx::AcceleratedWidget widget, |
117 int plane_z_order, | 121 int plane_z_order, |
118 gfx::OverlayTransform plane_transform, | 122 gfx::OverlayTransform plane_transform, |
119 const gfx::Rect& display_bounds, | 123 const gfx::Rect& display_bounds, |
120 const gfx::RectF& crop_rect) { | 124 const gfx::RectF& crop_rect) { |
121 DCHECK(buffer_->GetUsage() == gfx::BufferUsage::SCANOUT); | 125 DCHECK(buffer_->GetUsage() == gfx::BufferUsage::SCANOUT); |
122 gfx::Size required_size; | 126 gfx::Size required_size; |
123 if (plane_z_order && | 127 if (plane_z_order && |
124 ShouldApplyScaling(display_bounds, crop_rect, &required_size)) { | 128 ShouldApplyScaling(display_bounds, crop_rect, &required_size)) { |
125 scoped_refptr<NativePixmap> scaled_pixmap = GetScaledPixmap(required_size); | 129 scoped_refptr<NativePixmap> scaled_pixmap = GetScaledPixmap(required_size); |
(...skipping 20 matching lines...) Expand all Loading... |
146 | 150 |
147 gfx::Size pixmap_size = buffer_->GetSize(); | 151 gfx::Size pixmap_size = buffer_->GetSize(); |
148 // If the required size is not integer-sized, round it to the next integer. | 152 // If the required size is not integer-sized, round it to the next integer. |
149 *required_size = gfx::ToCeiledSize( | 153 *required_size = gfx::ToCeiledSize( |
150 gfx::SizeF(display_bounds.width() / crop_rect.width(), | 154 gfx::SizeF(display_bounds.width() / crop_rect.width(), |
151 display_bounds.height() / crop_rect.height())); | 155 display_bounds.height() / crop_rect.height())); |
152 return pixmap_size != *required_size; | 156 return pixmap_size != *required_size; |
153 } | 157 } |
154 | 158 |
155 } // namespace ui | 159 } // namespace ui |
OLD | NEW |