public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Vasilev, Oleg" <oleg.vasilev@intel.com>
To: "igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>,
	"Ser, Simon" <simon.ser@intel.com>
Cc: "daniel@ffwll.ch" <daniel@ffwll.ch>
Subject: Re: [igt-dev] [PATCH 2/2] tests/prime_generic: add vendor-agnostic prime tests
Date: Fri, 16 Aug 2019 14:21:46 +0000	[thread overview]
Message-ID: <e52563c18687eea965a4707ca6cfb7e8d4f4a374.camel@intel.com> (raw)
In-Reply-To: <03468d86c479d38c77fc3e119b97098618bc86bd.camel@intel.com>


[-- Attachment #1.1: Type: text/plain, Size: 3747 bytes --]

On Fri, 2019-08-16 at 11:07 +0100, Ser, Simon wrote:
> Hi,
> 
> Overall this looks good. Here are a few comments.
> 
> I agree with Chris and Daniel regarding naming.
> 
> On Fri, 2019-07-12 at 17:16 +0300, Oleg Vasilev wrote:
> > +static bool has_prime_import(int fd)
> > +{
> > +	uint64_t value;
> > +
> > +	if (drmGetCap(fd, DRM_CAP_PRIME, &value))
> > +		return false;
> > +
> > +	return value & DRM_PRIME_CAP_IMPORT;
> 
> This returns a non-zero value when import is supported, but doesn't
> return true. This can lead to strange bugs.
> 
> It's common to use !! to convert to a bool.

Hi,

As discussed, this should be still a valid stdbool.

> > +	vgem_create(exporter, scratch);
> 
> The return value should be checked.

Actually, it is already checked inside the function. AFAIU, in IGT
helpers usually call their __underscored siblings and assert return
value.
 
> 
> > +	ptr = vgem_mmap(exporter, scratch, PROT_WRITE);
> 
> Ditto, we should check that ptr != NULL.

Same.

> 
> > +	for (i = 0; i < scratch->size / sizeof(*ptr); ++i)
> > +		ptr[i] = color;
> > +
> > +	munmap(ptr, scratch->size);
> > +}
> > +
> > +static void prepare_fb(int importer, struct vgem_bo *scratch,
> > struct igt_fb *fb)
> > +{
> > +	enum igt_color_encoding color_encoding = IGT_COLOR_YCBCR_BT709;
> > +	enum igt_color_range color_range =
> > IGT_COLOR_YCBCR_LIMITED_RANGE;
> > +
> > +	igt_init_fb(fb, importer, scratch->width, scratch->height,
> > +		    DRM_FORMAT_XRGB8888, LOCAL_DRM_FORMAT_MOD_NONE,
> > +		    color_encoding, color_range);
> 
> Maybe we could populate fb->strides[0] here, so that we don't need to
> pass it around in import_fb.
> 
> > +}
> > 
> > +		dmabuf_fd = prime_handle_to_fd(exporter,
> > scratch.handle);
> 
> We should check dmabuf_fd >= 0.

Same, it is asserted internally.

> > +		gem_close(exporter, scratch.handle);
> > +
> > +		prepare_fb(importer, &scratch, &fb);
> > +		import_fb(importer, &fb, dmabuf_fd, scratch.pitch);
> 
> We should release this FB after we're done.

You mean remove fb? It is done in collect_crc, which I renamed to
collect_crc_for_fb to make it more clear.

> > +		close(dmabuf_fd);
> > +
> > +		colors[i].prime_crc.name = "prime";
> > +		collect_crc(importer, &fb, &display, output,
> > +			    pipe_crc, colors[i].color,
> > &colors[i].prime_crc);
> > +
> > +		igt_create_color_fb(importer,
> > +				    mode->hdisplay, mode->vdisplay,
> > +				    DRM_FORMAT_XRGB8888,
> > LOCAL_DRM_FORMAT_MOD_NONE,
> > +				    colors[i].r, colors[i].g,
> > colors[i].b,
> > +				    &fb);
> 
> Ditto, we should release this FB after we're done.

Same

> 
> > +
> > +		colors[i].direct_crc.name = "direct";
> > +		collect_crc(importer, &fb, &display, output,
> > +			    pipe_crc, colors[i].color,
> > &colors[i].direct_crc);
> > +	}
> > +	igt_pipe_crc_free(pipe_crc);
> > +
> > +	igt_debug("CRC table:\n");
> > +	igt_debug("Color\t\tPrime\t\tDirect\n");
> > +	for (i = 0; i < ARRAY_SIZE(colors); i++) {
> > +		igt_debug("%#08x\t%.8s\t%.8s\n", colors[i].color,
> > +			  colors[i].prime_crc.str,
> > colors[i].direct_crc.str);
> > +		free(colors[i].prime_crc.str);
> > +		free(colors[i].direct_crc.str);
> > +	}
...
> > +
> > +igt_main
> > +{
> > +	igt_fixture {
> > +		kmstest_set_vt_graphics_mode();
> 
> Is this really needed?

Yeah, it is necessary for every KMS test.

The rest is fixed, thanks for the review. New version is sent.

Oleg

> 
> > +	}
> > +	igt_subtest("crc")
> 
> Please add a subtest description. See:
> https://drm.pages.freedesktop.org/igt-gpu-tools/igt-gpu-tools-Core.html#igt-describe
> 
> > +		run_test_crc(DRIVER_VGEM, DRIVER_ANY);
> > +}

