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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0828C43334 for ; Sat, 25 Jun 2022 03:32:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232043AbiFYDcy (ORCPT ); Fri, 24 Jun 2022 23:32:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232089AbiFYDcu (ORCPT ); Fri, 24 Jun 2022 23:32:50 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A61533FBC8; Fri, 24 Jun 2022 20:32:45 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id v14so5481344wra.5; Fri, 24 Jun 2022 20:32:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=LKSco285r+LBQaMK3CEIw2Y2qyyLlRxk1QU/hwtaC7w=; b=pGbnH2iKlGn6nP41u7dMCmEWeVZTXyZSKKfbAPEqHgxJQEBNkUUfxz8QB8tfotERqO 7g3bKs8R54D2UxsOeg7ziQQM9Oksyn1yEF9w0KBE2P7GgP8QdjFPTxE/LQ/0fIoK/Ci1 YA4KyDAcRtVK/PLy5jcz3EwUVqY7pyS052CuTZGNZDoBXC+68SbFSgFOfcGw8l/n1dQP KO7chDVucEn5icBEv/yeYWFT3DAVns9rZmq9Gh4b3ozorLVK7BslOwmbRkgKOqRjcbhi Onb3eLGfq184O65NvaewS95eKbWjS5PVVE7/PVT+u47z5EmUs119b04LbKCkbwr2A9o1 iHmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=LKSco285r+LBQaMK3CEIw2Y2qyyLlRxk1QU/hwtaC7w=; b=el4ZQNnEXvZzul+547PcJNfVyjPm2/M19LjI6lUhV7vTyYuI2Z6aaQNMUeyf90SY5w a/nvStuwJi20KrKKlubRrh4gQ/z31rl/g7t4L1ycaX5h6gn7nZX/BMOzF1sjWurVr95i LcHVtgDjheTcSILhL6RTUR6va6X+A8MBupdxtXQyYDOY+PytSC6Nz2NElhQfJCHynTbQ W5rr1MDlO0msk0PHb/LzbcGCl5VZxrZnXobFZjaCjLvWFGSYm/K1IOi9xCYm/RFE2iDk NDUxkdnJKWuUJotIQSBcqX0FKaBCAU+72Xh2j8OTGsuFqTMoyIb+ABrGYnPTAYnCfqbq pf4g== X-Gm-Message-State: AJIora/AT99p++I/qxseNwbBsM2WtR2QqfjZyKtIbcvD6Tg6AORVEVeF MFkZ8lC3XWhGAxXJVPpIKhSB+9zv+lJcSHByUDo= X-Google-Smtp-Source: AGRyM1s7/4WbArtdYXdzQsrE61eW1zG66cSg/9SYyvW1Vr/b5J7u5RjICzNXTu+0WZziSzTzFzffhLTYZ8u/XYgr9VA= X-Received: by 2002:a5d:4251:0:b0:21b:885b:2fcc with SMTP id s17-20020a5d4251000000b0021b885b2fccmr2065007wrr.52.1656127964050; Fri, 24 Jun 2022 20:32:44 -0700 (PDT) MIME-Version: 1.0 References: <20220609174213.2265938-1-robdclark@gmail.com> In-Reply-To: From: Rob Clark Date: Fri, 24 Jun 2022 20:32:57 -0700 Message-ID: Subject: Re: [PATCH v3 1/2] drm: Add DRM_GEM_FOPS To: Rob Clark , dri-devel , freedreno , linux-arm-msm , Tvrtko Ursulin , Thomas Zimmermann , Chris Healy , Rob Clark , Maarten Lankhorst , Maxime Ripard , David Airlie , open list Cc: Daniel Vetter Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org On Fri, Jun 24, 2022 at 1:49 PM Daniel Vetter wrote: > > On Thu, Jun 09, 2022 at 10:42:11AM -0700, Rob Clark wrote: > > From: Rob Clark > > > > The DEFINE_DRM_GEM_FOPS() helper is a bit limiting if a driver wants to > > provide additional file ops, like show_fdinfo(). > > > > v2: Split out DRM_GEM_FOPS instead of making DEFINE_DRM_GEM_FOPS > > varardic > > v3: nits > > > > Signed-off-by: Rob Clark > > Acked-by: Thomas Zimmermann > > We're at three drivers, maybe it'd be better if this is more standardized? > I feel like we're opening a bit a can of worms here where everyone just > has some good odl fashioned fun. It's at least much better documented than > the old property proliferation :-) yeah, we could have a standardized drm_show_fdinfo() fop plus drm_driver callback.. at this point the drm core fxn would be rather boring, ie. only printing dev->driver->name, so I didn't pursue that approach (yet?).. but perhaps that changes over time. I think we chose the right approach here, focusing on the documentation first so that userspace has a standardized experience. The kernel side of things, we are free to refactor at any time ;-) BR, -R > -Daniel > > > --- > > include/drm/drm_gem.h | 26 ++++++++++++++++++-------- > > 1 file changed, 18 insertions(+), 8 deletions(-) > > > > diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h > > index 9d7c61a122dc..87cffc9efa85 100644 > > --- a/include/drm/drm_gem.h > > +++ b/include/drm/drm_gem.h > > @@ -314,6 +314,23 @@ struct drm_gem_object { > > const struct drm_gem_object_funcs *funcs; > > }; > > > > +/** > > + * DRM_GEM_FOPS - Default drm GEM file operations > > + * > > + * This macro provides a shorthand for setting the GEM file ops in the > > + * &file_operations structure. If all you need are the default ops, use > > + * DEFINE_DRM_GEM_FOPS instead. > > + */ > > +#define DRM_GEM_FOPS \ > > + .open = drm_open,\ > > + .release = drm_release,\ > > + .unlocked_ioctl = drm_ioctl,\ > > + .compat_ioctl = drm_compat_ioctl,\ > > + .poll = drm_poll,\ > > + .read = drm_read,\ > > + .llseek = noop_llseek,\ > > + .mmap = drm_gem_mmap > > + > > /** > > * DEFINE_DRM_GEM_FOPS() - macro to generate file operations for GEM drivers > > * @name: name for the generated structure > > @@ -330,14 +347,7 @@ struct drm_gem_object { > > #define DEFINE_DRM_GEM_FOPS(name) \ > > static const struct file_operations name = {\ > > .owner = THIS_MODULE,\ > > - .open = drm_open,\ > > - .release = drm_release,\ > > - .unlocked_ioctl = drm_ioctl,\ > > - .compat_ioctl = drm_compat_ioctl,\ > > - .poll = drm_poll,\ > > - .read = drm_read,\ > > - .llseek = noop_llseek,\ > > - .mmap = drm_gem_mmap,\ > > + DRM_GEM_FOPS,\ > > } > > > > void drm_gem_object_release(struct drm_gem_object *obj); > > -- > > 2.36.1 > > > > -- > Daniel Vetter > Software Engineer, Intel Corporation > http://blog.ffwll.ch 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id BE440C433EF for ; Sat, 25 Jun 2022 03:32:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AF01C10E2B6; Sat, 25 Jun 2022 03:32:46 +0000 (UTC) Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by gabe.freedesktop.org (Postfix) with ESMTPS id A7FB910E2B6; Sat, 25 Jun 2022 03:32:45 +0000 (UTC) Received: by mail-wr1-x430.google.com with SMTP id e7so5438099wrc.13; Fri, 24 Jun 2022 20:32:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=LKSco285r+LBQaMK3CEIw2Y2qyyLlRxk1QU/hwtaC7w=; b=pGbnH2iKlGn6nP41u7dMCmEWeVZTXyZSKKfbAPEqHgxJQEBNkUUfxz8QB8tfotERqO 7g3bKs8R54D2UxsOeg7ziQQM9Oksyn1yEF9w0KBE2P7GgP8QdjFPTxE/LQ/0fIoK/Ci1 YA4KyDAcRtVK/PLy5jcz3EwUVqY7pyS052CuTZGNZDoBXC+68SbFSgFOfcGw8l/n1dQP KO7chDVucEn5icBEv/yeYWFT3DAVns9rZmq9Gh4b3ozorLVK7BslOwmbRkgKOqRjcbhi Onb3eLGfq184O65NvaewS95eKbWjS5PVVE7/PVT+u47z5EmUs119b04LbKCkbwr2A9o1 iHmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=LKSco285r+LBQaMK3CEIw2Y2qyyLlRxk1QU/hwtaC7w=; b=fWFF/QDP6q2cybc8kjP970KdUrzJuBiZhexf33KYdBgw9LrA6FHELmFb/Qy1AnZpQj tCUDIJ75CfYS2QQ6go/1GVP/evcGdFyNJOhOVcOHpnXC1oKfFqb8Pk1hoFok093RK0Bg iO3znggFckGgM4YTpGYnxrwSP5dzUsWskBWGF4QvG39qB52RKMY0SbBLDHXqiSd1jQfQ tlK/6MOLVBPbddWUNHYR41dN98imGY4mI8BY6unBuIdTf2+gW7iGU45BSQZneUFX1mkx uVhcu4C0+g54TF2j3PYtH62Er2KAEWEFI//e/NGS6HurPwxLRdLKgSMX79M5DpeL+FBb CDcg== X-Gm-Message-State: AJIora/8zIqCJoRk9DlKwLYPRdOukrPX6BRnuFRpHkpg/o5g1iexLB8+ V08KXzpoRyevlZax1STgB9y+R57bMKSM6YdnZFo= X-Google-Smtp-Source: AGRyM1s7/4WbArtdYXdzQsrE61eW1zG66cSg/9SYyvW1Vr/b5J7u5RjICzNXTu+0WZziSzTzFzffhLTYZ8u/XYgr9VA= X-Received: by 2002:a5d:4251:0:b0:21b:885b:2fcc with SMTP id s17-20020a5d4251000000b0021b885b2fccmr2065007wrr.52.1656127964050; Fri, 24 Jun 2022 20:32:44 -0700 (PDT) MIME-Version: 1.0 References: <20220609174213.2265938-1-robdclark@gmail.com> In-Reply-To: From: Rob Clark Date: Fri, 24 Jun 2022 20:32:57 -0700 Message-ID: Subject: Re: [PATCH v3 1/2] drm: Add DRM_GEM_FOPS To: Rob Clark , dri-devel , freedreno , linux-arm-msm , Tvrtko Ursulin , Thomas Zimmermann , Chris Healy , Rob Clark , Maarten Lankhorst , Maxime Ripard , David Airlie , open list Content-Type: text/plain; charset="UTF-8" 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Fri, Jun 24, 2022 at 1:49 PM Daniel Vetter wrote: > > On Thu, Jun 09, 2022 at 10:42:11AM -0700, Rob Clark wrote: > > From: Rob Clark > > > > The DEFINE_DRM_GEM_FOPS() helper is a bit limiting if a driver wants to > > provide additional file ops, like show_fdinfo(). > > > > v2: Split out DRM_GEM_FOPS instead of making DEFINE_DRM_GEM_FOPS > > varardic > > v3: nits > > > > Signed-off-by: Rob Clark > > Acked-by: Thomas Zimmermann > > We're at three drivers, maybe it'd be better if this is more standardized? > I feel like we're opening a bit a can of worms here where everyone just > has some good odl fashioned fun. It's at least much better documented than > the old property proliferation :-) yeah, we could have a standardized drm_show_fdinfo() fop plus drm_driver callback.. at this point the drm core fxn would be rather boring, ie. only printing dev->driver->name, so I didn't pursue that approach (yet?).. but perhaps that changes over time. I think we chose the right approach here, focusing on the documentation first so that userspace has a standardized experience. The kernel side of things, we are free to refactor at any time ;-) BR, -R > -Daniel > > > --- > > include/drm/drm_gem.h | 26 ++++++++++++++++++-------- > > 1 file changed, 18 insertions(+), 8 deletions(-) > > > > diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h > > index 9d7c61a122dc..87cffc9efa85 100644 > > --- a/include/drm/drm_gem.h > > +++ b/include/drm/drm_gem.h > > @@ -314,6 +314,23 @@ struct drm_gem_object { > > const struct drm_gem_object_funcs *funcs; > > }; > > > > +/** > > + * DRM_GEM_FOPS - Default drm GEM file operations > > + * > > + * This macro provides a shorthand for setting the GEM file ops in the > > + * &file_operations structure. If all you need are the default ops, use > > + * DEFINE_DRM_GEM_FOPS instead. > > + */ > > +#define DRM_GEM_FOPS \ > > + .open = drm_open,\ > > + .release = drm_release,\ > > + .unlocked_ioctl = drm_ioctl,\ > > + .compat_ioctl = drm_compat_ioctl,\ > > + .poll = drm_poll,\ > > + .read = drm_read,\ > > + .llseek = noop_llseek,\ > > + .mmap = drm_gem_mmap > > + > > /** > > * DEFINE_DRM_GEM_FOPS() - macro to generate file operations for GEM drivers > > * @name: name for the generated structure > > @@ -330,14 +347,7 @@ struct drm_gem_object { > > #define DEFINE_DRM_GEM_FOPS(name) \ > > static const struct file_operations name = {\ > > .owner = THIS_MODULE,\ > > - .open = drm_open,\ > > - .release = drm_release,\ > > - .unlocked_ioctl = drm_ioctl,\ > > - .compat_ioctl = drm_compat_ioctl,\ > > - .poll = drm_poll,\ > > - .read = drm_read,\ > > - .llseek = noop_llseek,\ > > - .mmap = drm_gem_mmap,\ > > + DRM_GEM_FOPS,\ > > } > > > > void drm_gem_object_release(struct drm_gem_object *obj); > > -- > > 2.36.1 > > > > -- > Daniel Vetter > Software Engineer, Intel Corporation > http://blog.ffwll.ch