Re: [PATCH i-g-t 2/6] lib: Extract ssme common fb create+fill methods into helpers

Ville Syrjälä
2016-01-04T16:23:21Z

On Mon, Dec 21, 2015 at 10:42:46AM +0000, Thomas Wood wrote:
> On 18 December 2015 at 17:25, <ville.syrjala@linux.intel.com> wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > Several tests do one or more of the followin:
> > * igt_create_fb() + igt_paint_test_pattern()
> > * igt_create_color_fb() + igt_paint_test_pattern()
> > * igt_create_fb() + igt_paint_image()
> >
> > Extract them into new helpes: igt_create_pattern_fb(),
> > igt_create_color_pattern_fb(), igt_create_image_fb().
>
> Couple of typos above: "ssme", "followin", "helpes"
>
>
> >
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> > lib/igt_fb.c | 124 ++++++++++++++++++++++++++++++++++++++++++++++
> > lib/igt_fb.h | 11 ++++
> > tests/kms_atomic.c | 30 ++++-------
> > tests/kms_flip_tiling.c | 25 +++-------
> > tests/kms_panel_fitting.c | 42 ++++------------
> > tests/kms_plane_scaling.c | 60 ++++++----------------
> > tests/kms_pwrite_crc.c | 9 +---
> > tests/kms_setmode.c | 11 ++--
> > tests/pm_lpsp.c | 11 +---
> > tests/pm_rpm.c | 10 ++--
> > tests/testdisplay.c | 8 ++-
> > 11 files changed, 188 insertions(+), 153 deletions(-)
> >
> > diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> > index 3ea9915c42c4..b3c7840a22ae 100644
> > --- a/lib/igt_fb.c
> > +++ b/lib/igt_fb.c
> > @@ -537,6 +537,130 @@ unsigned int igt_create_color_fb(int fd, int width, int height,
> > return fb_id;
> > }
> >
> > +/**
> > + * igt_create_pattern_fb:
> > + * @fd: open i915 drm file descriptor
> > + * @width: width of the framebuffer in pixel
> > + * @height: height of the framebuffer in pixel
> > + * @format: drm fourcc pixel format code
> > + * @tiling: tiling layout of the framebuffer
> > + * @fb: pointer to an #igt_fb structure
> > + *
> > + * This function allocates a gem buffer object suitable to back a framebuffer
> > + * with the requested properties and then wraps it up in a drm framebuffer
> > + * object. All metadata is stored in @fb.
> > + *
> > + * Compared to igt_create_fb() this function also fills the entire framebuffer
> > + * with the test pattern.
> > + *
> > + * Returns:
> > + * The kms id of the created framebuffer on success or a negative error code on
> > + * failure.
> > + */
> > +unsigned int igt_create_pattern_fb(int fd, int width, int height,
> > + uint32_t format, uint64_t tiling,
> > + struct igt_fb *fb /* out */)
> > +{
> > + unsigned int fb_id;
> > + cairo_t *cr;
> > +
> > + fb_id = igt_create_fb(fd, width, height, format, tiling, fb);
> > + igt_assert(fb_id);
> > +
> > + cr = igt_get_cairo_ctx(fd, fb);
> > + igt_paint_test_pattern(cr, width, height);
> > + igt_assert(cairo_status(cr) == 0);
> > + cairo_destroy(cr);
> > +
> > + return fb_id;
> > +}
> > +
> > +/**
> > + * igt_create_pattern_fb:
>
> This should be igt_create_color_pattern_fb.
>
>
> > + * @fd: open i915 drm file descriptor
> > + * @width: width of the framebuffer in pixel
> > + * @height: height of the framebuffer in pixel
> > + * @format: drm fourcc pixel format code
> > + * @tiling: tiling layout of the framebuffer
> > + * @r: red value to use as fill color
> > + * @g: gree value to use as fill color
>
> Typo of "green" here.

I think this was copy pasted from somewhere else. I'll fix up the
original as well.

--
Ville Syrjälä
Intel OTC