From patchwork Wed Nov 23 07:26:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Gmeiner X-Patchwork-Id: 9442667 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 5C26460778 for ; Wed, 23 Nov 2016 07:26:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4DEDA1FE95 for ; Wed, 23 Nov 2016 07:26:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4299A203C0; Wed, 23 Nov 2016 07:26:43 +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 24FED1FE95 for ; Wed, 23 Nov 2016 07:26:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 44CF689F55; Wed, 23 Nov 2016 07:26:36 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5C22889EA9 for ; Wed, 23 Nov 2016 07:26:29 +0000 (UTC) Received: by mail-wm0-x242.google.com with SMTP id m203so850416wma.3 for ; Tue, 22 Nov 2016 23:26:29 -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:in-reply-to:references; bh=u0ZvOchUF/hu78JKyo9k7pIAq7rstPsCD0aFPRrrN9s=; b=tutCzU1BKThQoxS6Bq2O3WNfbb+PobF5jA+m6zJ4D8qI/yhM5uss2eA599jFtGDlYP mSu8BDF9bV9fvguHgq0H4lv4bnRIOOBjLzN45pViaoaDuw1Jfi7u8tACH6KnJYOK5xwc ctRyroDnu4w0tZiyQ1twfkNDvSN6b7GpDQTIqz2v6Xnis9QCxgNCZ7FC6KasnZ7vKC4P Z2ZNwd6/y6/eAx+yijHjEaHHLtsA4Ep7m08Y7s3abhaNMUt3SPIanAV/3W7/9hDcXXEd LRze+B1kTVSNIF3fR6+01ZV0eFmdK3tBJo7+ILAfcqouyYCXZp42R627KDqteBUnmSZD swFw== 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:in-reply-to :references; bh=u0ZvOchUF/hu78JKyo9k7pIAq7rstPsCD0aFPRrrN9s=; b=Nhb9pFw1588dBRAwF7C3kDFgu0WJOA+5jjy9fEOwqyO5gpexRroISAcigVZhXlMKaR 3LB5T+xw/ztSmIrkr9mRPzS4nr17N8/0qNTNiD8N6hM1K4xV4WPfgttSW8gfBUilHaBR zCWC02pyqG1BT49Pf4P25efJPGzMSXFWwd/1GCj7AZcAWHBGxH1k7sqU5b9Xii/56PqG WCAPzL3mAZRKE7WMzjCmWtS2zzF2A14jvlXUVR95AoQg6ulEy3ZzNdqzvVvUZv8lXTra COEpchfA0+Ih0B/ZKEyp0e+RVefzuLacx7nY79UNJsAfF+XeMucbO+YRaB/01m0jvXUv 1Rlg== X-Gm-Message-State: AKaTC00egj9DtC7zEsighg2VJZ/rRMQdvi+rIphNV5Wl1LpStbYluayj79pVWlQDLS/yxA== X-Received: by 10.28.88.18 with SMTP id m18mr1812443wmb.26.1479885987652; Tue, 22 Nov 2016 23:26:27 -0800 (PST) Received: from c720p.fritz.box (188-22-16-174.adsl.highway.telekom.at. [188.22.16.174]) by smtp.gmail.com with ESMTPSA id f134sm1162574wmf.19.2016.11.22.23.26.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Nov 2016 23:26:26 -0800 (PST) From: Christian Gmeiner To: dri-devel@lists.freedesktop.org Subject: [PATCH libdrm v3 1/4] etnaviv: add etna_pipe_wait_ns(..) Date: Wed, 23 Nov 2016 08:26:18 +0100 Message-Id: <1479885981-20186-2-git-send-email-christian.gmeiner@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1479885981-20186-1-git-send-email-christian.gmeiner@gmail.com> References: <1479885981-20186-1-git-send-email-christian.gmeiner@gmail.com> 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..22afd16 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_wait_ns 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..8119baa 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_wait_ns(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..f2e417f 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_wait_ns(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_ */