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_surface.h" | 5 #include "ui/ozone/platform/drm/gpu/gbm_surface.h" |
6 | 6 |
7 #include <gbm.h> | 7 #include <gbm.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 // release this buffer, keep a self-reference in order to keep this alive. | 37 // release this buffer, keep a self-reference in order to keep this alive. |
38 // When GBM calls Destroy(..) the self-reference will dissapear and this will | 38 // When GBM calls Destroy(..) the self-reference will dissapear and this will |
39 // be destroyed. | 39 // be destroyed. |
40 scoped_refptr<GbmSurfaceBuffer> self_; | 40 scoped_refptr<GbmSurfaceBuffer> self_; |
41 | 41 |
42 DISALLOW_COPY_AND_ASSIGN(GbmSurfaceBuffer); | 42 DISALLOW_COPY_AND_ASSIGN(GbmSurfaceBuffer); |
43 }; | 43 }; |
44 | 44 |
45 GbmSurfaceBuffer::GbmSurfaceBuffer(const scoped_refptr<DrmDevice>& drm, | 45 GbmSurfaceBuffer::GbmSurfaceBuffer(const scoped_refptr<DrmDevice>& drm, |
46 gbm_bo* bo) | 46 gbm_bo* bo) |
47 : GbmBufferBase(drm, bo, true) { | 47 : GbmBufferBase(drm, bo) { |
48 if (GetFramebufferId()) { | 48 if (GetFramebufferId()) { |
49 self_ = this; | 49 self_ = this; |
50 gbm_bo_set_user_data(bo, this, GbmSurfaceBuffer::Destroy); | 50 gbm_bo_set_user_data(bo, this, GbmSurfaceBuffer::Destroy); |
51 } | 51 } |
52 } | 52 } |
53 | 53 |
54 GbmSurfaceBuffer::~GbmSurfaceBuffer() { | 54 GbmSurfaceBuffer::~GbmSurfaceBuffer() { |
55 } | 55 } |
56 | 56 |
57 // static | 57 // static |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 gbm_bo* pending_buffer) { | 167 gbm_bo* pending_buffer) { |
168 // If there was a frontbuffer, it is no longer active. Release it back to GBM. | 168 // If there was a frontbuffer, it is no longer active. Release it back to GBM. |
169 if (current_buffer_) | 169 if (current_buffer_) |
170 gbm_surface_release_buffer(native_surface_, current_buffer_); | 170 gbm_surface_release_buffer(native_surface_, current_buffer_); |
171 | 171 |
172 current_buffer_ = pending_buffer; | 172 current_buffer_ = pending_buffer; |
173 callback.Run(); | 173 callback.Run(); |
174 } | 174 } |
175 | 175 |
176 } // namespace ui | 176 } // namespace ui |
OLD | NEW |