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

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

Issue 399213005: [Ozone-DRI] Adding ScanoutBuffer interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 5 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 | Annotate | Revision Log
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/gbm_surface.h" 5 #include "ui/ozone/platform/dri/gbm_surface.h"
6 6
7 #include <gbm.h> 7 #include <gbm.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "third_party/skia/include/core/SkImageInfo.h" 10 #include "third_party/skia/include/core/SkImageInfo.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 native_surface_ = gbm_surface_create( 44 native_surface_ = gbm_surface_create(
45 gbm_device_, 45 gbm_device_,
46 size_.width(), 46 size_.width(),
47 size_.height(), 47 size_.height(),
48 GBM_BO_FORMAT_XRGB8888, 48 GBM_BO_FORMAT_XRGB8888,
49 GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING); 49 GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING);
50 50
51 if (!native_surface_) 51 if (!native_surface_)
52 return false; 52 return false;
53 53
54 dumb_buffer_.reset(new DriBuffer(dri_)); 54 dumb_buffer_ = new DriBuffer(dri_);
55 if (!dumb_buffer_->Initialize(SkImageInfo::MakeN32Premul(size_.width(), 55 if (!dumb_buffer_->Initialize(SkImageInfo::MakeN32Premul(size_.width(),
56 size_.height()))) 56 size_.height())))
57 return false; 57 return false;
58 58
59 return true; 59 return true;
60 } 60 }
61 61
62 uint32_t GbmSurface::GetFramebufferId() const { 62 uint32_t GbmSurface::GetFramebufferId() const {
63 if (!buffers_[front_buffer_ ^ 1]) 63 if (!buffers_[front_buffer_ ^ 1])
64 return dumb_buffer_->framebuffer(); 64 return dumb_buffer_->GetFramebufferId();
65 65
66 BufferData* data = BufferData::GetData(buffers_[front_buffer_ ^ 1]); 66 BufferData* data = BufferData::GetData(buffers_[front_buffer_ ^ 1]);
67 CHECK(data); 67 CHECK(data);
68 return data->framebuffer(); 68 return data->framebuffer();
69 } 69 }
70 70
71 uint32_t GbmSurface::GetHandle() const { 71 uint32_t GbmSurface::GetHandle() const {
72 if (!buffers_[front_buffer_ ^ 1]) 72 if (!buffers_[front_buffer_ ^ 1])
73 return dumb_buffer_->handle(); 73 return dumb_buffer_->GetHandle();
74 74
75 BufferData* data = BufferData::GetData(buffers_[front_buffer_ ^ 1]); 75 BufferData* data = BufferData::GetData(buffers_[front_buffer_ ^ 1]);
76 CHECK(data); 76 CHECK(data);
77 return data->handle(); 77 return data->handle();
78 } 78 }
79 79
80 gfx::Size GbmSurface::Size() const { 80 gfx::Size GbmSurface::Size() const {
81 return size_; 81 return size_;
82 } 82 }
83 83
(...skipping 25 matching lines...) Expand all
109 109
110 // Update the index to the frontbuffer. 110 // Update the index to the frontbuffer.
111 front_buffer_ ^= 1; 111 front_buffer_ ^= 1;
112 // We've just released it. Since GBM doesn't guarantee we'll get the same 112 // We've just released it. Since GBM doesn't guarantee we'll get the same
113 // buffer back, we set it to NULL so we don't keep track of objects that may 113 // buffer back, we set it to NULL so we don't keep track of objects that may
114 // have been destroyed. 114 // have been destroyed.
115 buffers_[front_buffer_ ^ 1] = NULL; 115 buffers_[front_buffer_ ^ 1] = NULL;
116 } 116 }
117 117
118 } // namespace ui 118 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698