diff options
author | Yi Sun <yi.sun@intel.com> | 2014-05-23 08:28:47 +0800 |
---|---|---|
committer | Damien Lespiau <damien.lespiau@intel.com> | 2014-07-07 18:27:10 +0100 |
commit | b5333b416f6a206a583684b0fba9265c0badbd6c (patch) | |
tree | b1e816094759740c4de63e8452976128d0b88bac /lib | |
parent | de538cfc7cd649216801829daffe602f4efee08a (diff) |
kms_plane: Add panning test for primary plane
Get CRCs of a full red and a full blue surface as reference.
Create a big framebuffer that is twice width and twice height as the
current display mode.
Fill the top left quarter with red, bottom right quarter with blue
Check the scanned out image with the CRTC at position (0, 0) of the
framebuffer and it should be the same CRC as the full red fb
Check the scanned out image with the CRTC at position (hdisplay,
vdisplay) and it should be the same CRC as the full blue fb
v2: Fix a few things here and there (Damien)
Cc: Lei Liu <lei.a.liu@intel.com>
Cc: Yi Sun <yi.sun@intel.com>
Signed-off-by: Lei Liu <lei.a.liu@intel.com>
Signed-off-by: Yi Sun <yi.sun@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/igt_kms.c | 22 | ||||
-rw-r--r-- | lib/igt_kms.h | 4 |
2 files changed, 23 insertions, 3 deletions
diff --git a/lib/igt_kms.c b/lib/igt_kms.c index 82bdec50..4a8c394d 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -979,7 +979,8 @@ static int igt_primary_plane_commit_legacy(igt_plane_t *primary, /* Primary planes can't be windowed when using a legacy commit */ igt_assert((primary->crtc_x == 0 && primary->crtc_y == 0)); - if (!primary->fb_changed && !primary->position_changed) + if (!primary->fb_changed && !primary->position_changed && + !primary->panning_changed) return 0; crtc_id = output->config.crtc->crtc_id; @@ -996,13 +997,13 @@ static int igt_primary_plane_commit_legacy(igt_plane_t *primary, igt_output_name(output), pipe_name(output->config.pipe), fb_id, - 0, 0, + primary->pan_x, primary->pan_y, mode->hdisplay, mode->vdisplay); ret = drmModeSetCrtc(display->drm_fd, crtc_id, fb_id, - 0, 0, /* x, y */ + primary->pan_x, primary->pan_y, &output->id, 1, mode); @@ -1026,6 +1027,7 @@ static int igt_primary_plane_commit_legacy(igt_plane_t *primary, primary->pipe->enabled = (fb_id != 0); primary->fb_changed = false; primary->position_changed = false; + primary->panning_changed = false; return 0; } @@ -1254,6 +1256,20 @@ void igt_plane_set_position(igt_plane_t *plane, int x, int y) plane->position_changed = true; } +void igt_plane_set_panning(igt_plane_t *plane, int x, int y) +{ + igt_pipe_t *pipe = plane->pipe; + igt_display_t *display = pipe->display; + + LOG(display, "%c.%d: plane_set_panning(%d,%d)\n", pipe_name(pipe->pipe), + plane->index, x, y); + + plane->pan_x = x; + plane->pan_y = y; + + plane->panning_changed = true; +} + void igt_wait_for_vblank(int drm_fd, enum pipe pipe) { drmVBlank wait_vbl; diff --git a/lib/igt_kms.h b/lib/igt_kms.h index 95ba1129..a079fc24 100644 --- a/lib/igt_kms.h +++ b/lib/igt_kms.h @@ -113,6 +113,7 @@ typedef struct { unsigned int is_cursor : 1; unsigned int fb_changed : 1; unsigned int position_changed : 1; + unsigned int panning_changed : 1; /* * drm_plane can be NULL for primary and cursor planes (when not * using the atomic modeset API) @@ -121,6 +122,8 @@ typedef struct { struct igt_fb *fb; /* position within pipe_src_w x pipe_src_h */ int crtc_x, crtc_y; + /* panning offset within the fb */ + unsigned int pan_x, pan_y; } igt_plane_t; struct igt_pipe { @@ -170,6 +173,7 @@ igt_plane_t *igt_output_get_plane(igt_output_t *output, enum igt_plane plane); void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb); void igt_plane_set_position(igt_plane_t *plane, int x, int y); +void igt_plane_set_panning(igt_plane_t *plane, int x, int y); void igt_wait_for_vblank(int drm_fd, enum pipe pipe); |