OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "cc/output/ca_layer_overlay.h" | 5 #include "cc/output/ca_layer_overlay.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "cc/quads/render_pass_draw_quad.h" | 8 #include "cc/quads/render_pass_draw_quad.h" |
9 #include "cc/quads/solid_color_draw_quad.h" | 9 #include "cc/quads/solid_color_draw_quad.h" |
10 #include "cc/quads/stream_video_draw_quad.h" | 10 #include "cc/quads/stream_video_draw_quad.h" |
11 #include "cc/quads/texture_draw_quad.h" | 11 #include "cc/quads/texture_draw_quad.h" |
12 #include "cc/quads/tile_draw_quad.h" | 12 #include "cc/quads/tile_draw_quad.h" |
13 #include "cc/resources/resource_provider.h" | 13 #include "cc/resources/resource_provider.h" |
14 #include "gpu/GLES2/gl2extchromium.h" | 14 #include "gpu/GLES2/gl2extchromium.h" |
15 | 15 |
16 namespace cc { | 16 namespace cc { |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 bool g_allow_rpdq_quad_conversion = false; | |
21 | |
22 // This enum is used for histogram states and should only have new values added | 20 // This enum is used for histogram states and should only have new values added |
23 // to the end before COUNT. | 21 // to the end before COUNT. |
24 enum CALayerResult { | 22 enum CALayerResult { |
25 CA_LAYER_SUCCESS = 0, | 23 CA_LAYER_SUCCESS = 0, |
26 CA_LAYER_FAILED_UNKNOWN, | 24 CA_LAYER_FAILED_UNKNOWN, |
27 CA_LAYER_FAILED_IO_SURFACE_NOT_CANDIDATE, | 25 CA_LAYER_FAILED_IO_SURFACE_NOT_CANDIDATE, |
28 CA_LAYER_FAILED_STREAM_VIDEO_NOT_CANDIDATE, | 26 CA_LAYER_FAILED_STREAM_VIDEO_NOT_CANDIDATE, |
29 CA_LAYER_FAILED_STREAM_VIDEO_TRANSFORM, | 27 CA_LAYER_FAILED_STREAM_VIDEO_TRANSFORM, |
30 CA_LAYER_FAILED_TEXTURE_NOT_CANDIDATE, | 28 CA_LAYER_FAILED_TEXTURE_NOT_CANDIDATE, |
31 CA_LAYER_FAILED_TEXTURE_Y_FLIPPED, | 29 CA_LAYER_FAILED_TEXTURE_Y_FLIPPED, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 75 |
78 for (const FilterOperation& operation : quad->filters.operations()) { | 76 for (const FilterOperation& operation : quad->filters.operations()) { |
79 bool success = FilterOperationSupported(operation); | 77 bool success = FilterOperationSupported(operation); |
80 if (!success) | 78 if (!success) |
81 return CA_LAYER_FAILED_RENDER_PASS_FILTER_OPERATION; | 79 return CA_LAYER_FAILED_RENDER_PASS_FILTER_OPERATION; |
82 } | 80 } |
83 | 81 |
84 ca_layer_overlay->rpdq = quad; | 82 ca_layer_overlay->rpdq = quad; |
85 ca_layer_overlay->contents_rect = gfx::RectF(0, 0, 1, 1); | 83 ca_layer_overlay->contents_rect = gfx::RectF(0, 0, 1, 1); |
86 | 84 |
87 // TODO(erikchen): Enable this when RenderPassDrawQuad promotion to CALayer | 85 return CA_LAYER_SUCCESS; |
88 // is fully functional. https://crbug.com/581526. | |
89 if (g_allow_rpdq_quad_conversion) | |
90 return CA_LAYER_SUCCESS; | |
91 return CA_LAYER_FAILED_RENDER_PASS; | |
92 } | 86 } |
93 | 87 |
94 CALayerResult FromStreamVideoQuad(ResourceProvider* resource_provider, | 88 CALayerResult FromStreamVideoQuad(ResourceProvider* resource_provider, |
95 const StreamVideoDrawQuad* quad, | 89 const StreamVideoDrawQuad* quad, |
96 CALayerOverlay* ca_layer_overlay) { | 90 CALayerOverlay* ca_layer_overlay) { |
97 unsigned resource_id = quad->resource_id(); | 91 unsigned resource_id = quad->resource_id(); |
98 if (!resource_provider->IsOverlayCandidate(resource_id)) | 92 if (!resource_provider->IsOverlayCandidate(resource_id)) |
99 return CA_LAYER_FAILED_STREAM_VIDEO_NOT_CANDIDATE; | 93 return CA_LAYER_FAILED_STREAM_VIDEO_NOT_CANDIDATE; |
100 ca_layer_overlay->contents_resource_id = resource_id; | 94 ca_layer_overlay->contents_resource_id = resource_id; |
101 // TODO(ccameron): Support merging at least some basic transforms into the | 95 // TODO(ccameron): Support merging at least some basic transforms into the |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 UMA_HISTOGRAM_ENUMERATION("Compositing.Renderer.CALayerResult", result, | 291 UMA_HISTOGRAM_ENUMERATION("Compositing.Renderer.CALayerResult", result, |
298 CA_LAYER_FAILED_COUNT); | 292 CA_LAYER_FAILED_COUNT); |
299 | 293 |
300 if (result != CA_LAYER_SUCCESS) { | 294 if (result != CA_LAYER_SUCCESS) { |
301 ca_layer_overlays->clear(); | 295 ca_layer_overlays->clear(); |
302 return false; | 296 return false; |
303 } | 297 } |
304 return true; | 298 return true; |
305 } | 299 } |
306 | 300 |
307 void EnableRenderPassDrawQuadForTesting() { | |
308 g_allow_rpdq_quad_conversion = true; | |
309 } | |
310 | |
311 } // namespace cc | 301 } // namespace cc |
OLD | NEW |