From patchwork Fri Dec 9 11:21:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Gmeiner X-Patchwork-Id: 9467949 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 1CECE60586 for ; Fri, 9 Dec 2016 11:22:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0FE90285DC for ; Fri, 9 Dec 2016 11:22:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 04E2D285F7; Fri, 9 Dec 2016 11:22:00 +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 94FF7285DC for ; Fri, 9 Dec 2016 11:21:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A4CF16E97F; Fri, 9 Dec 2016 11:21:53 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wj0-x243.google.com (mail-wj0-x243.google.com [IPv6:2a00:1450:400c:c01::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 844D66E979 for ; Fri, 9 Dec 2016 11:21:51 +0000 (UTC) Received: by mail-wj0-x243.google.com with SMTP id xy5so1981739wjc.1 for ; Fri, 09 Dec 2016 03:21:51 -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=ifhRkAbQAShMnSbaPChxRBmD/tDkj6pCkeAIwZ/OMBM=; b=ATgfWAuJEeind6w7mjR33ymGAtstztRFA1Wbu06yatO5/wCRLnzfNJpbUft0Kz2eum /6/lKattZXtlWAl8/hJjP/iUnx1FtwT0XrSDyYkxT3RWiOhv7Qme7eLhedzOq8BjZ4Ip gquHv5m33SDNW18O0+6XRS5E97GpwLXuVJoo6gaAd+gPXzzlsc3S3MxkKDW/0QqWZNab EzIglrungXXFin4jLEzjuciol0DqzkW4QDiIq5u0WFjhepbZ41LOa5yJum0YsD8sb813 Kdb9u3Riszm8BXzbDr8HIgKVfaGNxTUavsf//IQoXirsgHhKRpIZ28IVTOWouJqKJZ47 1elQ== 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=ifhRkAbQAShMnSbaPChxRBmD/tDkj6pCkeAIwZ/OMBM=; b=Z3i3VmiU2OTnd7BC22VCFfBkRUtypLJ0m8tJVR+MyCS/5dU/83unOh1BDhRtSZl9Bw oaladqq8a9ewSPPankDCAuObdAfxOtcSH+B9ED0qiIe9Fg1DLEh+ZGjH9+UviLRzIsu4 xZDdiyUB48BTqRJXXhII0yDDBNVNCa0NIx23DlVdwSEPZP6RSyRKSWMOafFrohw/QqxZ 0/GYSxXk1y95LF4wXfSVCwfTtF/cZ9knpnAST3Aq9DrCYph2eKmNhmsdpw1dvP90rcUZ J6VoGSRyCEgS+P3j6UJyLjy+UV8zPh+G9SIunf6fH1zlxc8gJ0hJ+QnC1sIFyiSi4wRm UPvw== X-Gm-Message-State: AKaTC00EO6xa3a/Uw4IDuajswT7HNANiFgjfvh/A6g6PMWQ3ABWLNgVvJ6QUorSZqMHG0A== X-Received: by 10.194.174.229 with SMTP id bv5mr68716926wjc.21.1481282509807; Fri, 09 Dec 2016 03:21:49 -0800 (PST) Received: from linux.fritz.box.fritz.box (178-190-139-123.adsl.highway.telekom.at. [178.190.139.123]) by smtp.gmail.com with ESMTPSA id v2sm41824518wja.41.2016.12.09.03.21.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Dec 2016 03:21:48 -0800 (PST) From: Christian Gmeiner To: dri-devel@lists.freedesktop.org Subject: [PATCH 04/10] drm/etnaviv: extend etnaviv_gpu_cmdbuf_new(..) with nr_readbacks Date: Fri, 9 Dec 2016 12:21:25 +0100 Message-Id: <20161209112131.3924-5-christian.gmeiner@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20161209112131.3924-1-christian.gmeiner@gmail.com> References: <20161209112131.3924-1-christian.gmeiner@gmail.com> Cc: linux+etnaviv@armlinux.org.uk, cphealy@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 This commits extends etnaviv_gpu_cmdbuf_new(..) to define the size of struct etnaviv_readback gets used. Signed-off-by: Christian Gmeiner --- drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 2 +- drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 14 ++++++++++++-- drivers/gpu/drm/etnaviv/etnaviv_gpu.h | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c index afdd55d..ede5d71 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c @@ -333,7 +333,7 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data, relocs = drm_malloc_ab(args->nr_relocs, sizeof(*relocs)); stream = drm_malloc_ab(1, args->stream_size); cmdbuf = etnaviv_gpu_cmdbuf_new(gpu, ALIGN(args->stream_size, 8) + 8, - args->nr_bos); + args->nr_bos, 0); if (!bos || !relocs || !stream || !cmdbuf) { ret = -ENOMEM; goto err_submit_cmds; diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c index 09aa67a..2668723 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c @@ -655,7 +655,7 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu) } /* Create buffer: */ - gpu->buffer = etnaviv_gpu_cmdbuf_new(gpu, PAGE_SIZE, 0); + gpu->buffer = etnaviv_gpu_cmdbuf_new(gpu, PAGE_SIZE, 0, 0); if (!gpu->buffer) { ret = -ENOMEM; dev_err(gpu->dev, "could not create command buffer\n"); @@ -1114,9 +1114,10 @@ static void event_free(struct etnaviv_gpu *gpu, unsigned int event) */ struct etnaviv_cmdbuf *etnaviv_gpu_cmdbuf_new(struct etnaviv_gpu *gpu, u32 size, - size_t nr_bos) + size_t nr_bos, size_t nr_readbacks) { struct etnaviv_cmdbuf *cmdbuf; + struct etnaviv_readback *readbacks; size_t sz = size_vstruct(nr_bos, sizeof(cmdbuf->bo_map[0]), sizeof(*cmdbuf)); @@ -1124,6 +1125,11 @@ struct etnaviv_cmdbuf *etnaviv_gpu_cmdbuf_new(struct etnaviv_gpu *gpu, u32 size, if (!cmdbuf) goto fail; + sz = sizeof(*readbacks) * nr_readbacks; + readbacks = kzalloc(sz, GFP_KERNEL); + if (!readbacks) + goto fail; + if (gpu->mmu->version == ETNAVIV_IOMMU_V2) size = ALIGN(size, SZ_4K); @@ -1134,11 +1140,14 @@ struct etnaviv_cmdbuf *etnaviv_gpu_cmdbuf_new(struct etnaviv_gpu *gpu, u32 size, cmdbuf->gpu = gpu; cmdbuf->size = size; + cmdbuf->readbacks = readbacks; + cmdbuf->nr_readbacks = nr_readbacks; return cmdbuf; fail: kfree(cmdbuf); + kfree(readbacks); return NULL; } @@ -1148,6 +1157,7 @@ void etnaviv_gpu_cmdbuf_free(struct etnaviv_cmdbuf *cmdbuf) etnaviv_iommu_put_cmdbuf_va(cmdbuf->gpu, cmdbuf); dma_free_wc(cmdbuf->gpu->dev, cmdbuf->size, cmdbuf->vaddr, cmdbuf->paddr); + kfree(cmdbuf->readbacks); kfree(cmdbuf); } diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.h b/drivers/gpu/drm/etnaviv/etnaviv_gpu.h index 6527ceb..61b36af 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.h +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.h @@ -221,7 +221,7 @@ int etnaviv_gpu_wait_obj_inactive(struct etnaviv_gpu *gpu, int etnaviv_gpu_submit(struct etnaviv_gpu *gpu, struct etnaviv_gem_submit *submit, struct etnaviv_cmdbuf *cmdbuf); struct etnaviv_cmdbuf *etnaviv_gpu_cmdbuf_new(struct etnaviv_gpu *gpu, - u32 size, size_t nr_bos); + u32 size, size_t nr_bos, size_t nr_readbacks); void etnaviv_gpu_cmdbuf_free(struct etnaviv_cmdbuf *cmdbuf); int etnaviv_gpu_pm_get_sync(struct etnaviv_gpu *gpu); void etnaviv_gpu_pm_put(struct etnaviv_gpu *gpu);