KMS: igt-gpu-tools Reference Manual

## KMS KMS — Kernel modesetting support library |

## Functions

const char * | kmstest_pipe_name ()
int | kmstest_pipe_to_index ()
const char * | kmstest_plane_type_name ()
#define | kmstest_port_name()
const char * | kmstest_encoder_type_str ()
const char * | kmstest_connector_status_str ()
const char * | kmstest_connector_type_str ()
const char * | kmstest_scaling_filter_str ()
void | kmstest_dump_mode ()
int | kmstest_get_pipe_from_crtc_id ()
void | kmstest_set_vt_graphics_mode ()
void | kmstest_restore_vt_mode ()
void | kmstest_set_vt_text_mode ()
bool | kmstest_force_connector ()
void | kmstest_force_edid ()
bool | kmstest_get_connector_default_mode ()
bool | kmstest_get_connector_config ()
drmModePropertyBlobPtr | kmstest_get_path_blob ()
bool | kmstest_probe_connector_config ()
void | kmstest_free_connector_config ()
void | kmstest_set_connector_dpms ()
bool | kmstest_get_property ()
void | kmstest_unset_all_crtcs ()
int | kmstest_get_crtc_idx ()
uint32_t | kmstest_find_crtc_for_connector ()
uint32_t | kmstest_dumb_create ()
void * | kmstest_dumb_map_buffer ()
void | kmstest_dumb_destroy ()
void | kmstest_wait_for_pageflip ()
unsigned int | kmstest_get_vblank ()
bool | kms_has_vblank ()
bool | igt_rotation_90_or_270 ()
void | igt_display_reset_outputs ()
void | igt_display_require ()
void | igt_display_fini ()
void | igt_display_reset ()
int | igt_display_commit2 ()
int | igt_display_commit ()
int | igt_display_try_commit_atomic ()
void | igt_display_commit_atomic ()
int | igt_display_try_commit2 ()
int | igt_display_drop_events ()
int | igt_display_get_n_pipes ()
void | igt_display_require_output ()
void | igt_display_require_output_on_pipe ()
const char * | igt_output_name ()
drmModeModeInfo * | igt_output_get_mode ()
void | igt_output_override_mode ()
int | igt_output_preferred_vrefresh ()
void | igt_output_set_pipe ()
igt_plane_t * | igt_output_get_plane ()
igt_plane_t * | igt_output_get_plane_type ()
int | igt_output_count_plane_type ()
igt_plane_t * | igt_output_get_plane_type_index ()
igt_output_t * | igt_output_from_connector ()
void | igt_output_refresh ()
drmModeModeInfo * | igt_std_1024_mode_get ()
void | igt_output_set_writeback_fb ()
void | igt_modeset_disable_all_outputs ()
igt_plane_t * | igt_pipe_get_plane_type ()
int | igt_pipe_count_plane_type ()
igt_plane_t * | igt_pipe_get_plane_type_index ()
bool | output_is_internal_panel ()
igt_output_t * | igt_get_single_output_for_pipe ()
void | igt_pipe_request_out_fence ()
void | igt_plane_set_fb ()
void | igt_plane_set_fence_fd ()
void | igt_plane_set_pipe ()
void | igt_plane_set_position ()
void | igt_plane_set_size ()
void | igt_plane_set_rotation ()
void | igt_fb_set_position ()
void | igt_fb_set_size ()
bool | igt_plane_has_rotation ()
void | igt_wait_for_vblank ()
void | igt_wait_for_vblank_count ()
bool | igt_output_is_connected ()
#define | igt_pipe_connector_valid()
#define | for_each_if()
#define | for_each_output()
#define | for_each_connected_output()
#define | for_each_disconnected_output()
#define | for_each_pipe_static()
#define | for_each_pipe()
#define | for_each_pipe_with_valid_output()
#define | for_each_pipe_with_single_output()
#define | for_each_valid_output_on_pipe()
#define | for_each_plane_on_pipe()
#define | for_each_connector_mode()
#define | IGT_FIXED()
bool | igt_plane_has_prop ()
uint64_t | igt_plane_get_prop ()
#define | igt_plane_is_prop_changed()
#define | igt_plane_set_prop_changed()
#define | igt_plane_clear_prop_changed()
#define | igt_plane_set_prop_value()
bool | igt_plane_try_prop_enum ()
void | igt_plane_set_prop_enum ()
void | igt_plane_replace_prop_blob ()
bool | igt_output_has_prop ()
uint64_t | igt_output_get_prop ()
#define | igt_output_is_prop_changed()
#define | igt_output_set_prop_changed()
#define | igt_output_clear_prop_changed()
#define | igt_output_set_prop_value()
bool | igt_output_try_prop_enum ()
void | igt_output_set_prop_enum ()
void | igt_output_replace_prop_blob ()
bool | igt_pipe_obj_has_prop ()
uint64_t | igt_pipe_obj_get_prop ()
uint64_t | igt_pipe_get_prop ()
bool | igt_pipe_has_prop ()
#define | igt_pipe_obj_is_prop_changed()
#define | igt_pipe_is_prop_changed()
#define | igt_pipe_obj_set_prop_changed()
#define | igt_pipe_set_prop_changed()
#define | igt_pipe_obj_clear_prop_changed()
#define | igt_pipe_clear_prop_changed()
#define | igt_pipe_obj_set_prop_value()
#define | igt_pipe_set_prop_value()
bool | igt_pipe_obj_try_prop_enum ()
void | igt_pipe_obj_set_prop_enum ()
#define | igt_pipe_try_prop_enum()
#define | igt_pipe_set_prop_enum()
void | igt_pipe_obj_replace_prop_blob ()
#define | igt_pipe_replace_prop_blob()
void | igt_pipe_refresh ()
void | igt_enable_connectors ()
void | igt_reset_connectors ()
uint32_t | kmstest_get_vbl_flag ()
const struct edid * | igt_kms_get_base_edid ()
const struct edid * | igt_kms_get_full_edid ()
const struct edid * | igt_kms_get_base_tile_edid ()
const struct edid * | igt_kms_get_alt_edid ()
const struct edid * | igt_kms_get_hdmi_audio_edid ()
const struct edid * | igt_kms_get_dp_audio_edid ()
const struct edid * | igt_kms_get_4k_edid ()
const struct edid * | igt_kms_get_3d_edid ()
const struct edid * | igt_kms_get_aspect_ratio_edid ()
struct edid ** | igt_kms_get_tiled_edid ()
const struct edid * | igt_kms_get_custom_edid ()
struct udev_monitor * | igt_watch_uevents ()
bool | igt_hotplug_detected ()
bool | igt_lease_change_detected ()
bool | igt_connector_event_detected ()
void | igt_flush_uevents ()
void | igt_cleanup_uevents ()
bool | igt_display_has_format_mod ()
bool | igt_plane_has_format_mod ()
bool | igt_vblank_after_eq ()
bool | igt_vblank_before_eq ()
bool | igt_vblank_after ()
bool | igt_vblank_before ()
void | igt_parse_connector_tile_blob ()
int | igt_connector_sysfs_open ()
uint32_t | igt_reduce_format ()
void | igt_require_pipe ()
void | igt_dump_connectors_fd ()
void | igt_dump_crtcs_fd ()
bool | igt_override_all_active_output_modes_to_fit_bw ()
bool | igt_is_dsc_supported ()
bool | igt_is_fec_supported ()
bool | igt_is_dsc_enabled ()
bool | igt_is_force_dsc_enabled ()
int | igt_force_dsc_enable ()
int | igt_force_dsc_enable_bpc ()
int | igt_get_dsc_debugfs_fd ()
unsigned int | igt_get_output_max_bpc ()
unsigned int | igt_get_pipe_current_bpc ()
void | igt_assert_output_bpc_equal ()
bool | igt_check_output_bpc_equal ()
int | sort_drm_modes_by_clk_dsc ()
int | sort_drm_modes_by_clk_asc ()
int | sort_drm_modes_by_res_dsc ()
int | sort_drm_modes_by_res_asc ()
void | igt_sort_connector_modes ()
bool | igt_max_bpc_constraint ()
bool | igt_check_bigjoiner_support ()
bool | igt_parse_mode_string ()

## Types and Values

