From patchwork Fri Dec 15 07:43:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Gmeiner X-Patchwork-Id: 10114111 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 EB25160224 for ; Fri, 15 Dec 2017 07:43:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DDB7529F0B for ; Fri, 15 Dec 2017 07:43:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D2D8129F0D; Fri, 15 Dec 2017 07:43:59 +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 809BE29F0B for ; Fri, 15 Dec 2017 07:43:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 523B26E79B; Fri, 15 Dec 2017 07:43:54 +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 660A46E796; Fri, 15 Dec 2017 07:43:52 +0000 (UTC) Received: by mail-wm0-x244.google.com with SMTP id f140so15695986wmd.2; Thu, 14 Dec 2017 23:43:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=O6POolyQuYXmnIHeqm0xlPKDPkEQMIjg8iFV4nfmzXk=; b=NKS9y4ZdQ/meJLBb6ijfx5dHLMDlcRijt2ynHHvXCmT6TkfrvuRlYREYt6/tZW/jmB cDgGfoExwDrkOzoNdLPpc7I0ZtBYqB615tGR/eLVTYQzhYT5bzUU9dKYANzP3DuFpxt5 DvQjImdmrQXgm7aZKsNbeB/IdMMw1SDAhN28Yxb1o2QKlUMivAUXSz50pu8vxe4/AThV 71fVEwrk5nMndnJOSy8SKibINvrXwFyZ1DYA+03Iuh4yTYW10ZE90BJMoOOtVOmtjow/ TxfIZk8a7kKNd6G6z0CWEDSQG4MW2j/lKA3Z4o53kP9OC/BtUbOuXDdYPcNHkVcJGsi3 oFvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=O6POolyQuYXmnIHeqm0xlPKDPkEQMIjg8iFV4nfmzXk=; b=GCDER9tJ+NyIwMVEzwedvKZnR/oYpPtGqENSE9kGl+DokRuLUgOg5tDFkwD7SnljoI b9kaZKrxfzCrie5sRTqqNrCD9GQlzRLQh1fbskWEiwYbUWlUMqfgdu8rvxWaykpsB7Fz ucZKYNpiZdre/1SJIAqOC85QXasi8trO233NzkBjgx5bpM8omvbXb/lGZkIZG22Tgyvc AIuhjc6Eq4OhUvf+0ka6pp+RSRTcHgsn8iZU1ArKkR39dqSpQOFFoqplD9eqqbVG2Ace BtrXKEO3bJipCxNLfVpYNpr23V+dsI+kgJI7w3/eDrWmhRc1ihHUXA3J5gAi4F4girg7 gBsA== X-Gm-Message-State: AKGB3mLBJHfepcvpviiK6m3T2Wr63RdLjxm2drcDclfHuYjL9Rxitvay c8xEN3LJR7C2CbrFj7LGJ8qvIwq2 X-Google-Smtp-Source: ACJfBotP671IbewXc+hvE1XBL2b+3gH9aqBOIzulZ9KOxvBv/UrSPzzztI6XPFtQOucsvW0WB7361w== X-Received: by 10.28.5.198 with SMTP id 189mr4284351wmf.29.1513323830659; Thu, 14 Dec 2017 23:43:50 -0800 (PST) Received: from localhost.localdomain (213-147-163-36.nat.highway.bob.at. [213.147.163.36]) by smtp.gmail.com with ESMTPSA id r64sm1276760wrb.62.2017.12.14.23.43.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Dec 2017 23:43:49 -0800 (PST) From: Christian Gmeiner To: dri-devel@lists.freedesktop.org Subject: [PATCH v3 3/3] etnaviv: support performance monitor requests Date: Fri, 15 Dec 2017 08:43:40 +0100 Message-Id: <20171215074340.4501-4-christian.gmeiner@gmail.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171215074340.4501-1-christian.gmeiner@gmail.com> References: <20171215074340.4501-1-christian.gmeiner@gmail.com> Cc: etnaviv@lists.freedesktop.org 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 Add etna_cmd_stream_perf(..) to submit perform requests. Userspace can submit pmrs via submit ioctl to sample perfmon signals. v3: - mark perfmon bos as RW Signed-off-by: Christian Gmeiner Reviewed-by: Lucas Stach --- etnaviv/etnaviv-symbol-check | 1 + etnaviv/etnaviv_cmd_stream.c | 20 ++++++++++++++++++++ etnaviv/etnaviv_drmif.h | 12 ++++++++++++ etnaviv/etnaviv_priv.h | 4 ++++ 4 files changed, 37 insertions(+) diff --git a/etnaviv/etnaviv-symbol-check b/etnaviv/etnaviv-symbol-check index bd95b459..bc509615 100755 --- a/etnaviv/etnaviv-symbol-check +++ b/etnaviv/etnaviv-symbol-check @@ -41,6 +41,7 @@ etna_cmd_stream_timestamp etna_cmd_stream_flush etna_cmd_stream_flush2 etna_cmd_stream_finish +etna_cmd_stream_perf etna_cmd_stream_reloc etna_perfmon_create etna_perfmon_del diff --git a/etnaviv/etnaviv_cmd_stream.c b/etnaviv/etnaviv_cmd_stream.c index 8d0e8135..e8c58cd5 100644 --- a/etnaviv/etnaviv_cmd_stream.c +++ b/etnaviv/etnaviv_cmd_stream.c @@ -105,6 +105,7 @@ void etna_cmd_stream_del(struct etna_cmd_stream *stream) free(stream->buffer); free(priv->submit.relocs); + free(priv->submit.pmrs); free(priv); } @@ -115,6 +116,7 @@ static void reset_buffer(struct etna_cmd_stream *stream) stream->offset = 0; priv->submit.nr_bos = 0; priv->submit.nr_relocs = 0; + priv->submit.nr_pmrs = 0; priv->nr_bos = 0; if (priv->reset_notify) @@ -191,6 +193,8 @@ static void flush(struct etna_cmd_stream *stream, int in_fence_fd, .nr_bos = priv->submit.nr_bos, .relocs = VOID2U64(priv->submit.relocs), .nr_relocs = priv->submit.nr_relocs, + .pmrs = VOID2U64(priv->submit.pmrs), + .nr_pmrs = priv->submit.nr_pmrs, .stream = VOID2U64(stream->buffer), .stream_size = stream->offset * 4, /* in bytes */ }; @@ -260,3 +264,19 @@ void etna_cmd_stream_reloc(struct etna_cmd_stream *stream, const struct etna_rel etna_cmd_stream_emit(stream, addr); } + +void etna_cmd_stream_perf(struct etna_cmd_stream *stream, const struct etna_perf *p) +{ + struct etna_cmd_stream_priv *priv = etna_cmd_stream_priv(stream); + struct drm_etnaviv_gem_submit_pmr *pmr; + uint32_t idx = APPEND(&priv->submit, pmrs); + + pmr = &priv->submit.pmrs[idx]; + + pmr->flags = p->flags; + pmr->sequence = p->sequence; + pmr->read_offset = p->offset; + pmr->read_idx = bo2idx(stream, p->bo, ETNA_SUBMIT_BO_READ | ETNA_SUBMIT_BO_WRITE); + pmr->domain = p->signal->domain->id; + pmr->signal = p->signal->signal; +} diff --git a/etnaviv/etnaviv_drmif.h b/etnaviv/etnaviv_drmif.h index 949b9b62..5a6bef8d 100644 --- a/etnaviv/etnaviv_drmif.h +++ b/etnaviv/etnaviv_drmif.h @@ -201,4 +201,16 @@ void etna_perfmon_del(struct etna_perfmon *perfmon); struct etna_perfmon_domain *etna_perfmon_get_dom_by_name(struct etna_perfmon *pm, const char *name); struct etna_perfmon_signal *etna_perfmon_get_sig_by_name(struct etna_perfmon_domain *dom, const char *name); +struct etna_perf { +#define ETNA_PM_PROCESS_PRE 0x0001 +#define ETNA_PM_PROCESS_POST 0x0002 + uint32_t flags; + uint32_t sequence; + struct etna_perfmon_signal *signal; + struct etna_bo *bo; + uint32_t offset; +}; + +void etna_cmd_stream_perf(struct etna_cmd_stream *stream, const struct etna_perf *p); + #endif /* ETNAVIV_DRMIF_H_ */ diff --git a/etnaviv/etnaviv_priv.h b/etnaviv/etnaviv_priv.h index 7b289b61..e45d364c 100644 --- a/etnaviv/etnaviv_priv.h +++ b/etnaviv/etnaviv_priv.h @@ -140,6 +140,10 @@ struct etna_cmd_stream_priv { /* reloc's table: */ struct drm_etnaviv_gem_submit_reloc *relocs; uint32_t nr_relocs, max_relocs; + + /* perf's table: */ + struct drm_etnaviv_gem_submit_pmr *pmrs; + uint32_t nr_pmrs, max_pmrs; } submit; /* should have matching entries in submit.bos: */