Top | ![]() |
![]() |
![]() |
![]() |
enum | pipe |
enum | igt_plane |
enum | port |
enum | igt_atomic_crtc_properties |
enum | igt_atomic_connector_properties |
struct | kmstest_connector_config |
enum | kmstest_force_connector_state |
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 |
igt_plane_t | |
struct | igt_pipe |
igt_output_t | |
struct | igt_display |
#define | EDID_LENGTH |
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.
void
kmstest_dump_mode (drmModeModeInfo *mode
);
Prints mode
to stdout in a human-readable form.
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.
void
kmstest_restore_vt_mode (void
);
Restore the VT mode in use before kmstest_set_vt_graphics_mode was called.
bool kmstest_force_connector (int fd
,drmModeConnector *connector
,enum kmstest_force_connector_state state
);
Force the specified state on the specified connector.
void kmstest_edid_add_3d (const unsigned char *edid
,size_t length
,unsigned char *new_edid_ptr[]
,size_t *new_length
);
Makes a copy of an existing edid block and adds an extension indicating stereo 3D capabilities.
void kmstest_force_edid (int drm_fd
,drmModeConnector *connector
,const unsigned char *edid
,size_t length
);
Set the EDID data on connector
to edid
. See also igt_kms_get_base_edid.
If length
is zero, the forced EDID will be removed.
drm_fd |
drm file descriptor |
|
connector |
connector to set |
|
edid |
An EDID data block |
|
length |
length of the EDID data. EDID_LENGTH defines the standard EDID length |
bool kmstest_get_connector_default_mode (int drm_fd
,drmModeConnector *connector
,drmModeModeInfo *mode
);
Retrieves the default mode for connector
and stores it in mode
.
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
.
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.
void
kmstest_free_connector_config (struct kmstest_connector_config *config
);
Free any resources in config
allocated in kmstest_get_connector_config()
.
void kmstest_set_connector_dpms (int fd
,drmModeConnector *connector
,int mode
);
This function sets the DPMS setting of connector
to mode
.
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.
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. |
void kmstest_unset_all_crtcs (int drm_fd
,drmModeResPtr resources
);
Disables all the screens.
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.
uint32_t kmstest_find_crtc_for_connector (int fd
,drmModeRes *res
,drmModeConnector *connector
,uint32_t crtc_blacklist_idx_mask
);
uint32_t kmstest_dumb_create (int fd
,int width
,int height
,int bpp
,unsigned *stride
,unsigned *size
);
This wraps the CREATE_DUMB ioctl, which allocates a new dumb buffer object for the specified dimensions.
void * kmstest_dumb_map_buffer (int fd
,uint32_t handle
,uint64_t size
,unsigned prot
);
void igt_display_init (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.
void
igt_display_fini (igt_display_t *display
);
Release any resources associated with display
. This does not free display
itself.
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.
0 upon success. This function will never return upon failure
since igt_fail()
at lower levels will longjmp out of it.
int
igt_display_commit (igt_display_t *display
);
Commits framebuffer and positioning changes to all planes of each display pipe.
0 upon success. This function will never return upon failure
since igt_fail()
at lower levels will longjmp out of it.
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.
display |
igt_display_t to commit. |
|
flags |
Flags passed to drmModeAtomicCommit. |
|
user_data |
User defined pointer passed to drmModeAtomicCommit. |
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.
display |
igt_display_t to commit. |
|
flags |
Flags passed to drmModeAtomicCommit. |
|
user_data |
User defined pointer passed to drmModeAtomicCommit. |
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.
void igt_output_override_mode (igt_output_t *output
,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.
void igt_output_set_scaling_mode (igt_output_t *output
,uint64_t scaling_mode
);
igt_plane_t * igt_output_get_plane (igt_output_t *output
,enum igt_plane plane
);
bool igt_pipe_get_property (igt_pipe_t *pipe
,const char *name
,uint32_t *prop_id
,uint64_t *value
,drmModePropertyPtr *prop
);
void igt_pipe_set_degamma_lut (igt_pipe_t *pipe
,void *ptr
,size_t length
);
void igt_pipe_set_ctm_matrix (igt_pipe_t *pipe
,void *ptr
,size_t length
);
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()
.
void igt_plane_set_rotation (igt_plane_t *plane
,igt_rotation_t rotation
);
void igt_crtc_set_background (igt_pipe_t *pipe
,uint64_t background
);
Sets background color for requested pipe. Color value provided here will be actually submitted at output commit time via "background_color" property. For example to get red as background, set background = 0x00000000FFFF.
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()
.
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()
.
#define igt_pipe_connector_valid(pipe, output)
Checks whether the given pipe and output can be used together.
#define for_each_connected_output(display, output)
This for loop iterates over all outputs.
#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
.
display |
a pointer to an igt_display_t structure |
|
pipe |
The pipe for which this |
|
output |
The output for which this |
#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.
display |
a pointer to an igt_display_t structure |
|
pipe |
Pipe to enumerate valid outputs over |
|
output |
The enumerated output. |
#define igt_atomic_populate_connector_req(req, output, prop, value)
void
igt_enable_connectors (void
);
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.
void
igt_reset_connectors (void
);
Remove any forced state from the connectors.
uint32_t
kmstest_get_vbl_flag (uint32_t pipe_id
);
Convert a pipe id into the flag representation expected in DRM while processing DRM_IOCTL_WAIT_VBLANK.
const unsigned char *
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
This can be extended with further features using functions such as kmstest_edid_add_3d.
const unsigned char *
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
This can be extended with further features using functions such as kmstest_edid_add_3d.
struct kmstest_connector_config { drmModeCrtc *crtc; drmModeConnector *connector; drmModeEncoder *encoder; drmModeModeInfo default_mode; uint64_t connector_scaling_mode; bool connector_scaling_mode_changed; bool pipe_changed; uint32_t atomic_props_connector[IGT_NUM_CONNECTOR_PROPS]; int pipe; unsigned valid_crtc_idx_mask; };
struct igt_pipe { igt_display_t *display; enum pipe pipe; bool enabled; int n_planes; igt_plane_t planes[IGT_MAX_PLANES]; uint32_t atomic_props_crtc[IGT_NUM_CRTC_PROPS]; uint64_t background; /* Background color MSB BGR 16bpc LSB */ uint32_t background_changed : 1; uint32_t background_property; uint64_t degamma_blob; uint32_t degamma_property; uint64_t ctm_blob; uint32_t ctm_property; uint64_t gamma_blob; uint32_t gamma_property; uint32_t color_mgmt_changed : 1; uint32_t crtc_id; uint64_t mode_blob; bool mode_changed; };
struct igt_display { int drm_fd; int log_shift; int n_pipes; int n_outputs; unsigned long pipes_in_use; igt_output_t *outputs; igt_pipe_t pipes[I915_MAX_PIPES]; bool has_universal_planes; bool is_atomic; };