From patchwork Fri Nov 30 15:00:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 10706481 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4927B13BF for ; Fri, 30 Nov 2018 15:01:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B3DB301AA for ; Fri, 30 Nov 2018 15:01:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2F691301D3; Fri, 30 Nov 2018 15:01:06 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 D210F301AF for ; Fri, 30 Nov 2018 15:01:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9317F6E615; Fri, 30 Nov 2018 15:01:04 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qt1-x844.google.com (mail-qt1-x844.google.com [IPv6:2607:f8b0:4864:20::844]) by gabe.freedesktop.org (Postfix) with ESMTPS id A70DA6E55D; Fri, 30 Nov 2018 15:01:02 +0000 (UTC) Received: by mail-qt1-x844.google.com with SMTP id n21so6179570qtl.6; Fri, 30 Nov 2018 07:01:02 -0800 (PST) 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:mime-version:content-transfer-encoding; bh=FIYmFGHlDtXLaqHVE1ZXmEz+PUDSoNeUl/RQokZJ9SA=; b=fOubNczYDdncvj/FZZKCjNuy4qo0pAmEB558eyjQjp3QWQ1CPyYO0YDmdwkXRph0QF Wu/YaeoUi7ke5a98e85+gD+Cnve37am9YZ13DINYVD2x3Rhy1DXGrbVd+1Y03rhhEmsY Nlcao8EolUzccHMMIE9zMmSs6itzB4tf8yQkuRPi+P1M2449X4GpJE+ZA4MptAI3RT18 Ql18f6MfkM8n/hWZMvRiOQbe2YQAIww39r422HamvP/SLoSmSS1LycnhnbeU8xxx1VRz iJXANVL2C1iEcEtRhIdproTB/fU0MWXNR8j9WBkrp9b7/aEUy4pK1Hs5sY73z9U03RaT DHcA== X-Gm-Message-State: AA+aEWbeRAf5q7J1t+zwQcPrLd1XBqeqRBHyUscImmqoOceyAFOh+0Vw lLHaQG6sEOIQeUs7XgrkD4wfjdl+ X-Google-Smtp-Source: AFSGD/WX6xAvGVT8Jgdyw9E/DU9IGPs9fF24IOFE8NkNFreFxGl1ly9vxBxLHC6Y9d1ZHPxNoFkdUA== X-Received: by 2002:ac8:3810:: with SMTP id q16mr5433033qtb.91.1543590061445; Fri, 30 Nov 2018 07:01:01 -0800 (PST) Received: from localhost ([144.121.20.162]) by smtp.gmail.com with ESMTPSA id l15sm2377586qtr.25.2018.11.30.07.01.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Nov 2018 07:01:00 -0800 (PST) From: Rob Clark To: dri-devel@lists.freedesktop.org Subject: [PATCH 1/4] drm/msm/gpu: add submit flag to hint which buffers should be dumped Date: Fri, 30 Nov 2018 10:00:39 -0500 Message-Id: <20181130150050.13762-2-robdclark@gmail.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181130150050.13762-1-robdclark@gmail.com> References: <20181130150050.13762-1-robdclark@gmail.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP To lower CPU overhead, future userspace will be switching to pinning iova and avoiding the use of relocs, and only include cmds table entries for IB1 level cmdstream (but not IB2 or state-groups). This leaves the kernel unsure what to dump for rd/hangrd cmdstream dumping. So add a MSM_SUBMIT_BO_DUMP flag so userspace can indicate buffers that contain cmdstream (or are otherwise important to dump). Signed-off-by: Rob Clark --- drivers/gpu/drm/msm/msm_gem_submit.c | 5 ++++- drivers/gpu/drm/msm/msm_rd.c | 13 ++++++++++--- include/uapi/drm/msm_drm.h | 5 ++++- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c index ddd95a078ec4..eab638011f4c 100644 --- a/drivers/gpu/drm/msm/msm_gem_submit.c +++ b/drivers/gpu/drm/msm/msm_gem_submit.c @@ -114,8 +114,11 @@ static int submit_lookup_objects(struct msm_gem_submit *submit, pagefault_disable(); } +/* at least one of READ and/or WRITE flags should be set: */ +#define MANDATORY_FLAGS (MSM_SUBMIT_BO_READ | MSM_SUBMIT_BO_WRITE) + if ((submit_bo.flags & ~MSM_SUBMIT_BO_FLAGS) || - !(submit_bo.flags & MSM_SUBMIT_BO_FLAGS)) { + !(submit_bo.flags & MANDATORY_FLAGS)) { DRM_ERROR("invalid flags: %x\n", submit_bo.flags); ret = -EINVAL; goto out_unlock; diff --git a/drivers/gpu/drm/msm/msm_rd.c b/drivers/gpu/drm/msm/msm_rd.c index 0c2c8d2c631f..90e9d0a48dc0 100644 --- a/drivers/gpu/drm/msm/msm_rd.c +++ b/drivers/gpu/drm/msm/msm_rd.c @@ -348,6 +348,12 @@ static void snapshot_buf(struct msm_rd_state *rd, msm_gem_put_vaddr(&obj->base); } +static bool +should_dump(struct msm_gem_submit *submit, int idx) +{ + return rd_full || (submit->bos[idx].flags & MSM_SUBMIT_BO_DUMP); +} + /* called under struct_mutex */ void msm_rd_dump_submit(struct msm_rd_state *rd, struct msm_gem_submit *submit, const char *fmt, ...) @@ -389,15 +395,16 @@ void msm_rd_dump_submit(struct msm_rd_state *rd, struct msm_gem_submit *submit, rd_write_section(rd, RD_CMD, msg, ALIGN(n, 4)); - for (i = 0; rd_full && i < submit->nr_bos; i++) - snapshot_buf(rd, submit, i, 0, 0); + for (i = 0; i < submit->nr_bos; i++) + if (should_dump(submit, i)) + snapshot_buf(rd, submit, i, 0, 0); for (i = 0; i < submit->nr_cmds; i++) { uint64_t iova = submit->cmd[i].iova; uint32_t szd = submit->cmd[i].size; /* in dwords */ /* snapshot cmdstream bo's (if we haven't already): */ - if (!rd_full) { + if (!should_dump(submit, i)) { snapshot_buf(rd, submit, submit->cmd[i].idx, submit->cmd[i].iova, szd * 4); } diff --git a/include/uapi/drm/msm_drm.h b/include/uapi/drm/msm_drm.h index c06d0a5bdd80..3c3af92c4b3e 100644 --- a/include/uapi/drm/msm_drm.h +++ b/include/uapi/drm/msm_drm.h @@ -188,8 +188,11 @@ struct drm_msm_gem_submit_cmd { */ #define MSM_SUBMIT_BO_READ 0x0001 #define MSM_SUBMIT_BO_WRITE 0x0002 +#define MSM_SUBMIT_BO_DUMP 0x0004 -#define MSM_SUBMIT_BO_FLAGS (MSM_SUBMIT_BO_READ | MSM_SUBMIT_BO_WRITE) +#define MSM_SUBMIT_BO_FLAGS (MSM_SUBMIT_BO_READ | \ + MSM_SUBMIT_BO_WRITE | \ + MSM_SUBMIT_BO_DUMP) struct drm_msm_gem_submit_bo { __u32 flags; /* in, mask of MSM_SUBMIT_BO_x */ From patchwork Fri Nov 30 15:00:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 10706483 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8715113BF for ; Fri, 30 Nov 2018 15:01:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 773E6301AF for ; Fri, 30 Nov 2018 15:01:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6B43D301D8; Fri, 30 Nov 2018 15:01:10 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 23C20301AF for ; Fri, 30 Nov 2018 15:01:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3455C6E619; Fri, 30 Nov 2018 15:01:09 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qk1-x741.google.com (mail-qk1-x741.google.com [IPv6:2607:f8b0:4864:20::741]) by gabe.freedesktop.org (Postfix) with ESMTPS id 947FD6E619; Fri, 30 Nov 2018 15:01:05 +0000 (UTC) Received: by mail-qk1-x741.google.com with SMTP id w204so3312196qka.2; Fri, 30 Nov 2018 07:01:05 -0800 (PST) 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:mime-version:content-transfer-encoding; bh=ZIIynXA0FFPSVLn3lu7FimIsuF4uLklcho7eShOE9ec=; b=BDcbliiZgPiPh3liTz3FFLmaVq3egrbjFw7Ij3IQYCSMKWYXm34fv+YtU2OER2K1Yw d2ku8KADOLfFWmtccFq3AzO1/trGetpBmeH4iWKVvqFpJX+geWPZo4R4D4QWmDz4wYJE +cul4EFZslC8uuvSCCrVd8JPQLeLHcOY5bdgNYZH53Y/bTjCWPNatEwOLvipVgUH3M9S 8/nXf4QbWmk+8kkcychAQvYbzqNSlRExFjji1MrG+yGy+lSbagm9wz8JfaJ18lq6/T+K I/lC4NLVMEpSutwbueedXeoZCLmubwf+XRKmgBijCN0HhLuvzmjnS2K+HluDnG1u6lJj AJlQ== X-Gm-Message-State: AA+aEWY9wdYE4nMnNEAvX5xAoi8wqMSZ508AdZot2DU0Qg9ZKLomxS8m RS70uXqXmc5APw6AQTrp0oTDqSOl X-Google-Smtp-Source: AFSGD/VBclVMflf2PkhIstqjDgtpeWySWWZjjSUuJsaYqjszs6R9mPuxycA1WNmZR5V4Vo/iAaGdVw== X-Received: by 2002:a37:8d81:: with SMTP id p123mr5425667qkd.241.1543590064496; Fri, 30 Nov 2018 07:01:04 -0800 (PST) Received: from localhost ([144.121.20.162]) by smtp.gmail.com with ESMTPSA id k22sm2417808qtm.73.2018.11.30.07.01.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Nov 2018 07:01:03 -0800 (PST) From: Rob Clark To: dri-devel@lists.freedesktop.org Subject: [PATCH 2/4] drm/msm: rework GEM_INFO ioctl Date: Fri, 30 Nov 2018 10:00:40 -0500 Message-Id: <20181130150050.13762-3-robdclark@gmail.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181130150050.13762-1-robdclark@gmail.com> References: <20181130150050.13762-1-robdclark@gmail.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Prep work to add a way to get/set the GEM objects debug name. Signed-off-by: Rob Clark --- drivers/gpu/drm/msm/msm_drv.c | 25 ++++++++++++++++--------- include/uapi/drm/msm_drm.h | 17 ++++++++++++----- 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 9f823bf8d312..913f5b3642b5 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -863,21 +863,28 @@ static int msm_ioctl_gem_info(struct drm_device *dev, void *data, struct drm_gem_object *obj; int ret = 0; - if (args->flags & ~MSM_INFO_FLAGS) + switch (args->info) { + case MSM_INFO_GET_OFFSET: + case MSM_INFO_GET_IOVA: + /* value returned as immediate, not pointer, so len==0: */ + if (args->len) + return -EINVAL; + break; + default: return -EINVAL; + } obj = drm_gem_object_lookup(file, args->handle); if (!obj) return -ENOENT; - if (args->flags & MSM_INFO_IOVA) { - uint64_t iova; - - ret = msm_ioctl_gem_info_iova(dev, obj, &iova); - if (!ret) - args->offset = iova; - } else { - args->offset = msm_gem_mmap_offset(obj); + switch (args->info) { + case MSM_INFO_GET_OFFSET: + args->value = msm_gem_mmap_offset(obj); + break; + case MSM_INFO_GET_IOVA: + ret = msm_ioctl_gem_info_iova(dev, obj, &args->value); + break; } drm_gem_object_put_unlocked(obj); diff --git a/include/uapi/drm/msm_drm.h b/include/uapi/drm/msm_drm.h index 3c3af92c4b3e..bc1757848c7c 100644 --- a/include/uapi/drm/msm_drm.h +++ b/include/uapi/drm/msm_drm.h @@ -105,14 +105,21 @@ struct drm_msm_gem_new { __u32 handle; /* out */ }; -#define MSM_INFO_IOVA 0x01 - -#define MSM_INFO_FLAGS (MSM_INFO_IOVA) +/* Get or set GEM buffer info. The requested value can be passed + * directly in 'value', or for data larger than 64b 'value' is a + * pointer to userspace buffer, with 'len' specifying the number of + * bytes copied into that buffer. For info returned by pointer, + * calling the GEM_INFO ioctl with null 'value' will return the + * required buffer size in 'len' + */ +#define MSM_INFO_GET_OFFSET 0x00 /* get mmap() offset, returned by value */ +#define MSM_INFO_GET_IOVA 0x01 /* get iova, returned by value */ struct drm_msm_gem_info { __u32 handle; /* in */ - __u32 flags; /* in - combination of MSM_INFO_* flags */ - __u64 offset; /* out, mmap() offset or iova */ + __u32 info; /* in - one of MSM_INFO_* */ + __u64 value; /* in or out */ + __u32 len; /* in or out */ }; #define MSM_PREP_READ 0x01 From patchwork Fri Nov 30 15:00:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 10706491 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5BB1F13AD for ; Fri, 30 Nov 2018 15:01:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4C27630199 for ; Fri, 30 Nov 2018 15:01:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 40902301E4; Fri, 30 Nov 2018 15:01:17 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 E80DC301E3 for ; Fri, 30 Nov 2018 15:01:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 35CD26E61D; Fri, 30 Nov 2018 15:01:14 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) by gabe.freedesktop.org (Postfix) with ESMTPS id D12CC6E619; Fri, 30 Nov 2018 15:01:08 +0000 (UTC) Received: by mail-qk1-x743.google.com with SMTP id w204so3312328qka.2; Fri, 30 Nov 2018 07:01:08 -0800 (PST) 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:mime-version:content-transfer-encoding; bh=luJtdTOq5YyKAq6WN9mVXmmzV+2w+uytn39snmmCeq4=; b=UM5wse/k1OEifsjh1jWpiCn1MR6O3r1NkDQ3MVzbfOTgor17kmyqw37CC8fg/ULaHh pTTdtwjyMWriBVSj3TeoFdM97zcONndiTcBv24rrW0hnIZmjktoF6CGAoTtVd7/DI4Mb WK/HSU6214PmWY0zA+FB0GCQRJNmCESrF/M7P54p/RvtmFkerPNhmxh/3xUPrEE2/lq3 u4fIBD6IARIJoRzP1NAM/++K9Y/hFgJtiwpxBS48EKB1wzHF3Mcs1Jen79WHrCLhzkSW YgmysAmjMbG6oocSTLo5GWAWdC0FvPhp6LTIz5IuYsMeNYm9QzP9o5xPwnw3/sYEZ+o2 ONxg== X-Gm-Message-State: AA+aEWZ5Yx2HdOxbgux5BPWHu04iBEjmLWrvdIuB1JoshKKTnWbXCOu6 mSFXkh4RigtbIVxgOzdLINfLpBvK X-Google-Smtp-Source: AFSGD/WSve9AcaU/LS2rxVkDSOPUuMmvKLpx1KtVOvrrSnPOlz1ZN/SSVjGB/+BVVe8ifvvAqnRLUg== X-Received: by 2002:a37:2808:: with SMTP id o8mr5430825qkh.14.1543590067701; Fri, 30 Nov 2018 07:01:07 -0800 (PST) Received: from localhost ([144.121.20.162]) by smtp.gmail.com with ESMTPSA id 46sm3629818qtv.22.2018.11.30.07.01.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Nov 2018 07:01:06 -0800 (PST) From: Rob Clark To: dri-devel@lists.freedesktop.org Subject: [PATCH 3/4] drm/msm: add uapi to get/set debug name Date: Fri, 30 Nov 2018 10:00:41 -0500 Message-Id: <20181130150050.13762-4-robdclark@gmail.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181130150050.13762-1-robdclark@gmail.com> References: <20181130150050.13762-1-robdclark@gmail.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Add UAPI to get/set GEM objects' debug name. Signed-off-by: Rob Clark --- drivers/gpu/drm/msm/msm_drv.c | 36 ++++++++++++++++++++++++++++++++++- include/uapi/drm/msm_drm.h | 2 ++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 913f5b3642b5..6ebbd5010722 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -23,6 +23,7 @@ #include "msm_drv.h" #include "msm_debugfs.h" #include "msm_fence.h" +#include "msm_gem.h" #include "msm_gpu.h" #include "msm_kms.h" @@ -861,7 +862,8 @@ static int msm_ioctl_gem_info(struct drm_device *dev, void *data, { struct drm_msm_gem_info *args = data; struct drm_gem_object *obj; - int ret = 0; + struct msm_gem_object *msm_obj; + int i, ret = 0; switch (args->info) { case MSM_INFO_GET_OFFSET: @@ -870,6 +872,9 @@ static int msm_ioctl_gem_info(struct drm_device *dev, void *data, if (args->len) return -EINVAL; break; + case MSM_INFO_SET_NAME: + case MSM_INFO_GET_NAME: + break; default: return -EINVAL; } @@ -878,6 +883,8 @@ static int msm_ioctl_gem_info(struct drm_device *dev, void *data, if (!obj) return -ENOENT; + msm_obj = to_msm_bo(obj); + switch (args->info) { case MSM_INFO_GET_OFFSET: args->value = msm_gem_mmap_offset(obj); @@ -885,6 +892,33 @@ static int msm_ioctl_gem_info(struct drm_device *dev, void *data, case MSM_INFO_GET_IOVA: ret = msm_ioctl_gem_info_iova(dev, obj, &args->value); break; + case MSM_INFO_SET_NAME: + /* length check should leave room for terminating null: */ + if (args->len >= sizeof(msm_obj->name)) { + ret = -EINVAL; + break; + } + ret = copy_from_user(msm_obj->name, + u64_to_user_ptr(args->value), args->len); + msm_obj->name[args->len] = '\0'; + for (i = 0; i < args->len; i++) { + if (!isprint(msm_obj->name[i])) { + msm_obj->name[i] = '\0'; + break; + } + } + break; + case MSM_INFO_GET_NAME: + if (args->value && (args->len < strlen(msm_obj->name))) { + ret = -EINVAL; + break; + } + args->len = strlen(msm_obj->name); + if (args->value) { + ret = copy_to_user(u64_to_user_ptr(args->value), + msm_obj->name, args->len); + } + break; } drm_gem_object_put_unlocked(obj); diff --git a/include/uapi/drm/msm_drm.h b/include/uapi/drm/msm_drm.h index bc1757848c7c..09f16fd7beda 100644 --- a/include/uapi/drm/msm_drm.h +++ b/include/uapi/drm/msm_drm.h @@ -114,6 +114,8 @@ struct drm_msm_gem_new { */ #define MSM_INFO_GET_OFFSET 0x00 /* get mmap() offset, returned by value */ #define MSM_INFO_GET_IOVA 0x01 /* get iova, returned by value */ +#define MSM_INFO_SET_NAME 0x02 /* set the debug name (by pointer) */ +#define MSM_INFO_GET_NAME 0x03 /* get debug name, returned by pointer */ struct drm_msm_gem_info { __u32 handle; /* in */ From patchwork Fri Nov 30 15:00:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 10706489 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1C56E17D5 for ; Fri, 30 Nov 2018 15:01:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C15F301CC for ; Fri, 30 Nov 2018 15:01:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 008D3301DB; Fri, 30 Nov 2018 15:01:14 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 A58E5301CC for ; Fri, 30 Nov 2018 15:01:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D6A466E61B; Fri, 30 Nov 2018 15:01:13 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qt1-x844.google.com (mail-qt1-x844.google.com [IPv6:2607:f8b0:4864:20::844]) by gabe.freedesktop.org (Postfix) with ESMTPS id C19356E61A; Fri, 30 Nov 2018 15:01:11 +0000 (UTC) Received: by mail-qt1-x844.google.com with SMTP id r14so6219551qtp.1; Fri, 30 Nov 2018 07:01:11 -0800 (PST) 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:mime-version:content-transfer-encoding; bh=Yi3QxUDrTuf8SJj23ZTRflIxXEj4e3uKqUxXVSvJuzU=; b=BnIx6WUEIHBro0Key3Jvvg7IF+iI+yoVa2y8HTiob9qavNEEQGNHnm3g2LquTXkMct azqMmxyvOKZ3BdCbbQx6ijkKNey7hRV9/PdphIY33op/5KFQdQUQNxBlkV2Bm94SFYyV lWs1FkAnzTfIv28izpZNWRNftg7fb0oQ/xthFAzoTzj5Eo4G4Ht1E4qfPk64mGz5iBcb mBXz50QPvvFugjx1v6vXUaAnKTw0a0Chuzt/gpReMFDNOm3HyXduBCOnTV8JUiciazns AuUZG+++LKsoJsU7b+xNp7CVX/0LA0twymZb0f9SIzN9lAqlvTNIwbcnlgqM0JBQh9Ds FbvA== X-Gm-Message-State: AA+aEWbu7PWpXlaxVz3SAUgbcF00g6u2AhRMQcHvrSynfVLsk1qC8QF2 YG0akVXIfSRFU6CLNoDZhP841h5a X-Google-Smtp-Source: AFSGD/XneYnsdpJDQ4UwdEsfqUPSe+qWevU8uynMC8lRrCQA3lW8FTuLIRott0SuZJqHXcmpUOIr6w== X-Received: by 2002:aed:2fc4:: with SMTP id m62mr5508622qtd.8.1543590070766; Fri, 30 Nov 2018 07:01:10 -0800 (PST) Received: from localhost ([144.121.20.162]) by smtp.gmail.com with ESMTPSA id n8sm2986525qtk.91.2018.11.30.07.01.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Nov 2018 07:01:10 -0800 (PST) From: Rob Clark To: dri-devel@lists.freedesktop.org Subject: [PATCH 4/4] drm/msm: bump UAPI version Date: Fri, 30 Nov 2018 10:00:42 -0500 Message-Id: <20181130150050.13762-5-robdclark@gmail.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181130150050.13762-1-robdclark@gmail.com> References: <20181130150050.13762-1-robdclark@gmail.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Rob Clark --- drivers/gpu/drm/msm/msm_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 6ebbd5010722..782cc33916d6 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -36,9 +36,11 @@ * - 1.3.0 - adds GMEM_BASE + NR_RINGS params, SUBMITQUEUE_NEW + * SUBMITQUEUE_CLOSE ioctls, and MSM_INFO_IOVA flag for * MSM_GEM_INFO ioctl. + * - 1.4.0 - softpin, MSM_RELOC_BO_DUMP, and GEM_INFO support to set/get + * GEM object's debug name */ #define MSM_VERSION_MAJOR 1 -#define MSM_VERSION_MINOR 3 +#define MSM_VERSION_MINOR 4 #define MSM_VERSION_PATCHLEVEL 0 static const struct drm_mode_config_funcs mode_config_funcs = {