Chromium Code Reviews| 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/drm_buffer.h" | 5 #include "ui/ozone/platform/drm/gpu/drm_buffer.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 20 matching lines...) Expand all Loading... | |
| 31 return 0; | 31 return 0; |
| 32 } | 32 } |
| 33 } | 33 } |
| 34 | 34 |
| 35 } // namespace | 35 } // namespace |
| 36 | 36 |
| 37 DrmBuffer::DrmBuffer(const scoped_refptr<DrmDevice>& drm) : drm_(drm) { | 37 DrmBuffer::DrmBuffer(const scoped_refptr<DrmDevice>& drm) : drm_(drm) { |
| 38 } | 38 } |
| 39 | 39 |
| 40 DrmBuffer::~DrmBuffer() { | 40 DrmBuffer::~DrmBuffer() { |
| 41 surface_.clear(); | |
|
f(malita)
2016/04/05 14:31:52
I think we should leave this alone (security/DRM i
tomhudson
2016/04/05 14:52:50
I thought surface_->clear() would be significant,
f(malita)
2016/04/05 14:56:02
You're right - I was thinking this clears the surf
| |
| 42 | |
| 43 if (framebuffer_ && !drm_->RemoveFramebuffer(framebuffer_)) | 41 if (framebuffer_ && !drm_->RemoveFramebuffer(framebuffer_)) |
| 44 PLOG(ERROR) << "DrmBuffer: RemoveFramebuffer: fb " << framebuffer_; | 42 PLOG(ERROR) << "DrmBuffer: RemoveFramebuffer: fb " << framebuffer_; |
| 45 | 43 |
| 46 if (mmap_base_ && !drm_->UnmapDumbBuffer(mmap_base_, mmap_size_)) | 44 if (mmap_base_ && !drm_->UnmapDumbBuffer(mmap_base_, mmap_size_)) |
| 47 PLOG(ERROR) << "DrmBuffer: UnmapDumbBuffer: handle " << handle_; | 45 PLOG(ERROR) << "DrmBuffer: UnmapDumbBuffer: handle " << handle_; |
| 48 | 46 |
| 49 if (handle_ && !drm_->DestroyDumbBuffer(handle_)) | 47 if (handle_ && !drm_->DestroyDumbBuffer(handle_)) |
| 50 PLOG(ERROR) << "DrmBuffer: DestroyDumbBuffer: handle " << handle_; | 48 PLOG(ERROR) << "DrmBuffer: DestroyDumbBuffer: handle " << handle_; |
| 51 } | 49 } |
| 52 | 50 |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 71 strides[0] = stride_; | 69 strides[0] = stride_; |
| 72 uint32_t offsets[4] = {0}; | 70 uint32_t offsets[4] = {0}; |
| 73 fb_pixel_format_ = GetFourCCCodeForSkColorType(info.colorType()); | 71 fb_pixel_format_ = GetFourCCCodeForSkColorType(info.colorType()); |
| 74 if (!drm_->AddFramebuffer2(info.width(), info.height(), fb_pixel_format_, | 72 if (!drm_->AddFramebuffer2(info.width(), info.height(), fb_pixel_format_, |
| 75 handles, strides, offsets, &framebuffer_, 0)) { | 73 handles, strides, offsets, &framebuffer_, 0)) { |
| 76 PLOG(ERROR) << "DrmBuffer: AddFramebuffer2: handle " << handle_; | 74 PLOG(ERROR) << "DrmBuffer: AddFramebuffer2: handle " << handle_; |
| 77 return false; | 75 return false; |
| 78 } | 76 } |
| 79 } | 77 } |
| 80 | 78 |
| 81 surface_ = | 79 surface_ = SkSurface::MakeRasterDirect(info, mmap_base_, stride_); |
| 82 skia::AdoptRef(SkSurface::NewRasterDirect(info, mmap_base_, stride_)); | |
| 83 if (!surface_) { | 80 if (!surface_) { |
| 84 LOG(ERROR) << "DrmBuffer: Failed to create SkSurface: handle " << handle_; | 81 LOG(ERROR) << "DrmBuffer: Failed to create SkSurface: handle " << handle_; |
| 85 return false; | 82 return false; |
| 86 } | 83 } |
| 87 | 84 |
| 88 return true; | 85 return true; |
| 89 } | 86 } |
| 90 | 87 |
| 91 SkCanvas* DrmBuffer::GetCanvas() const { | 88 SkCanvas* DrmBuffer::GetCanvas() const { |
| 92 return surface_->getCanvas(); | 89 return surface_->getCanvas(); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 106 | 103 |
| 107 gfx::Size DrmBuffer::GetSize() const { | 104 gfx::Size DrmBuffer::GetSize() const { |
| 108 return gfx::Size(surface_->width(), surface_->height()); | 105 return gfx::Size(surface_->width(), surface_->height()); |
| 109 } | 106 } |
| 110 | 107 |
| 111 bool DrmBuffer::RequiresGlFinish() const { | 108 bool DrmBuffer::RequiresGlFinish() const { |
| 112 return false; | 109 return false; |
| 113 } | 110 } |
| 114 | 111 |
| 115 } // namespace ui | 112 } // namespace ui |
| OLD | NEW |