From patchwork Tue Nov 22 21:54:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Gmeiner X-Patchwork-Id: 9442261 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 C706D605EE for ; Tue, 22 Nov 2016 21:54:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE082204BD for ; Tue, 22 Nov 2016 21:54:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A2E1A204BF; Tue, 22 Nov 2016 21:54:58 +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.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID 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 4D359204BD for ; Tue, 22 Nov 2016 21:54:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9D1AD6E69C; Tue, 22 Nov 2016 21:54:56 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 804D46E69C for ; Tue, 22 Nov 2016 21:54:54 +0000 (UTC) Received: by mail-wm0-x244.google.com with SMTP id a20so7016602wme.2 for ; Tue, 22 Nov 2016 13:54:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=5b6f5Xz6rW+b+gw/7ighWfdRM9MefleF5rUoFWmVGQw=; b=x3fojPJ2+wKBUbXy9R841mslQ5YMMYcpFAfbCGjcQ/DbDrXj006XRpIZekggKSFGOk moVaMjLylfBE6NGSl8FVLAMgTgqOc2lkkBMOiQsHxF/u0qo2V6bjy7Sfqptg7prLiz9M AgGAl+08v3yL5/JTy+G43ozT5QSWwo1zPcVfm1WnC+6xr4k2X4FQgtTn+173FBWgOjFG tpKfTUBZPREB1Le4T/CPHXcDakKRoKmWhJoQ6qvxcYrKv+Ul4TR+8bwuYYCXx4gcGiEj 4e8nik7yYJhkfrHjGARepGFwnvxhgTW96E0uZx3YE8mhyK4Fe5jRL2WKFFQOS9RG5mQh jj6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=5b6f5Xz6rW+b+gw/7ighWfdRM9MefleF5rUoFWmVGQw=; b=U7RObcSAn80vWkqcwKwH+EmwluOhpVEb9lAeJnQlYaypRsQ5HYZaoQKzYMPBSaTVe3 G45+6AVM42z6ZDTOs/UH+s71RuI77AWMBl4Ttn/9j8UkeHFQtujaR6ygoFdwns3LSQ/A ndTq1IFvxnx4gMRwu5yh5+y0Rs51S+3eLjiKAgtzyl5YrkyNkN3UvC2WyFeK50gXrLyC HOEJdhBqWDU/OY0AUvR1FdhPsFs9qQpqwb/cKfXYCZ9M2cmpf22rkAv0tWJCS0hAOMNg pjdxAMNAenG6asNVyBzBvW5dCTBKf1CMI/LkmMrG0Nva9xgRgfd35095pbEs5E4fQqU0 KHog== X-Gm-Message-State: AKaTC000gMTC/aM/MUUBtCLUos/tjaP4O1S5RNKfEAG3EpjLUJ3Ig6ttzBMco9wmlL0kQQ== X-Received: by 10.28.63.16 with SMTP id m16mr296654wma.113.1479851692676; Tue, 22 Nov 2016 13:54:52 -0800 (PST) Received: from c720p.fritz.box (188-22-25-65.adsl.highway.telekom.at. [188.22.25.65]) by smtp.gmail.com with ESMTPSA id kq7sm32874104wjb.30.2016.11.22.13.54.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Nov 2016 13:54:51 -0800 (PST) From: Christian Gmeiner To: dri-devel@lists.freedesktop.org Subject: [PATCH libdrm] etnaviv: add etna_pipe_wait2(..) Date: Tue, 22 Nov 2016 22:54:32 +0100 Message-Id: <1479851672-7019-1-git-send-email-christian.gmeiner@gmail.com> X-Mailer: git-send-email 2.7.4 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP We need to pass through a timeout parameter to implement pipe->fence_finish() properly. The new fxn accepts a timeout in nanoseconds. Signed-off-by: Christian Gmeiner --- etnaviv/etnaviv-symbol-check | 1 + etnaviv/etnaviv_drmif.h | 1 + etnaviv/etnaviv_pipe.c | 24 ++++++++++++++++++++++++ etnaviv/etnaviv_priv.h | 9 +++++++++ 4 files changed, 35 insertions(+) diff --git a/etnaviv/etnaviv-symbol-check b/etnaviv/etnaviv-symbol-check index 72f2bc5..b16f629 100755 --- a/etnaviv/etnaviv-symbol-check +++ b/etnaviv/etnaviv-symbol-check @@ -21,6 +21,7 @@ etna_gpu_get_param etna_pipe_new etna_pipe_del etna_pipe_wait +etna_pipe_wait2 etna_bo_new etna_bo_from_handle etna_bo_from_name diff --git a/etnaviv/etnaviv_drmif.h b/etnaviv/etnaviv_drmif.h index fe9d5db..1bec762 100644 --- a/etnaviv/etnaviv_drmif.h +++ b/etnaviv/etnaviv_drmif.h @@ -104,6 +104,7 @@ int etna_gpu_get_param(struct etna_gpu *gpu, enum etna_param_id param, struct etna_pipe *etna_pipe_new(struct etna_gpu *gpu, enum etna_pipe_id id); void etna_pipe_del(struct etna_pipe *pipe); int etna_pipe_wait(struct etna_pipe *pipe, uint32_t timestamp, uint32_t ms); +int etna_pipe_wait2(struct etna_pipe *pipe, uint32_t timestamp, uint64_t ns); /* buffer-object functions: diff --git a/etnaviv/etnaviv_pipe.c b/etnaviv/etnaviv_pipe.c index 402b71d..9e624c5 100644 --- a/etnaviv/etnaviv_pipe.c +++ b/etnaviv/etnaviv_pipe.c @@ -54,6 +54,30 @@ int etna_pipe_wait(struct etna_pipe *pipe, uint32_t timestamp, uint32_t ms) return 0; } +int etna_pipe_wait2(struct etna_pipe *pipe, uint32_t timestamp, uint64_t ns) +{ + struct etna_device *dev = pipe->gpu->dev; + int ret; + + struct drm_etnaviv_wait_fence req = { + .pipe = pipe->gpu->core, + .fence = timestamp, + }; + + if (ns == 0) + req.flags |= ETNA_WAIT_NONBLOCK; + + get_abs_timeout_ns(&req.timeout, ns); + + ret = drmCommandWrite(dev->fd, DRM_ETNAVIV_WAIT_FENCE, &req, sizeof(req)); + if (ret) { + ERROR_MSG("wait-fence failed! %d (%s)", ret, strerror(errno)); + return ret; + } + + return 0; +} + void etna_pipe_del(struct etna_pipe *pipe) { free(pipe); diff --git a/etnaviv/etnaviv_priv.h b/etnaviv/etnaviv_priv.h index eb62ed3..30cc1bd 100644 --- a/etnaviv/etnaviv_priv.h +++ b/etnaviv/etnaviv_priv.h @@ -198,4 +198,13 @@ static inline void get_abs_timeout(struct drm_etnaviv_timespec *tv, uint32_t ms) tv->tv_nsec = t.tv_nsec + ((ms - (s * 1000)) * 1000000); } +static inline void get_abs_timeout_ns(struct drm_etnaviv_timespec *tv, uint64_t ns) +{ + struct timespec t; + uint32_t s = ns / 1000000000; + clock_gettime(CLOCK_MONOTONIC, &t); + tv->tv_sec = t.tv_sec + s; + tv->tv_nsec = t.tv_nsec + ns - (s * 1000000000); +} + #endif /* ETNAVIV_PRIV_H_ */