enum | pipe
enum | port
enum | igt_custom_edid_type
#define | IGT_CUSTOM_EDID_COUNT
#define | MAX_HDISPLAY_PER_PIPE
enum | igt_atomic_crtc_properties
enum | igt_atomic_connector_properties
struct | kmstest_connector_config
struct | kmstest_plane
struct | kmstest_crtc
enum | kmstest_force_connector_state
enum | intel_broadcast_rgb_mode
enum | igt_commit_style
enum | igt_atomic_plane_properties
typedef | igt_display_t
typedef | igt_pipe_t
typedef | igt_fixed_t
enum | igt_rotation_t
#define | IGT_ROTATION_MASK
| igt_plane_t
struct | igt_pipe
| igt_output_t
struct | igt_display
| igt_tile_info_t
struct | edid

## Includes

    #include <igt.h>

## Description

This library provides support to enumerate and set modeset configurations.

There are two parts in this library: First the low level helper function which directly build on top of raw ioctls or the interfaces provided by libdrm. Those functions all have a kmstest_ prefix.

The second part is a high-level library to manage modeset configurations which abstracts away some of the low-level details like the difference between legacy and universal plane support for setting cursors or in the future the difference between legacy and atomic commit. These high-level functions have all igt_ prefixes. This part is still very much work in progress and so also lacks a bit documentation for the individual functions.

Note that this library's header pulls in the i-g-t framebuffer library as a dependency.

## Functions

### kmstest_pipe_name ()

    const char *
    kmstest_pipe_name (enum pipe pipe);

#### Parameters

pipe | display pipe |

#### Returns

String representing `pipe` , e.g. "A".

### kmstest_pipe_to_index ()

    int
    kmstest_pipe_to_index (char pipe);

#### Parameters

pipe | display pipe in string format |

#### Returns

index to corresponding pipe

### kmstest_plane_type_name ()

    const char *
    kmstest_plane_type_name (int plane_type);

#### Parameters

plane_type | display plane type |

#### Returns

String representing `plane_type` , e.g. "overlay".

### kmstest_port_name()

    #define kmstest_port_name(port) ((port) + 'A')

#### Parameters

port | display plane |

#### Returns

String representing `port` , e.g. "A".

### kmstest_encoder_type_str ()

    const char *
    kmstest_encoder_type_str (int type);

#### Parameters

type | DRM_MODE_ENCODER_* enumeration value |

#### Returns

A string representing the drm encoder `type` .

### kmstest_connector_status_str ()

    const char *
    kmstest_connector_status_str (int status);

#### Parameters

status | DRM_MODE_* connector status value |

#### Returns

A string representing the drm connector status `status` .

### kmstest_connector_type_str ()

    const char *
    kmstest_connector_type_str (int type);

#### Parameters

type | DRM_MODE_CONNECTOR_* enumeration value |

#### Returns

A string representing the drm connector `type` .

### kmstest_scaling_filter_str ()

    const char *
    kmstest_scaling_filter_str (int filter);

#### Parameters

filter | SCALING_FILTER_* filter value |

#### Returns

A string representing the scaling filter `filter` .

### kmstest_dump_mode ()

    void
    kmstest_dump_mode (drmModeModeInfo *mode);

Prints `mode` to stdout in a human-readable form.

#### Parameters

mode | libdrm mode structure |

### kmstest_get_pipe_from_crtc_id ()

    int
    kmstest_get_pipe_from_crtc_id (int fd,
                                   int crtc_id);

#### Parameters

fd | DRM fd |
crtc_id | DRM CRTC id |

#### Returns

The crtc index for the given DRM CRTC ID `crtc_id` . The crtc index is the equivalent of the pipe id. This value maps directly to an enum pipe value used in other helper functions. Returns 0 if the index could not be determined.

### kmstest_set_vt_graphics_mode ()

    void
    kmstest_set_vt_graphics_mode (void);

Sets the controlling VT (if available) into graphics/raw mode and installs an igt exit handler to set the VT back to text mode on exit. Use kmstest_restore_vt_mode to restore the previous VT mode manually.

All kms tests must call this function to make sure that the fbcon doesn't interfere by e.g. blanking the screen.

### kmstest_restore_vt_mode ()

    void
    kmstest_restore_vt_mode (void);

Restore the VT mode in use before kmstest_set_vt_graphics_mode was called.

### kmstest_set_vt_text_mode ()

    void
    kmstest_set_vt_text_mode (void);

Sets the controlling VT (if available) into text mode. Unlikely `kmstest_set_vt_graphics_mode()` it do not install an igt exit handler to set the VT back to the previous mode.

### kmstest_force_connector ()

    bool
    kmstest_force_connector (int fd,
                             drmModeConnector *connector,
                             enum kmstest_force_connector_state state);

Force the specified state on the specified connector.

#### Parameters

fd | drm file descriptor |
connector | connector |
state | state to force on `connector` |

#### Returns

true on success

### kmstest_force_edid ()

    void
    kmstest_force_edid (int drm_fd,
                        drmModeConnector *connector,
                        const struct edid *edid);

Set the EDID data on `connector` to `edid` . See also igt_kms_get_base_edid.

If `edid` is NULL, the forced EDID will be removed.

#### Parameters

drm_fd | drm file descriptor |
connector | connector to set `edid` on |
edid | An EDID data block |

### kmstest_get_connector_default_mode ()

    bool
    kmstest_get_connector_default_mode (int drm_fd,
                                        drmModeConnector *connector,
                                        drmModeModeInfo *mode);

Retrieves the default mode for `connector` and stores it in `mode` .

#### Parameters

drm_fd | DRM fd |
connector | libdrm connector |
mode | libdrm mode |

#### Returns

true on success, false on failure

### kmstest_get_connector_config ()

    bool
    kmstest_get_connector_config (int drm_fd,
                                  uint32_t connector_id,
                                  unsigned long  crtc_idx_mask,
                                  struct kmstest_connector_config *config);

This tries to find a suitable configuration for the given connector and CRTC constraint and fills it into `config` .

#### Parameters

drm_fd | DRM fd |
connector_id | DRM connector id |
crtc_idx_mask | mask of allowed DRM CRTC indices |
config | structure filled with the possible configuration |

### kmstest_get_path_blob ()

    drmModePropertyBlobPtr
    kmstest_get_path_blob (int drm_fd,
                           uint32_t connector_id);

### kmstest_probe_connector_config ()

    bool
    kmstest_probe_connector_config (int drm_fd,
                                    uint32_t connector_id,
                                    unsigned long  crtc_idx_mask,
                                    struct kmstest_connector_config *config);

This tries to find a suitable configuration for the given connector and CRTC constraint and fills it into `config` , fully probing the connector in the process.

#### Parameters

drm_fd | DRM fd |
connector_id | DRM connector id |
crtc_idx_mask | mask of allowed DRM CRTC indices |
config | structure filled with the possible configuration |

### kmstest_free_connector_config ()

    void
    kmstest_free_connector_config (struct kmstest_connector_config *config);

Free any resources in `config` allocated in `kmstest_get_connector_config()`.

#### Parameters

config | connector configuration structure |

### kmstest_set_connector_dpms ()

    void
    kmstest_set_connector_dpms (int fd,
                                drmModeConnector *connector,
                                int mode);

This function sets the DPMS setting of `connector` to `mode` .

#### Parameters

fd | DRM fd |
connector | libdrm connector |
mode | DRM DPMS value |

### kmstest_get_property ()

    bool
    kmstest_get_property (int drm_fd,
                          uint32_t object_id,
                          uint32_t object_type,
                          const char *name,
                          uint32_t *prop_id,
                          uint64_t *value,
                          drmModePropertyPtr *prop);

Finds a property with the given name on the given object.

#### Parameters

drm_fd | drm file descriptor |
object_id | object whose properties we're going to get |
object_type | type of obj_id (DRM_MODE_OBJECT_*) |
name | name of the property we're going to get |
prop_id | if not NULL, returns the property id |
value | if not NULL, returns the property value |
prop | if not NULL, returns the property, and the caller will have to free it manually. |

#### Returns

true in case we found something.

### kmstest_unset_all_crtcs ()

    void
    kmstest_unset_all_crtcs (int drm_fd,
                             drmModeResPtr resources);

Disables all the screens.

#### Parameters

drm_fd | the DRM fd |
resources | libdrm resources pointer |

### kmstest_get_crtc_idx ()

    int
    kmstest_get_crtc_idx (drmModeRes *res,
                          uint32_t crtc_id);

Get the CRTC index based on its ID. This is useful since a few places of libdrm deal with CRTC masks.

#### Parameters

res | the libdrm resources |
crtc_id | the CRTC id |

### kmstest_find_crtc_for_connector ()

    uint32_t
    kmstest_find_crtc_for_connector (int fd,
                                     drmModeRes *res,
                                     drmModeConnector *connector,
                                     uint32_t crtc_blacklist_idx_mask);

