modetest: Fix warnings

Enable all standard automake warnings except for -Wpointer-arith (as the
test pattern generation code uses void pointer arithmetics) and fix
them.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
modetest: Remove extern declarations of opt(arg|ind|err|opt)

Those variables are declared in unistd.h, there's no need to redeclare
them here.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
modetest: Sort command line arguments

The current mostly random sort order hinders code readability. Sort the
options alphabetically in the code, and by group in the help message.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
modetest: Add a command line parameter to select the driver

If the -M parameter is specified, modetest will use the requested device
name instead of trying its builtin list of device names.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
modetest: Add a command line parameter to drop master after mode set

If the -d parameter is specified, modetest will drop master permissions
after setting the mode.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
modetest: Retrieve all resources in one go

Instead of retrieving resources as they are needed, retrieve them all
(except property blobs) in one go at startup.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
modetest: Don't limit mode set and planes to two instances

Configuring mode on more than two connectors or two planes is perfectly
valid. Support it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
modetest: Add a command line parameter to set properties

The -w parameter can be used to set a property value from the command
line, using the target object ID and the property name.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
modetest: Allow specifying plane position

Extend the -P option to allow specifying the plane x and y offsets. The
position is optional, if not specified the plane will be positioned at
the center of the screen as before.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
modetest: Print the plane ID when setting up a plane

As modetest automatically selects an unused plan, providing the plane ID
allows modifying plane properties for the selected planes.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
modetest: Remove the -m argument

The argument isn't used, remove it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
modetest: Create a device structure

Instead of passing the device fd and resources as global variables group
them in a device structure and pass it explictly to all functions that
need it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
modetest: Compute CRTC pipe number as needed

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
modetest: Remove the struct connector_arg encoder field

The field is no needed, make it a local variable where used.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
modetest: Store the crtc in the connector_arg structure

This prepares the code for the split in separate functions of CRTC and
planes setup.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
modetest: Store the mode in the crtc structure

This prepares the code for the split in separate functions of CRTC and
planes setup.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
modetest: Give the CRTC ID to the -P option

Planes are associated with CRTCs, not connectors. Don't try to be too
clever, use the CRTC ID in the -P option. This prepares for splitting
CRTC and planes setup.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
modetest: Split mode setting and plane setup

There's not reason to require setting a mode to test planes. Split the
two operations.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
modetest: Rename struct connector_arg to struct pipe_arg

This prepares the code for handling multiple connectors in a single
pipeline in a cloned configuration.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
modetest: Support pipes with multiple connectors

The -s argument can now take a list of connectors. Configure all of them
in cloned mode using a single CRTC.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>