## Chipset Chipset — Feature macros and chipset helpers |

## Functions

struct pci_device * | intel_get_pci_device ()
uint32_t | intel_get_drm_devid ()
const struct intel_device_info * | intel_get_device_info ()
unsigned | intel_gen ()
unsigned | intel_gt ()
void | intel_check_pch ()
#define | IS_915G()
#define | IS_915GM()
#define | IS_915()
#define | IS_945G()
#define | IS_945GM()
#define | IS_945()
#define | IS_PINEVIEW()
#define | IS_G33()
#define | IS_BROADWATER()
#define | IS_CRESTLINE()
#define | IS_GM45()
#define | IS_G45()
#define | IS_G4X()
#define | IS_IRONLAKE()
#define | IS_ARRANDALE()
#define | IS_SANDYBRIDGE()
#define | IS_IVYBRIDGE()
#define | IS_VALLEYVIEW()
#define | IS_HASWELL()
#define | IS_BROADWELL()
#define | IS_CHERRYVIEW()
#define | IS_KABYLAKE()
#define | IS_SKYLAKE()
#define | IS_BROXTON()
#define | IS_GEMINILAKE()
#define | IS_COFFEELAKE()
#define | IS_CANNONLAKE()
#define | IS_GEN()
#define | AT_LEAST_GEN()
#define | IS_GEN2()
#define | IS_GEN3()
#define | IS_GEN4()
#define | IS_GEN5()
#define | IS_GEN6()
#define | IS_GEN7()
#define | IS_GEN8()
#define | IS_GEN9()
#define | IS_GEN10()
#define | IS_MOBILE()
#define | IS_965()
#define | HAS_BSD_RING()
#define | HAS_BLT_RING()
#define | HAS_PCH_SPLIT()

## Types and Values

struct | intel_device_info
enum | pch_type
#define | HAS_IBX
#define | HAS_CPT
#define | HAS_LPT

## Includes

    #include <igt.h>

## Description

This library mostly provides feature macros which use raw pci device ids. It also provides a few more helper functions to handle pci devices, chipset detection and related issues.

## Functions

### intel_get_pci_device ()

    struct pci_device *
    intel_get_pci_device (void);

Looks up the main graphics pci device using libpciaccess.

#### Returns

The pci_device, exits the program on any failures.

### intel_get_drm_devid ()

    uint32_t
    intel_get_drm_devid (int fd);

Queries the kernel for the pci device id corresponding to the drm file descriptor.

#### Parameters

fd | open i915 drm file descriptor |

#### Returns

The devid, exits the program on any failures.

### intel_get_device_info ()

    const struct intel_device_info *
    intel_get_device_info (uint16_t devid);

Looks up the Intel GFX device info for the given device id.

#### Parameters

devid | pci device id |

#### Returns

The associated intel_get_device_info

### intel_gen ()

    unsigned
    intel_gen (uint16_t devid);

Computes the Intel GFX generation for the given device id.

#### Parameters

devid | pci device id |

#### Returns

The GFX generation on successful lookup, 0 on failure.

### intel_gt ()

    unsigned
    intel_gt (uint16_t devid);

Computes the Intel GFX GT size for the given device id.

#### Parameters

devid | pci device id |

#### Returns

The GT size.

### intel_check_pch ()

    void
    intel_check_pch (void);

Detects the PCH chipset type of the running systems and fills in the results into the global intel_pch variable.

### IS_915G()

    #define IS_915G(devid)		(intel_get_device_info(devid)->is_grantsdale)

### IS_915GM()

    #define IS_915GM(devid)		(intel_get_device_info(devid)->is_alviso)

### IS_915()

    #define IS_915(devid)		(IS_915G(devid) || IS_915GM(devid))

### IS_945G()

    #define IS_945G(devid)		(intel_get_device_info(devid)->is_lakeport)

### IS_945GM()

    #define IS_945GM(devid)		(intel_get_device_info(devid)->is_calistoga)

### IS_945()

    #define             IS_945(devid)

### IS_PINEVIEW()

    #define IS_PINEVIEW(devid) (intel_get_device_info(devid)->is_pineview)

### IS_G33()

    #define             IS_G33(devid)

### IS_BROADWATER()

    #define IS_BROADWATER(devid) (intel_get_device_info(devid)->is_broadwater)

### IS_CRESTLINE()

    #define IS_CRESTLINE(devid) (intel_get_device_info(devid)->is_crestline)

### IS_GM45()

    #define IS_GM45(devid)		(intel_get_device_info(devid)->is_cantiga)

### IS_G45()

    #define IS_G45(devid)		(intel_get_device_info(devid)->is_eaglelake)

### IS_G4X()

    #define IS_G4X(devid)		(IS_G45(devid) || IS_GM45(devid))

### IS_IRONLAKE()

    #define IS_IRONLAKE(devid) (intel_get_device_info(devid)->is_ironlake)

### IS_ARRANDALE()

    #define IS_ARRANDALE(devid) (intel_get_device_info(devid)->is_arrandale)