#### Parameters

fd | DRM fd |
res | libdrm resources pointer |
connector | libdrm connector pointer |
crtc_blacklist_idx_mask | a mask of CRTC indexes that we can't return |

#### Returns

the CRTC ID for a CRTC that fits the connector, otherwise it asserts false and never returns. The blacklist mask can be used in case you have CRTCs that are already in use by other connectors.

### kmstest_dumb_create ()

    uint32_t
    kmstest_dumb_create (int fd,
                         int width,
                         int height,
                         int bpp,
                         unsigned *stride,
                         uint64_t *size);

This wraps the CREATE_DUMB ioctl, which allocates a new dumb buffer object for the specified dimensions.

#### Parameters

fd | open drm file descriptor |
width | width of the buffer in pixels |
height | height of the buffer in pixels |
bpp | bytes per pixel of the buffer |
stride | Pointer which receives the dumb bo's stride, can be NULL. |
size | Pointer which receives the dumb bo's size, can be NULL. |

#### Returns

The file-private handle of the created buffer object

### kmstest_dumb_map_buffer ()

    void *
    kmstest_dumb_map_buffer (int fd,
                             uint32_t handle,
                             uint64_t size,
                             unsigned  prot);

#### Parameters

fd | Opened drm file descriptor |
handle | Offset in the file referred to by fd |
size | Length of the mapping, must be greater than 0 |
prot | Describes the memory protection of the mapping |

#### Returns

A pointer representing the start of the virtual mapping Caller of this function should munmap the pointer returned, after its usage.

### kmstest_dumb_destroy ()

    void
    kmstest_dumb_destroy (int fd,
                          uint32_t handle);

#### Parameters

fd | Opened drm file descriptor |
handle | Offset in the file referred to by fd |

### kmstest_wait_for_pageflip ()

    void
    kmstest_wait_for_pageflip (int fd);

Blocks until pageflip is completed

#### Parameters

fd | Opened drm file descriptor |

### kmstest_get_vblank ()

    unsigned int
    kmstest_get_vblank (int fd,
                        int pipe,
                        unsigned int flags);

Blocks or request a signal when a specified vblank event occurs

Returns 0 on success or non-zero unsigned integer otherwise

#### Parameters

fd | Opened drm file descriptor |
pipe | Display pipe |
flags | Flags passed to drm_ioctl_wait_vblank |

### kms_has_vblank ()

    bool
    kms_has_vblank (int fd);

Get the VBlank errno after an attempt to call `drmWaitVBlank()`. This function is useful for checking if a driver has support or not for VBlank.

#### Parameters

fd | DRM fd |

#### Returns

true if target driver has VBlank support, otherwise return false.

### igt_rotation_90_or_270 ()

    bool
    igt_rotation_90_or_270 (igt_rotation_t rotation);

### igt_display_reset_outputs ()

    void
    igt_display_reset_outputs (igt_display_t *display);

### igt_display_require ()

    void
    igt_display_require (igt_display_t *display,
                         int drm_fd);

Initialize `display` and allocate the various resources required. Use igt_display_fini to release the resources when they are no longer required.

This function automatically skips if the kernel driver doesn't support any CRTC or outputs.

#### Parameters

display | a pointer to an igt_display_t structure |
drm_fd | a drm file descriptor |

### igt_display_fini ()

    void
    igt_display_fini (igt_display_t *display);

Release any resources associated with `display` . This does not free `display` itself.

#### Parameters

display | a pointer to an igt_display_t structure |

### igt_display_reset ()

    void
    igt_display_reset (igt_display_t *display);

Reset basic pipes, connectors and planes on `display` back to default values. In particular, the following properties will be reset:

For outputs:

- `IGT_CONNECTOR_CRTC_ID`

- `IGT_CONNECTOR_BROADCAST_RGB` (if applicable) `IGT_CONNECTOR_CONTENT_PROTECTION` (if applicable) `IGT_CONNECTOR_HDR_OUTPUT_METADATA` (if applicable)

- `IGT_CONNECTOR_DITHERING_MODE` (if applicable)

- igt_output_override_mode() to default.

For pipes:

- `IGT_CRTC_MODE_ID` (leaked)

- `IGT_CRTC_ACTIVE`

- `IGT_CRTC_OUT_FENCE_PTR`

For planes:

- `IGT_PLANE_SRC_`*

- `IGT_PLANE_CRTC_`*

- `IGT_PLANE_FB_ID`

- `IGT_PLANE_CRTC_ID`

- `IGT_PLANE_ROTATION`

- `IGT_PLANE_IN_FENCE_FD`

#### Parameters

display | a pointer to an igt_display_t structure |

### igt_display_commit2 ()

    int
    igt_display_commit2 (igt_display_t *display,
                         enum igt_commit_style s);

Commits framebuffer and positioning changes to all planes of each display pipe, using a specific API to perform the programming. This function should be used to exercise a specific driver programming API; igt_display_commit should be used instead if the API used is unimportant to the test being run.

This function should only be used to commit changes that are expected to succeed, since any failure during the commit process will cause the IGT subtest to fail. To commit changes that are expected to fail, use `igt_try_display_commit2` instead.

#### Parameters

display | DRM device handle |
s | Commit style |

#### Returns

0 upon success. This function will never return upon failure since `igt_fail()` at lower levels will longjmp out of it.

### igt_display_commit ()

    int
    igt_display_commit (igt_display_t *display);

Commits framebuffer and positioning changes to all planes of each display pipe.

#### Parameters

display | DRM device handle |

#### Returns

0 upon success. This function will never return upon failure since `igt_fail()` at lower levels will longjmp out of it.

### igt_display_try_commit_atomic ()

    int
    igt_display_try_commit_atomic (igt_display_t *display,
                                   uint32_t flags,
                                   void *user_data);

This function is similar to igt_display_try_commit2, but is used when you want to pass different flags to the actual commit.

Useful flags can be DRM_MODE_ATOMIC_ALLOW_MODESET, DRM_MODE_ATOMIC_NONBLOCK, DRM_MODE_PAGE_FLIP_EVENT, or DRM_MODE_ATOMIC_TEST_ONLY.

`user_data` is returned in the event if you pass DRM_MODE_PAGE_FLIP_EVENT to `flags` .

This function will return an error if commit fails, instead of aborting the test.

#### Parameters

display | igt_display_t to commit. |
flags | Flags passed to drmModeAtomicCommit. |
user_data | User defined pointer passed to drmModeAtomicCommit. |

### igt_display_commit_atomic ()

    void
    igt_display_commit_atomic (igt_display_t *display,
                               uint32_t flags,
                               void *user_data);

This function is similar to igt_display_commit2, but is used when you want to pass different flags to the actual commit.

Useful flags can be DRM_MODE_ATOMIC_ALLOW_MODESET, DRM_MODE_ATOMIC_NONBLOCK, DRM_MODE_PAGE_FLIP_EVENT, or DRM_MODE_ATOMIC_TEST_ONLY.

`user_data` is returned in the event if you pass DRM_MODE_PAGE_FLIP_EVENT to `flags` .

This function will abort the test if commit fails.

#### Parameters

display | igt_display_t to commit. |
flags | Flags passed to drmModeAtomicCommit. |
user_data | User defined pointer passed to drmModeAtomicCommit. |

### igt_display_try_commit2 ()

    int
    igt_display_try_commit2 (igt_display_t *display,
                             enum igt_commit_style s);

Attempts to commit framebuffer and positioning changes to all planes of each display pipe. This function should be used to commit changes that are expected to fail, so that the error code can be checked for correctness. For changes that are expected to succeed, use `igt_display_commit` instead.

Note that in non-atomic commit styles, no display programming will be performed after the first failure is encountered, so only some of the operations requested by a test may have been completed. Tests that catch errors returned by this function should take care to restore the display to a sane state after a failure is detected.

#### Parameters

display | DRM device handle |
s | Commit style |

#### Returns

0 upon success, otherwise the error code of the first error encountered.

### igt_display_drop_events ()

    int
    igt_display_drop_events (igt_display_t *display);

Nonblockingly reads all current events and drops them, for highest reliablility, call `igt_display_commit2()` first to flush all outstanding events.

This will be called on the first commit after `igt_display_reset()` too, to make sure any stale events are flushed.

#### Parameters

display | DRM device handle |

#### Returns

Number of dropped events.

### igt_display_get_n_pipes ()

    int
    igt_display_get_n_pipes (igt_display_t *display);

Returns total number of pipes for the given `display`

#### Parameters

display | A pointer to an igt_display_t structure |

