Chromium Code Reviews| Index: ui/ozone/platform/dri/dri_buffer.cc |
| diff --git a/ui/ozone/platform/dri/dri_buffer.cc b/ui/ozone/platform/dri/dri_buffer.cc |
| index 547b3ca666186c84b9d00eb44e185b6553be77fe..2d3e47a2ae5686178d2629f5d947bc6ceaaabb2b 100644 |
| --- a/ui/ozone/platform/dri/dri_buffer.cc |
| +++ b/ui/ozone/platform/dri/dri_buffer.cc |
| @@ -53,20 +53,17 @@ DriBuffer::~DriBuffer() { |
| dri_->DestroyDumbBuffer(info, handle_, stride_, pixels); |
| } |
| -bool DriBuffer::Initialize(const SkImageInfo& info) { |
| +bool DriBuffer::Initialize(const SkImageInfo& info, bool is_scanout) { |
| void* pixels = NULL; |
| if (!dri_->CreateDumbBuffer(info, &handle_, &stride_, &pixels)) { |
| VLOG(2) << "Cannot create drm dumb buffer"; |
| return false; |
| } |
| - if (!dri_->AddFramebuffer(info.width(), |
| - info.height(), |
| - GetColorDepth(info.colorType()), |
| - info.bytesPerPixel() << 3, |
| - stride_, |
| - handle_, |
| - &framebuffer_)) { |
| + if (is_scanout && |
| + !dri_->AddFramebuffer( |
| + info.width(), info.height(), GetColorDepth(info.colorType()), |
| + 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
|
| VLOG(2) << "Failed to register framebuffer: " << strerror(errno); |
| return false; |
| } |
| @@ -106,7 +103,7 @@ scoped_refptr<ScanoutBuffer> DriBufferGenerator::Create( |
| const gfx::Size& size) { |
| scoped_refptr<DriBuffer> buffer(new DriBuffer(drm)); |
| SkImageInfo info = SkImageInfo::MakeN32Premul(size.width(), size.height()); |
| - if (!buffer->Initialize(info)) |
| + if (!buffer->Initialize(info, true)) |
| return NULL; |
| return buffer; |