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

Side by Side Diff: content/browser/gpu/gpu_blacklist.cc

Issue 7967020: Implement --use-gl=any (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 3 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/gpu/gpu_blacklist.h" 5 #include "content/browser/gpu/gpu_blacklist.h"
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/string_piece.h" 10 #include "base/string_piece.h"
(...skipping 16 matching lines...) Expand all
27 if (pieces.size() != 3) 27 if (pieces.size() != 3)
28 return NULL; 28 return NULL;
29 std::string date_as_version_string = pieces[2]; 29 std::string date_as_version_string = pieces[2];
30 for (size_t i = 0; i < 2; ++i) { 30 for (size_t i = 0; i < 2; ++i) {
31 date_as_version_string += "."; 31 date_as_version_string += ".";
32 date_as_version_string += pieces[i]; 32 date_as_version_string += pieces[i];
33 } 33 }
34 return Version::GetVersionFromString(date_as_version_string); 34 return Version::GetVersionFromString(date_as_version_string);
35 } 35 }
36 36
37 Value* NewStatusValue(const char* name, const char* status)
38 {
39 DictionaryValue* value = new DictionaryValue();
40 value->SetString("name", name);
41 value->SetString("status", status);
42 return value;
43 }
44
45 } // namespace anonymous 37 } // namespace anonymous
46 38
47 GpuBlacklist::VersionInfo::VersionInfo(const std::string& version_op, 39 GpuBlacklist::VersionInfo::VersionInfo(const std::string& version_op,
48 const std::string& version_string, 40 const std::string& version_string,
49 const std::string& version_string2) { 41 const std::string& version_string2) {
50 op_ = StringToOp(version_op); 42 op_ = StringToOp(version_op);
51 if (op_ == kUnknown || op_ == kAny) 43 if (op_ == kUnknown || op_ == kAny)
52 return; 44 return;
53 version_.reset(Version::GetVersionFromString(version_string)); 45 version_.reset(Version::GetVersionFromString(version_string));
54 if (version_.get() == NULL) { 46 if (version_.get() == NULL) {
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 void GpuBlacklist::GetGpuFeatureFlagEntries( 754 void GpuBlacklist::GetGpuFeatureFlagEntries(
763 GpuFeatureFlags::GpuFeatureType feature, 755 GpuFeatureFlags::GpuFeatureType feature,
764 std::vector<uint32>& entry_ids) const { 756 std::vector<uint32>& entry_ids) const {
765 entry_ids.clear(); 757 entry_ids.clear();
766 for (size_t i = 0; i < active_entries_.size(); ++i) { 758 for (size_t i = 0; i < active_entries_.size(); ++i) {
767 if ((feature & active_entries_[i]->GetGpuFeatureFlags().flags()) != 0) 759 if ((feature & active_entries_[i]->GetGpuFeatureFlags().flags()) != 0)
768 entry_ids.push_back(active_entries_[i]->id()); 760 entry_ids.push_back(active_entries_[i]->id());
769 } 761 }
770 } 762 }
771 763
772 bool GpuBlacklist::IsFeatureBlacklisted( 764 void GpuBlacklist::GetBlacklistReasons(ListValue* problem_list) const {
773 GpuFeatureFlags::GpuFeatureType feature) const 765 DCHECK(problem_list);
774 {
775 for (size_t i = 0; i < active_entries_.size(); ++i) { 766 for (size_t i = 0; i < active_entries_.size(); ++i) {
776 if (active_entries_[i]->GetGpuFeatureFlags().flags() & feature) 767 GpuBlacklistEntry* entry = active_entries_[i];
777 return true; 768 DictionaryValue* problem = new DictionaryValue();
769
770 problem->SetString("description", entry->description());
771
772 ListValue* cr_bugs = new ListValue();
773 for (size_t j = 0; j < entry->cr_bugs().size(); ++j)
774 cr_bugs->Append(Value::CreateIntegerValue(entry->cr_bugs()[j]));
775 problem->Set("crBugs", cr_bugs);
776
777 ListValue* webkit_bugs = new ListValue();
778 for (size_t j = 0; j < entry->webkit_bugs().size(); ++j) {
779 webkit_bugs->Append(Value::CreateIntegerValue(
780 entry->webkit_bugs()[j]));
781 }
782 problem->Set("webkitBugs", webkit_bugs);
783
784 problem_list->Append(problem);
778 } 785 }
779 return false;
780 }
781
782 Value* GpuBlacklist::GetFeatureStatus(bool gpu_access_allowed,
783 bool disable_accelerated_compositing,
784 bool disable_accelerated_2D_canvas,
785 bool disable_experimental_webgl,
786 bool disable_multisampling) const {
787 DictionaryValue* status = new DictionaryValue();
788
789 // Build the feature_status field.
790 {
791 ListValue* feature_status_list = new ListValue();
792
793 // 2d_canvas.
794 if (!gpu_access_allowed) {
795 if (disable_accelerated_2D_canvas)
796 feature_status_list->Append(NewStatusValue("2d_canvas",
797 "software"));
798 else
799 feature_status_list->Append(NewStatusValue("2d_canvas",
800 "unavailable_software"));
801 } else if (!disable_accelerated_2D_canvas) {
802 if (IsFeatureBlacklisted(
803 GpuFeatureFlags::kGpuFeatureAccelerated2dCanvas))
804 feature_status_list->Append(NewStatusValue("2d_canvas",
805 "unavailable_software"));
806 else if (disable_accelerated_compositing)
807 feature_status_list->Append(NewStatusValue("2d_canvas",
808 "disabled_software"));
809 else
810 feature_status_list->Append(NewStatusValue("2d_canvas",
811 "enabled"));
812 } else {
813 feature_status_list->Append(NewStatusValue("2d_canvas",
814 "software"));
815 }
816
817 // 3d css and compositing.
818 if (!gpu_access_allowed) {
819 feature_status_list->Append(NewStatusValue("3d_css",
820 "unavailable_off"));
821 feature_status_list->Append(NewStatusValue("compositing",
822 "unavailable_software"));
823 } else if (disable_accelerated_compositing) {
824 feature_status_list->Append(NewStatusValue("3d_css",
825 "unavailable_off"));
826 feature_status_list->Append(NewStatusValue("compositing",
827 "disabled_software"));
828 } else if (IsFeatureBlacklisted(
829 GpuFeatureFlags::kGpuFeatureAcceleratedCompositing)) {
830 feature_status_list->Append(NewStatusValue("3d_css",
831 "unavailable_off"));
832 feature_status_list->Append(NewStatusValue("compositing",
833 "disabled_software"));
834 } else {
835 feature_status_list->Append(NewStatusValue("3d_css",
836 "enabled"));
837 feature_status_list->Append(NewStatusValue("compositing",
838 "enabled"));
839 }
840
841 // webgl
842 if (!gpu_access_allowed)
843 feature_status_list->Append(NewStatusValue("webgl",
844 "unavailable_off"));
845 else if (disable_experimental_webgl)
846 feature_status_list->Append(NewStatusValue("webgl",
847 "disabled_off"));
848 else if (IsFeatureBlacklisted(
849 GpuFeatureFlags::kGpuFeatureWebgl))
850 feature_status_list->Append(NewStatusValue("webgl",
851 "unavailable_off"));
852 else if (disable_accelerated_compositing)
853 feature_status_list->Append(NewStatusValue("webgl",
854 "enabled_readback"));
855 else
856 feature_status_list->Append(NewStatusValue("webgl",
857 "enabled"));
858
859 // multisampling
860 if (!gpu_access_allowed)
861 feature_status_list->Append(NewStatusValue("multisampling",
862 "unavailable_off"));
863 else if (disable_multisampling)
864 feature_status_list->Append(NewStatusValue("multisampling",
865 "disabled_off"));
866 else if (IsFeatureBlacklisted(
867 GpuFeatureFlags::kGpuFeatureMultisampling))
868 feature_status_list->Append(NewStatusValue("multisampling",
869 "disabled_off"));
870 else
871 feature_status_list->Append(NewStatusValue("multisampling",
872 "enabled"));
873
874 status->Set("featureStatus", feature_status_list);
875 }
876
877 // Build the problems list.
878 {
879 ListValue* problem_list = new ListValue();
880 if (!gpu_access_allowed) {
881 DictionaryValue* problem = new DictionaryValue();
882 problem->SetString("description",
883 "GPU process was unable to boot. Access to GPU disallowed.");
884 problem->Set("crBugs", new ListValue());
885 problem->Set("webkitBugs", new ListValue());
886 problem_list->Append(problem);
887 }
888 if (disable_accelerated_2D_canvas) {
889 DictionaryValue* problem = new DictionaryValue();
890 problem->SetString("description",
891 "Accelerated 2D canvas has been disabled at the command line");
892 problem->Set("crBugs", new ListValue());
893 problem->Set("webkitBugs", new ListValue());
894 problem_list->Append(problem);
895 }
896 if (disable_accelerated_compositing) {
897 DictionaryValue* problem = new DictionaryValue();
898 problem->SetString("description",
899 "Accelerated compositing has been disabled, either via about:flags "
900 "or command line. This adversely affects performance of all hardware "
901 " accelerated features.");
902 problem->Set("crBugs", new ListValue());
903 problem->Set("webkitBugs", new ListValue());
904 problem_list->Append(problem);
905 }
906 if (disable_experimental_webgl) {
907 DictionaryValue* problem = new DictionaryValue();
908 problem->SetString("description",
909 "WebGL has been disabled, either via about:flags "
910 "or command line");
911 problem->Set("crBugs", new ListValue());
912 problem->Set("webkitBugs", new ListValue());
913 problem_list->Append(problem);
914 }
915 if (disable_multisampling) {
916 DictionaryValue* problem = new DictionaryValue();
917 problem->SetString("description",
918 "Multisampling has been disabled, either via about:flags "
919 "or command line");
920 problem->Set("crBugs", new ListValue());
921 problem->Set("webkitBugs", new ListValue());
922 problem_list->Append(problem);
923 }
924 for (size_t i = 0; i < active_entries_.size(); ++i) {
925 ScopedGpuBlacklistEntry entry = active_entries_[i];
926 DictionaryValue* problem = new DictionaryValue();
927
928 problem->SetString("description", entry->description());
929
930 ListValue* cr_bugs = new ListValue();
931 for (size_t j = 0; j < entry->cr_bugs().size(); ++j)
932 cr_bugs->Append(Value::CreateIntegerValue(
933 entry->cr_bugs()[j]));
934 problem->Set("crBugs", cr_bugs);
935
936 ListValue* webkit_bugs = new ListValue();
937 for (size_t j = 0; j < entry->webkit_bugs().size(); ++j)
938 webkit_bugs->Append(Value::CreateIntegerValue(
939 entry->webkit_bugs()[j]));
940 problem->Set("webkitBugs", webkit_bugs);
941
942 problem_list->Append(problem);
943 }
944 status->Set("problems", problem_list);
945 }
946 return status;
947 } 786 }
948 787
949 size_t GpuBlacklist::num_entries() const { 788 size_t GpuBlacklist::num_entries() const {
950 return blacklist_.size(); 789 return blacklist_.size();
951 } 790 }
952 791
953 uint32 GpuBlacklist::max_entry_id() const { 792 uint32 GpuBlacklist::max_entry_id() const {
954 return max_entry_id_; 793 return max_entry_id_;
955 } 794 }
956 795
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 return kStable; 893 return kStable;
1055 if (value == "beta") 894 if (value == "beta")
1056 return kBeta; 895 return kBeta;
1057 if (value == "dev") 896 if (value == "dev")
1058 return kDev; 897 return kDev;
1059 if (value == "canary") 898 if (value == "canary")
1060 return kCanary; 899 return kCanary;
1061 return kUnknown; 900 return kUnknown;
1062 } 901 }
1063 902
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698