### igt_display_require_output ()

    void
    igt_display_require_output (igt_display_t *display);

Checks whether there's a valid `pipe` /`output` combination for the given `display` Skips test if a valid combination of `pipe` and `output` is not found

#### Parameters

display | A pointer to an igt_display_t structure |

### igt_display_require_output_on_pipe ()

    void
    igt_display_require_output_on_pipe (igt_display_t *display,
                                        enum pipe pipe);

Checks whether there's a valid `pipe` /`output` combination for the given `display` and `pipe` Skips test if a valid `pipe` is not found

#### Parameters

display | A pointer to an igt_display_t structure |
pipe | Display pipe |

### igt_output_name ()

    const char *
    igt_output_name (igt_output_t *output);

#### Parameters

output | Target output |

#### Returns

String representing a connector's name, e.g. "DP-1".

### igt_output_get_mode ()

    drmModeModeInfo *
    igt_output_get_mode (igt_output_t *output);

Get the current mode of the given connector

#### Parameters

output | Target output |

#### Returns

A drmModeModeInfo struct representing the current mode

### igt_output_override_mode ()

    void
    igt_output_override_mode (igt_output_t *output,
                              const drmModeModeInfo *mode);

Overrides the output's mode with `mode` , so that it is used instead of the mode obtained with get connectors. Note that the mode is used without checking if the output supports it, so this might lead to unexpected results.

#### Parameters

output | Output of which the mode will be overridden |
mode | New mode, or NULL to disable override. |

### igt_output_preferred_vrefresh ()

    int
    igt_output_preferred_vrefresh (igt_output_t *output);

### igt_output_set_pipe ()

    void
    igt_output_set_pipe (igt_output_t *output,
                         enum pipe pipe);

### igt_output_get_plane ()

    igt_plane_t *
    igt_output_get_plane (igt_output_t *output,
                          int plane_idx);

### igt_output_get_plane_type ()

    igt_plane_t *
    igt_output_get_plane_type (igt_output_t *output,
                               int plane_type);

Finds a valid plane type for the given `output` otherwise the test is skipped if the right combination of `output` /`plane_type` is not found

#### Parameters

output | Target output |
plane_type | Cursor, primary or an overlay plane |

#### Returns

A igt_plane_t structure that matches the requested plane type

### igt_output_count_plane_type ()

    int
    igt_output_count_plane_type (igt_output_t *output,
                                 int plane_type);

Counts the number of planes of type `plane_type` for the provided `output` .

#### Parameters

output | Target output |
plane_type | Cursor, primary or an overlay plane |

#### Returns

The number of planes that match the requested plane type

### igt_output_get_plane_type_index ()

    igt_plane_t *
    igt_output_get_plane_type_index (igt_output_t *output,
                                     int plane_type,
                                     int index);

Get the `index` th plane of type `plane_type` for the provided `output` .

#### Parameters

output | Target output |
plane_type | Cursor, primary or an overlay plane |
index | the index of the plane among planes of the same type |

#### Returns

The `index` th plane that matches the requested plane type

### igt_output_from_connector ()

    igt_output_t *
    igt_output_from_connector (igt_display_t *display,
                               drmModeConnector *connector);

Finds the output corresponding to the given connector

#### Parameters

display | a pointer to an igt_display_t structure |
connector | a pointer to a drmModeConnector |

#### Returns

A igt_output_t structure configured to use the connector, or NULL if none was found

### igt_output_refresh ()

    void
    igt_output_refresh (igt_output_t *output);

### igt_std_1024_mode_get ()

    drmModeModeInfo *
    igt_std_1024_mode_get (int vrefresh);

### igt_output_set_writeback_fb ()

    void
    igt_output_set_writeback_fb (igt_output_t *output,
                                 struct igt_fb *fb);

This function sets the given `fb` to be used as the target framebuffer for the writeback engine at the next atomic commit. It will also request a writeback out fence that will contain the fd number of the out fence created by KMS if the given `fb` is valid.

#### Parameters

output | Target output |
fb | Target framebuffer |

### igt_modeset_disable_all_outputs ()

    void
    igt_modeset_disable_all_outputs (igt_display_t *display);

### igt_pipe_get_plane_type ()

    igt_plane_t *
    igt_pipe_get_plane_type (igt_pipe_t *pipe,
                             int plane_type);

Finds a valid plane type for the given `pipe` otherwise it skips the test if the right combination of `pipe` /`plane_type` is not found

#### Parameters

pipe | Target pipe |
plane_type | Cursor, primary or an overlay plane |

#### Returns

A igt_plane_t structure that matches the requested plane type

### igt_pipe_count_plane_type ()

    int
    igt_pipe_count_plane_type (igt_pipe_t *pipe,
                               int plane_type);

Counts the number of planes of type `plane_type` for the provided `pipe` .

#### Parameters

pipe | Target pipe |
plane_type | Cursor, primary or an overlay plane |

#### Returns

The number of planes that match the requested plane type

### igt_pipe_get_plane_type_index ()

    igt_plane_t *
    igt_pipe_get_plane_type_index (igt_pipe_t *pipe,
                                   int plane_type,
                                   int index);

Get the `index` th plane of type `plane_type` for the provided `pipe` .

#### Parameters

pipe | Target pipe |
plane_type | Cursor, primary or an overlay plane |
index | the index of the plane among planes of the same type |

#### Returns

The `index` th plane that matches the requested plane type

### output_is_internal_panel ()

    bool
    output_is_internal_panel (igt_output_t *output);

### igt_get_single_output_for_pipe ()

    igt_output_t *
    igt_get_single_output_for_pipe (igt_display_t *display,
                                    enum pipe pipe);

Get a compatible output for a pipe.

#### Parameters

display | a pointer to an igt_display_t structure |
pipe | The pipe for which an igt_output_t must be returned. |

#### Returns

A compatible output for a given pipe, or NULL.

### igt_pipe_request_out_fence ()

    void
    igt_pipe_request_out_fence (igt_pipe_t *pipe);

Marks this pipe for requesting an out fence at the next atomic commit will contain the fd number of the out fence created by KMS.

#### Parameters

pipe | pipe which out fence will be requested for |

### igt_plane_set_fb ()

    void
    igt_plane_set_fb (igt_plane_t *plane,
                      struct igt_fb *fb);

Pairs a given `framebuffer` to a `plane`

This function also sets a default size and position for the framebuffer to avoid crashes on applications that ignore to set these.

#### Parameters

plane | Plane |
fb | Framebuffer pointer |

### igt_plane_set_fence_fd ()

    void
    igt_plane_set_fence_fd (igt_plane_t *plane,
                            int fence_fd);

This function sets a fence fd to enable a commit to wait for some event to occur before completing.

#### Parameters

plane | plane |
fence_fd | fence fd, disable fence_fd by setting it to -1 |

### igt_plane_set_pipe ()

    void
    igt_plane_set_pipe (igt_plane_t *plane,
                        igt_pipe_t *pipe);

#### Parameters

plane | Target plane pointer |
pipe | The pipe to assign the plane to |

### igt_plane_set_position ()

    void
    igt_plane_set_position (igt_plane_t *plane,
                            int x,
                            int y);

This function sets a new (x,y) position for the given plane. New position will be committed at plane commit time via `drmModeSetPlane()`.

#### Parameters

plane | Plane pointer for which position is to be set |
x | X coordinate |
y | Y coordinate |

### igt_plane_set_size ()

    void
    igt_plane_set_size (igt_plane_t *plane,
                        int w,
                        int h);

This function sets width and height for requested plane. New size will be committed at plane commit time via `drmModeSetPlane()`.

#### Parameters

plane | plane pointer for which size to be set |
w | width |
h | height |

### igt_plane_set_rotation ()

    void
    igt_plane_set_rotation (igt_plane_t *plane,
                            igt_rotation_t rotation);

This function sets a new rotation for the requested `plane` . New `rotation` will be committed at plane commit time via `drmModeSetPlane()`.

#### Parameters

plane | Plane pointer for which rotation is to be set |
rotation | Plane rotation value (0, 90, 180, 270) |

### igt_fb_set_position ()

    void
    igt_fb_set_position (struct igt_fb *fb,
                         igt_plane_t *plane,
                         uint32_t x,
                         uint32_t y);

This function sets position for requested framebuffer as src to plane. New position will be committed at plane commit time via `drmModeSetPlane()`.

#### Parameters

fb | framebuffer pointer |
plane | plane |
x | X position |
y | Y position |

### igt_fb_set_size ()

    void
    igt_fb_set_size (struct igt_fb *fb,
                     igt_plane_t *plane,
                     uint32_t w,
                     uint32_t h);

