Chamelium

Chamelium — Library for using the Chamelium into igt tests

Functions

void chamelium_deinit_rpc_only ()
struct chamelium * chamelium_init_rpc_only ()
struct chamelium * chamelium_init ()
void chamelium_deinit ()
void chamelium_reset ()
struct chamelium_port ** chamelium_get_ports ()
drmModeConnector * chamelium_port_get_connector ()
const char * chamelium_port_get_name ()
void chamelium_require_connector_present ()
drmModeConnection chamelium_reprobe_connector ()
void chamelium_wait_for_conn_status_change ()
void chamelium_reset_state ()
bool chamelium_wait_reachable ()
void chamelium_assert_reachable ()
void chamelium_plug ()
void chamelium_unplug ()
bool chamelium_is_plugged ()
bool chamelium_port_wait_video_input_stable ()
void chamelium_fire_mixed_hpd_pulses ()
void chamelium_fire_hpd_pulses ()
void chamelium_schedule_hpd_toggle ()
struct chamelium_edid * chamelium_new_edid ()
const struct edid * chamelium_edid_get_raw ()
struct edid * chamelium_edid_get_editable_raw ()
void chamelium_port_set_edid ()
void chamelium_port_set_tiled_edid ()
bool chamelium_port_get_ddc_state ()
void chamelium_port_set_ddc_state ()
void chamelium_port_get_resolution ()
bool chamelium_supports_get_video_params ()
void chamelium_port_get_video_params ()
igt_crc_t * chamelium_get_crc_for_area ()
void chamelium_start_capture ()
void chamelium_stop_capture ()
void chamelium_capture ()
bool chamelium_supports_get_last_infoframe ()
struct chamelium_infoframe * chamelium_get_last_infoframe ()
bool chamelium_has_audio_support ()
void chamelium_get_audio_channel_mapping ()
void chamelium_get_audio_format ()
void chamelium_start_capturing_audio ()
struct chamelium_audio_file * chamelium_stop_capturing_audio ()
igt_crc_t * chamelium_read_captured_crcs ()
struct chamelium_frame_dump * chamelium_read_captured_frame ()
struct chamelium_frame_dump * chamelium_port_dump_pixels ()
igt_crc_t * chamelium_calculate_fb_crc ()
struct chamelium_fb_crc_async_data * chamelium_calculate_fb_crc_async_start ()
igt_crc_t * chamelium_calculate_fb_crc_async_finish ()
int chamelium_get_captured_frame_count ()
int chamelium_get_frame_limit ()
void chamelium_assert_frame_eq ()
void chamelium_assert_crc_eq_or_dump ()
void chamelium_assert_frame_match_or_dump ()
bool chamelium_frame_match_or_dump ()
void chamelium_crop_analog_frame ()
void chamelium_destroy_frame_dump ()
void chamelium_destroy_audio_file ()
void chamelium_infoframe_destroy ()
bool chamelium_plug_all ()
bool chamelium_wait_all_configured_ports_connected ()

Types and Values

Includes

#include <igt_chamelium.h>

Description

This library contains helpers for using Chameliums in IGT tests. This allows for tests to simulate more difficult tasks to automate such as display hotplugging, faulty display behaviors, etc.

More information on the Chamelium can be found on the ChromeOS project page.

In order to run tests using the Chamelium, a valid configuration file must be present. It must contain Chamelium-specific keys as shown with the following example:

[Chamelium]
URL=http://chameleon:9992 # The URL used for connecting to the Chamelium's RPC server

# The rest of the sections are used for defining connector mappings.
# This is required so any tests using the Chamelium know which connector
# on the test machine should be connected to each Chamelium port.
#
# In the event that any of these mappings are specified incorrectly,
# any hotplugging tests for the incorrect connector mapping will fail.

[Chamelium:DP-1] # The name of the DRM connector
ChameliumPortID=1 # The ID of the port on the Chamelium this connector is attached to

[Chamelium:HDMI-A-1]
ChameliumPortID=3

Functions

chamelium_deinit_rpc_only ()

void
chamelium_deinit_rpc_only (struct chamelium *chamelium);

