From patchwork Tue Nov 22 22:20: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: 9442273 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 28FD360235 for ; Tue, 22 Nov 2016 22:20:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D9B51FF0B for ; Tue, 22 Nov 2016 22:20:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1274120747; Tue, 22 Nov 2016 22:20:55 +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 C16CD1FF0B for ; Tue, 22 Nov 2016 22:20:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D7CA86E103; Tue, 22 Nov 2016 22:20:50 +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 87C0F6E050 for ; Tue, 22 Nov 2016 22:20:43 +0000 (UTC) Received: by mail-wm0-x242.google.com with SMTP id g23so7157215wme.1 for ; Tue, 22 Nov 2016 14:20:43 -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=YhydX33EVAgSb+2IPnRwRBQNoGXLkXr1jpN4vGusaUA/2XlF6JjVhr/AAIU9ZdBt9y L2tsTd+p/EDvYOTitTYSH9KUcXogvAFd+SuLLJ0XL5znaNVRwtj5KWP8R6boGAstur2d jeA08QJP1mmlk0gJ9jxs0BDkmdamLv3NceTRdZXjhq9wUmdtDJiqC9pDOUg7G9E220qU 4phDztK3C5lbeRFyRRPJaeexlwkQs3QT6VfV2d51eVulJ67dviZlu5M2FLqZo6DNwAdB 4stVuM2rNEngjby9mWrZqZf0bRLdXB5BRSX3Saca2sIjp4ZKiaMpzcmDzNQeYl+Gco8v Przg== 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=Kom3/7AOw+J7RoVPnsidrzJs3puoLKZkMckJ7GK/NusKB1xBLdSRrYDh+QBfOi+GIX 2WOrfb7IJxlpx2aOjfI284HUDECUlubsNKMC7+aLM/u2DFAvPwxZpb2+HowK3AAmZnvz 9uixV9zGTW6J0+Z0pCQum/ft7fZlP1rJoR3gCcXQRHszwjpsfkOAYGel1WGQdTUfEMTv xuX0c8ez6PYlBPMxuACA9j/H5ffzp0/qLTlu4RaQiI3HYCN76joPK3lYMeDfNsAYkOSS fbIru5giJ3ZbPTFc4YJoxEkhhxYmxLW01DbNIw7A+VUtvAJrwAWOLHjAaqTnyUEcq3qw BU5w== X-Gm-Message-State: AKaTC00fgCQ2PGOw2cMuOCPgKPr1d3mLWiht7xKthZha5ej1tJoiAGiWps1UcAJ6rRYm+A== X-Received: by 10.28.222.6 with SMTP id v6mr388273wmg.107.1479853241765; Tue, 22 Nov 2016 14:20:41 -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 i2sm33023073wjx.44.2016.11.22.14.20.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Nov 2016 14:20:40 -0800 (PST) From: Christian Gmeiner To: dri-devel@lists.freedesktop.org Subject: [PATCH libdrm v2 1/3] etnaviv: add etna_pipe_wait_ns(..) Date: Tue, 22 Nov 2016 23:20:18 +0100 Message-Id: <1479853220-9479-2-git-send-email-christian.gmeiner@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1479853220-9479-1-git-send-email-christian.gmeiner@gmail.com> References: <1479853220-9479-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_ */