This function sets fetch rect size from requested framebuffer as src to plane. New size will be committed at plane commit time via `drmModeSetPlane()`.

#### Parameters

fb | framebuffer pointer |
plane | plane |
w | width |
h | height |

### igt_plane_has_rotation ()

    bool
    igt_plane_has_rotation (igt_plane_t *plane,
                            igt_rotation_t rotation);

Check whether `plane` potentially supports the given `rotation` . Note that `rotation` may still rejected later due to other constraints (eg. incompatible pixel format or modifier).

#### Parameters

plane | Plane pointer for which rotation is to be queried |
rotation | Plane rotation value (0, 90, 180, 270) |

### igt_wait_for_vblank ()

    void
    igt_wait_for_vblank (int drm_fd,
                         int crtc_offset);

See igt_wait_for_vblank_count for more details

Waits for 1 vertical blank intervals

#### Parameters

drm_fd | A drm file descriptor |
crtc_offset | offset of a crtc in drmModeRes.crtcs |

### igt_wait_for_vblank_count ()

    void
    igt_wait_for_vblank_count (int drm_fd,
                               int crtc_offset,
                               int count);

Waits for a given number of vertical blank intervals

In DRM, 'Pipe', as understood by DRM_IOCTL_WAIT_VBLANK, is actually an offset of crtc in drmModeRes.crtcs and it has nothing to do with a hardware concept of a pipe. They can match but don't have to in case of DRM lease or non-contiguous pipes.

To make thing clear we are calling DRM_IOCTL_WAIT_VBLANK's 'pipe' a crtc_offset.

#### Parameters

drm_fd | A drm file descriptor |
crtc_offset | offset of the crtc in drmModeRes.crtcs |
count | Number of vblanks to wait on |

### igt_output_is_connected ()

    bool
    igt_output_is_connected (igt_output_t *output);

### igt_pipe_connector_valid()

    #define             igt_pipe_connector_valid(pipe, output)

Checks whether the given pipe and output can be used together.

#### Parameters

pipe | pipe to check. |
output | igt_output_t to check. |

### for_each_if()

    #define for_each_if(condition) if (!(condition)) {} else

### for_each_output()

    #define             for_each_output(display, output)

This for loop iterates over all outputs.

#### Parameters

display | a pointer to an igt_display_t structure |
output | The output to iterate. |

### for_each_connected_output()

    #define             for_each_connected_output(display, output)

This for loop iterates over all connected outputs.

#### Parameters

display | a pointer to an igt_display_t structure |
output | The output to iterate. |

### for_each_disconnected_output()

    #define             for_each_disconnected_output(display, output)

This for loop iterates over all disconnected outputs.

#### Parameters

display | a pointer to an igt_display_t structure |
output | The output to iterate. |

### for_each_pipe_static()

    #define             for_each_pipe_static(pipe)

This for loop iterates over all pipes supported by IGT libraries.

This should be used to enumerate per-pipe subtests since it has no runtime depencies.

#### Parameters

pipe | The pipe to iterate. |

### for_each_pipe()

    #define             for_each_pipe(display, pipe)

This for loop iterates over all pipes.

Note that this cannot be used to enumerate per-pipe subtest names since it depends upon runtime probing of the actual kms driver that is being tested. Use for_each_pipe_static instead.

#### Parameters

display | a pointer to an igt_display_t structure |
pipe | The pipe to iterate. |

### for_each_pipe_with_valid_output()

    #define             for_each_pipe_with_valid_output(display, pipe, output)

This for loop is called over all connected outputs. This function will try every combination of `pipe` and `output` .

If you only need to test a single output for each pipe, use `for_each_pipe_with_single_output()`, if you only need an output for a single pipe, use `igt_get_single_output_for_pipe()`.

#### Parameters

display | a pointer to an igt_display_t structure |
pipe | The pipe for which this `pipe` / `output` combination is valid. |
output | The output for which this `pipe` / `output` combination is valid. |

### for_each_pipe_with_single_output()

    #define             for_each_pipe_with_single_output(display, pipe, output)

This loop is called over all pipes, and will try to find a compatible output for each pipe. Unlike `for_each_pipe_with_valid_output()`, this function will be called at most once for each pipe.

#### Parameters

display | a pointer to an igt_display_t structure |
pipe | The pipe for which this `pipe` / `output` combination is valid. |
output | The output for which this `pipe` / `output` combination is valid. |

### for_each_valid_output_on_pipe()

    #define             for_each_valid_output_on_pipe(display, pipe, output)

This for loop is called over all connected `output` that can be used on this `pipe` . If there are no valid outputs for this pipe, nothing happens.

#### Parameters

display | a pointer to an igt_display_t structure |
pipe | Pipe to enumerate valid outputs over |
output | The enumerated output. |

### for_each_plane_on_pipe()

    #define             for_each_plane_on_pipe(display, pipe, plane)

### for_each_connector_mode()

    #define             for_each_connector_mode(output)

### IGT_FIXED()

    #define IGT_FIXED(i,f) ((i) << 16 | (f))

### igt_plane_has_prop ()

    bool
    igt_plane_has_prop (igt_plane_t *plane,
                        enum igt_atomic_plane_properties prop);

Check whether plane supports a given property.

#### Parameters

plane | Plane to check. |
prop | Property to check. |

#### Returns

True if the property is supported, otherwise false.

### igt_plane_get_prop ()

    uint64_t
    igt_plane_get_prop (igt_plane_t *plane,
                        enum igt_atomic_plane_properties prop);

Return current value on a plane for a given property.

#### Parameters

plane | Target plane. |
prop | Property to check. |

#### Returns

The value the property is set to, if this is a blob, the blob id is returned. This can be passed to `drmModeGetPropertyBlob()` to get the contents of the blob.

### igt_plane_is_prop_changed()

    #define             igt_plane_is_prop_changed(plane, prop)

### igt_plane_set_prop_changed()

    #define             igt_plane_set_prop_changed(plane, prop)

### igt_plane_clear_prop_changed()

    #define             igt_plane_clear_prop_changed(plane, prop)

### igt_plane_set_prop_value()

    #define             igt_plane_set_prop_value(plane, prop, value)

### igt_plane_try_prop_enum ()

    bool
    igt_plane_try_prop_enum (igt_plane_t *plane,
                             enum igt_atomic_plane_properties prop,
                             const char *val);

### igt_plane_set_prop_enum ()

    void
    igt_plane_set_prop_enum (igt_plane_t *plane,
                             enum igt_atomic_plane_properties prop,
                             const char *val);

### igt_plane_replace_prop_blob ()

    void
    igt_plane_replace_prop_blob (igt_plane_t *plane,
                                 enum igt_atomic_plane_properties prop,
                                 const void *ptr,
                                 size_t length);

This function will destroy the old property blob for the given property, and will create a new property blob with the values passed to this function.

The new property blob will be committed when you call `igt_display_commit()`, `igt_display_commit2()` or `igt_display_commit_atomic()`.

#### Parameters

plane | plane to set property on. |
prop | property for which the blob will be replaced. |
ptr | Pointer to contents for the property. |
length | Length of contents. |

### igt_output_has_prop ()

    bool
    igt_output_has_prop (igt_output_t *output,
                         enum igt_atomic_connector_properties prop);

Check whether output supports a given property.

#### Parameters

output | Output to check. |
prop | Property to check. |

#### Returns

True if the property is supported, otherwise false.

### igt_output_get_prop ()

    uint64_t
    igt_output_get_prop (igt_output_t *output,
                         enum igt_atomic_connector_properties prop);

Return current value on an output for a given property.

#### Parameters

output | Target output. |
prop | Property to return. |

#### Returns

The value the property is set to, if this is a blob, the blob id is returned. This can be passed to `drmModeGetPropertyBlob()` to get the contents of the blob.

### igt_output_is_prop_changed()

    #define             igt_output_is_prop_changed(output, prop)

### igt_output_set_prop_changed()

    #define             igt_output_set_prop_changed(output, prop)

### igt_output_clear_prop_changed()

    #define             igt_output_clear_prop_changed(output, prop)

### igt_output_set_prop_value()

    #define             igt_output_set_prop_value(output, prop, value)

### igt_output_try_prop_enum ()

    bool
    igt_output_try_prop_enum (igt_output_t *output,
                              enum igt_atomic_connector_properties prop,
                              const char *val);

### igt_output_set_prop_enum ()

    void
    igt_output_set_prop_enum (igt_output_t *output,
                              enum igt_atomic_connector_properties prop,
                              const char *val);