### IS_SANDYBRIDGE()

    #define IS_SANDYBRIDGE(devid) (intel_get_device_info(devid)->is_sandybridge)

### IS_IVYBRIDGE()

    #define IS_IVYBRIDGE(devid) (intel_get_device_info(devid)->is_ivybridge)

### IS_VALLEYVIEW()

    #define IS_VALLEYVIEW(devid) (intel_get_device_info(devid)->is_valleyview)

### IS_HASWELL()

    #define IS_HASWELL(devid) (intel_get_device_info(devid)->is_haswell)

### IS_BROADWELL()

    #define IS_BROADWELL(devid) (intel_get_device_info(devid)->is_broadwell)

### IS_CHERRYVIEW()

    #define IS_CHERRYVIEW(devid) (intel_get_device_info(devid)->is_cherryview)

### IS_KABYLAKE()

    #define IS_KABYLAKE(devid) (intel_get_device_info(devid)->is_kabylake)

### IS_SKYLAKE()

    #define IS_SKYLAKE(devid) (intel_get_device_info(devid)->is_skylake)

### IS_BROXTON()

    #define IS_BROXTON(devid) (intel_get_device_info(devid)->is_broxton)

### IS_GEMINILAKE()

    #define IS_GEMINILAKE(devid) (intel_get_device_info(devid)->is_geminilake)

### IS_COFFEELAKE()

    #define IS_COFFEELAKE(devid) (intel_get_device_info(devid)->is_coffeelake)

### IS_CANNONLAKE()

    #define IS_CANNONLAKE(devid) (intel_get_device_info(devid)->is_cannonlake)

### IS_GEN()

    #define IS_GEN(devid, x) (intel_get_device_info(devid)->gen & (1u << ((x)-1)))

### AT_LEAST_GEN()

    #define AT_LEAST_GEN(devid, x) (intel_get_device_info(devid)->gen & -(1u << ((x)-1)))

### IS_GEN2()

    #define IS_GEN2(devid)		IS_GEN(devid, 2)

### IS_GEN3()

    #define IS_GEN3(devid)		IS_GEN(devid, 3)

### IS_GEN4()

    #define IS_GEN4(devid)		IS_GEN(devid, 4)

### IS_GEN5()

    #define IS_GEN5(devid)		IS_GEN(devid, 5)

### IS_GEN6()

    #define IS_GEN6(devid)		IS_GEN(devid, 6)

### IS_GEN7()

    #define IS_GEN7(devid)		IS_GEN(devid, 7)

### IS_GEN8()

    #define IS_GEN8(devid)		IS_GEN(devid, 8)

### IS_GEN9()

    #define IS_GEN9(devid)		IS_GEN(devid, 9)

### IS_GEN10()

    #define IS_GEN10(devid)		IS_GEN(devid, 10)

### IS_MOBILE()

    #define IS_MOBILE(devid) (intel_get_device_info(devid)->is_mobile)

### IS_965()

    #define IS_965(devid)		AT_LEAST_GEN(devid, 4)

### HAS_BSD_RING()

    #define HAS_BSD_RING(devid) AT_LEAST_GEN(devid, 5)

### HAS_BLT_RING()

    #define HAS_BLT_RING(devid) AT_LEAST_GEN(devid, 6)

### HAS_PCH_SPLIT()

    #define             HAS_PCH_SPLIT(devid)

## Types and Values

### struct intel_device_info

    struct intel_device_info {
    	unsigned gen;
    	bool is_mobile : 1;
    	bool is_whitney : 1;
    	bool is_almador : 1;
    	bool is_brookdale : 1;
    	bool is_montara : 1;
    	bool is_springdale : 1;
    	bool is_grantsdale : 1;
    	bool is_alviso : 1;
    	bool is_lakeport : 1;
    	bool is_calistoga : 1;
    	bool is_bearlake : 1;
    	bool is_pineview : 1;
    	bool is_broadwater : 1;
    	bool is_crestline : 1;
    	bool is_eaglelake : 1;
    	bool is_cantiga : 1;
    	bool is_ironlake : 1;
    	bool is_arrandale : 1;
    	bool is_sandybridge : 1;
    	bool is_ivybridge : 1;
    	bool is_valleyview : 1;
    	bool is_haswell : 1;
    	bool is_broadwell : 1;
    	bool is_cherryview : 1;
    	bool is_skylake : 1;
    	bool is_broxton : 1;
    	bool is_kabylake : 1;
    	bool is_geminilake : 1;
    	bool is_coffeelake : 1;
    	bool is_cannonlake : 1;
    	const char *codename;
    };

### enum pch_type

#### Members

PCH_NONE |  |
PCH_IBX |  |
PCH_CPT |  |
PCH_LPT |  |

### HAS_IBX

    #define HAS_IBX (intel_pch == PCH_IBX)

### HAS_CPT

    #define HAS_CPT (intel_pch == PCH_CPT)

### HAS_LPT

    #define HAS_LPT (intel_pch == PCH_LPT)