Frees the resources used by a connection to the chamelium that was set up with chamelium_init_rpc_only.

Parameters

chamelium

The Chamelium instance to use

 

chamelium_init_rpc_only ()

struct chamelium *
chamelium_init_rpc_only (void);

Sets up a connection with a chamelium, using the URL specified in the Chamelium configuration. The function initializes only the RPC - no port autodiscovery happens, which means only the functions that do not require struct chamelium_port can be called with an instance produced by this function.

chamelium_init is almost always a better choice.

Returns

A newly initialized chamelium struct, or NULL on lack of configuration


chamelium_init ()

struct chamelium *
chamelium_init (int drm_fd,
                igt_display_t *display);

Sets up a connection with a chamelium, using the URL specified in the Chamelium configuration. This must be called first before trying to use the chamelium.

Needs to happen *after* igt_display_require() as otherwise the board will get reset.

If we fail to establish a connection with the chamelium, fail to find a configured connector, etc. we fail the current test.

Parameters

chamelium

The Chamelium instance to use

 

drm_fd

a display initialized with igt_display_require

 

Returns

A newly initialized chamelium struct, or NULL on error


chamelium_deinit ()

void
chamelium_deinit (struct chamelium *chamelium);

Frees the resources used by a connection to the chamelium that was set up with chamelium_init. As well, this function restores the state of the chamelium like it was before calling chamelium_init. This function is also called as an exit handler, so users only need to call manually if they don't want the chamelium interfering with other tests in the same file.

Parameters

chamelium

The Chamelium instance to use

 

chamelium_reset ()

void
chamelium_reset (struct chamelium *chamelium);

Resets the chamelium's IO board. As well, this also has the effect of causing all of the chamelium ports to get set to unplugged

Parameters

chamelium

The Chamelium instance to use

 

chamelium_get_ports ()

struct chamelium_port **
chamelium_get_ports (struct chamelium *chamelium,
                     int *count);

Retrieves all of the ports currently configured for use with this chamelium

Parameters

chamelium

The Chamelium instance to use

 

count

Where to store the number of ports

 

Returns

an array containing a pointer to each configured chamelium port


chamelium_port_get_connector ()

drmModeConnector *
chamelium_port_get_connector (struct chamelium *chamelium,
                              struct chamelium_port *port,
                              bool reprobe);

Get a drmModeConnector object for the given Chamelium port, and optionally reprobe the port in the process

Parameters

chamelium

The Chamelium instance to use

 

port

The chamelium port to retrieve the DRM connector for

 

reprobe

Whether or not to reprobe the DRM connector

 

Returns

a drmModeConnector object corresponding to the given port


chamelium_port_get_name ()

const char *
chamelium_port_get_name (struct chamelium_port *port);

Gets the name of the DRM connector corresponding to the given Chamelium port.

Parameters

port

The chamelium port to retrieve the name of

 

Returns

the name of the DRM connector


chamelium_require_connector_present ()

void
chamelium_require_connector_present (struct chamelium_port **ports,
                                     unsigned int type,
                                     int port_count,
                                     int count);

Check there are required ports connected of given type

Parameters

ports

All connected ports

 

type

Required port type

 

port_count

Total port count

 

count

The required number of port count

 

chamelium_reprobe_connector ()

drmModeConnection
chamelium_reprobe_connector (igt_display_t *display,
                             struct chamelium *chamelium,
                             struct chamelium_port *port);

Reprobe the given connector and fetch current status

Parameters

display

A pointer to an igt_display_t structure

 

chamelium

The Chamelium instance to use

 

port

Chamelium port to reprobe

 

Returns

drmModeConnection


chamelium_wait_for_conn_status_change ()

void
chamelium_wait_for_conn_status_change (igt_display_t *display,
                                       struct chamelium *chamelium,
                                       struct chamelium_port *port,
                                       drmModeConnection status);

Wait for the connector to change the status

Parameters

display

A pointer to an igt_display_t structure

 

chamelium

The Chamelium instance to use

 

port

Chamelium port to check connector status update

 

status

Enum which describes connector states

 

chamelium_reset_state ()

void
chamelium_reset_state (igt_display_t *display,
                       struct chamelium *chamelium,
                       struct chamelium_port *port,
                       struct chamelium_port **ports,
                       int port_count);