### igt_output_replace_prop_blob ()

    void
    igt_output_replace_prop_blob (igt_output_t *output,
                                  enum igt_atomic_connector_properties prop,
                                  const void *ptr,
                                  size_t length);

This function will destroy the old property blob for the given property, and will create a new property blob with the values passed to this function.

The new property blob will be committed when you call `igt_display_commit()`, `igt_display_commit2()` or `igt_display_commit_atomic()`.

#### Parameters

output | output to set property on. |
prop | property for which the blob will be replaced. |
ptr | Pointer to contents for the property. |
length | Length of contents. |

### igt_pipe_obj_has_prop ()

    bool
    igt_pipe_obj_has_prop (igt_pipe_t *pipe,
                           enum igt_atomic_crtc_properties prop);

Check whether pipe supports a given property.

#### Parameters

pipe | Pipe to check. |
prop | Property to check. |

#### Returns

True if the property is supported, otherwise false.

### igt_pipe_obj_get_prop ()

    uint64_t
    igt_pipe_obj_get_prop (igt_pipe_t *pipe,
                           enum igt_atomic_crtc_properties prop);

Return current value on a pipe for a given property.

#### Parameters

pipe | Target pipe. |
prop | Property to return. |

#### Returns

The value the property is set to, if this is a blob, the blob id is returned. This can be passed to `drmModeGetPropertyBlob()` to get the contents of the blob.

### igt_pipe_get_prop ()

    uint64_t
    igt_pipe_get_prop (igt_display_t *display,
                       enum pipe pipe,
                       enum igt_atomic_crtc_properties prop);

Return current value on a pipe for a given property.

#### Parameters

display | Pointer to display. |
pipe | Target pipe. |
prop | Property to return. |

#### Returns

The value the property is set to, if this is a blob, the blob id is returned. This can be passed to `drmModeGetPropertyBlob()` to get the contents of the blob.

### igt_pipe_has_prop ()

    bool
    igt_pipe_has_prop (igt_display_t *display,
                       enum pipe pipe,
                       enum igt_atomic_crtc_properties prop);

Check whether pipe supports a given property.

#### Parameters

display | Pointer to display. |
pipe | Pipe to check. |
prop | Property to check. |

#### Returns

True if the property is supported, otherwise false.

### igt_pipe_obj_is_prop_changed()

    #define             igt_pipe_obj_is_prop_changed(pipe_obj, prop)

### igt_pipe_is_prop_changed()

    #define             igt_pipe_is_prop_changed(display, pipe, prop)

### igt_pipe_obj_set_prop_changed()

    #define             igt_pipe_obj_set_prop_changed(pipe_obj, prop)

### igt_pipe_set_prop_changed()

    #define             igt_pipe_set_prop_changed(display, pipe, prop)

### igt_pipe_obj_clear_prop_changed()

    #define             igt_pipe_obj_clear_prop_changed(pipe_obj, prop)

### igt_pipe_clear_prop_changed()

    #define             igt_pipe_clear_prop_changed(display, pipe, prop)

### igt_pipe_obj_set_prop_value()

    #define             igt_pipe_obj_set_prop_value(pipe_obj, prop, value)

### igt_pipe_set_prop_value()

    #define             igt_pipe_set_prop_value(display, pipe, prop, value)

### igt_pipe_obj_try_prop_enum ()

    bool
    igt_pipe_obj_try_prop_enum (igt_pipe_t *pipe,
                                enum igt_atomic_crtc_properties prop,
                                const char *val);

### igt_pipe_obj_set_prop_enum ()

    void
    igt_pipe_obj_set_prop_enum (igt_pipe_t *pipe,
                                enum igt_atomic_crtc_properties prop,
                                const char *val);

### igt_pipe_try_prop_enum()

    #define             igt_pipe_try_prop_enum(display, pipe, prop, val)

### igt_pipe_set_prop_enum()

    #define             igt_pipe_set_prop_enum(display, pipe, prop, val)

### igt_pipe_obj_replace_prop_blob ()

    void
    igt_pipe_obj_replace_prop_blob (igt_pipe_t *pipe,
                                    enum igt_atomic_crtc_properties prop,
                                    const void *ptr,
                                    size_t length);

This function will destroy the old property blob for the given property, and will create a new property blob with the values passed to this function.

The new property blob will be committed when you call `igt_display_commit()`, `igt_display_commit2()` or `igt_display_commit_atomic()`.

Please use `igt_output_override_mode()` if you want to set IGT_CRTC_MODE_ID, it works better with legacy commit.

#### Parameters

pipe | pipe to set property on. |
prop | property for which the blob will be replaced. |
ptr | Pointer to contents for the property. |
length | Length of contents. |

### igt_pipe_replace_prop_blob()

    #define             igt_pipe_replace_prop_blob(display, pipe, prop, ptr, length)

### igt_pipe_refresh ()

    void
    igt_pipe_refresh (igt_display_t *display,
                      enum pipe pipe,
                      bool force);

### igt_enable_connectors ()

    void
    igt_enable_connectors (int drm_fd);

Force connectors to be enabled where this is known to work well. Use igt_reset_connectors to revert the changes.

An exit handler is installed to ensure connectors are reset when the test exits.

#### Parameters

drm_fd | A drm file descriptor |

### igt_reset_connectors ()

    void
    igt_reset_connectors (void);

Remove any forced state from the connectors.

### kmstest_get_vbl_flag ()

    uint32_t
    kmstest_get_vbl_flag (int crtc_offset);

Convert an offset of an crtc in drmModeRes.crtcs into flag representation expected by DRM_IOCTL_WAIT_VBLANK. See igt_wait_for_vblank_count for details

#### Parameters

crtc_offset | CRTC offset to convert into pipe flag representation. |

### igt_kms_get_base_edid ()

    const struct edid *
    igt_kms_get_base_edid (void);

Get the base edid block, which includes the following modes:

- 1920x1080 60Hz

- 1280x720 60Hz

- 1024x768 60Hz

- 800x600 60Hz

- 640x480 60Hz

#### Returns

a basic edid block

### igt_kms_get_full_edid ()

    const struct edid *
    igt_kms_get_full_edid (void);

### igt_kms_get_base_tile_edid ()

    const struct edid *
    igt_kms_get_base_tile_edid (void);

### igt_kms_get_alt_edid ()

    const struct edid *
    igt_kms_get_alt_edid (void);

Get an alternate edid block, which includes the following modes:

- 1400x1050 60Hz

- 1920x1080 60Hz

- 1280x720 60Hz

- 1024x768 60Hz

- 800x600 60Hz

- 640x480 60Hz

#### Returns

an alternate edid block

### igt_kms_get_hdmi_audio_edid ()

    const struct edid *
    igt_kms_get_hdmi_audio_edid (void);

### igt_kms_get_dp_audio_edid ()

    const struct edid *
    igt_kms_get_dp_audio_edid (void);

### igt_kms_get_4k_edid ()

    const struct edid *
    igt_kms_get_4k_edid (void);

### igt_kms_get_3d_edid ()

    const struct edid *
    igt_kms_get_3d_edid (void);

### igt_kms_get_aspect_ratio_edid ()

    const struct edid *
    igt_kms_get_aspect_ratio_edid (void);

Gets the base edid block, which includes the following modes and different aspect ratio

- 1920x1080 60Hz

- 1280x720 60Hz

- 1024x768 60Hz

- 800x600 60Hz

- 640x480 60Hz

#### Returns

a basic edid block with aspect ratio block

### igt_kms_get_tiled_edid ()

    struct edid **
    igt_kms_get_tiled_edid (uint8_t htile,
                            uint8_t vtile);

### igt_kms_get_custom_edid ()

    const struct edid *
    igt_kms_get_custom_edid (enum igt_custom_edid_type edid);

`edid` : enum to specify which edid block is required returns pointer to requested edid block

#### Returns

required edid

### igt_watch_uevents ()

    struct udev_monitor *
    igt_watch_uevents (void);

Begin monitoring udev for sysfs uevents.

#### Returns

a udev monitor for detecting uevents on

### igt_hotplug_detected ()

    bool
    igt_hotplug_detected (struct udev_monitor *mon,
                          int timeout_secs);

Detect if a hotplug event was received since we last checked the monitor.

#### Parameters

mon | A udev monitor initialized with igt_watch_uevents |
timeout_secs | How long to wait for a hotplug event to occur. |

#### Returns

true if a sysfs hotplug event was received, false if we timed out

### igt_lease_change_detected ()

    bool
    igt_lease_change_detected (struct udev_monitor *mon,
                               int timeout_secs);

