Re: [PATCH i-g-t v3 06/11] lib/igt_kms: Add support for the IN_FENCE_FD property

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 30, 2017 at 08:58:42PM -0500, Robert Foss wrote:
Add support dor the IN_FENCE_FD property to enable setting in fences for atomic
commits.

Signed-off-by: Robert Foss <robert.foss@xxxxxxxxxxxxx>
---
lib/igt_kms.c | 20 ++++++++++++++++++++
lib/igt_kms.h |  5 +++++
2 files changed, 25 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index f0e38b75..b79d2867 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -168,6 +168,7 @@ const char *igt_plane_prop_names[IGT_NUM_PLANE_PROPS] = {
	"CRTC_H",
	"FB_ID",
	"CRTC_ID",
+	"IN_FENCE_FD",
	"type",
	"rotation"
};
@@ -1667,6 +1668,7 @@ void igt_display_init(igt_display_t *display, int drm_fd)
			plane->type = type;
			plane->pipe = pipe;
			plane->drm_plane = drm_plane;
+			plane->fence_fd = -1;

			if (is_atomic == 0) {
				display->is_atomic = 1;
@@ -2002,6 +2004,11 @@ igt_atomic_prepare_plane_commit(igt_plane_t *plane, igt_pipe_t *pipe,
	    plane->index,
	    fb_id);

+	if (plane->fence_fd >= 0) {
+		uint64_t fence_fd = (int64_t) plane->fence_fd;
+		igt_atomic_populate_plane_req(req, plane, IGT_PLANE_IN_FENCE_FD, fence_fd);
+	}
+
	if (plane->fb_changed) {
		igt_atomic_populate_plane_req(req, plane, IGT_PLANE_CRTC_ID, fb_id ? crtc_id : 0);
		igt_atomic_populate_plane_req(req, plane, IGT_PLANE_FB_ID, fb_id);
@@ -2823,6 +2830,19 @@ void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb)
	plane->size_changed = true;
}

+/**
+ * igt_plane_set_fence_fd:
+ * @plane: plane
+ * @fence_fd: fence fd, disable fence_fd by setting it to -1
+ *
+ * This function sets a fence fd to enable a commit to wait for some event to
+ * occur before completing.
+ */
+void igt_plane_set_fence_fd(igt_plane_t *plane, uint32_t fence_fd)

nitpick, but should that be "int fence_fd" ?

Also have some comments later in the series around the fd ownership.
If nothing else, the comment here could say what's expected.

-Brian

+{
+	plane->fence_fd = fence_fd;
+}
+
void igt_plane_set_position(igt_plane_t *plane, int x, int y)
{
	igt_pipe_t *pipe = plane->pipe;
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 94ff27bb..85688853 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -248,6 +248,7 @@ enum igt_atomic_plane_properties {

       IGT_PLANE_FB_ID,
       IGT_PLANE_CRTC_ID,
+       IGT_PLANE_IN_FENCE_FD,
       IGT_PLANE_TYPE,
       IGT_PLANE_ROTATION,
       IGT_NUM_PLANE_PROPS
@@ -306,6 +307,9 @@ typedef struct {
	uint32_t src_h;

	igt_rotation_t rotation;
+
+	/* in fence fd */
+	int32_t fence_fd;
	uint32_t atomic_props_plane[IGT_NUM_PLANE_PROPS];
} igt_plane_t;

@@ -397,6 +401,7 @@ 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_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);
void igt_plane_set_position(igt_plane_t *plane, int x, int y);
void igt_plane_set_size(igt_plane_t *plane, int w, int h);
void igt_plane_set_rotation(igt_plane_t *plane, igt_rotation_t rotation);
--
2.11.0.453.g787f75f05

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux