Commit 2f7519a8 authored by Maarten Lankhorst's avatar Maarten Lankhorst

lib/igt_kms: Add igt_$obj_has_prop functions, v2.

This allows test to test whether a property is supported, in
a nice and clean way. It removes the need for special case
functions like igt_plane_supports_rotation.

Convert the users of igt_plane_supports_rotation and remove the
extra check in drm_plane_commit, this is already checked below
when setting plane properties.

Changes since v1:
- Use the correct has_prop in kms_crtc_background_color.c
Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: default avatarMika Kahola <mika.kahola@intel.com>
parent d04d6328
......@@ -2110,10 +2110,6 @@ static int igt_drm_plane_commit(igt_plane_t *plane,
igt_assert(plane->drm_plane);
/* it's an error to try an unsupported feature */
igt_assert(igt_plane_supports_rotation(plane) ||
!igt_plane_is_prop_changed(plane, IGT_PLANE_ROTATION));
fb_id = igt_plane_get_fb_id(plane);
crtc_id = pipe->crtc_id;
......
......@@ -374,10 +374,6 @@ bool igt_pipe_get_property(igt_pipe_t *pipe, const char *name,
uint32_t *prop_id, uint64_t *value,
drmModePropertyPtr *prop);
static inline bool igt_plane_supports_rotation(igt_plane_t *plane)
{
return plane->props[IGT_PLANE_ROTATION] != 0;
}
void igt_pipe_request_out_fence(igt_pipe_t *pipe);
void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb);
......@@ -493,6 +489,20 @@ static inline bool igt_output_is_connected(igt_output_t *output)
#define IGT_FIXED(i,f) ((i) << 16 | (f))
/**
* igt_plane_has_prop - Check whether plane supports a given property.
*
* @plane: Plane to check.
* @prop: Property to check.
*
* Returns: True if the property is supported, otherwise false.
*/
static inline bool
igt_plane_has_prop(igt_plane_t *plane, enum igt_atomic_plane_properties prop)
{
return plane->props[prop];
}
#define igt_plane_is_prop_changed(plane, prop) \
(!!((plane)->changed & (1 << (prop))))
......@@ -512,6 +522,20 @@ extern void igt_plane_replace_prop_blob(igt_plane_t *plane,
enum igt_atomic_plane_properties prop,
const void *ptr, size_t length);
/**
* igt_output_has_prop - Check whether output supports a given property.
*
* @output: Output to check.
* @prop: Property to check.
*
* Returns: True if the property is supported, otherwise false.
*/
static inline bool
igt_output_has_prop(igt_output_t *output, enum igt_atomic_connector_properties prop)
{
return output->props[prop];
}
#define igt_output_is_prop_changed(output, prop) \
(!!((output)->changed & (1 << (prop))))
#define igt_output_set_prop_changed(output, prop) \
......@@ -530,6 +554,36 @@ extern void igt_output_replace_prop_blob(igt_output_t *output,
enum igt_atomic_connector_properties prop,
const void *ptr, size_t length);
/**
* igt_pipe_obj_has_prop - Check whether pipe supports a given property.
*
* @pipe: Pipe to check.
* @prop: Property to check.
*
* Returns: True if the property is supported, otherwise false.
*/
static inline bool
igt_pipe_obj_has_prop(igt_pipe_t *pipe, enum igt_atomic_crtc_properties prop)
{
return pipe->props[prop];
}
/**
* igt_pipe_has_prop - Check whether pipe supports a given property.
*
* @display: Pointer to display.
* @pipe: Pipe to check.
* @prop: Property to check.
*
* Returns: True if the property is supported, otherwise false.
*/
static inline bool
igt_pipe_has_prop(igt_display_t *display, enum pipe pipe,
enum igt_atomic_connector_properties prop)
{
return display->pipes[pipe].props[prop];
}
#define igt_pipe_obj_is_prop_changed(pipe_obj, prop) \
(!!((pipe_obj)->changed & (1 << (prop))))
......
......@@ -137,7 +137,7 @@ static void test_crtc_background(data_t *data)
igt_output_set_pipe(output, pipe);
plane = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
igt_require(plane->pipe->props[IGT_CRTC_BACKGROUND]);
igt_require(igt_pipe_has_prop(display, pipe, IGT_CRTC_BACKGROUND));
prepare_crtc(data, output, pipe, plane, 1, PURPLE, BLACK64);
......
......@@ -351,7 +351,7 @@ static void test_plane_rotation(data_t *data, int plane_type)
igt_output_set_pipe(output, pipe);
plane = igt_output_get_plane_type(output, plane_type);
igt_require(igt_plane_supports_rotation(plane));
igt_require(igt_plane_has_prop(plane, IGT_PLANE_ROTATION));
prepare_crtc(data, output, pipe, plane, commit);
......@@ -438,7 +438,7 @@ static void test_plane_rotation_ytiled_obj(data_t *data,
int ret;
plane = igt_output_get_plane_type(output, plane_type);
igt_require(igt_plane_supports_rotation(plane));
igt_require(igt_plane_has_prop(plane, IGT_PLANE_ROTATION));
if (plane_type == DRM_PLANE_TYPE_PRIMARY || plane_type == DRM_PLANE_TYPE_CURSOR)
commit = COMMIT_UNIVERSAL;
......@@ -504,7 +504,7 @@ static void test_plane_rotation_exhaust_fences(data_t *data,
int i, ret;
plane = igt_output_get_plane_type(output, plane_type);
igt_require(igt_plane_supports_rotation(plane));
igt_require(igt_plane_has_prop(plane, IGT_PLANE_ROTATION));
if (plane_type == DRM_PLANE_TYPE_PRIMARY || plane_type == DRM_PLANE_TYPE_CURSOR)
commit = COMMIT_UNIVERSAL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment