mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2026-08-20 12:52:55 +00:00
lib: consolidate chipset helpers in intel_chipset.[hc]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
+44
-1
@@ -36,8 +36,9 @@
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/mman.h>
|
||||
#include "i915_drm.h"
|
||||
|
||||
#include "intel_gpu_tools.h"
|
||||
#include "intel_chipset.h"
|
||||
|
||||
enum pch_type pch;
|
||||
|
||||
@@ -91,6 +92,48 @@ intel_get_pci_device(void)
|
||||
return pci_dev;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
intel_get_drm_devid(int fd)
|
||||
{
|
||||
int ret;
|
||||
struct drm_i915_getparam gp;
|
||||
uint32_t devid;
|
||||
char *override;
|
||||
|
||||
override = getenv("INTEL_DEVID_OVERRIDE");
|
||||
if (override) {
|
||||
devid = strtod(override, NULL);
|
||||
} else {
|
||||
gp.param = I915_PARAM_CHIPSET_ID;
|
||||
gp.value = (int *)&devid;
|
||||
|
||||
ret = ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp, sizeof(gp));
|
||||
assert(ret == 0);
|
||||
}
|
||||
|
||||
return devid;
|
||||
}
|
||||
|
||||
int intel_gen(uint32_t devid)
|
||||
{
|
||||
if (IS_GEN2(devid))
|
||||
return 2;
|
||||
if (IS_GEN3(devid))
|
||||
return 3;
|
||||
if (IS_GEN4(devid))
|
||||
return 4;
|
||||
if (IS_GEN5(devid))
|
||||
return 5;
|
||||
if (IS_GEN6(devid))
|
||||
return 6;
|
||||
if (IS_GEN7(devid))
|
||||
return 7;
|
||||
if (IS_GEN8(devid))
|
||||
return 8;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void
|
||||
intel_check_pch(void)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user