OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 class GPUDevice(object): | 5 class GPUDevice(object): |
6 """Provides information about an individual GPU device. | 6 """Provides information about an individual GPU device. |
7 | 7 |
8 On platforms which support them, the vendor_id and device_id are | 8 On platforms which support them, the vendor_id and device_id are |
9 PCI IDs. On other platforms, the vendor_string and device_string | 9 PCI IDs. On other platforms, the vendor_string and device_string |
10 are platform-dependent strings. | 10 are platform-dependent strings. |
11 """ | 11 """ |
12 | 12 |
13 _VENDOR_ID_MAP = { | 13 _VENDOR_ID_MAP = { |
14 0x1002: 'ATI', | 14 0x1002: 'ATI', |
15 0x8086: 'Intel', | 15 0x8086: 'Intel', |
16 0x10de: 'Nvidia', | 16 0x10de: 'Nvidia', |
17 } | 17 } |
18 | 18 |
19 def __init__(self, vendor_id, device_id, vendor_string, device_string): | 19 def __init__(self, vendor_id, device_id, vendor_string, device_string): |
20 self._vendor_id = vendor_id | 20 self._vendor_id = vendor_id |
21 self._device_id = device_id | 21 self._device_id = device_id |
22 self._vendor_string = vendor_string | 22 self._vendor_string = vendor_string |
23 self._device_string = device_string | 23 self._device_string = device_string |
24 | 24 |
25 def __str__(self): | 25 def __str__(self): |
26 vendor = 'VENDOR = 0x%x' % self._vendor_id | 26 vendor = 'VENDOR = 0x%x' % self._vendor_id |
27 vendor_string = self._vendor_string | 27 vendor_string = self._vendor_string |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 return self._vendor_string | 75 return self._vendor_string |
76 | 76 |
77 @property | 77 @property |
78 def device_string(self): | 78 def device_string(self): |
79 """The GPU device's name as a string, or the empty string if not | 79 """The GPU device's name as a string, or the empty string if not |
80 available. | 80 available. |
81 | 81 |
82 Most mobile devices supply this information rather than the PCI | 82 Most mobile devices supply this information rather than the PCI |
83 IDs.""" | 83 IDs.""" |
84 return self._device_string | 84 return self._device_string |
OLD | NEW |