On 17 July 2015 at 09:34, Nabendu Maiti <nabendu.bikash.maiti@xxxxxxxxx> wrote: > 1) Added more overlay plane support for BXT. > 2) Added and enhanced scaler test cases for additional planes. Please split the various separate changes in different patches. The i-g-t tag should also appear in the subject prefix rather than the subject tag. (i.e. use --subject-prefix="PATCH i-g-t" or git config format.subjectprefix "PATCH i-g-t"). > > Signed-off-by: Nabendu Maiti <nabendu.bikash.maiti@xxxxxxxxx> > --- > lib/igt_fb.c | 40 ++++++++++++++++++++++++ > lib/igt_fb.h | 1 + > lib/igt_kms.c | 1 + > lib/igt_kms.h | 3 +- > tests/kms_plane_scaling.c | 79 ++++++++++++++++++++++++++++++++++++++++++++--- > 5 files changed, 118 insertions(+), 6 deletions(-) > > diff --git a/lib/igt_fb.c b/lib/igt_fb.c > index 134dbd2..e61b762 100644 > --- a/lib/igt_fb.c > +++ b/lib/igt_fb.c > @@ -393,6 +393,46 @@ void igt_paint_image(cairo_t *cr, const char *filename, > } > > /** > + * igt_paint_cross_ruler: > + * @cr: cairo drawing context > + * @dst_width: width of the horizontal ruler > + * @dst_height: height of the vertical ruler > + * > + * This function can be used to draw a cross ruler on a frame buffer. > + */ > +void > +igt_paint_cross_ruler(cairo_t *cr, uint16_t w, uint16_t h) Other cairo functions use int rather than uint16_t for width and height, so int should be sufficient here too, at least for consistency. > +{ > + > + uint16_t i; > + > + /* Paint corner markers */ > + paint_marker(cr, 0, 0); > + paint_marker(cr, w, 0); > + paint_marker(cr, 0, h); > + paint_marker(cr, w, h); > + > + > + cairo_move_to(cr, w/2, 0); > + cairo_line_to(cr, w/2, h); > + > + cairo_set_source_rgb(cr, 4, 1, 10); > + cairo_move_to(cr, 0, h/2); > + cairo_line_to(cr, w, h/2 ); > + cairo_stroke(cr); > + > + cairo_set_source_rgb(cr, 2, 5, 1); > + cairo_set_line_width(cr, 2); > + cairo_stroke(cr); > + cairo_stroke_preserve(cr); > + for (i = 0; i < w; i +=200) > + paint_marker(cr, i, h/2); > + > + for (i = 0; i < h; i +=200) > + paint_marker(cr, w/2, i); > +} > + > +/** > * igt_create_fb_with_bo_size: > * @fd: open i915 drm file descriptor > * @width: width of the framebuffer in pixel > diff --git a/lib/igt_fb.h b/lib/igt_fb.h > index a07acd2..cf6e7e3 100644 > --- a/lib/igt_fb.h > +++ b/lib/igt_fb.h > @@ -98,6 +98,7 @@ void igt_write_fb_to_png(int fd, struct igt_fb *fb, const char *filename); > int igt_cairo_printf_line(cairo_t *cr, enum igt_text_align align, > double yspacing, const char *fmt, ...) > __attribute__((format (printf, 4, 5))); > +void igt_paint_cross_ruler(cairo_t *cr, uint16_t w, uint16_t h); > > /* helpers to handle drm fourcc codes */ > uint32_t igt_bpp_depth_to_drm_format(int bpp, int depth); > diff --git a/lib/igt_kms.c b/lib/igt_kms.c > index 0bb16b4..781ffa5 100644 > --- a/lib/igt_kms.c > +++ b/lib/igt_kms.c > @@ -213,6 +213,7 @@ const char *kmstest_plane_name(enum igt_plane plane) > [IGT_PLANE_1] = "plane1", > [IGT_PLANE_2] = "plane2", > [IGT_PLANE_3] = "plane3", > + [IGT_PLANE_4] = "plane4", > [IGT_PLANE_CURSOR] = "cursor", > }; > > diff --git a/lib/igt_kms.h b/lib/igt_kms.h > index 09c08aa..14c8b28 100644 > --- a/lib/igt_kms.h > +++ b/lib/igt_kms.h > @@ -53,6 +53,7 @@ enum igt_plane { > IGT_PLANE_PRIMARY = IGT_PLANE_1, > IGT_PLANE_2, > IGT_PLANE_3, > + IGT_PLANE_4, > IGT_PLANE_CURSOR, > }; > > @@ -205,7 +206,7 @@ struct igt_pipe { > igt_display_t *display; > enum pipe pipe; > bool enabled; > -#define IGT_MAX_PLANES 4 > +#define IGT_MAX_PLANES 5 > int n_planes; > igt_plane_t planes[IGT_MAX_PLANES]; > uint64_t background; /* Background color MSB BGR 16bpc LSB */ > diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c > index 00db5cb..8e3d559 100644 > --- a/tests/kms_plane_scaling.c > +++ b/tests/kms_plane_scaling.c > @@ -23,7 +23,7 @@ > */ > > #include <math.h> > - > +#include <cairo.h> cairo is already included via igt_kms.h and igt_fb.h. > #include "drmtest.h" > #include "igt_debugfs.h" > #include "igt_kms.h" > @@ -48,9 +48,11 @@ typedef struct { > struct igt_fb fb1; > struct igt_fb fb2; > struct igt_fb fb3; > + struct igt_fb fb4; > int fb_id1; > int fb_id2; > int fb_id3; > + int fb_id4; > > igt_plane_t *plane1; > igt_plane_t *plane2; > @@ -61,6 +63,22 @@ typedef struct { > #define FILE_NAME "1080p-left.png" > > static void > +paint_plane_ID(data_t *d, struct igt_fb *fb, igt_plane_t *plane) > +{ > + cairo_t *cr; > + > + cr = igt_get_cairo_ctx(d->drm_fd, fb); > + cairo_move_to(cr, (fb->width/5), > + (fb->height / 5)); > + cairo_set_font_size(cr, 25); > + igt_cairo_printf_line(cr, align_hcenter, 10, "PIPE:PLANE:"); > + cairo_set_font_size(cr, 30); > + igt_cairo_printf_line(cr, align_hcenter, 40, " %d:%d", > + plane->pipe->pipe, plane->index); > + cairo_destroy(cr); > +} > + > +static void > paint_color(data_t *d, struct igt_fb *fb, uint16_t w, uint16_t h) > { > cairo_t *cr; > @@ -71,12 +89,14 @@ paint_color(data_t *d, struct igt_fb *fb, uint16_t w, uint16_t h) > } > > static void > -paint_image(data_t *d, struct igt_fb *fb, uint16_t w, uint16_t h) > +paint_image(const char *filename, data_t *d, struct igt_fb *fb, > + uint16_t w, uint16_t h) What is the purpose of the new filename parameter? It always appears to be set to to the same value (FILE_NAME) as used previously in the vall to igt_paint_image. > { > cairo_t *cr; > > cr = igt_get_cairo_ctx(d->drm_fd, fb); > - igt_paint_image(cr, FILE_NAME, 0, 0, w, h); > + igt_paint_image(cr, filename, 0, 0, w, h); > + igt_paint_cross_ruler(cr, w, h); > cairo_destroy(cr); > } > > @@ -106,6 +126,7 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe, > igt_assert(data->fb_id1); > > paint_color(data, &data->fb1, mode->hdisplay, mode->vdisplay); > + paint_plane_ID(data, &data->fb1, plane); > > /* > * We always set the primary plane to actually enable the pipe as > @@ -154,7 +175,10 @@ static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane) > igt_remove_fb(data->drm_fd, &data->fb3); > data->fb_id3 = 0; > } > - > + if (data->fb_id4) { > + igt_remove_fb(data->drm_fd, &data->fb4); > + data->fb_id4 = 0; > + } > if (!plane->is_primary) { > igt_plane_t *primary; > > @@ -235,7 +259,7 @@ static void test_plane_scaling(data_t *d) > LOCAL_I915_FORMAT_MOD_X_TILED, /* tiled */ > &d->fb2); > igt_assert(d->fb_id2); > - paint_image(d, &d->fb2, d->fb2.width, d->fb2.height); > + paint_image(FILE_NAME, d, &d->fb2, d->fb2.width, d->fb2.height); > > d->fb_id3 = igt_create_fb(d->drm_fd, > mode->hdisplay, mode->vdisplay, > @@ -245,6 +269,17 @@ static void test_plane_scaling(data_t *d) > igt_assert(d->fb_id3); > paint_color(d, &d->fb3, mode->hdisplay, mode->vdisplay); > > + if ((display->pipes[pipe].n_planes > 4) && (pipe != PIPE_C)) { > + d->fb_id4 = igt_create_fb(d->drm_fd, > + d->image_w, d->image_h, > + DRM_FORMAT_XRGB8888, > + LOCAL_I915_FORMAT_MOD_X_TILED, /*tiled*/ > + &d->fb4); > + igt_assert(d->fb_id4); > + paint_image(FILE_NAME, d,&d->fb4, d->fb4.width, > + d->fb4.height); > + } > + > /* Set up display with plane 1 */ > d->plane1 = igt_output_get_plane(output, IGT_PLANE_PRIMARY); > prepare_crtc(d, output, pipe, d->plane1, mode, COMMIT_UNIVERSAL); > @@ -268,6 +303,7 @@ static void test_plane_scaling(data_t *d) > /* Set up fb2->plane2 mapping. */ > d->plane2 = igt_output_get_plane(output, IGT_PLANE_2); > igt_plane_set_fb(d->plane2, &d->fb2); > + paint_plane_ID(d, &d->fb2, d->plane2); > > /* 2nd plane windowed */ > igt_fb_set_position(&d->fb2, d->plane2, 100, 100); > @@ -293,6 +329,7 @@ static void test_plane_scaling(data_t *d) > igt_display_commit2(display, COMMIT_UNIVERSAL); > > if (primary_plane_scaling) { > + > /* Primary plane up scaling */ > igt_fb_set_position(&d->fb1, d->plane1, 100, 100); > igt_fb_set_size(&d->fb1, d->plane1, 500, 500); > @@ -304,6 +341,7 @@ static void test_plane_scaling(data_t *d) > /* Set up fb3->plane3 mapping. */ > d->plane3 = igt_output_get_plane(output, IGT_PLANE_3); > igt_plane_set_fb(d->plane3, &d->fb3); > + paint_plane_ID(d, &d->fb3, d->plane3); > > /* 3rd plane windowed - no scaling */ > igt_fb_set_position(&d->fb3, d->plane3, 100, 100); > @@ -324,6 +362,35 @@ static void test_plane_scaling(data_t *d) > igt_plane_set_size(d->plane3, mode->hdisplay-300, mode->vdisplay-300); > igt_display_commit2(display, COMMIT_UNIVERSAL); > > + if ((display->pipes[pipe].n_planes > 4) && (pipe != PIPE_C)) { > + > + /* Set up fb4->plane4 mapping. */ > + d->plane4 = igt_output_get_plane(output, IGT_PLANE_4); > + igt_plane_set_fb(d->plane4, &d->fb4); > + paint_plane_ID(d, &d->fb4, d->plane4); > + > + /* 4th plane windowed - no scaling */ > + igt_fb_set_position(&d->fb4, d->plane4, 50, 200); > + igt_fb_set_size(&d->fb4, d->plane4, d->fb4.width-300, d->fb4.height-300); > + igt_plane_set_position(d->plane4, 100, 100); > + igt_plane_set_size(d->plane4, d->fb4.width-300, d->fb4.height-300); > + igt_display_commit2(display, COMMIT_UNIVERSAL); > + > + /* Switch scaler from plane 3 to plane 4 */ > + igt_fb_set_position(&d->fb3, d->plane3, 100, 100); > + igt_fb_set_size(&d->fb3, d->plane3, d->fb3.width-300, d->fb3.height-300); > + igt_plane_set_position(d->plane3, 100, 100); > + igt_plane_set_size(d->plane3, d->fb3.width-300, d->fb3.height-300); > + igt_display_commit2(display, COMMIT_UNIVERSAL); > + > + igt_fb_set_position(&d->fb4, d->plane4, 10, 10); > + igt_fb_set_size(&d->fb4, d->plane4, d->fb4.width-50, d->fb4.height-50); > + igt_plane_set_position(d->plane4, 10, 10); > + igt_plane_set_size(d->plane4, mode->hdisplay-300, mode->vdisplay-300); > + igt_display_commit2(display, COMMIT_UNIVERSAL); > + > + } > + > if (primary_plane_scaling) { > /* Switch scaler from plane 1 to plane 2 */ > igt_fb_set_position(&d->fb1, d->plane1, 0, 0); > @@ -341,6 +408,8 @@ static void test_plane_scaling(data_t *d) > /* back to single plane mode */ > igt_plane_set_fb(d->plane2, NULL); > igt_plane_set_fb(d->plane3, NULL); > + if (d->plane4) > + igt_plane_set_fb(d->plane4, NULL); > igt_display_commit2(display, COMMIT_UNIVERSAL); > > valid_tests++; > -- > 1.9.1 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@xxxxxxxxxxxxxxxxxxxxx > http://lists.freedesktop.org/mailman/listinfo/intel-gfx _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx