From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dmitry Osipenko Subject: Re: [RFC] Host1x/TegraDRM UAPI (drm_tegra_submit_command) Date: Sun, 28 Jun 2020 01:32:00 +0300 Message-ID: References: <9b06b7ec-f952-2561-7afb-5653514cd5d3@kapsi.fi> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: In-Reply-To: <9b06b7ec-f952-2561-7afb-5653514cd5d3-/1wQRMveznE@public.gmane.org> Content-Language: en-US Sender: linux-tegra-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Mikko Perttunen , Thierry Reding , Jon Hunter , David Airlie , Daniel Vetter , sumit.semwal-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org, gustavo-THi1TnShQwVAfugRpC6u6w@public.gmane.org Cc: "linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , dri-devel , talho-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org, bhuntsman-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org List-Id: linux-tegra@vger.kernel.org 23.06.2020 15:09, Mikko Perttunen пишет: > /* Command is an opcode gather from a GEM handle */ > #define DRM_TEGRA_SUBMIT_COMMAND_GATHER             0 > /* Command is an opcode gather from a user pointer */ > #define DRM_TEGRA_SUBMIT_COMMAND_GATHER_UPTR        1 > /* Command is a wait for syncpt fence completion */ > #define DRM_TEGRA_SUBMIT_COMMAND_WAIT_SYNCPT        2 > /* Command is a wait for SYNC_FILE FD completion */ > #define DRM_TEGRA_SUBMIT_COMMAND_WAIT_SYNC_FILE     3 > /* Command is a wait for DRM syncobj completion */ > #define DRM_TEGRA_SUBMIT_COMMAND_WAIT_SYNCOBJ       4 > > /* >  * Allow driver to skip command execution if engine >  * was not accessed by another channel between >  * submissions. >  */ > #define DRM_TEGRA_SUBMIT_CONTEXT_SETUP                        (1<<0) > > struct drm_tegra_submit_command { >         __u16 type; >         __u16 flags; Shouldn't the "packed" attribute be needed if a non-32bit aligned fields are used? >         union { >                 struct { >                     /* GEM handle */ >                     __u32 handle; > >                     /* >                      * Offset into GEM object in bytes. >                      * Must be aligned by 4. >                      */ >                     __u64 offset; 64bits for a gather offset is a bit too much, in most cases gathers are under 4K. u32 should be more than enough (maybe even u16 if offset is given in a dword granularity). >                     /* >                      * Length of gather in bytes. >                      * Must be aligned by 4. >                      */ >                     __u64 length; u32/16 >                 } gather; >                 struct { >                         __u32 reserved[1]; > >                         /* >                          * Pointer to gather data. >                          * Must be aligned by 4 bytes. >                          */ >                         __u64 base; >                         /* >                          * Length of gather in bytes. >                          * Must be aligned by 4. >                          */ >                         __u64 length; >                 } gather_uptr; What about to inline the UPTR gather data and relocs into the drm_tegra_submit_command[] buffer: struct drm_tegra_submit_command { struct { u16 num_words; u16 num_relocs; gather_data[]; drm_tegra_submit_relocation relocs[]; } gather_uptr; }; struct drm_tegra_channel_submit { __u32 num_syncpt_incrs; __u32 syncpt_idx; __u64 commands_ptr; __u32 commands_size; ... }; struct drm_tegra_submit_command example[] = { cmd.gather_uptr{}, ... gather_data[], gather_relocs[], cmd.wait_syncpt{}, ... }; This way we will have only a single copy_from_user() for the whole cmdstream, which should be more efficient to do and nicer from both userspace and kernel perspectives in regards to forming and parsing the commands. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2D9CC433DF for ; Sun, 28 Jun 2020 20:36:47 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 75911206C3 for ; Sun, 28 Jun 2020 20:36:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AqdsbRdr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 75911206C3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7FCD56E3AA; Sun, 28 Jun 2020 20:36:38 +0000 (UTC) Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by gabe.freedesktop.org (Postfix) with ESMTPS id C61016E18F for ; Sat, 27 Jun 2020 22:32:03 +0000 (UTC) Received: by mail-lf1-x143.google.com with SMTP id y18so6984666lfh.11 for ; Sat, 27 Jun 2020 15:32:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=KI0QLmVCjjTMq/liju5LuAbZSO1DU/M8HGIKzvnZfZA=; b=AqdsbRdrumFb5omQ54zZ/ZMuSu6PWS1wyma5Kowy/H7iXUYC5t+Yn4WkAgSfDWQfaK VyAfCFBZQDixCaa/rflKPaOPO2g8l/XtH9PXE7AZZjJVAKosoGNrWnf3B4u+KucbrK/y 4cpo9eEkdcsebW2CC63QFf4xjFlJPkm7s7JGXTMCeDlcwUb46z9kvMro+sbbQZKUgzRu qblWJ8HtWJffT8GKNt16HDQ+5qECUVGoyWMgGXEBfizcpL1sRqzZUgGeQm13mZTR6luq HvtZJ++THOWm1vBHVkdknhrW+NomNXNtYLS5gR5buIqhHH3OF8qehZWg48IeuLPjL2mM wbsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=KI0QLmVCjjTMq/liju5LuAbZSO1DU/M8HGIKzvnZfZA=; b=uiPHPrIxkUyNjUvS6P5zpm7Cc4otQFy6Pz6w/hcdPOPqYJ7RrEckKg+okudWT5hEmw uOM9piM6xvdmxL5+Ly50CpoHXT8xsNHZq/XpQaoNV24uXscdjd5+H4J6/2eoeXtIWOlA jkI5/UdtyVf3SrGkYJwhYzTK6HjhvyqF7RInvqLXRyvkmtZo21T2OF98YEhYafoc09Xu GFLCJF5h5GdS8jfNVqGJutDYJyp6aP2QZeWVEU9juHvapEayEL3KeVVcbjPY0NWHl+p7 hc8MHRkjvOvtzynysbQQ4F43UXYsw8Zy66msK7aBbc/FC2kOOFMD/Me2ui8YS3SJVAnD gl0g== X-Gm-Message-State: AOAM531m7r/xQpyleJDY5v9oaqZKF2qAJxSPjFT4EUfNYJ4Kb9xn+HK4 0Ua3/B4HUKaobmCe3n4/0cc= X-Google-Smtp-Source: ABdhPJwptYMmsgc+XFwI8cVVRMC/GMyQh++1AuGgHnkvFWOM8oeAqqgisonrCpYywqUd+dbSmj/wSg== X-Received: by 2002:a05:6512:4c6:: with SMTP id w6mr3250609lfq.76.1593297122246; Sat, 27 Jun 2020 15:32:02 -0700 (PDT) Received: from [192.168.2.145] (79-139-237-54.dynamic.spd-mgts.ru. [79.139.237.54]) by smtp.googlemail.com with ESMTPSA id z84sm6078108lfa.54.2020.06.27.15.32.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 27 Jun 2020 15:32:01 -0700 (PDT) Subject: Re: [RFC] Host1x/TegraDRM UAPI (drm_tegra_submit_command) To: Mikko Perttunen , Thierry Reding , Jon Hunter , David Airlie , Daniel Vetter , sumit.semwal@linaro.org, gustavo@padovan.org References: <9b06b7ec-f952-2561-7afb-5653514cd5d3@kapsi.fi> From: Dmitry Osipenko Message-ID: Date: Sun, 28 Jun 2020 01:32:00 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <9b06b7ec-f952-2561-7afb-5653514cd5d3@kapsi.fi> Content-Language: en-US X-Mailman-Approved-At: Sun, 28 Jun 2020 20:36:36 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "linux-tegra@vger.kernel.org" , talho@nvidia.com, bhuntsman@nvidia.com, dri-devel Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" MjMuMDYuMjAyMCAxNTowOSwgTWlra28gUGVydHR1bmVuINC/0LjRiNC10YI6Cj4gLyogQ29tbWFu ZCBpcyBhbiBvcGNvZGUgZ2F0aGVyIGZyb20gYSBHRU0gaGFuZGxlICovCj4gI2RlZmluZSBEUk1f VEVHUkFfU1VCTUlUX0NPTU1BTkRfR0FUSEVSwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgIDAKPiAv KiBDb21tYW5kIGlzIGFuIG9wY29kZSBnYXRoZXIgZnJvbSBhIHVzZXIgcG9pbnRlciAqLwo+ICNk ZWZpbmUgRFJNX1RFR1JBX1NVQk1JVF9DT01NQU5EX0dBVEhFUl9VUFRSwqDCoMKgwqDCoMKgwqAg MQo+IC8qIENvbW1hbmQgaXMgYSB3YWl0IGZvciBzeW5jcHQgZmVuY2UgY29tcGxldGlvbiAqLwo+ ICNkZWZpbm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