| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/renderer_host/compositor_impl_android.h" | 5 #include "content/browser/renderer_host/compositor_impl_android.h" |
| 6 | 6 |
| 7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
| 8 #include <android/native_window_jni.h> | 8 #include <android/native_window_jni.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <unordered_set> | 10 #include <unordered_set> |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 gpu::gles2::ContextCreationAttribHelper attributes; | 162 gpu::gles2::ContextCreationAttribHelper attributes; |
| 163 attributes.alpha_size = -1; | 163 attributes.alpha_size = -1; |
| 164 attributes.stencil_size = 0; | 164 attributes.stencil_size = 0; |
| 165 attributes.depth_size = 0; | 165 attributes.depth_size = 0; |
| 166 attributes.samples = 0; | 166 attributes.samples = 0; |
| 167 attributes.sample_buffers = 0; | 167 attributes.sample_buffers = 0; |
| 168 attributes.bind_generates_resource = false; | 168 attributes.bind_generates_resource = false; |
| 169 | 169 |
| 170 if (has_transparent_background) { | 170 if (has_transparent_background) { |
| 171 attributes.alpha_size = 8; | 171 attributes.alpha_size = 8; |
| 172 } else if (base::SysInfo::IsLowEndDevice()) { | 172 } else if (base::SysInfo::AmountOfPhysicalMemoryMB() <= 512) { |
| 173 // In this case we prefer to use RGB565 format instead of RGBA8888 if | 173 // In this case we prefer to use RGB565 format instead of RGBA8888 if |
| 174 // possible. | 174 // possible. |
| 175 // TODO(danakj): GpuCommandBufferStub constructor checks for alpha == 0 in | 175 // TODO(danakj): GpuCommandBufferStub constructor checks for alpha == 0 in |
| 176 // order to enable 565, but it should avoid using 565 when -1s are | 176 // order to enable 565, but it should avoid using 565 when -1s are |
| 177 // specified | 177 // specified |
| 178 // (IOW check that a <= 0 && rgb > 0 && rgb <= 565) then alpha should be | 178 // (IOW check that a <= 0 && rgb > 0 && rgb <= 565) then alpha should be |
| 179 // -1. | 179 // -1. |
| 180 // TODO(liberato): This condition is memorized in ComositorView.java, to | 180 // TODO(liberato): This condition is memorized in ComositorView.java, to |
| 181 // avoid using two surfaces temporarily during alpha <-> no alpha | 181 // avoid using two surfaces temporarily during alpha <-> no alpha |
| 182 // transitions. If these mismatch, then we risk a power regression if the | 182 // transitions. If these mismatch, then we risk a power regression if the |
| (...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 869 } | 869 } |
| 870 GetSurfaceManager()->UnregisterFrameSinkHierarchy(frame_sink_id_, | 870 GetSurfaceManager()->UnregisterFrameSinkHierarchy(frame_sink_id_, |
| 871 frame_sink_id); | 871 frame_sink_id); |
| 872 } | 872 } |
| 873 | 873 |
| 874 bool CompositorImpl::HavePendingReadbacks() { | 874 bool CompositorImpl::HavePendingReadbacks() { |
| 875 return !readback_layer_tree_->children().empty(); | 875 return !readback_layer_tree_->children().empty(); |
| 876 } | 876 } |
| 877 | 877 |
| 878 } // namespace content | 878 } // namespace content |
| OLD | NEW |