From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: Daniel Stone <daniels@collabora.com>,
Tomeu Vizoso <tomeu.vizoso@collabora.com>,
Intel GFX discussion <intel-gfx@lists.freedesktop.org>,
Micah Fedke <micah.fedke@collabora.com>,
Gustavo Padovan <gustavo.padovan@collabora.co.uk>,
Emil Velikov <emil.velikov@collabora.com>
Subject: Re: [i-g-t PATCH v1 08/14] lib: Add igt_create_bo_with_dimensions
Date: Mon, 7 Mar 2016 18:25:01 +0200 [thread overview]
Message-ID: <20160307162501.GE10446@intel.com> (raw)
In-Reply-To: <20160305123034.GG18536@phenom.ffwll.local>
On Sat, Mar 05, 2016 at 01:30:34PM +0100, Daniel Vetter wrote:
> On Wed, Mar 02, 2016 at 03:00:15PM +0100, Tomeu Vizoso wrote:
> > igt_create_bo_with_dimensions() is intended to abstract differences
> > between drivers in buffer object creation.
> >
> > The driver-specific ioctls will be called if the driver that is being
> > tested can satisfy the needs of the calling subtest, or it will be
> > skipped otherwise.
> >
> > Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
> > ---
> >
> > lib/igt_fb.c | 83 ++++++++++++++++++++++++++++++++++++++++++------------------
> > lib/igt_fb.h | 6 +++++
> > 2 files changed, 65 insertions(+), 24 deletions(-)
> >
> > diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> > index cd1605308308..0a3526f4e4ea 100644
> > --- a/lib/igt_fb.c
> > +++ b/lib/igt_fb.c
> > @@ -174,30 +174,66 @@ void igt_calc_fb_size(int fd, int width, int height, int bpp, uint64_t tiling,
> > *size_ret = size;
> > }
> >
> > +int igt_create_bo_with_dimensions(int fd, int width, int height,
>
> Needs gtkdoc. Also this seems to overlap in functionality with the very
> recently added igt_calc_fb_size. Could we perhaps implement your new
> function here using igt_calc_fb_size plus igt_create_fb_with_size? Then
> this would just be a convenience wrapper.
BTW I also have some improvements to igt_calc_fb_size() lined up to deal
with offsets[] and whatnot. It also fixes it to account for the passed
in stride when computing the required fb size.
git://github.com/vsyrjala/linux.git fb_offsets
>
> I just want to make sure that we have a consistent interface to igt_fb.c
> functionality and avoid the need that driver-specific tiling formats need
> to overwrite bazillion of different places.
> -Daniel
>
> > + uint32_t format, uint64_t modifier,
> > + unsigned stride, unsigned *size_ret,
> > + unsigned *stride_ret, bool *is_dumb)
> > +{
> > + int bpp = igt_drm_format_to_bpp(format);
> > + int bo;
> > +
> > + igt_assert((modifier && stride) || (!modifier && !stride));
> > +
> > + if (modifier) {
> > + unsigned size, calculated_stride;
> > +
> > + igt_calc_fb_size(fd, width, height, bpp, modifier, &size,
> > + &calculated_stride);
> > + if (stride == 0)
> > + stride = calculated_stride;
> > +
> > + if (is_dumb)
> > + *is_dumb = false;
> > +
> > + if (is_i915_device(fd)) {
> > +
> > + bo = gem_create(fd, size);
> > + gem_set_tiling(fd, bo, modifier, stride);
> > +
> > + if (size_ret)
> > + *size_ret = size;
> > +
> > + if (stride_ret)
> > + *stride_ret = stride;
> > +
> > + return bo;
> > + } else {
> > + bool driver_has_tiling_support = false;
> > +
> > + igt_require(driver_has_tiling_support);
> > + return -EINVAL;
> > + }
> > + } else {
> > + if (is_dumb)
> > + *is_dumb = true;
> > + return dumb_create(fd, width, height, bpp, stride_ret, size_ret);
> > + }
> > +}
> > +
> > /* helpers to create nice-looking framebuffers */
> > -static int create_bo_for_fb(int fd, int width, int height, int bpp,
> > +static int create_bo_for_fb(int fd, int width, int height, uint32_t format,
> > uint64_t tiling, unsigned bo_size,
> > unsigned bo_stride, uint32_t *gem_handle_ret,
> > - unsigned *size_ret, unsigned *stride_ret)
> > + unsigned *size_ret, unsigned *stride_ret,
> > + bool *is_dumb)
> > {
> > uint32_t gem_handle;
> > int ret = 0;
> > - unsigned size, stride;
> > -
> > - igt_calc_fb_size(fd, width, height, bpp, tiling, &size, &stride);
> > - if (bo_size == 0)
> > - bo_size = size;
> > - if (bo_stride == 0)
> > - bo_stride = stride;
> > -
> > - gem_handle = gem_create(fd, bo_size);
> >
> > - if (tiling == LOCAL_I915_FORMAT_MOD_X_TILED)
> > - ret = __gem_set_tiling(fd, gem_handle, I915_TILING_X,
> > - bo_stride);
> > + gem_handle = igt_create_bo_with_dimensions(fd, width, height, format,
> > + tiling, bo_stride, size_ret,
> > + stride_ret, is_dumb);
> >
> > - *stride_ret = bo_stride;
> > - *size_ret = bo_size;
> > *gem_handle_ret = gem_handle;
> >
> > return ret;
> > @@ -501,17 +537,14 @@ igt_create_fb_with_bo_size(int fd, int width, int height,
> > unsigned bo_stride)
> > {
> > uint32_t fb_id;
> > - int bpp;
> >
> > memset(fb, 0, sizeof(*fb));
> >
> > - bpp = igt_drm_format_to_bpp(format);
> > -
> > - igt_debug("%s(width=%d, height=%d, format=0x%x [bpp=%d], tiling=0x%"PRIx64", size=%d)\n",
> > - __func__, width, height, format, bpp, tiling, bo_size);
> > - do_or_die(create_bo_for_fb(fd, width, height, bpp, tiling, bo_size,
> > + igt_debug("%s(width=%d, height=%d, format=0x%x, tiling=0x%"PRIx64", size=%d)\n",
> > + __func__, width, height, format, tiling, bo_size);
> > + do_or_die(create_bo_for_fb(fd, width, height, format, tiling, bo_size,
> > bo_stride, &fb->gem_handle, &fb->size,
> > - &fb->stride));
> > + &fb->stride, &fb->is_dumb));
> >
> > igt_debug("%s(handle=%d, pitch=%d)\n",
> > __func__, fb->gem_handle, fb->stride);
> > @@ -860,6 +893,7 @@ struct fb_blit_upload {
> > uint32_t handle;
> > unsigned size, stride;
> > uint8_t *map;
> > + bool is_dumb;
> > } linear;
> > };
> >
> > @@ -928,7 +962,8 @@ static void create_cairo_surface__blit(int fd, struct igt_fb *fb)
> > LOCAL_DRM_FORMAT_MOD_NONE, 0, 0,
> > &blit->linear.handle,
> > &blit->linear.size,
> > - &blit->linear.stride);
> > + &blit->linear.stride,
> > + &blit->linear.is_dumb);
> >
> > igt_assert(ret == 0);
> >
> > diff --git a/lib/igt_fb.h b/lib/igt_fb.h
> > index 4e6a76947c18..10e59deebe88 100644
> > --- a/lib/igt_fb.h
> > +++ b/lib/igt_fb.h
> > @@ -47,6 +47,7 @@ typedef struct _cairo cairo_t;
> > struct igt_fb {
> > uint32_t fb_id;
> > uint32_t gem_handle;
> > + bool is_dumb;
> > uint32_t drm_format;
> > int width;
> > int height;
> > @@ -97,6 +98,11 @@ unsigned int igt_create_stereo_fb(int drm_fd, drmModeModeInfo *mode,
> > uint32_t format, uint64_t tiling);
> > void igt_remove_fb(int fd, struct igt_fb *fb);
> >
> > +int igt_create_bo_with_dimensions(int fd, int width, int height, uint32_t format,
> > + uint64_t modifier, unsigned stride,
> > + unsigned *stride_out, unsigned *size_out,
> > + bool *is_dumb);
> > +
> > /* cairo-based painting */
> > cairo_t *igt_get_cairo_ctx(int fd, struct igt_fb *fb);
> > void igt_paint_color(cairo_t *cr, int x, int y, int w, int h,
> > --
> > 2.5.0
> >
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-03-07 16:25 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-02 14:00 [i-g-t PATCH v1 00/14] Get a few more tests to run on !i915 Tomeu Vizoso
2016-03-02 14:00 ` [i-g-t PATCH v1 01/14] lib: add igt_require_intel Tomeu Vizoso
2016-03-02 14:18 ` Chris Wilson
2016-03-02 14:00 ` [i-g-t PATCH v1 02/14] lib: Have gem_set_tiling require intel Tomeu Vizoso
2016-03-02 14:00 ` [i-g-t PATCH v1 03/14] lib: Expose is_i915_device Tomeu Vizoso
2016-03-02 14:00 ` [i-g-t PATCH v1 04/14] lib: Have intel_get_drm_devid call igt_require_intel Tomeu Vizoso
2016-03-02 14:00 ` [i-g-t PATCH v1 05/14] lib: Call intel_get_drm_devid only from intel code Tomeu Vizoso
2016-03-02 14:00 ` [i-g-t PATCH v1 06/14] lib: Add wrapper for DRM_IOCTL_MODE_CREATE_DUMB Tomeu Vizoso
2016-03-05 12:21 ` Daniel Vetter
2016-03-02 14:00 ` [i-g-t PATCH v1 07/14] lib: Map dumb buffers Tomeu Vizoso
2016-03-02 14:21 ` Chris Wilson
2016-03-02 14:22 ` Daniel Stone
2016-03-02 14:39 ` Chris Wilson
2016-03-02 14:40 ` Daniel Stone
2016-03-02 14:54 ` Chris Wilson
2016-03-02 15:41 ` Daniel Stone
2016-03-05 12:24 ` Daniel Vetter
2016-03-05 12:27 ` Daniel Vetter
2016-03-02 14:00 ` [i-g-t PATCH v1 08/14] lib: Add igt_create_bo_with_dimensions Tomeu Vizoso
2016-03-05 12:30 ` Daniel Vetter
2016-03-07 16:19 ` Tomeu Vizoso
2016-03-07 16:25 ` Ville Syrjälä [this message]
2016-03-08 11:45 ` Daniel Stone
2016-11-01 15:44 ` Tvrtko Ursulin
2016-11-10 13:17 ` Tomeu Vizoso
2016-11-10 16:23 ` Tvrtko Ursulin
2016-11-11 11:23 ` Tomeu Vizoso
2016-11-11 11:33 ` Tvrtko Ursulin
2016-11-11 13:14 ` Tomeu Vizoso
2016-03-02 14:00 ` [i-g-t PATCH v1 09/14] tests: Open any driver Tomeu Vizoso
2016-03-02 14:00 ` [i-g-t PATCH v1 10/14] kms_addfb_basic: call igt_create_bo_with_dimensions Tomeu Vizoso
2016-03-02 14:00 ` [i-g-t PATCH v1 11/14] kms_addfb_basic: move tiling functionality into each subtest Tomeu Vizoso
2016-03-02 14:00 ` [i-g-t PATCH v1 12/14] kms_addfb_basic: Split tiling_tests off Tomeu Vizoso
2016-03-05 12:33 ` Daniel Vetter
2016-03-07 16:08 ` Tomeu Vizoso
2016-03-02 14:00 ` [i-g-t PATCH v1 13/14] kms_addfb_basic: Move calls to gem_set_tiling to the subtests Tomeu Vizoso
2016-03-02 14:00 ` [i-g-t PATCH v1 14/14] kms_addfb_basic: Get intel gen from within subtest Tomeu Vizoso
2016-03-05 12:34 ` [i-g-t PATCH v1 00/14] Get a few more tests to run on !i915 Daniel Vetter
2016-04-14 12:56 ` Daniel Stone
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160307162501.GE10446@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=daniel@ffwll.ch \
--cc=daniels@collabora.com \
--cc=emil.velikov@collabora.com \
--cc=gustavo.padovan@collabora.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
--cc=micah.fedke@collabora.com \
--cc=tomeu.vizoso@collabora.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).