| 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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 OverlayPlane(buffer_, plane_z_order, plane_transform, display_bounds, | 273 OverlayPlane(buffer_, plane_z_order, plane_transform, display_bounds, |
| 274 crop_rect, processing_callback)); | 274 crop_rect, processing_callback)); |
| 275 | 275 |
| 276 return true; | 276 return true; |
| 277 } | 277 } |
| 278 | 278 |
| 279 scoped_refptr<ScanoutBuffer> GbmPixmap::ProcessBuffer(const gfx::Size& size, | 279 scoped_refptr<ScanoutBuffer> GbmPixmap::ProcessBuffer(const gfx::Size& size, |
| 280 uint32_t format) { | 280 uint32_t format) { |
| 281 DCHECK(GetBufferSize() != size || | 281 DCHECK(GetBufferSize() != size || |
| 282 buffer_->GetFramebufferPixelFormat() != format); | 282 buffer_->GetFramebufferPixelFormat() != format); |
| 283 PLOG(ERROR) << "GbmPixmap::ProcessBuffer " << format; |
| 283 | 284 |
| 284 if (!processed_pixmap_ || size != processed_pixmap_->GetBufferSize() || | 285 if (!processed_pixmap_ || size != processed_pixmap_->GetBufferSize() || |
| 285 format != processed_pixmap_->buffer()->GetFramebufferPixelFormat()) { | 286 format != processed_pixmap_->buffer()->GetFramebufferPixelFormat()) { |
| 286 // Release any old processed pixmap. | 287 // Release any old processed pixmap. |
| 287 processed_pixmap_ = nullptr; | 288 processed_pixmap_ = nullptr; |
| 288 scoped_refptr<GbmBuffer> buffer = GbmBuffer::CreateBuffer( | 289 scoped_refptr<GbmBuffer> buffer = GbmBuffer::CreateBuffer( |
| 289 buffer_->drm().get(), format, size, buffer_->GetFlags()); | 290 buffer_->drm().get(), format, size, buffer_->GetFlags()); |
| 290 if (!buffer) | 291 if (!buffer) |
| 291 return nullptr; | 292 return nullptr; |
| 292 | 293 |
| 293 // ProcessBuffer is called on DrmThread. We could have used | 294 // ProcessBuffer is called on DrmThread. We could have used |
| 294 // CreateNativePixmap to initialize the pixmap, however it posts a | 295 // CreateNativePixmap to initialize the pixmap, however it posts a |
| 295 // synchronous task to DrmThread resulting in a deadlock. | 296 // synchronous task to DrmThread resulting in a deadlock. |
| 296 processed_pixmap_ = new GbmPixmap(surface_manager_, buffer); | 297 processed_pixmap_ = new GbmPixmap(surface_manager_, buffer); |
| 297 } | 298 } |
| 298 | 299 |
| 299 DCHECK(!processing_callback_.is_null()); | 300 DCHECK(!processing_callback_.is_null()); |
| 300 if (!processing_callback_.Run(this, processed_pixmap_)) { | 301 if (!processing_callback_.Run(this, processed_pixmap_)) { |
| 301 LOG(ERROR) << "Failed processing NativePixmap"; | 302 LOG(ERROR) << "Failed processing NativePixmap"; |
| 302 return nullptr; | 303 return nullptr; |
| 303 } | 304 } |
| 304 | 305 |
| 305 return processed_pixmap_->buffer(); | 306 return processed_pixmap_->buffer(); |
| 306 } | 307 } |
| 307 | 308 |
| 308 } // namespace ui | 309 } // namespace ui |
| OLD | NEW |