From patchwork Tue Dec 12 21:27:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Gmeiner X-Patchwork-Id: 10108277 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 DDFAF6032B for ; Tue, 12 Dec 2017 21:28:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CFDD02940B for ; Tue, 12 Dec 2017 21:28:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C4A7429427; Tue, 12 Dec 2017 21:28:08 +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 754002940B for ; Tue, 12 Dec 2017 21:28:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9ABA46E3C6; Tue, 12 Dec 2017 21:28:07 +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 428696E269; Tue, 12 Dec 2017 21:28:04 +0000 (UTC) Received: by mail-wm0-x242.google.com with SMTP id t8so1308767wmc.3; Tue, 12 Dec 2017 13:28:04 -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=/+cwaNofs7HQQPOytplQyZ3sipElApEB1f0Hb8xtsW0=; b=IWQ0fRNFF2VudW7aD6AL7sFOLwADVgJ2copFo9IrbAZ5cX2oy7cRHWuAppqdHKEUKw LvRRzmP3GLV+EMHGkDedCj9l0i590bHb3Gq4BCMagcwI19+jUWMWjqNv47peeY/azHN9 Igp/xfBa6dBasRbZPmUh2BoU9L4nSNgJ8CP2P41tNnbnT5R8YAO+pac0ITTeBgt9Cg5l ij1JCH4udS9Q20oGb0KKDf+ey7MKJYyaNhHdxh9O7fv/rBAI/ez8F0kHE2J5seg3BuvN N9CSsbbs9CNHxpvoYSwKoA0wo2QP58HWtP5Z3fZpiwwY+ikaRFsqDhSxyKIDg3HmOR6W 86gA== 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=/+cwaNofs7HQQPOytplQyZ3sipElApEB1f0Hb8xtsW0=; b=l+JHcBaknSDmJQTRwpzFZe3WusoxmeNV6upzaoJopw5BL51wOl+HwX1M637C0V7Hfd QEjwIIqviIVtzQqDKo7t/mJXV1guiEfuPMcy1uA2o04xlz5ZGo7IdXbHi/oWKAMCK6Lx FI/vNh/L5MGutqStY3HEFvPXqp/mvtGWmVr7JZslm40DsNh1clt2XH9CTp8/RqVHe/sK EW3WzvrdnU+LrJwq8Wk9IYalL/pzFevw6Na/titfmsPCpxEwCexkTD0JOfnX7sWf0ZJB ybviWkgsmK7HOKlTZdUDNJbtZglm61pP+5jqYus9KSx0Z/3kOGXQfPPdHgoJ34xlM1ul CwRw== X-Gm-Message-State: AKGB3mJtqDjHALVoQse8shwnXkenlEx6lSlh+6DA1zfVHOVomLx2b3nz EA8B3EIo/YBPq/7ZDyBtX8H94A== X-Google-Smtp-Source: ACJfBotqGL0PfSP4NxG/9pXweUk5AvL6QSb8xbnAd7/JHJ0wx9qv/9EF7UPgEEx67/nxgp7x7SPdXA== X-Received: by 10.28.64.68 with SMTP id n65mr168595wma.0.1513114082626; Tue, 12 Dec 2017 13:28:02 -0800 (PST) Received: from cp720.fritz.box (88-117-25-68.adsl.highway.telekom.at. [88.117.25.68]) by smtp.gmail.com with ESMTPSA id v16sm106429wrb.11.2017.12.12.13.28.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Dec 2017 13:28:01 -0800 (PST) From: Christian Gmeiner To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 3/3] etnaviv: support performance monitor requests Date: Tue, 12 Dec 2017 22:27:50 +0100 Message-Id: <20171212212750.5372-4-christian.gmeiner@gmail.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171212212750.5372-1-christian.gmeiner@gmail.com> References: <20171212212750.5372-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. Signed-off-by: Christian Gmeiner --- 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..d6f26a88 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); + 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: */