From patchwork Wed Feb 1 01:25:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foss X-Patchwork-Id: 9548825 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F239960416 for ; Wed, 1 Feb 2017 01:25:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E62BE2840A for ; Wed, 1 Feb 2017 01:25:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DAFCF2840F; Wed, 1 Feb 2017 01:25:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 98CC72840A for ; Wed, 1 Feb 2017 01:25:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 014486E782; Wed, 1 Feb 2017 01:25:36 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by gabe.freedesktop.org (Postfix) with ESMTPS id CCEE16E77C for ; Wed, 1 Feb 2017 01:25:33 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: robertfoss) with ESMTPSA id E17B72682DE From: Robert Foss To: intel-gfx@lists.freedesktop.org, Gustavo Padovan , Brian Starkey , Daniel Vetter , Tomeu Vizoso Date: Tue, 31 Jan 2017 20:25:14 -0500 Message-Id: <20170201012520.27352-6-robert.foss@collabora.com> X-Mailer: git-send-email 2.11.0.453.g787f75f05 In-Reply-To: <20170201012520.27352-1-robert.foss@collabora.com> References: <20170201012520.27352-1-robert.foss@collabora.com> Subject: [Intel-gfx] [PATCH i-g-t v4 05/11] lib/igt_kms: Add support for the IN_FENCE_FD property X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Add support dor the IN_FENCE_FD property to enable setting in fences for atomic commits. Signed-off-by: Robert Foss --- lib/igt_kms.c | 25 +++++++++++++++++++++++++ lib/igt_kms.h | 5 +++++ 2 files changed, 30 insertions(+) diff --git a/lib/igt_kms.c b/lib/igt_kms.c index 142658a6..9b60d74a 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; @@ -1994,6 +1996,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); @@ -2815,6 +2822,24 @@ 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, int fence_fd) +{ + close(plane->fence_fd); + + if (fcntl(fence_fd, F_GETFD) != -1) + plane->fence_fd = dup(fence_fd); + else + plane->fence_fd = -1; +} + 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 00e0dc68..8acad8ef 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 */ + int fence_fd; uint32_t atomic_props_plane[IGT_NUM_PLANE_PROPS]; } igt_plane_t; @@ -396,6 +400,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, int 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);