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

Side by Side Diff: ui/ozone/platform/dri/dri_buffer.cc

Issue 959953002: [Ozone-Dri] Do not call AddFramebuffer with cursor buffers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « ui/ozone/platform/dri/dri_buffer.h ('k') | ui/ozone/platform/dri/dri_surface.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/dri/dri_buffer.h" 5 #include "ui/ozone/platform/dri/dri_buffer.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ui/ozone/platform/dri/dri_wrapper.h" 8 #include "ui/ozone/platform/dri/dri_wrapper.h"
9 9
10 namespace ui { 10 namespace ui {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 dri_->RemoveFramebuffer(framebuffer_); 46 dri_->RemoveFramebuffer(framebuffer_);
47 47
48 SkImageInfo info; 48 SkImageInfo info;
49 void* pixels = const_cast<void*>(surface_->peekPixels(&info, NULL)); 49 void* pixels = const_cast<void*>(surface_->peekPixels(&info, NULL));
50 if (!pixels) 50 if (!pixels)
51 return; 51 return;
52 52
53 dri_->DestroyDumbBuffer(info, handle_, stride_, pixels); 53 dri_->DestroyDumbBuffer(info, handle_, stride_, pixels);
54 } 54 }
55 55
56 bool DriBuffer::Initialize(const SkImageInfo& info) { 56 bool DriBuffer::Initialize(const SkImageInfo& info, bool is_scanout) {
57 void* pixels = NULL; 57 void* pixels = NULL;
58 if (!dri_->CreateDumbBuffer(info, &handle_, &stride_, &pixels)) { 58 if (!dri_->CreateDumbBuffer(info, &handle_, &stride_, &pixels)) {
59 VLOG(2) << "Cannot create drm dumb buffer"; 59 VLOG(2) << "Cannot create drm dumb buffer";
60 return false; 60 return false;
61 } 61 }
62 62
63 if (!dri_->AddFramebuffer(info.width(), 63 if (is_scanout &&
64 info.height(), 64 !dri_->AddFramebuffer(
65 GetColorDepth(info.colorType()), 65 info.width(), info.height(), GetColorDepth(info.colorType()),
66 info.bytesPerPixel() << 3, 66 info.bytesPerPixel() << 3, stride_, handle_, &framebuffer_)) {
spang 2015/02/25 22:30:01 Can you move this to a 2nd function?
dnicoara 2015/02/25 22:48:56 Why do you want to split it in another function? I
67 stride_,
68 handle_,
69 &framebuffer_)) {
70 VLOG(2) << "Failed to register framebuffer: " << strerror(errno); 67 VLOG(2) << "Failed to register framebuffer: " << strerror(errno);
71 return false; 68 return false;
72 } 69 }
73 70
74 surface_ = skia::AdoptRef(SkSurface::NewRasterDirect(info, pixels, stride_)); 71 surface_ = skia::AdoptRef(SkSurface::NewRasterDirect(info, pixels, stride_));
75 if (!surface_) { 72 if (!surface_) {
76 VLOG(2) << "Cannot install Skia pixels for drm buffer"; 73 VLOG(2) << "Cannot install Skia pixels for drm buffer";
77 return false; 74 return false;
78 } 75 }
79 76
(...skipping 19 matching lines...) Expand all
99 DriBufferGenerator::DriBufferGenerator() { 96 DriBufferGenerator::DriBufferGenerator() {
100 } 97 }
101 98
102 DriBufferGenerator::~DriBufferGenerator() {} 99 DriBufferGenerator::~DriBufferGenerator() {}
103 100
104 scoped_refptr<ScanoutBuffer> DriBufferGenerator::Create( 101 scoped_refptr<ScanoutBuffer> DriBufferGenerator::Create(
105 const scoped_refptr<DriWrapper>& drm, 102 const scoped_refptr<DriWrapper>& drm,
106 const gfx::Size& size) { 103 const gfx::Size& size) {
107 scoped_refptr<DriBuffer> buffer(new DriBuffer(drm)); 104 scoped_refptr<DriBuffer> buffer(new DriBuffer(drm));
108 SkImageInfo info = SkImageInfo::MakeN32Premul(size.width(), size.height()); 105 SkImageInfo info = SkImageInfo::MakeN32Premul(size.width(), size.height());
109 if (!buffer->Initialize(info)) 106 if (!buffer->Initialize(info, true))
110 return NULL; 107 return NULL;
111 108
112 return buffer; 109 return buffer;
113 } 110 }
114 111
115 } // namespace ui 112 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/dri/dri_buffer.h ('k') | ui/ozone/platform/dri/dri_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698