[-- Attachment #1.2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 3261 bytes --]

[-- Attachment #2: Type: text/plain, Size: 153 bytes --]

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2019-08-16 14:21 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-12 14:16 [igt-dev] [PATCH 1/2] lib: expose fb_init Oleg Vasilev
2019-07-12 14:16 ` [igt-dev] [PATCH 2/2] tests/prime_generic: add vendor-agnostic prime tests Oleg Vasilev
2019-07-12 14:20   ` Chris Wilson
2019-07-31  9:45   ` Vasilev, Oleg
2019-08-02 14:38   ` Daniel Vetter
2019-08-16 10:07   ` Ser, Simon
2019-08-16 10:13     ` Chris Wilson
2019-08-16 10:35       ` Ser, Simon
2019-08-16 14:21     ` Vasilev, Oleg [this message]
2019-08-16 14:33       ` Ser, Simon
2019-08-16 14:39         ` Ser, Simon
2019-08-16 14:21   ` [igt-dev] [PATCH 1/2] lib: expose fb_init Oleg Vasilev
2019-08-16 14:21     ` [igt-dev] [PATCH 2/2] tests/kms_prime: add vendor-agnostic kms prime tests Oleg Vasilev
2019-08-19  9:50       ` Ser, Simon
2019-07-12 15:45 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [1/2] lib: expose fb_init Patchwork
2019-07-12 17:07 ` [igt-dev] ✗ GitLab.Pipeline: warning " Patchwork
2019-07-14  4:16 ` [igt-dev] ✓ Fi.CI.IGT: success " Patchwork
2019-08-16 14:56 ` [igt-dev] ✗ GitLab.Pipeline: warning for series starting with [1/2] lib: expose fb_init (rev3) Patchwork
2019-08-16 15:02 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2019-08-17  6:57 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2019-07-04  9:56 [igt-dev] [PATCH 1/2] lib: prepare helpers for generic prime test Oleg Vasilev
2019-07-04  9:56 ` [igt-dev] [PATCH 2/2] tests/prime_generic: add vendor-agnostic prime tests Oleg Vasilev
2019-07-09 13:48   ` Rodrigo Siqueira
2019-07-10 16:35   ` Daniel Vetter
2019-07-11  9:09     ` Vasilev, Oleg
2019-07-11 12:36       ` Daniel Vetter
2019-07-11 15:20         ` Ser, Simon
2019-07-11 17:19           ` Daniel Vetter
2019-07-12  8:36             ` Vasilev, Oleg
2019-07-12 10:24             ` Ser, Simon

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=e52563c18687eea965a4707ca6cfb7e8d4f4a374.camel@intel.com \
    --to=oleg.vasilev@intel.com \
    --cc=daniel@ffwll.ch \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=simon.ser@intel.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