Detect if a lease change event was received since we last checked the monitor.

#### Parameters

mon | A udev monitor initialized with igt_watch_uevents |
timeout_secs | How long to wait for a lease change event to occur. |

#### Returns

true if a sysfs lease change event was received, false if we timed out

### igt_connector_event_detected ()

    bool
    igt_connector_event_detected (struct udev_monitor *mon,
                                  uint32_t conn_id,
                                  uint32_t prop_id,
                                  int timeout_msecs);

Detect if a connector event is received for a given connector and property.

#### Parameters

mon | A udev monitor initialized with igt_watch_uevents |
conn_id | Connector id of the Connector for which the property change is expected. |
prop_id | Property id for which the change is expected. |
timeout_secs | How long to wait for a connector event to occur. |

#### Returns

true if the connector event was received, false if we timed out

### igt_flush_uevents ()

    void
    igt_flush_uevents (struct udev_monitor *mon);

Get rid of any pending uevents

#### Parameters

mon | A udev monitor initialized with igt_watch_uevents |

### igt_cleanup_uevents ()

    void
    igt_cleanup_uevents (struct udev_monitor *mon);

Cleanup the resources allocated by igt_watch_uevents

#### Parameters

mon | A udev monitor initialized with igt_watch_uevents |

### igt_display_has_format_mod ()

    bool
    igt_display_has_format_mod (igt_display_t *display,
                                uint32_t format,
                                uint64_t modifier);

### igt_plane_has_format_mod ()

    bool
    igt_plane_has_format_mod (igt_plane_t *plane,
                              uint32_t format,
                              uint64_t modifier);

### igt_vblank_after_eq ()

    bool
    igt_vblank_after_eq (uint32_t a,
                         uint32_t b);

Compare vblank sequence numbers, handling wraparound correctly.

#### Parameters

a | First vblank sequence number. |
b | Second vblank sequence number. |

#### Returns

`a` >= `b`

### igt_vblank_before_eq ()

    bool
    igt_vblank_before_eq (uint32_t a,
                          uint32_t b);

Compare vblank sequence numbers, handling wraparound correctly.

#### Parameters

a | First vblank sequence number. |
b | Second vblank sequence number. |

#### Returns

`a` <= `b`

### igt_vblank_after ()

    bool
    igt_vblank_after (uint32_t a,
                      uint32_t b);

Compare vblank sequence numbers, handling wraparound correctly.

#### Parameters

a | First vblank sequence number. |
b | Second vblank sequence number. |

#### Returns

`a` > `b`

### igt_vblank_before ()

    bool
    igt_vblank_before (uint32_t a,
                       uint32_t b);

Compare vblank sequence numbers, handling wraparound correctly.

#### Parameters

a | First vblank sequence number. |
b | Second vblank sequence number. |

#### Returns

`a` < `b`

### igt_parse_connector_tile_blob ()

    void
    igt_parse_connector_tile_blob (drmModePropertyBlobPtr blob,
                                   igt_tile_info_t *tile);

Parses the connector tile blob to extract the tile information. The blob information is exposed from drm/drm_connector.c in the kernel. The format of the tile property is defined in the kernel as char tile[256] that consists of 8 integers that are ':' separated.

#### Parameters

blob | pointer to the connector's tile properties |
tile | pointer to tile structure that is populated by the function |

### igt_connector_sysfs_open ()

    int
    igt_connector_sysfs_open (int drm_fd,
                              drmModeConnector *connector);

### igt_reduce_format ()

    uint32_t
    igt_reduce_format (uint32_t format);

Reduce `format` to a base format. The aim is to allow grouping sufficiently similar formats into classes. Formats with identical component sizes, overall pixel size, chroma subsamling, etc. are considered part of the same class, no matter in which order the components appear. We arbitrarily choose one of the formats in the class as the base format. Note that the base format itself may not be supported by whatever device is being tested even if some of the other formats in the class are supported.

#### Parameters

format | drm fourcc |

#### Returns

The base format for `format`

### igt_require_pipe ()

    void
    igt_require_pipe (igt_display_t *display,
                      enum pipe pipe);

### igt_dump_connectors_fd ()

    void
    igt_dump_connectors_fd (int drmfd);

Iterates through list of connectors and dumps their list of modes.

#### Parameters

drmfd | handle to open drm device. |

### igt_dump_crtcs_fd ()

    void
    igt_dump_crtcs_fd (int drmfd);

Iterates through the list of crtcs and dumps out the mode and basic information for each of them.

#### Parameters

drmfd | handle to open drm device. |

### igt_override_all_active_output_modes_to_fit_bw ()

    bool
    igt_override_all_active_output_modes_to_fit_bw
                                   (igt_display_t *display);

Override the mode on all active outputs (i.e. pending_pipe != PIPE_NONE) on basis of bandwidth.

#### Parameters

display | a pointer to an igt_display_t structure |

#### Returns

true if a valid connector mode combo found, else false

### igt_is_dsc_supported ()

    bool
    igt_is_dsc_supported (int drmfd,
                          char *connector_name);

### igt_is_fec_supported ()

    bool
    igt_is_fec_supported (int drmfd,
                          char *connector_name);

### igt_is_dsc_enabled ()

    bool
    igt_is_dsc_enabled (int drmfd,
                        char *connector_name);

### igt_is_force_dsc_enabled ()

    bool
    igt_is_force_dsc_enabled (int drmfd,
                              char *connector_name);

### igt_force_dsc_enable ()

    int
    igt_force_dsc_enable (int drmfd,
                          char *connector_name);

### igt_force_dsc_enable_bpc ()

    int
    igt_force_dsc_enable_bpc (int drmfd,
                              char *connector_name,
                              int bpc);

### igt_get_dsc_debugfs_fd ()

    int
    igt_get_dsc_debugfs_fd (int drmfd,
                            char *connector_name);

### igt_get_output_max_bpc ()

    unsigned int
    igt_get_output_max_bpc (int drmfd,
                            char *connector_name);

### igt_get_pipe_current_bpc ()

    unsigned int
    igt_get_pipe_current_bpc (int drmfd,
                              enum pipe pipe);

### igt_assert_output_bpc_equal ()

    void
    igt_assert_output_bpc_equal (int drmfd,
                                 enum pipe pipe,
                                 char *output_name,
                                 unsigned int bpc);

### igt_check_output_bpc_equal ()

    bool
    igt_check_output_bpc_equal (int drmfd,
                                enum pipe pipe,
                                char *output_name,
                                unsigned int bpc);

### sort_drm_modes_by_clk_dsc ()

    int
    sort_drm_modes_by_clk_dsc (const void *a,
                               const void *b);

Comparator function for sorting DRM modes in descending order by clock.

#### Parameters

a | first element |
b | second element |

### sort_drm_modes_by_clk_asc ()

    int
    sort_drm_modes_by_clk_asc (const void *a,
                               const void *b);

Comparator function for sorting DRM modes in ascending order by clock.

#### Parameters

a | first element |
b | second element |

### sort_drm_modes_by_res_dsc ()

    int
    sort_drm_modes_by_res_dsc (const void *a,
                               const void *b);

Comparator function for sorting DRM modes in descending order by resolution.

#### Parameters

a | first element |
b | second element |

### sort_drm_modes_by_res_asc ()

    int
    sort_drm_modes_by_res_asc (const void *a,
                               const void *b);

Comparator function for sorting DRM modes in ascending order by resolution.

#### Parameters

a | first element |
b | second element |

### igt_sort_connector_modes ()

    void
    igt_sort_connector_modes (drmModeConnector *connector,
                              int (*comparator) (const void *, const void*));

Sorts connector modes based on the `comparator` .

#### Parameters

connector | libdrm connector |
comparator | comparison function to compare two elements |

### igt_max_bpc_constraint ()

    bool
    igt_max_bpc_constraint (igt_display_t *display,
                            enum pipe pipe,
                            igt_output_t *output,
                            int bpc);

### igt_check_bigjoiner_support ()

    bool
    igt_check_bigjoiner_support (igt_display_t *display);

### igt_parse_mode_string ()

    bool
    igt_parse_mode_string (const char *mode_string,
                           drmModeModeInfo *mode);

Parse mode string and populate mode

Format: clock(MHz),hdisp,hsync-start,hsync-end,htotal,vdisp,vsync-start, vsync-end,vtotal

#### Parameters

mode_string | modeline string |
mode | a pointer to a drm mode structure |

#### Returns

true if the correct number of arguments are entered, else false.

## Types and Values

### enum pipe

#### Members

