mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2026-08-11 16:32:58 +00:00
i-g-t: Adding test case to test background color.
Adding i-g-t test case to test display crtc background color. v2: - Added IGT_TEST_DESCRIPTION() (Thomas Wood) - Added to .gitignore (Thomas Wood) - Added additional details to function header (Thomas Wood) - Simplified igt_main (Thomas Wood) v3: - rebased to latest master (me) - took sleep calls out (Daniel) - use new tiled types when calling igt_create_fb (me) Signed-off-by: chandra konduru <chandra.konduru@intel.com> [Thomas: convert test to use igt_simple_main] Signed-off-by: Thomas Wood <thomas.wood@intel.com>
This commit is contained in:
committed by
Thomas Wood
parent
e371b3fbad
commit
ace4208702
@@ -940,6 +940,22 @@ igt_plane_set_property(igt_plane_t *plane, uint32_t prop_id, uint64_t value)
|
||||
DRM_MODE_OBJECT_PLANE, prop_id, value);
|
||||
}
|
||||
|
||||
static bool
|
||||
get_crtc_property(int drm_fd, uint32_t crtc_id, const char *name,
|
||||
uint32_t *prop_id /* out */, uint64_t *value /* out */,
|
||||
drmModePropertyPtr *prop /* out */)
|
||||
{
|
||||
return kmstest_get_property(drm_fd, crtc_id, DRM_MODE_OBJECT_CRTC,
|
||||
name, prop_id, value, prop);
|
||||
}
|
||||
|
||||
static void
|
||||
igt_crtc_set_property(igt_output_t *output, uint32_t prop_id, uint64_t value)
|
||||
{
|
||||
drmModeObjectSetProperty(output->display->drm_fd,
|
||||
output->config.crtc->crtc_id, DRM_MODE_OBJECT_CRTC, prop_id, value);
|
||||
}
|
||||
|
||||
/*
|
||||
* Walk a plane's property list to determine its type. If we don't
|
||||
* find a type property, then the kernel doesn't support universal
|
||||
@@ -1097,6 +1113,7 @@ void igt_display_init(igt_display_t *display, int drm_fd)
|
||||
igt_assert(display->outputs);
|
||||
|
||||
for (i = 0; i < display->n_outputs; i++) {
|
||||
int j;
|
||||
igt_output_t *output = &display->outputs[i];
|
||||
|
||||
/*
|
||||
@@ -1108,6 +1125,19 @@ void igt_display_init(igt_display_t *display, int drm_fd)
|
||||
output->display = display;
|
||||
|
||||
igt_output_refresh(output);
|
||||
|
||||
for (j = 0; j < display->n_pipes; j++) {
|
||||
uint64_t prop_value;
|
||||
igt_pipe_t *pipe = &display->pipes[j];
|
||||
if (output->config.crtc) {
|
||||
get_crtc_property(display->drm_fd, output->config.crtc->crtc_id,
|
||||
"background_color",
|
||||
&pipe->background_property,
|
||||
&prop_value,
|
||||
NULL);
|
||||
pipe->background = (uint32_t)prop_value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
drmModeFreePlaneResources(plane_resources);
|
||||
@@ -1527,6 +1557,13 @@ static int igt_output_commit(igt_output_t *output,
|
||||
|
||||
pipe = igt_output_get_driving_pipe(output);
|
||||
|
||||
if (pipe->background_changed) {
|
||||
igt_crtc_set_property(output, pipe->background_property,
|
||||
pipe->background);
|
||||
|
||||
pipe->background_changed = false;
|
||||
}
|
||||
|
||||
for (i = 0; i < pipe->n_planes; i++) {
|
||||
igt_plane_t *plane = &pipe->planes[i];
|
||||
|
||||
@@ -1794,6 +1831,30 @@ void igt_plane_set_rotation(igt_plane_t *plane, igt_rotation_t rotation)
|
||||
plane->rotation_changed = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* igt_crtc_set_background:
|
||||
* @pipe: pipe pointer to which background color to be set
|
||||
* @background: background color value in BGR 16bpc
|
||||
*
|
||||
* 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_crtc_set_background(igt_pipe_t *pipe, uint64_t background)
|
||||
{
|
||||
igt_display_t *display = pipe->display;
|
||||
|
||||
LOG(display, "%s.%d: crtc_set_background(%lu)\n",
|
||||
kmstest_pipe_name(pipe->pipe),
|
||||
pipe->pipe, background);
|
||||
|
||||
pipe->background = background;
|
||||
|
||||
pipe->background_changed = true;
|
||||
}
|
||||
|
||||
|
||||
void igt_wait_for_vblank(int drm_fd, enum pipe pipe)
|
||||
{
|
||||
drmVBlank wait_vbl;
|
||||
|
||||
@@ -207,6 +207,9 @@ struct igt_pipe {
|
||||
#define IGT_MAX_PLANES 4
|
||||
int n_planes;
|
||||
igt_plane_t planes[IGT_MAX_PLANES];
|
||||
uint64_t background; /* Background color MSB BGR 16bpc LSB */
|
||||
uint32_t background_changed : 1;
|
||||
uint32_t background_property;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
@@ -255,6 +258,7 @@ void igt_plane_set_position(igt_plane_t *plane, int x, int y);
|
||||
void igt_plane_set_size(igt_plane_t *plane, int w, int h);
|
||||
void igt_plane_set_panning(igt_plane_t *plane, int x, int y);
|
||||
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);
|
||||
|
||||
void igt_wait_for_vblank(int drm_fd, enum pipe pipe);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user