chamelium : The Chamelium instance to use port : Chamelium port to reset ports : All connected ports port_count : Count of connected ports

Reset chamelium ports


chamelium_wait_reachable ()

bool
chamelium_wait_reachable (struct chamelium *chamelium,
                          int timeout);

Parameters

chamelium

The Chamelium instance to use

 

timeout

Time (in seconds) to wait for chamelium to be reachable

 

Returns

true if the Chamelium is reachable, false otherwise.


chamelium_assert_reachable ()

void
chamelium_assert_reachable (struct chamelium *chamelium,
                            int timeout);

Asserts that the chamelium is reachable.

Parameters

chamelium

The Chamelium instance to use

 

timeout

Time (in seconds) to wait for chamelium to be reachable

 

chamelium_plug ()

void
chamelium_plug (struct chamelium *chamelium,
                struct chamelium_port *port);

Simulate a display connector being plugged into the system using the chamelium.

Parameters

chamelium

The Chamelium instance to use

 

port

The port on the chamelium to plug

 

chamelium_unplug ()

void
chamelium_unplug (struct chamelium *chamelium,
                  struct chamelium_port *port);

Simulate a display connector being unplugged from the system using the chamelium.

Parameters

chamelium

The Chamelium instance to use

 

port

The port on the chamelium to unplug

 

chamelium_is_plugged ()

bool
chamelium_is_plugged (struct chamelium *chamelium,
                      struct chamelium_port *port);

Check whether or not the given port has been plugged into the system using chamelium_plug.

Parameters

chamelium

The Chamelium instance to use

 

port

The port on the Chamelium to check the status of

 

Returns

true if the connector is set to plugged in, false otherwise.


chamelium_port_wait_video_input_stable ()

bool
chamelium_port_wait_video_input_stable
                               (struct chamelium *chamelium,
                                struct chamelium_port *port,
                                int timeout_secs);

Waits for a video signal to appear on the given port. This is useful for checking whether or not we've setup a monitor correctly.

Parameters

chamelium

The Chamelium instance to use

 

port

The port on the Chamelium to check the status of

 

timeout_secs

How long to wait for a video signal to appear before timing out

 

Returns

true if a video signal was detected, false if we timed out


chamelium_fire_mixed_hpd_pulses ()

void
chamelium_fire_mixed_hpd_pulses (struct chamelium *chamelium,
                                 struct chamelium_port *port,
                                 ...);

Does the same thing as chamelium_fire_hpd_pulses, but allows the caller to specify the length of each individual pulse.

Parameters

chamelium

The Chamelium instance to use

 

port

The port to fire the HPD pulses on

 

...

The length of each pulse in milliseconds, terminated with a 0

 

chamelium_fire_hpd_pulses ()

void
chamelium_fire_hpd_pulses (struct chamelium *chamelium,
                           struct chamelium_port *port,
                           int width_msec,
                           int count);

A convienence function for sending multiple hotplug pulses to the system. The pulses start at low (e.g. connector is disconnected), and then alternate from high (e.g. connector is plugged in) to low. This is the equivalent of repeatedly calling chamelium_plug and chamelium_unplug, waiting width_msec between each call.

If count is even, the last pulse sent will be high, and if it's odd then it will be low. Resetting the HPD line back to it's previous state, if desired, is the responsibility of the caller.

Parameters

chamelium

The Chamelium instance to use

 

port

The port to fire the HPD pulses on

 

width_msec

How long each pulse should last

 

count

The number of pulses to send

 

chamelium_schedule_hpd_toggle ()

void
chamelium_schedule_hpd_toggle (struct chamelium *chamelium,
                               struct chamelium_port *port,
                               int delay_ms,
                               bool rising_edge);

Instructs the chamelium to schedule an hpd toggle (either a rising edge or a falling edge, depending on rising_edg ) after delay_ms have passed. This is useful for testing things such as hpd after a suspend/resume cycle.

Parameters

chamelium

The Chamelium instance to use

 

port

The port to fire the HPD pulses on

 

delay_ms

Delay in milli-second before the toggle takes place

 

rising_edge

Whether the toggle should be a rising edge or a falling edge

 

chamelium_new_edid ()

struct chamelium_edid *
chamelium_new_edid (struct chamelium *chamelium,
                    const struct edid *edid);

Uploads and registers a new EDID with the chamelium. The EDID will be destroyed automatically when chamelium_deinit is called.

Callers shouldn't assume that the raw EDID they provide is uploaded as-is to the Chamelium. The EDID may be mutated (e.g. a serial number can be appended to be able to uniquely identify the EDID). To retrieve the exact EDID that will be applied to a particular port, use chamelium_edid_get_raw.

Parameters

chamelium

The Chamelium instance to use

 

edid

The edid blob to upload to the chamelium

 

Returns

An opaque pointer to the Chamelium EDID


chamelium_edid_get_raw ()

const struct edid *
chamelium_edid_get_raw (struct chamelium_edid *edid,
                        struct chamelium_port *port);

chamelium_edid_get_editable_raw ()

struct edid *
chamelium_edid_get_editable_raw (struct chamelium_edid *edid,
                                 struct chamelium_port *port);

chamelium_port_set_edid ()

void
chamelium_port_set_edid (struct chamelium *chamelium,
                         struct chamelium_port *port,
                         struct chamelium_edid *edid);

Sets a port on the chamelium to use the specified EDID. This does not fire a hotplug pulse on it's own, and merely changes what EDID the chamelium port will report to us the next time we probe it. Users will need to reprobe the connectors themselves if they want to see the EDID reported by the port change.

To create an EDID, see chamelium_new_edid.

Parameters

chamelium

The Chamelium instance to use

 

port

The port on the Chamelium to set the EDID on

 

edid

The Chamelium EDID to set or NULL to use the default Chamelium EDID

 

chamelium_port_set_tiled_edid ()

void
chamelium_port_set_tiled_edid (struct chamelium *chamelium,
                               struct chamelium_port *port,
                               struct chamelium_edid *edid);

Sets unique serial for tiled edid. Sets a port on the chamelium to use the specified EDID. This does not fire a hotplug pulse on it's own, and merely changes what EDID the chamelium port will report to us the next time we probe it. Users will need to reprobe the connectors themselves if they want to see the EDID reported by the port change.

To create an EDID, see chamelium_new_edid.

Parameters

chamelium

The Chamelium instance to use

 

port

The port on the Chamelium to set the EDID on

 

edid

The Chamelium EDID to set or NULL to use the default Chamelium EDID

 

chamelium_port_get_ddc_state ()

bool
chamelium_port_get_ddc_state (struct chamelium *chamelium,
                              struct chamelium_port *port);

Check whether or not the DDC bus on the specified chamelium port is enabled or not.

Parameters

chamelium

The Chamelium instance to use

 

port

The port on the Chamelium to check the status of

 

Returns

true if the DDC bus is enabled, false otherwise.


chamelium_port_set_ddc_state ()

void
chamelium_port_set_ddc_state (struct chamelium *chamelium,
                              struct chamelium_port *port,
                              bool enabled);

This disables the DDC bus (e.g. the i2c line on the connector that gives us an EDID) of the specified port on the chamelium. This is useful for testing behavior on legacy connectors such as VGA, where the presence of a DDC bus is not always guaranteed.

Parameters

chamelium

The Chamelium instance to use

 

port

The port to change the DDC state on

 

enabled

Whether or not to enable the DDC bus

 

chamelium_port_get_resolution ()

void
chamelium_port_get_resolution (struct chamelium *chamelium,
                               struct chamelium_port *port,
                               int *x,
                               int *y);

Check the current reported display resolution of the specified port on the chamelium. This information is provided by the chamelium itself, not DRM. Useful for verifying that we really are scanning out at the resolution we think we are.

Parameters

chamelium

The Chamelium instance to use

 

port

The port on the Chamelium to check

 

x

Where to store the horizontal resolution of the port

 

y

Where to store the verical resolution of the port

 

chamelium_supports_get_video_params ()

bool
chamelium_supports_get_video_params (struct chamelium *chamelium);

chamelium_port_get_video_params ()

