| // Copyright (C) 2016 The Android Open Source Project |
| // |
| // Licensed under the Apache License, Version 2.0 (the "License"); |
| // you may not use this file except in compliance with the License. |
| // You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, software |
| // distributed under the License is distributed on an "AS IS" BASIS, |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| // See the License for the specific language governing permissions and |
| // limitations under the License. |
| |
| package device |
| |
| var ( |
| UnknownChipset = chipset("unknown", UnknownGPU) |
| SnapdragonS4Pro = chipset("Snapdragon S4 Pro", Adreno320, Krait) |
| Snapdragon800 = chipset("Snapdragon 800", Adreno330, Krait) |
| Snapdragon801 = chipset("Snapdragon 801", Adreno330, Krait) |
| Snapdragon805 = chipset("Snapdragon 805", Adreno420, Krait) |
| Snapdragon808 = chipset("Snapdragon 808", Adreno418, CortexA57, CortexA53) |
| Snapdragon810 = chipset("Snapdragon 810", Adreno430, CortexA57, CortexA53) |
| Snapdragon820 = chipset("Snapdragon 820", Adreno530, Kryo) |
| TegraK1Denver = chipset("Tegra K1 Denver", Kepler, Denver) |
| ) |
| |
| func chipset(name string, gpu GPU, cpus ...CPU) Chipset { |
| chipset := Chipset{ |
| Name: name, |
| Cores: cpus, |
| GPU: gpu, |
| } |
| return chipset |
| } |
| |
| // SameChipset returns true if the two chipset objects are a match. |
| func SameChipset(a, b Chipset) bool { |
| // If the chipset name is set, treat it as an authoratitive comparison point |
| if a.Name != "" && b.Name != "" { |
| return a.Name == b.Name |
| } |
| // Check if we have the same set of cpu cores |
| if len(a.Cores) != len(b.Cores) { |
| return false |
| } |
| for i, cpu := range a.Cores { |
| if !SameCPU(cpu, b.Cores[i]) { |
| return false |
| } |
| } |
| return SameGPU(a.GPU, b.GPU) |
| } |