All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Starkey <brian.starkey@arm.com>
To: Robert Foss <robert.foss@collabora.com>
Cc: Gustavo Padovan <gustavo.padovan@collabora.com>,
	intel-gfx@lists.freedesktop.org,
	Gustavo Padovan <gustavo.padovan@collabora.co.uk>,
	Tomeu Vizoso <tomeu.vizoso@collabora.com>
Subject: Re: [PATCH i-g-t v2 07/12] lib/igt_kms: Add support for the OUT_FENCE_PTR property
Date: Fri, 16 Dec 2016 18:57:58 +0000	[thread overview]
Message-ID: <20161216185757.GA16797@e106950-lin.cambridge.arm.com> (raw)
In-Reply-To: <189c0b96-39e0-4ac5-72f8-0417964e501f@collabora.com>

On Fri, Dec 16, 2016 at 03:21:45AM -0500, Robert Foss wrote:
>
>
>On 2016-12-14 11:13 AM, Brian Starkey wrote:
>>Hi,
>>
>>On Wed, Dec 14, 2016 at 04:05:04AM -0500, Robert Foss wrote:
>>>From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>>>
>>>Add support for the OUT_FENCE_PTR property to enable setting out
>>>fences for
>>>atomic commits.
>>>
>>>Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>>>Signed-off-by: Robert Foss <robert.foss@collabora.com>
>>>---
>>>lib/igt_kms.c | 21 ++++++++++++++++++++-
>>>lib/igt_kms.h |  3 +++
>>>2 files changed, 23 insertions(+), 1 deletion(-)
>>>
>>>diff --git a/lib/igt_kms.c b/lib/igt_kms.c
>>>index 8ca49d86..fe1b356d 100644
>>>--- a/lib/igt_kms.c
>>>+++ b/lib/igt_kms.c
>>>@@ -175,7 +175,8 @@ const char
>>>*igt_crtc_prop_names[IGT_NUM_CRTC_PROPS] = {
>>>    "DEGAMMA_LUT",
>>>    "GAMMA_LUT",
>>>    "MODE_ID",
>>>-    "ACTIVE"
>>>+    "ACTIVE",
>>>+    "OUT_FENCE_PTR"
>>>};
>>>
>>>const char *igt_connector_prop_names[IGT_NUM_CONNECTOR_PROPS] = {
>>>@@ -2103,6 +2104,10 @@ static void
>>>igt_atomic_prepare_crtc_commit(igt_pipe_t *pipe_obj, drmModeAtomicRe
>>>        igt_atomic_populate_crtc_req(req, pipe_obj, IGT_CRTC_ACTIVE,
>>>!!output);
>>>    }
>>>
>>>+    if (pipe_obj->out_fence_ptr)
>>>+        igt_atomic_populate_crtc_req(req, pipe_obj,
>>>IGT_CRTC_OUT_FENCE_PTR,
>>>+            (uint64_t)(uintptr_t) pipe_obj->out_fence_ptr);
>>>+
>>>    /*
>>>     *    TODO: Add all crtc level properties here
>>>     */
>>>@@ -2683,6 +2688,20 @@ igt_pipe_set_gamma_lut(igt_pipe_t *pipe, void
>>>*ptr, size_t length)
>>>}
>>>
>>>/**
>>>+ * igt_pipe_set_out_fence_ptr:
>>>+ * @pipe: pipe pointer to which background color to be set
>>>+ * @fence_ptr: out fence pointer
>>>+ *
>>>+ * Sets the out fence pointer that will be passed to the kernel in
>>>+ * the atomic ioctl. When the kernel returns the out fence pointer
>>>+ * will contain the fd number of the out fence created by KMS.
>>>+ */
>>>+void igt_pipe_set_out_fence_ptr(igt_pipe_t *pipe, int64_t *fence_ptr)
>>>+{
>>>+    pipe->out_fence_ptr = fence_ptr;
>>>+}
>>>+
>>>+/**
>>> * igt_crtc_set_background:
>>> * @pipe: pipe pointer to which background color to be set
>>> * @background: background color value in BGR 16bpc
>>>diff --git a/lib/igt_kms.h b/lib/igt_kms.h
>>>index 9766807c..8eb611c0 100644
>>>--- a/lib/igt_kms.h
>>>+++ b/lib/igt_kms.h
>>>@@ -110,6 +110,7 @@ enum igt_atomic_crtc_properties {
>>>       IGT_CRTC_GAMMA_LUT,
>>>       IGT_CRTC_MODE_ID,
>>>       IGT_CRTC_ACTIVE,
>>>+       IGT_CRTC_OUT_FENCE_PTR,
>>>       IGT_NUM_CRTC_PROPS
>>>};
>>>
>>>@@ -316,6 +317,7 @@ struct igt_pipe {
>>>
>>>    uint64_t mode_blob;
>>>    bool mode_changed;
>>>+    int64_t *out_fence_ptr;
>>
>>I prefer the interface that got suggested before - igt_pipe gets an
>>"int64_t out_fence;" member which tests can query to get the fence
>>value:
>>
>>int igt_pipe_get_last_out_fence(igt_pipe_t *pipe);
>>
>>..and the kernel only ever receives a pointer to pipe->out_fence.
>>
>>The only reason I can see for a test to want to provide its own fence
>>pointer is to test invalid pointer values - and I think it's OK for
>>that test to set the property directly instead of making setting a
>>custom fence pointer the common case for all users.
>>
>>If we don't want to get a fence for every commit then I guess there
>>could be a way for a test to request an out-fence for just the next
>>commit on a pipe (or the inverse - disable fencing for a particular
>>commit):
>>
>>void igt_pipe_request_out_fence(igt_pipe_t *pipe);
>>
>>-Brian
>
>Now I see what you meant in the v1 discussion, I'll amend the 
>implementation in v3 to be the one mentioned above.
>

Partly... my main point on v1 was just to make sure the pointer was to
a 64-bit type.

>The only question I have is about igt_pipe_get_last_out_fence(), is 
>it really necessary? I don't foresee a function like that ever doing 
>more than just returning a struct member. Is it not a bit redundant?
>

I see two reasons for it:
  - It means tests only deal with plain ints, which I think Chris was
    fairly adamant about on v1.
  - The getter can set pipe->out_fence to -1 when its called, making
    the ownership of the fd obvious.

In this case I guess before each commit out_fence needs to be checked,
close()'d if it looks valid, and set to -1 too.

Cheers,
Brian

>
>Rob.
>
>>
>>>};
>>>
>>>typedef struct {
>>>@@ -369,6 +371,7 @@ static inline bool
>>>igt_plane_supports_rotation(igt_plane_t *plane)
>>>void igt_pipe_set_degamma_lut(igt_pipe_t *pipe, void *ptr, size_t
>>>length);
>>>void igt_pipe_set_ctm_matrix(igt_pipe_t *pipe, void *ptr, size_t length);
>>>void igt_pipe_set_gamma_lut(igt_pipe_t *pipe, void *ptr, size_t length);
>>>+void igt_pipe_set_out_fence_ptr(igt_pipe_t *pipe, int64_t *fence_ptr);
>>>
>>>void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb);
>>>void igt_plane_set_fence_fd(igt_plane_t *plane, uint32_t fence_fd);
>>>--
>>>2.11.0
>>>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-12-16 18:58 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-14  9:04 [PATCH i-g-t v2 00/12] tests/kms_atomic_transition add fence testing Robert Foss
2016-12-14  9:04 ` [PATCH i-g-t v2 01/12] tests/kms_atomic_transition: use igt timeout instead of blocking Robert Foss
2016-12-14  9:04 ` [PATCH i-g-t v2 02/12] tests/kms_atomic_transition: don't assume max pipes Robert Foss
2016-12-14  9:05 ` [PATCH i-g-t v2 03/12] lib/igt_kms: move igt_kms_get_alt_edid() to the right place Robert Foss
2016-12-14  9:05 ` [PATCH i-g-t v2 04/12] lib/igt_kms: export properties names Robert Foss
2016-12-14  9:05 ` [PATCH i-g-t v2 05/12] tests/kms_atomic: use global atomic properties definitions Robert Foss
2016-12-14  9:05 ` [PATCH i-g-t v2 06/12] lib/igt_kms: Add support for the IN_FENCE_FD property Robert Foss
2016-12-14 16:04   ` Brian Starkey
2016-12-15 12:36     ` Robert Foss
2016-12-14  9:05 ` [PATCH i-g-t v2 07/12] lib/igt_kms: Add support for the OUT_FENCE_PTR property Robert Foss
2016-12-14 16:13   ` Brian Starkey
2016-12-16  8:21     ` Robert Foss
2016-12-16 18:57       ` Brian Starkey [this message]
2016-12-14  9:05 ` [PATCH i-g-t v2 08/12] tests/kms_atomic: stress possible fence settings Robert Foss
2016-12-14 16:39   ` Brian Starkey
2016-12-16  8:35     ` Robert Foss
2016-12-16 19:05       ` Brian Starkey
2016-12-14  9:05 ` [PATCH i-g-t v2 09/12] tests/kms_atomic_transition: add fencing parameter to run_transition_tests Robert Foss
2016-12-14  9:05 ` [PATCH i-g-t v2 10/12] tests/kms_atomic_transition: add out_fences tests Robert Foss
2016-12-14 16:57   ` Brian Starkey
2016-12-16  8:59     ` Robert Foss
2016-12-16 19:06       ` Brian Starkey
2016-12-14  9:05 ` [PATCH i-g-t v2 11/12] tests/kms_atomic_transition: add in_fences tests Robert Foss
2016-12-14  9:05 ` [PATCH i-g-t v2 12/12] tests/kms_atomic_transition: set out_fence for all crtcs Robert Foss

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=20161216185757.GA16797@e106950-lin.cambridge.arm.com \
    --to=brian.starkey@arm.com \
    --cc=gustavo.padovan@collabora.co.uk \
    --cc=gustavo.padovan@collabora.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=robert.foss@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.