From patchwork Tue Nov 22 22:20:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Gmeiner X-Patchwork-Id: 9442271 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 D01A260235 for ; Tue, 22 Nov 2016 22:20:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C50DC1FF0B for ; Tue, 22 Nov 2016 22:20:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BA0D120747; Tue, 22 Nov 2016 22:20:51 +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 83EA51FF0B for ; Tue, 22 Nov 2016 22:20:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0C8516E050; 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-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id DF4F56E050 for ; Tue, 22 Nov 2016 22:20:44 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id m203so7117476wma.3 for ; Tue, 22 Nov 2016 14:20:44 -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=+h11OHay5SRdR7+c0SV5sRNcM3gcsW5aaI7YlvsW3LM=; b=co3kYdSlM8vkEr+dVWRsnHRYAmv0dmIGCK0PoefkvWkY+Utc2PLv6RQI2hc7D/5OvF TfnvWgQGu7eAt7JbLso7YXiHix/z/tCPkvsL0GA58pihINdpqfjsxj2ZLHS6x54yCx87 UcOXgYBFQC9cG23kdEnTgElBcgZx458eCnLUUfna890faJIg6WJ/IZVcao9FZudsamhG Trkk6SVqj+WpGYy/VpndGQUQxeq4cOhWIjClKaxoJz+zncziuiFJLNcRJkQaqmwBXWrW MnR79xpRx/YLVBnPY8K+qChraVXpF9eFVepqiZrxHj/gytWe9Y1B8AIb1yfqhOTY2R9K /Saw== 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=+h11OHay5SRdR7+c0SV5sRNcM3gcsW5aaI7YlvsW3LM=; b=BSTFA0gPcVrUsgX1Ku9n/ORa/6mAano2SGYU1eAxCFPKamcrCp7yPpZxIGgAnsQhXz Y1OoU2P347WnTv+b2+P2sjfRq02c7gPoCLoIsfYTrYi84IWhZDMUR6c0bgFQTTLNFLdN nJbSmpODSH0541brltEpU6VKSS+hvh+4ahd6Xi8KDkgKcDVsqL1GqsQak0m69Xyfl+qQ C1e4tSRju9fUCteuNEyGmTjC4ZlFLfoiUh2Bu6aEfe5a73LLS2yYlkHJqDKjPQUCTDex BGTKSmMRVI5hfAaPjRxfVw3YTaMStVx9JdA6zX2+mERNZsFnzc5LkkRhBjUDzt0n1nFi N3YA== X-Gm-Message-State: AKaTC03NAZ1yr8IQQ2csmEhxx+fGau/3dpIy0xmSFRxe7hDdnGMazPsZvSr2s2rTdjnNpQ== X-Received: by 10.28.145.66 with SMTP id t63mr350066wmd.99.1479853243317; Tue, 22 Nov 2016 14:20:43 -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.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Nov 2016 14:20:42 -0800 (PST) From: Christian Gmeiner To: dri-devel@lists.freedesktop.org Subject: [PATCH libdrm v2 2/3] etnaviv: simplify etna_pipe_wait(..) Date: Tue, 22 Nov 2016 23:20:19 +0100 Message-Id: <1479853220-9479-3-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 can make use of etna_pipe_wait_ns(..). Signed-off-by: Christian Gmeiner --- etnaviv/etnaviv_pipe.c | 21 +-------------------- etnaviv/etnaviv_priv.h | 9 --------- 2 files changed, 1 insertion(+), 29 deletions(-) diff --git a/etnaviv/etnaviv_pipe.c b/etnaviv/etnaviv_pipe.c index f2e417f..6951362 100644 --- a/etnaviv/etnaviv_pipe.c +++ b/etnaviv/etnaviv_pipe.c @@ -32,26 +32,7 @@ int etna_pipe_wait(struct etna_pipe *pipe, uint32_t timestamp, uint32_t ms) { - struct etna_device *dev = pipe->gpu->dev; - int ret; - - struct drm_etnaviv_wait_fence req = { - .pipe = pipe->gpu->core, - .fence = timestamp, - }; - - if (ms == 0) - req.flags |= ETNA_WAIT_NONBLOCK; - - get_abs_timeout(&req.timeout, ms); - - 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; + return etna_pipe_wait_ns(pipe, timestamp, ms * 1000000); } int etna_pipe_wait_ns(struct etna_pipe *pipe, uint32_t timestamp, uint64_t ns) diff --git a/etnaviv/etnaviv_priv.h b/etnaviv/etnaviv_priv.h index 30cc1bd..667bf23 100644 --- a/etnaviv/etnaviv_priv.h +++ b/etnaviv/etnaviv_priv.h @@ -189,15 +189,6 @@ struct etna_cmd_stream_priv { #define VOID2U64(x) ((uint64_t)(unsigned long)(x)) -static inline void get_abs_timeout(struct drm_etnaviv_timespec *tv, uint32_t ms) -{ - struct timespec t; - uint32_t s = ms / 1000; - clock_gettime(CLOCK_MONOTONIC, &t); - tv->tv_sec = t.tv_sec + s; - 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;