From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Daniel Stone <daniels@collabora.com>
Cc: igt-dev@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t 1/3] tests/kms_getfb: Split property-ID get into helper
Date: Fri, 23 Mar 2018 16:53:31 +0200 [thread overview]
Message-ID: <20180323145331.GZ5453@intel.com> (raw)
In-Reply-To: <20180323134616.16058-1-daniels@collabora.com>
On Fri, Mar 23, 2018 at 01:46:14PM +0000, Daniel Stone wrote:
> We'll want to reuse this, so split it out into a (smaller!) helper.
>
> Signed-off-by: Daniel Stone <daniels@collabora.com>
> ---
> tests/kms_getfb.c | 36 +++++++++++++++++++-----------------
> 1 file changed, 19 insertions(+), 17 deletions(-)
>
> diff --git a/tests/kms_getfb.c b/tests/kms_getfb.c
> index c5968e75..a9852626 100644
> --- a/tests/kms_getfb.c
> +++ b/tests/kms_getfb.c
> @@ -72,6 +72,23 @@ static void get_ccs_fb(int fd, struct drm_mode_fb_cmd2 *ret)
> gem_close(fd, add.handles[0]);
> }
>
> +/**
> + * Find and return an arbitrary valid property ID.
> + */
> +static uint32_t get_prop_id(int fd)
get_any_prop_id() or something like that maybe?
Either way
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> +{
> + igt_display_t display;
> +
> + igt_display_init(&display, fd);
> + for (int i = 0; i < display.n_outputs; i++) {
> + igt_output_t *output = &display.outputs[i];
> + if (output->props[IGT_CONNECTOR_DPMS] != 0)
> + return output->props[IGT_CONNECTOR_DPMS];
> + }
> +
> + return 0;
> +}
> +
> static void test_handle_input(int fd)
> {
> struct drm_mode_fb_cmd2 add = {};
> @@ -111,23 +128,8 @@ static void test_handle_input(int fd)
> }
>
> igt_subtest("getfb-handle-not-fb") {
> - struct drm_mode_fb_cmd get = { };
> - uint32_t prop_id = 0;
> - igt_display_t display;
> -
> - /* Find a valid property ID to use. */
> - igt_display_init(&display, fd);
> - for (int i = 0; i < display.n_outputs; i++) {
> - igt_output_t *output = &display.outputs[i];
> -
> - if (output->props[IGT_CONNECTOR_DPMS] != 0) {
> - prop_id = output->props[IGT_CONNECTOR_DPMS];
> - break;
> - }
> - }
> - igt_require(prop_id > 0);
> -
> - get.fb_id = prop_id;
> + struct drm_mode_fb_cmd get = { .fb_id = get_prop_id(fd) };
> + igt_require(get.fb_id > 0);
> do_ioctl_err(fd, DRM_IOCTL_MODE_GETFB, &get, ENOENT);
> }
> }
> --
> 2.16.2
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Ville Syrjälä
Intel OTC
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2018-03-23 14:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-23 13:42 [igt-dev] [PATCH 0/8] Add GetFB2 ioctl Daniel Stone
2018-03-23 13:46 ` [igt-dev] [PATCH i-g-t 1/3] tests/kms_getfb: Split property-ID get into helper Daniel Stone
2018-03-23 13:46 ` [PATCH i-g-t 2/3] NOMERGE: Update DRM UAPI to latest kernel version Daniel Stone
2018-03-23 13:46 ` [igt-dev] [PATCH i-g-t 3/3] tests/kms_getfb: Add getfb2 tests Daniel Stone
2018-03-23 15:01 ` Ville Syrjälä
2018-03-23 14:53 ` Ville Syrjälä [this message]
2018-03-23 14:55 ` [igt-dev] [PATCH i-g-t 1/3] tests/kms_getfb: Split property-ID get into helper Daniel Stone
2018-03-23 13:51 ` [igt-dev] [PATCH 0/8] Add GetFB2 ioctl 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=20180323145331.GZ5453@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=daniels@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=igt-dev@lists.freedesktop.org \
/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