Nader Jawad | 086645d | 2021-09-24 13:42:47 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2021 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | #include <stdio.h> |
| 17 | #include <string.h> |
| 18 | #include <utils/Log.h> |
| 19 | |
| 20 | bool supportsRenderEffectCache(const char* vendor, const char* version) { |
| 21 | if (strcmp(vendor, "Qualcomm") != 0) { |
| 22 | return true; |
| 23 | } |
| 24 | |
| 25 | int major; |
| 26 | int minor; |
| 27 | int driverMajor; |
| 28 | int driverMinor; |
| 29 | int n = sscanf(version,"OpenGL ES %d.%d V@%d.%d", |
| 30 | &major, |
| 31 | &minor, |
| 32 | &driverMajor, |
| 33 | &driverMinor); |
| 34 | // Ensure we have parsed the vendor string properly and we have either |
| 35 | // a newer major driver version, or the minor version is rev'ed |
| 36 | // Based on b/198227600#comment5 it appears that the corresponding fix |
| 37 | // is in driver version 571.0 |
| 38 | return n == 4 && driverMajor >= 571; |
| 39 | } |