Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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/gl_renderer.h" | 5 #include "cc/output/gl_renderer.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| 11 #include <limits> | 11 #include <limits> |
| 12 #include <memory> | 12 #include <memory> |
| 13 #include <numeric> | 13 #include <numeric> |
| 14 #include <set> | 14 #include <set> |
| 15 #include <string> | 15 #include <string> |
| 16 #include <vector> | 16 #include <vector> |
| 17 | 17 |
| 18 #include "base/command_line.h" | |
| 18 #include "base/feature_list.h" | 19 #include "base/feature_list.h" |
| 19 #include "base/logging.h" | 20 #include "base/logging.h" |
| 20 #include "base/macros.h" | 21 #include "base/macros.h" |
| 21 #include "base/memory/ptr_util.h" | 22 #include "base/memory/ptr_util.h" |
| 22 #include "base/strings/string_split.h" | 23 #include "base/strings/string_split.h" |
| 23 #include "base/strings/string_util.h" | 24 #include "base/strings/string_util.h" |
| 24 #include "base/strings/stringprintf.h" | 25 #include "base/strings/stringprintf.h" |
| 25 #include "base/threading/thread_task_runner_handle.h" | 26 #include "base/threading/thread_task_runner_handle.h" |
| 26 #include "base/trace_event/trace_event.h" | 27 #include "base/trace_event/trace_event.h" |
| 27 #include "build/build_config.h" | 28 #include "build/build_config.h" |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 55 #include "media/base/media_switches.h" | 56 #include "media/base/media_switches.h" |
| 56 #include "skia/ext/texture_handle.h" | 57 #include "skia/ext/texture_handle.h" |
| 57 #include "third_party/skia/include/core/SkBitmap.h" | 58 #include "third_party/skia/include/core/SkBitmap.h" |
| 58 #include "third_party/skia/include/core/SkColor.h" | 59 #include "third_party/skia/include/core/SkColor.h" |
| 59 #include "third_party/skia/include/core/SkColorFilter.h" | 60 #include "third_party/skia/include/core/SkColorFilter.h" |
| 60 #include "third_party/skia/include/core/SkImage.h" | 61 #include "third_party/skia/include/core/SkImage.h" |
| 61 #include "third_party/skia/include/core/SkSurface.h" | 62 #include "third_party/skia/include/core/SkSurface.h" |
| 62 #include "third_party/skia/include/gpu/GrContext.h" | 63 #include "third_party/skia/include/gpu/GrContext.h" |
| 63 #include "third_party/skia/include/gpu/gl/GrGLInterface.h" | 64 #include "third_party/skia/include/gpu/gl/GrGLInterface.h" |
| 64 #include "third_party/skia/include/gpu/gl/GrGLTypes.h" | 65 #include "third_party/skia/include/gpu/gl/GrGLTypes.h" |
| 66 #include "ui/display/display_switches.h" | |
| 65 #include "ui/gfx/color_space.h" | 67 #include "ui/gfx/color_space.h" |
| 66 #include "ui/gfx/color_transform.h" | 68 #include "ui/gfx/color_transform.h" |
| 67 #include "ui/gfx/geometry/quad_f.h" | 69 #include "ui/gfx/geometry/quad_f.h" |
| 68 #include "ui/gfx/geometry/rect_conversions.h" | 70 #include "ui/gfx/geometry/rect_conversions.h" |
| 69 #include "ui/gfx/skia_util.h" | 71 #include "ui/gfx/skia_util.h" |
| 70 | 72 |
| 71 using gpu::gles2::GLES2Interface; | 73 using gpu::gles2::GLES2Interface; |
| 72 | 74 |
| 73 namespace cc { | 75 namespace cc { |
| 74 namespace { | 76 namespace { |
| (...skipping 1979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2054 quad->v_plane_resource_id() == quad->u_plane_resource_id() | 2056 quad->v_plane_resource_id() == quad->u_plane_resource_id() |
| 2055 ? UV_TEXTURE_MODE_UV | 2057 ? UV_TEXTURE_MODE_UV |
| 2056 : UV_TEXTURE_MODE_U_V; | 2058 : UV_TEXTURE_MODE_U_V; |
| 2057 | 2059 |
| 2058 // TODO(ccameron): There are currently three sources of the color space: the | 2060 // TODO(ccameron): There are currently three sources of the color space: the |
| 2059 // resource, quad->color_space, and quad->video_color_space. Remove two of | 2061 // resource, quad->color_space, and quad->video_color_space. Remove two of |
| 2060 // them. | 2062 // them. |
| 2061 gfx::ColorSpace src_color_space = quad->video_color_space; | 2063 gfx::ColorSpace src_color_space = quad->video_color_space; |
| 2062 gfx::ColorSpace dst_color_space = | 2064 gfx::ColorSpace dst_color_space = |
| 2063 current_frame()->current_render_pass->color_space; | 2065 current_frame()->current_render_pass->color_space; |
| 2064 if (!base::FeatureList::IsEnabled(media::kVideoColorManagement)) { | 2066 if (!base::FeatureList::IsEnabled(media::kVideoColorManagement) && |
| 2067 !base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 2068 switches::kEnableHDR)) { | |
|
ccameron
2017/03/25 00:19:13
Settings are sent to cc/ via the cc::RendererSetti
hubbe
2017/03/27 21:35:17
option B sounds good.
| |
| 2065 if (!settings_->enable_color_correct_rendering) | 2069 if (!settings_->enable_color_correct_rendering) |
| 2066 dst_color_space = gfx::ColorSpace(); | 2070 dst_color_space = gfx::ColorSpace(); |
| 2067 switch (quad->color_space) { | 2071 switch (quad->color_space) { |
| 2068 case YUVVideoDrawQuad::REC_601: | 2072 case YUVVideoDrawQuad::REC_601: |
| 2069 src_color_space = gfx::ColorSpace::CreateREC601(); | 2073 src_color_space = gfx::ColorSpace::CreateREC601(); |
| 2070 break; | 2074 break; |
| 2071 case YUVVideoDrawQuad::REC_709: | 2075 case YUVVideoDrawQuad::REC_709: |
| 2072 src_color_space = gfx::ColorSpace::CreateREC709(); | 2076 src_color_space = gfx::ColorSpace::CreateREC709(); |
| 2073 break; | 2077 break; |
| 2074 case YUVVideoDrawQuad::JPEG: | 2078 case YUVVideoDrawQuad::JPEG: |
| (...skipping 1511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3586 return; | 3590 return; |
| 3587 | 3591 |
| 3588 // Report GPU overdraw as a percentage of |max_result|. | 3592 // Report GPU overdraw as a percentage of |max_result|. |
| 3589 TRACE_COUNTER1( | 3593 TRACE_COUNTER1( |
| 3590 TRACE_DISABLED_BY_DEFAULT("cc.debug.overdraw"), "GPU Overdraw", | 3594 TRACE_DISABLED_BY_DEFAULT("cc.debug.overdraw"), "GPU Overdraw", |
| 3591 (std::accumulate(overdraw->begin(), overdraw->end(), 0) * 100) / | 3595 (std::accumulate(overdraw->begin(), overdraw->end(), 0) * 100) / |
| 3592 max_result); | 3596 max_result); |
| 3593 } | 3597 } |
| 3594 | 3598 |
| 3595 } // namespace cc | 3599 } // namespace cc |
| OLD | NEW |