| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 if (fds_.empty()) | 51 if (fds_.empty()) |
| 52 return false; | 52 return false; |
| 53 | 53 |
| 54 for (const auto& fd : fds_) { | 54 for (const auto& fd : fds_) { |
| 55 if (fd.get() == -1) | 55 if (fd.get() == -1) |
| 56 return false; | 56 return false; |
| 57 } | 57 } |
| 58 return true; | 58 return true; |
| 59 } | 59 } |
| 60 | 60 |
| 61 size_t GbmBuffer::GetFdCount() const { |
| 62 return fds_.size(); |
| 63 } |
| 64 |
| 61 int GbmBuffer::GetFd(size_t plane) const { | 65 int GbmBuffer::GetFd(size_t plane) const { |
| 62 DCHECK_LT(plane, fds_.size()); | 66 DCHECK_LT(plane, fds_.size()); |
| 63 return fds_[plane].get(); | 67 return fds_[plane].get(); |
| 64 } | 68 } |
| 65 | 69 |
| 66 int GbmBuffer::GetStride(size_t plane) const { | 70 int GbmBuffer::GetStride(size_t plane) const { |
| 67 DCHECK_LT(plane, strides_.size()); | 71 DCHECK_LT(plane, strides_.size()); |
| 68 return strides_[plane]; | 72 return strides_[plane]; |
| 69 } | 73 } |
| 70 | 74 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 } | 181 } |
| 178 | 182 |
| 179 void* GbmPixmap::GetEGLClientBuffer() const { | 183 void* GbmPixmap::GetEGLClientBuffer() const { |
| 180 return nullptr; | 184 return nullptr; |
| 181 } | 185 } |
| 182 | 186 |
| 183 bool GbmPixmap::AreDmaBufFdsValid() const { | 187 bool GbmPixmap::AreDmaBufFdsValid() const { |
| 184 return buffer_->AreFdsValid(); | 188 return buffer_->AreFdsValid(); |
| 185 } | 189 } |
| 186 | 190 |
| 191 size_t GbmPixmap::GetDmaBufFdCount() const { |
| 192 return buffer_->GetFdCount(); |
| 193 } |
| 194 |
| 187 int GbmPixmap::GetDmaBufFd(size_t plane) const { | 195 int GbmPixmap::GetDmaBufFd(size_t plane) const { |
| 188 return buffer_->GetFd(plane); | 196 return buffer_->GetFd(plane); |
| 189 } | 197 } |
| 190 | 198 |
| 191 int GbmPixmap::GetDmaBufPitch(size_t plane) const { | 199 int GbmPixmap::GetDmaBufPitch(size_t plane) const { |
| 192 return buffer_->GetStride(plane); | 200 return buffer_->GetStride(plane); |
| 193 } | 201 } |
| 194 | 202 |
| 195 int GbmPixmap::GetDmaBufOffset(size_t plane) const { | 203 int GbmPixmap::GetDmaBufOffset(size_t plane) const { |
| 196 return buffer_->GetOffset(plane); | 204 return buffer_->GetOffset(plane); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 DCHECK(!processing_callback_.is_null()); | 254 DCHECK(!processing_callback_.is_null()); |
| 247 if (!processing_callback_.Run(this, processed_pixmap_)) { | 255 if (!processing_callback_.Run(this, processed_pixmap_)) { |
| 248 LOG(ERROR) << "Failed processing NativePixmap"; | 256 LOG(ERROR) << "Failed processing NativePixmap"; |
| 249 return nullptr; | 257 return nullptr; |
| 250 } | 258 } |
| 251 | 259 |
| 252 return processed_pixmap_->buffer(); | 260 return processed_pixmap_->buffer(); |
| 253 } | 261 } |
| 254 | 262 |
| 255 } // namespace ui | 263 } // namespace ui |
| OLD | NEW |