PIPE_NONE | Invalid pipe, used for disconnecting a output from a pipe. |
PIPE_ANY | Deprecated alias for `PIPE_NONE` . |
PIPE_A | First crtc. |
PIPE_B | Second crtc. |
PIPE_C | Third crtc. |
PIPE_D | Fourth crtc. |
PIPE_E | Fifth crtc. |
PIPE_F | Sixth crtc. |
IGT_MAX_PIPES | Max number of pipes allowed. |

### enum port

#### Members

PORT_A |  |
PORT_B |  |
PORT_C |  |
PORT_D |  |
PORT_E |  |
I915_MAX_PORTS |  |

### enum igt_custom_edid_type

Enum used for the helper function igt_custom_edid_type `IGT_CUSTOM_EDID_BASE` : Returns base edid `IGT_CUSTOM_EDID_FULL` : Returns edid with full list of standard timings. `IGT_CUSTOM_EDID_ALT` : Returns alternate edid `IGT_CUSTOM_EDID_HDMI_AUDIO` : Returns edid with HDMI audio block `IGT_CUSTOM_EDID_DP_AUDIO` : Returns edid with DP audio block `IGT_CUSTOM_EDID_ASPECT_RATIO` : Returns base edid with apect ratio data block

#### Members

IGT_CUSTOM_EDID_BASE |  |
IGT_CUSTOM_EDID_FULL |  |
IGT_CUSTOM_EDID_ALT |  |
IGT_CUSTOM_EDID_HDMI_AUDIO |  |
IGT_CUSTOM_EDID_DP_AUDIO |  |
IGT_CUSTOM_EDID_ASPECT_RATIO |  |

### IGT_CUSTOM_EDID_COUNT

    #define IGT_CUSTOM_EDID_COUNT 6

### MAX_HDISPLAY_PER_PIPE

    #define MAX_HDISPLAY_PER_PIPE 5120

### enum igt_atomic_crtc_properties

#### Members

IGT_CRTC_CTM |  |
IGT_CRTC_GAMMA_LUT |  |
IGT_CRTC_GAMMA_LUT_SIZE |  |
IGT_CRTC_DEGAMMA_LUT |  |
IGT_CRTC_DEGAMMA_LUT_SIZE |  |
IGT_CRTC_MODE_ID |  |
IGT_CRTC_ACTIVE |  |
IGT_CRTC_OUT_FENCE_PTR |  |
IGT_CRTC_VRR_ENABLED |  |
IGT_CRTC_SCALING_FILTER |  |
IGT_NUM_CRTC_PROPS |  |

### enum igt_atomic_connector_properties

#### Members

IGT_CONNECTOR_SCALING_MODE |  |
IGT_CONNECTOR_CRTC_ID |  |
IGT_CONNECTOR_DPMS |  |
IGT_CONNECTOR_BROADCAST_RGB |  |
IGT_CONNECTOR_CONTENT_PROTECTION |  |
IGT_CONNECTOR_VRR_CAPABLE |  |
IGT_CONNECTOR_HDCP_CONTENT_TYPE |  |
IGT_CONNECTOR_LINK_STATUS |  |
IGT_CONNECTOR_MAX_BPC |  |
IGT_CONNECTOR_HDR_OUTPUT_METADATA |  |
IGT_CONNECTOR_WRITEBACK_PIXEL_FORMATS |  |
IGT_CONNECTOR_WRITEBACK_FB_ID |  |
IGT_CONNECTOR_WRITEBACK_OUT_FENCE_PTR |  |
IGT_CONNECTOR_DITHERING_MODE |  |
IGT_NUM_CONNECTOR_PROPS |  |

### struct kmstest_connector_config

    struct kmstest_connector_config {
    	drmModeCrtc *crtc;
    	drmModeConnector *connector;
    	drmModeEncoder *encoder;
    	drmModeModeInfo default_mode;

    	int pipe;
    	unsigned valid_crtc_idx_mask;
    	char *connector_path;
    };

### struct kmstest_plane

    struct kmstest_plane {
    	int id;
    	int index;
    	int type;
    	int pos_x;
    	int pos_y;
    	int width;
    	int height;
    };

### struct kmstest_crtc

    struct kmstest_crtc {
    	int id;
    	int pipe;
    	bool active;
    	int width;
    	int height;
    	int n_planes;
    	struct kmstest_plane *planes;
    };

### enum kmstest_force_connector_state

#### Members

FORCE_CONNECTOR_UNSPECIFIED | Unspecified |
FORCE_CONNECTOR_ON | On |
FORCE_CONNECTOR_DIGITAL | Digital |
FORCE_CONNECTOR_OFF | Off |

### enum intel_broadcast_rgb_mode

#### Members

BROADCAST_RGB_AUTO | Choose the color range to use automatically |
BROADCAST_RGB_FULL | Force the connector to use full color range |
BROADCAST_RGB_16_235 | Force the connector to use a limited 16:235 color range |

### enum igt_commit_style

#### Members

COMMIT_LEGACY | Changes will be committed using the legacy API. |
COMMIT_UNIVERSAL | Changes will be committed with the universal plane API, no modesets are allowed. |
COMMIT_ATOMIC | Changes will be committed using the atomic API. |

### enum igt_atomic_plane_properties

#### Members

IGT_PLANE_SRC_X |  |
IGT_PLANE_SRC_Y |  |
IGT_PLANE_SRC_W |  |
IGT_PLANE_SRC_H |  |
IGT_PLANE_CRTC_X |  |
IGT_PLANE_CRTC_Y |  |
IGT_PLANE_CRTC_W |  |
IGT_PLANE_CRTC_H |  |
IGT_PLANE_FB_ID |  |
IGT_PLANE_CRTC_ID |  |
IGT_PLANE_IN_FENCE_FD |  |
IGT_PLANE_TYPE |  |
IGT_PLANE_ROTATION |  |
IGT_PLANE_IN_FORMATS |  |
IGT_PLANE_COLOR_ENCODING |  |
IGT_PLANE_COLOR_RANGE |  |
IGT_PLANE_PIXEL_BLEND_MODE |  |
IGT_PLANE_ALPHA |  |
IGT_PLANE_ZPOS |  |
IGT_PLANE_FB_DAMAGE_CLIPS |  |
IGT_PLANE_SCALING_FILTER |  |
IGT_NUM_PLANE_PROPS |  |

### igt_display_t

    typedef struct igt_display igt_display_t;

### igt_pipe_t

    typedef struct igt_pipe igt_pipe_t;

### igt_fixed_t

    typedef uint32_t igt_fixed_t;			/* 16.16 fixed point */

### enum igt_rotation_t

#### Members

IGT_ROTATION_0 |  |
IGT_ROTATION_90 |  |
IGT_ROTATION_180 |  |
IGT_ROTATION_270 |  |
IGT_REFLECT_X |  |
IGT_REFLECT_Y |  |

### IGT_ROTATION_MASK

    #define             IGT_ROTATION_MASK

### igt_plane_t

    typedef struct {
    } igt_plane_t;

### struct igt_pipe

    struct igt_pipe {
    	igt_display_t *display;
    	/* ID of a hardware pipe */
    	enum pipe pipe;
    	/* pipe is enabled or not */
    	bool enabled;

    	int n_planes;
    	int num_primary_planes;
    	int plane_cursor;
    	int plane_primary;
    	igt_plane_t *planes;

    	uint64_t changed;
    	uint32_t props[IGT_NUM_CRTC_PROPS];
    	uint64_t values[IGT_NUM_CRTC_PROPS];

    	/* ID of KMS CRTC object */
    	uint32_t crtc_id;
    	/* offset of a pipe in drmModeRes.crtcs */
    	uint32_t crtc_offset;

    	int32_t out_fence_fd;
    };

### igt_output_t

    typedef struct {
    } igt_output_t;

### struct igt_display

    struct igt_display {
    	int drm_fd;
    	int log_shift;
    	int n_pipes;
    	int n_planes;
    	int n_outputs;
    	igt_output_t *outputs;
    	igt_plane_t *planes;
    	igt_pipe_t *pipes;
    	bool has_cursor_plane;
    	bool is_atomic;
    	bool first_commit;

    	uint64_t *modifiers;
    	uint32_t *formats;
    	int format_mod_count;
    };

### igt_tile_info_t

    typedef struct {
    	int tile_group_id;
    	bool tile_is_single_monitor;
    	uint8_t num_h_tile, num_v_tile;
    	uint8_t tile_h_loc, tile_v_loc;
    	uint16_t tile_h_size, tile_v_size;
    } igt_tile_info_t;

### struct edid

    struct edid;