void
chamelium_port_get_video_params (struct chamelium *chamelium,
                                 struct chamelium_port *port,
                                 struct chamelium_video_params *params);

chamelium_get_crc_for_area ()

igt_crc_t *
chamelium_get_crc_for_area (struct chamelium *chamelium,
                            struct chamelium_port *port,
                            int x,
                            int y,
                            int w,
                            int h);

Reads back the pixel CRC for an area on the specified chamelium port. This is the same as using the CRC readback from a GPU, the main difference being the data is provided by the chamelium and also allows us to specify a region of the screen to use as opposed to the entire thing.

As an important note: some of the EDIDs provided by the Chamelium cause certain GPU drivers to default to using limited color ranges. This can cause video captures from the Chamelium to provide different images then expected due to the difference in color ranges (framebuffer uses full color range, but the video output doesn't), and as a result lead to CRC mismatches. To workaround this, the caller should force the connector to use full color ranges by using kmstest_set_connector_broadcast_rgb before setting up the display.

After the caller is finished with the EDID returned by this function, the caller should manually free the resources associated with it.

Parameters

chamelium

The Chamelium instance to use

 

port

The port to perform the CRC checking on

 

x

The X coordinate on the emulated display to start calculating the CRC from

 

y

The Y coordinate on the emulated display to start calculating the CRC from

 

w

The width of the area to fetch the CRC from, or 0 for the whole display

 

h

The height of the area to fetch the CRC from, or 0 for the whole display

 

Returns

The CRC read back from the chamelium


chamelium_start_capture ()

void
chamelium_start_capture (struct chamelium *chamelium,
                         struct chamelium_port *port,
                         int x,
                         int y,
                         int w,
                         int h);

Starts capturing video frames on the given Chamelium port. Once the user is finished capturing frames, they should call chamelium_stop_capture.

A blocking, one-shot version of this function is available: see chamelium_capture

As an important note: some of the EDIDs provided by the Chamelium cause certain GPU drivers to default to using limited color ranges. This can cause video captures from the Chamelium to provide different images then expected due to the difference in color ranges (framebuffer uses full color range, but the video output doesn't), and as a result lead to CRC and frame dump comparison mismatches. To workaround this, the caller should force the connector to use full color ranges by using kmstest_set_connector_broadcast_rgb before setting up the display.

Parameters

chamelium

The Chamelium instance to use

 

port

The port to perform the video capture on

 

x

The X coordinate to crop the video to

 

y

The Y coordinate to crop the video to

 

w

The width of the cropped video, or 0 for the whole display

 

h

The height of the cropped video, or 0 for the whole display

 

chamelium_stop_capture ()

void
chamelium_stop_capture (struct chamelium *chamelium,
                        int frame_count);

Finishes capturing video frames on the given Chamelium port. If frame_count is specified, this call will block until the given number of frames have been captured.

Parameters

chamelium

The Chamelium instance to use

 

frame_count

The number of frames to wait to capture, or 0 to stop immediately

 

chamelium_capture ()

void
chamelium_capture (struct chamelium *chamelium,
                   struct chamelium_port *port,
                   int x,
                   int y,
                   int w,
                   int h,
                   int frame_count);

Captures the given number of frames on the chamelium. This is equivalent to calling chamelium_start_capture immediately followed by chamelium_stop_capture. The caller is blocked until all of the frames have been captured.

As an important note: some of the EDIDs provided by the Chamelium cause certain GPU drivers to default to using limited color ranges. This can cause video captures from the Chamelium to provide different images then expected due to the difference in color ranges (framebuffer uses full color range, but the video output doesn't), and as a result lead to CRC and frame dump comparison mismatches. To workaround this, the caller should force the connector to use full color ranges by using kmstest_set_connector_broadcast_rgb before setting up the display.

Parameters

chamelium

The Chamelium instance to use

 

port

The port to perform the video capture on

 

x

The X coordinate to crop the video to

 

y

The Y coordinate to crop the video to

 

w

The width of the cropped video, or 0 for the whole display

 

h

The height of the cropped video, or 0 for the whole display

 

frame_count

The number of frames to capture

 

chamelium_supports_get_last_infoframe ()

bool
chamelium_supports_get_last_infoframe (struct chamelium *chamelium);

chamelium_get_last_infoframe ()

struct chamelium_infoframe *
chamelium_get_last_infoframe (struct chamelium *chamelium,
                              struct chamelium_port *port,
                              enum chamelium_infoframe_type type);

chamelium_has_audio_support ()

bool
chamelium_has_audio_support (struct chamelium *chamelium,
                             struct chamelium_port *port);

chamelium_get_audio_channel_mapping ()

void
chamelium_get_audio_channel_mapping (struct chamelium *chamelium,
                                     struct chamelium_port *port);

Obtains the channel mapping for an audio port.

Audio channels are not guaranteed not to be swapped. Users can use the channel mapping to match an input channel to a capture channel.

The mapping contains one element per capture channel. Each element indicates which input channel the capture channel is mapped to. As a special case, -1 means that the channel isn't mapped.

Parameters

chamelium

the Chamelium instance

 

port

the audio port

 

mapping

will be filled with the channel mapping

 

chamelium_get_audio_format ()

void
chamelium_get_audio_format (struct chamelium *chamelium,
                            struct chamelium_port *port,
                            int *rate,
                            int *channels);

Obtains the audio format of the captured data. Users should start sending an audio signal to the Chamelium device prior to calling this function.

The captured data is guaranteed to be in the S32_LE format.

Parameters

chamelium

the Chamelium instance

 

port

the audio port

 

rate

if non-NULL, will be set to the sample rate in Hz

 

channels

if non-NULL, will be set to the number of channels

 

chamelium_start_capturing_audio ()

void
chamelium_start_capturing_audio (struct chamelium *chamelium,
                                 struct chamelium_port *port,
                                 bool save_to_file);

Starts capturing audio from a Chamelium port. To stop the capture, use chamelium_stop_capturing_audio. To retrieve the audio data, either use the stream server or enable save_to_file (the latter is mainly useful for debugging purposes).

It isn't possible to capture audio from multiple ports at the same time.

Parameters

chamelium

the Chamelium instance

 

port

the port to capture audio from (it must support audio)

 

save_to_file

whether the captured audio data should be saved to a file on the Chamelium device

 

chamelium_stop_capturing_audio ()

struct chamelium_audio_file *
chamelium_stop_capturing_audio (struct chamelium *chamelium,
                                struct chamelium_port *port);

Stops capturing audio from a Chamelium port. If chamelium_start_capturing_audio has been called with save_to_file enabled, this function will return a chamelium_audio_file struct containing details about the audio file. Once the caller is done with the struct, they should release it with chamelium_destroy_audio_file.

Parameters

chamelium

the Chamelium instance

 

port

the port from which audio is being captured

 

chamelium_read_captured_crcs ()

igt_crc_t *
chamelium_read_captured_crcs (struct chamelium *chamelium,
                              int *frame_count);

Reads all of the CRCs that have been captured thus far from the Chamelium.

Parameters

chamelium

The Chamelium instance to use

 

frame_count

Where to store the number of CRCs we read in

 

Returns

An array of frame_count length containing all of the CRCs we read


chamelium_read_captured_frame ()

struct chamelium_frame_dump *
chamelium_read_captured_frame (struct chamelium *chamelium,
                               unsigned int index);

chamelium_port_dump_pixels ()

struct chamelium_frame_dump *
chamelium_port_dump_pixels (struct chamelium *chamelium,
                            struct chamelium_port *port,
                            int x,
                            int y,
                            int w,
                            int h);

Captures the currently displayed image on the given chamelium port, optionally cropped to a given region. In situations where pre-calculating CRCs may not be reliable, this can be used as an alternative for figuring out whether or not the correct images are being displayed on the screen.

The frame dump data returned by this function should be freed when the caller is done with it using chamelium_destroy_frame_dump.

As an important note: some of the EDIDs provided by the Chamelium cause certain GPU drivers to default to using limited color ranges. This can cause video captures from the Chamelium to provide different images then expected due to the difference in color ranges (framebuffer uses full color range, but the video output doesn't), and as a result lead to CRC mismatches. To workaround this, the caller should force the connector to use full color ranges by using kmstest_set_connector_broadcast_rgb before setting up the display.

Parameters

chamelium

The Chamelium instance to use

 

port

The port to perform the video capture on

 

x

The X coordinate to crop the screen capture to

 

y

The Y coordinate to crop the screen capture to

 

w

The width of the area to crop the screen capture to, or 0 for the whole screen

 

h

The height of the area to crop the screen capture to, or 0 for the whole screen

 

Returns

a chamelium_frame_dump struct


chamelium_calculate_fb_crc ()

igt_crc_t *
chamelium_calculate_fb_crc (int fd,
                            struct igt_fb *fb);

Calculates the CRC for the provided framebuffer, using the Chamelium's CRC algorithm. This calculates the CRC in a synchronous fashion.

Parameters

fd

The drm file descriptor

 

fb

The framebuffer to calculate the CRC for

 

Returns

The calculated CRC


chamelium_calculate_fb_crc_async_start ()

struct chamelium_fb_crc_async_data *
chamelium_calculate_fb_crc_async_start
                               (int fd,
                                struct igt_fb *fb);

chamelium_calculate_fb_crc_async_finish ()

igt_crc_t *
chamelium_calculate_fb_crc_async_finish
                               (struct chamelium_fb_crc_async_data *fb_crc);

chamelium_get_captured_frame_count ()

int
chamelium_get_captured_frame_count (struct chamelium *chamelium);

Gets the number of frames that were captured during the last video capture.

Parameters

chamelium

The Chamelium instance to use

 

Returns

the number of frames the Chamelium captured during the last video capture.


chamelium_get_frame_limit ()

int
chamelium_get_frame_limit (struct chamelium *chamelium,
                           struct chamelium_port *port,
                           int w,
                           int h);

Gets the max number of frames we can capture with the Chamelium for the given resolution.

Parameters

chamelium

The Chamelium instance to use

 

port

The port to check the frame limit on

 

w

The width of the area to get the capture frame limit for, or 0 for the whole display

 

h

The height of the area to get the capture frame limit for, or 0 for the whole display

 

Returns

The number of the max number of frames we can capture


chamelium_assert_frame_eq ()

void
chamelium_assert_frame_eq (const struct chamelium *chamelium,
                           const struct chamelium_frame_dump *dump,
                           struct igt_fb *fb);

Asserts that the image contained in the chamelium frame dump is identical to the given framebuffer. Useful for scenarios where pre-calculating CRCs might not be ideal.

Parameters

chamelium

The chamelium instance the frame dump belongs to

 

dump

The chamelium frame dump to check

 

fb

The framebuffer to check against

 

chamelium_assert_crc_eq_or_dump ()

void
chamelium_assert_crc_eq_or_dump (struct chamelium *chamelium,
                                 igt_crc_t *reference_crc,
                                 igt_crc_t *capture_crc,
                                 struct igt_fb *fb,
                                 int index);

Asserts that the CRC provided for both the reference and the captured frame are identical. If they are not, this grabs the captured frame and saves it along with the reference to a png file.

Parameters

chamelium

The chamelium instance the frame dump belongs to

 

reference_crc

The CRC for the reference frame

 

capture_crc

The CRC for the captured frame

 

fb

pointer to an igt_fb structure

 

chamelium_assert_frame_match_or_dump ()

void
chamelium_assert_frame_match_or_dump (struct chamelium *chamelium,
                                      struct chamelium_port *port,
                                      const struct chamelium_frame_dump *frame,
                                      struct igt_fb *fb,
                                      enum chamelium_check check);

Asserts that the provided captured frame matches the reference frame from the framebuffer. If they do not, this saves the reference and captured frames to a png file.

Parameters

chamelium

The chamelium instance the frame dump belongs to

 

frame

The chamelium frame dump to match

 

fb

pointer to an igt_fb structure

 

check

the type of frame matching check to use

 

chamelium_frame_match_or_dump ()

bool
chamelium_frame_match_or_dump (struct chamelium *chamelium,
                               struct chamelium_port *port,
                               const struct chamelium_frame_dump *frame,
                               struct igt_fb *fb,
                               enum chamelium_check check);

Returns bool that the provided captured frame matches the reference frame from the framebuffer. If they do not, this saves the reference and captured frames to a png file.

Parameters

chamelium

The chamelium instance the frame dump belongs to

 

frame

The chamelium frame dump to match

 

fb

pointer to an igt_fb structure

 

check

the type of frame matching check to use

 

chamelium_crop_analog_frame ()

void
chamelium_crop_analog_frame (struct chamelium_frame_dump *dump,
                             int width,
                             int height);

chamelium_destroy_frame_dump ()

void
chamelium_destroy_frame_dump (struct chamelium_frame_dump *dump);

Destroys the given frame dump and frees all of the resources associated with it.

Parameters

dump

The frame dump to destroy

 

chamelium_destroy_audio_file ()

void
chamelium_destroy_audio_file (struct chamelium_audio_file *audio_file);

chamelium_infoframe_destroy ()

void
chamelium_infoframe_destroy (struct chamelium_infoframe *infoframe);

chamelium_plug_all ()

bool
chamelium_plug_all (struct chamelium *chamelium);

chamelium_wait_all_configured_ports_connected ()

bool
chamelium_wait_all_configured_ports_connected
                               (struct chamelium *chamelium,
                                int drm_fd);

Types and Values

igt_crc_t

Pipe CRC value. All other members than frame are private and should not be inspected by testcases.


enum chamelium_check

Checking method for comparing between reference and captured frames.

Members

CHAMELIUM_CHECK_ANALOG

Fuzzy checking method for analog interfaces

 

CHAMELIUM_CHECK_CHECKERBOARD

   

CHAMELIUM_CHECK_CRC

CRC-based checking method for pixel-perfect interfaces

 

struct chamelium_video_params

struct chamelium_video_params {
	double clock;
	int htotal, hactive, hsync_offset, hsync_width, hsync_polarity;
	int vtotal, vactive, vsync_offset, vsync_width, vsync_polarity;
};

struct chamelium_audio_file

struct chamelium_audio_file {
	char *path;
	int rate; /* Hz */
	int channels;
};

enum chamelium_infoframe_type

Members

CHAMELIUM_INFOFRAME_AVI

   

CHAMELIUM_INFOFRAME_AUDIO

   

CHAMELIUM_INFOFRAME_MPEG

   

CHAMELIUM_INFOFRAME_VENDOR

   

struct chamelium_infoframe

struct chamelium_infoframe {
	int version;
	size_t payload_size;
	uint8_t *payload;
};

CHAMELIUM_MAX_PORTS

#define CHAMELIUM_MAX_PORTS 4

CHAMELIUM_DEFAULT_EDID

#define CHAMELIUM_DEFAULT_EDID 0

CHAMELIUM_MAX_AUDIO_CHANNELS

#define CHAMELIUM_MAX_AUDIO_CHANNELS 8

igt_chamelium_allow_fsm_handling

extern bool igt_chamelium_allow_fsm_handling;

CHAMELIUM_HOTPLUG_TIMEOUT

#define CHAMELIUM_HOTPLUG_TIMEOUT 20 /* seconds */

struct chamelium_edid

struct chamelium_edid {
	struct chamelium *chamelium;
	struct edid *base;
	struct edid *raw[CHAMELIUM_MAX_PORTS];
	int ids[CHAMELIUM_MAX_PORTS];
	struct igt_list_head link;
};

Members

struct chamelium *chamelium;

instance of the chamelium where the EDID will be applied

 

struct edid *base;

Unaltered EDID that would be used for all ports. Matches what you would get from a real monitor.

 

struct edid *raw[CHAMELIUM_MAX_PORTS];

EDID to be applied for each port.

 

int ids[CHAMELIUM_MAX_PORTS];

The ID received from Chamelium after it's created for specific ports.

 

struct igt_list_head link;

   

struct chamelium

struct chamelium;

struct chamelium_fb_crc_async_data

struct chamelium_fb_crc_async_data;

struct chamelium_frame_dump

struct chamelium_frame_dump;

struct chamelium_port

struct chamelium_port;

struct edid

struct edid;

struct igt_fb

struct igt_fb;