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=-6.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 0C476C33CA9 for ; Sun, 12 Jan 2020 22:53:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BB00021556 for ; Sun, 12 Jan 2020 22:53:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="kb6TnFq/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733179AbgALWx1 (ORCPT ); Sun, 12 Jan 2020 17:53:27 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:41574 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727222AbgALWx1 (ORCPT ); Sun, 12 Jan 2020 17:53:27 -0500 Received: by mail-pg1-f196.google.com with SMTP id x8so3783699pgk.8 for ; Sun, 12 Jan 2020 14:53:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=mN3OohFuWT/b3tQcks3MjC4mIBwZ0BmU1pug0HHFBA8=; b=kb6TnFq/1j0a2g5CEH0dwgYru/JrTDzsIQ5lH6fwGPfA4FHMT7MUtVeevbRwcdUKCr gJ1umclAsxpCWVsdc9lmxc17CoVkN91Y/fbNlb3MoFW2qbdl4QxvrgVFzjbau0cRitq5 sUrLF07n03/0kDexoiN5qBCebux94EmoDTI70= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=mN3OohFuWT/b3tQcks3MjC4mIBwZ0BmU1pug0HHFBA8=; b=DxO29aWQyOHvBnLGvS4DI34lwfW/7/OBHOQcL8ikY5TrTct/KgMKVfHZY2sAPXpqYh sPbTNadkNdwP9Bc8tQQOfddlHV0r4wFm3ML133A5lZq5ar4ViUthHrHl3QwzpnHO4ikx ef6I3Rpv7x6BbFBjplhkkmLy+xfLo9AlBECwdZxMhK2KVWaXnfBdDA+DxmFl+B7uHYX+ zFYCKMFZhwd4sAbFGbmg0ZBaQKKYImw7D2lcclNP4G3jdMcRCD+d0YUIYZi4++p7bUCX vAUYBmXCou4IEkotB1ZwzUwrOfkzrLQz7B291leWabvi1LpWcbU9Z/yVYtA5OdioSkvP YulA== X-Gm-Message-State: APjAAAXAf/aR5L91P7hBT9/VRVrE3PHLt2eNgOD78GoHPrvM9FClwFlK kJFtDUfEdGyXAeKvN9RzuPsB8g== X-Google-Smtp-Source: APXvYqzuVMccGIlYN3NWuH5sobRxngrV6L5TKIyuAMS6+VMeeMkB4pB7p1cgi1jZEAORT6jG0Ta+aQ== X-Received: by 2002:a62:3703:: with SMTP id e3mr16618728pfa.154.1578869606016; Sun, 12 Jan 2020 14:53:26 -0800 (PST) Received: from dvetter-linux.ger.corp.intel.com ([138.44.248.126]) by smtp.gmail.com with ESMTPSA id g67sm11800045pfb.66.2020.01.12.14.53.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Jan 2020 14:53:25 -0800 (PST) Date: Sun, 12 Jan 2020 23:53:12 +0100 From: Daniel Vetter To: Thomas Zimmermann Cc: airlied@linux.ie, daniel@ffwll.ch, alexander.deucher@amd.com, christian.koenig@amd.com, David1.Zhou@amd.com, maarten.lankhorst@linux.intel.com, patrik.r.jakobsson@gmail.com, robdclark@gmail.com, sean@poorly.run, benjamin.gaignard@linaro.org, vincent.abriou@st.com, yannick.fertre@st.com, philippe.cornu@st.com, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com, eric@anholt.net, rodrigosiqueiramelo@gmail.com, hamohammed.sa@gmail.com, linux-graphics-maintainer@vmware.com, thellstrom@vmware.com, bskeggs@redhat.com, harry.wentland@amd.com, sunpeng.li@amd.com, jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, nouveau@lists.freedesktop.org Subject: Re: [PATCH 23/23] drm: Cleanup VBLANK callbacks in struct drm_driver Message-ID: <20200112225312.GC5340@dvetter-linux.ger.corp.intel.com> References: <20200110092127.27847-1-tzimmermann@suse.de> <20200110092127.27847-24-tzimmermann@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200110092127.27847-24-tzimmermann@suse.de> X-Operating-System: Linux dvetter-linux.ger.corp.intel.com 5.2.11-200.fc30.x86_64 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org On Fri, Jan 10, 2020 at 10:21:27AM +0100, Thomas Zimmermann wrote: > All non-legacy users of VBLANK functions in struct drm_driver have been > converted to use the respective interfaces in struct drm_crtc_funcs. The > remaining users of VBLANK callbacks in struct drm_driver are legacy drivers > with userspace modesetting. > > There are no users left of get_vblank_timestamp(), so the callback is > being removed. The other VBLANK callbacks are being moved to the legacy > section at the end of struct drm_driver. > > Signed-off-by: Thomas Zimmermann I think sprinkling some WARN_ON (in drm_dev_register or wherever) if new drivers try to use the legacy hooks would be really nice. Experience says someone is going to copypaste this stuff around forever otherwise. Reviewed-by: Daniel Vetter > --- > drivers/gpu/drm/drm_vblank.c | 39 +++++--------- > include/drm/drm_drv.h | 101 ++--------------------------------- > 2 files changed, 17 insertions(+), 123 deletions(-) > > diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c > index 7cf436a4b908..ceff68474d4d 100644 > --- a/drivers/gpu/drm/drm_vblank.c > +++ b/drivers/gpu/drm/drm_vblank.c > @@ -138,10 +138,9 @@ static u32 __get_vblank_counter(struct drm_device *dev, unsigned int pipe) > > if (crtc->funcs->get_vblank_counter) > return crtc->funcs->get_vblank_counter(crtc); > - } > - > - if (dev->driver->get_vblank_counter) > + } else if (dev->driver->get_vblank_counter) { > return dev->driver->get_vblank_counter(dev, pipe); > + } > > return drm_vblank_no_hw_counter(dev, pipe); > } > @@ -334,8 +333,7 @@ u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc) > unsigned long flags; > > WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) && > - !crtc->funcs->get_vblank_timestamp && > - !dev->driver->get_vblank_timestamp, > + !crtc->funcs->get_vblank_timestamp, > "This function requires support for accurate vblank timestamps."); > > spin_lock_irqsave(&dev->vblank_time_lock, flags); > @@ -357,13 +355,11 @@ static void __disable_vblank(struct drm_device *dev, unsigned int pipe) > if (WARN_ON(!crtc)) > return; > > - if (crtc->funcs->disable_vblank) { > + if (crtc->funcs->disable_vblank) > crtc->funcs->disable_vblank(crtc); > - return; > - } > + } else { > + dev->driver->disable_vblank(dev, pipe); > } > - > - dev->driver->disable_vblank(dev, pipe); > } > > /* > @@ -791,9 +787,6 @@ drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe, > > ret = crtc->funcs->get_vblank_timestamp(crtc, &max_error, > tvblank, in_vblank_irq); > - } else if (dev->driver->get_vblank_timestamp && (max_error > 0)) { > - ret = dev->driver->get_vblank_timestamp(dev, pipe, &max_error, > - tvblank, in_vblank_irq); > } > > /* GPU high precision timestamp query unsupported or failed. > @@ -1016,9 +1009,11 @@ static int __enable_vblank(struct drm_device *dev, unsigned int pipe) > > if (crtc->funcs->enable_vblank) > return crtc->funcs->enable_vblank(crtc); > + } else if (dev->driver->enable_vblank) { > + return dev->driver->enable_vblank(dev, pipe); > } > > - return dev->driver->enable_vblank(dev, pipe); > + return -EINVAL; > } > > static int drm_vblank_enable(struct drm_device *dev, unsigned int pipe) > @@ -1109,13 +1104,10 @@ static bool __vblank_disable_immediate(struct drm_device *dev, unsigned int pipe > return false; > > crtc = drm_crtc_from_index(dev, pipe); > - if (crtc && crtc->funcs->get_vblank_timestamp) > - return true; > - > - if (dev->driver->get_vblank_timestamp) > - return true; > + if (!crtc || !crtc->funcs->get_vblank_timestamp) > + return false; > > - return false; > + return true; > } > > static void drm_vblank_put(struct drm_device *dev, unsigned int pipe) > @@ -1798,7 +1790,6 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe) > struct drm_pending_vblank_event *e, *t; > ktime_t now; > u64 seq; > - bool high_prec; > > assert_spin_locked(&dev->event_lock); > > @@ -1818,10 +1809,8 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe) > send_vblank_event(dev, e, seq, now); > } > > - high_prec = crtc->funcs->get_vblank_timestamp || > - dev->driver->get_vblank_timestamp; > - > - trace_drm_vblank_event(pipe, seq, now, high_prec); > + trace_drm_vblank_event(pipe, seq, now, > + crtc->funcs->get_vblank_timestamp != NULL); > } > > /** > diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h > index b704e252f3b2..e290b3aca6eb 100644 > --- a/include/drm/drm_drv.h > +++ b/include/drm/drm_drv.h > @@ -268,104 +268,6 @@ struct drm_driver { > */ > void (*release) (struct drm_device *); > > - /** > - * @get_vblank_counter: > - * > - * Driver callback for fetching a raw hardware vblank counter for the > - * CRTC specified with the pipe argument. If a device doesn't have a > - * hardware counter, the driver can simply leave the hook as NULL. > - * The DRM core will account for missed vblank events while interrupts > - * where disabled based on system timestamps. > - * > - * Wraparound handling and loss of events due to modesetting is dealt > - * with in the DRM core code, as long as drivers call > - * drm_crtc_vblank_off() and drm_crtc_vblank_on() when disabling or > - * enabling a CRTC. > - * > - * This is deprecated and should not be used by new drivers. > - * Use &drm_crtc_funcs.get_vblank_counter instead. > - * > - * Returns: > - * > - * Raw vblank counter value. > - */ > - u32 (*get_vblank_counter) (struct drm_device *dev, unsigned int pipe); > - > - /** > - * @enable_vblank: > - * > - * Enable vblank interrupts for the CRTC specified with the pipe > - * argument. > - * > - * This is deprecated and should not be used by new drivers. > - * Use &drm_crtc_funcs.enable_vblank instead. > - * > - * Returns: > - * > - * Zero on success, appropriate errno if the given @crtc's vblank > - * interrupt cannot be enabled. > - */ > - int (*enable_vblank) (struct drm_device *dev, unsigned int pipe); > - > - /** > - * @disable_vblank: > - * > - * Disable vblank interrupts for the CRTC specified with the pipe > - * argument. > - * > - * This is deprecated and should not be used by new drivers. > - * Use &drm_crtc_funcs.disable_vblank instead. > - */ > - void (*disable_vblank) (struct drm_device *dev, unsigned int pipe); > - > - /** > - * @get_vblank_timestamp: > - * > - * Called by drm_get_last_vbltimestamp(). Should return a precise > - * timestamp when the most recent VBLANK interval ended or will end. > - * > - * Specifically, the timestamp in @vblank_time should correspond as > - * closely as possible to the time when the first video scanline of > - * the video frame after the end of VBLANK will start scanning out, > - * the time immediately after end of the VBLANK interval. If the > - * @crtc is currently inside VBLANK, this will be a time in the future. > - * If the @crtc is currently scanning out a frame, this will be the > - * past start time of the current scanout. This is meant to adhere > - * to the OpenML OML_sync_control extension specification. > - * > - * Paramters: > - * > - * dev: > - * dev DRM device handle. > - * pipe: > - * crtc for which timestamp should be returned. > - * max_error: > - * Maximum allowable timestamp error in nanoseconds. > - * Implementation should strive to provide timestamp > - * with an error of at most max_error nanoseconds. > - * Returns true upper bound on error for timestamp. > - * vblank_time: > - * Target location for returned vblank timestamp. > - * in_vblank_irq: > - * True when called from drm_crtc_handle_vblank(). Some drivers > - * need to apply some workarounds for gpu-specific vblank irq quirks > - * if flag is set. > - * > - * Returns: > - * > - * True on success, false on failure, which means the core should > - * fallback to a simple timestamp taken in drm_crtc_handle_vblank(). > - * > - * FIXME: > - * > - * We should move this hook to &struct drm_crtc_funcs like all the other > - * vblank hooks. > - */ > - bool (*get_vblank_timestamp) (struct drm_device *dev, unsigned int pipe, > - int *max_error, > - ktime_t *vblank_time, > - bool in_vblank_irq); > - > /** > * @irq_handler: > * > @@ -720,6 +622,9 @@ struct drm_driver { > int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv); > int (*dma_quiescent) (struct drm_device *); > int (*context_dtor) (struct drm_device *dev, int context); > + u32 (*get_vblank_counter)(struct drm_device *dev, unsigned int pipe); > + int (*enable_vblank)(struct drm_device *dev, unsigned int pipe); > + void (*disable_vblank)(struct drm_device *dev, unsigned int pipe); > int dev_priv_size; > }; > > -- > 2.24.1 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: Re: [PATCH 23/23] drm: Cleanup VBLANK callbacks in struct drm_driver Date: Sun, 12 Jan 2020 23:53:12 +0100 Message-ID: <20200112225312.GC5340@dvetter-linux.ger.corp.intel.com> References: <20200110092127.27847-1-tzimmermann@suse.de> <20200110092127.27847-24-tzimmermann@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <20200110092127.27847-24-tzimmermann-l3A5Bk7waGM@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: freedreno-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Sender: "Freedreno" To: Thomas Zimmermann Cc: hamohammed.sa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, airlied-cv59FeDIM0c@public.gmane.org, nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, joonas.lahtinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org, dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, eric-WhKQ6XTQaPysTnJN9+BGXg@public.gmane.org, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, benjamin.gaignard-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org, alexandre.torgue-qxv4g6HH51o@public.gmane.org, David1.Zhou-5C7GfCeVMHo@public.gmane.org, thellstrom-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org, sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org, patrik.r.jakobsson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, linux-graphics-maintainer-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org, bskeggs-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org, harry.wentland-5C7GfCeVMHo@public.gmane.org, mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, sunpeng.li-5C7GfCeVMHo@public.gmane.org, linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, maarten.lankhorst-VuQAYsv1563Yd54FQh9/CA@public.gmane.org, jani.nikula-VuQAYsv1563Yd54FQh9/CA@public.gmane.org, rodrigo.vivi-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org, vincent.abriou-qxv4g6HH51o@public.gmane.org, rodrigosiqueiramelo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, philippe.cornu-qxv4g6HH51o@public.gmane.org, yannick.fertre-qxv4g6HH51o@public.gmane.org, robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, daniel-/w4YWyX8dFk@public.gmane.org, alexander.deucher-5C7GfCeVMHo@public.gmane.org, freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, christian.koenig-5C7GfCeVMHo@public.gmane.org List-Id: nouveau.vger.kernel.org On Fri, Jan 10, 2020 at 10:21:27AM +0100, Thomas Zimmermann wrote: > All non-legacy users of VBLANK functions in struct drm_driver have been > converted to use the respective interfaces in struct drm_crtc_funcs. The > remaining users of VBLANK callbacks in struct drm_driver are legacy drivers > with userspace modesetting. > > There are no users left of get_vblank_timestamp(), so the callback is > being removed. The other VBLANK callbacks are being moved to the legacy > section at the end of struct drm_driver. > > Signed-off-by: Thomas Zimmermann I think sprinkling some WARN_ON (in drm_dev_register or wherever) if new drivers try to use the legacy hooks would be really nice. Experience says someone is going to copypaste this stuff around forever otherwise. Reviewed-by: Daniel Vetter > --- > drivers/gpu/drm/drm_vblank.c | 39 +++++--------- > include/drm/drm_drv.h | 101 ++--------------------------------- > 2 files changed, 17 insertions(+), 123 deletions(-) > > diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c > index 7cf436a4b908..ceff68474d4d 100644 > --- a/drivers/gpu/drm/drm_vblank.c > +++ b/drivers/gpu/drm/drm_vblank.c > @@ -138,10 +138,9 @@ static u32 __get_vblank_counter(struct drm_device *dev, unsigned int pipe) > > if (crtc->funcs->get_vblank_counter) > return crtc->funcs->get_vblank_counter(crtc); > - } > - > - if (dev->driver->get_vblank_counter) > + } else if (dev->driver->get_vblank_counter) { > return dev->driver->get_vblank_counter(dev, pipe); > + } > > return drm_vblank_no_hw_counter(dev, pipe); > } > @@ -334,8 +333,7 @@ u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc) > unsigned long flags; > > WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) && > - !crtc->funcs->get_vblank_timestamp && > - !dev->driver->get_vblank_timestamp, > + !crtc->funcs->get_vblank_timestamp, > "This function requires support for accurate vblank timestamps."); > > spin_lock_irqsave(&dev->vblank_time_lock, flags); > @@ -357,13 +355,11 @@ static void __disable_vblank(struct drm_device *dev, unsigned int pipe) > if (WARN_ON(!crtc)) > return; > > - if (crtc->funcs->disable_vblank) { > + if (crtc->funcs->disable_vblank) > crtc->funcs->disable_vblank(crtc); > - return; > - } > + } else { > + dev->driver->disable_vblank(dev, pipe); > } > - > - dev->driver->disable_vblank(dev, pipe); > } > > /* > @@ -791,9 +787,6 @@ drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe, > > ret = crtc->funcs->get_vblank_timestamp(crtc, &max_error, > tvblank, in_vblank_irq); > - } else if (dev->driver->get_vblank_timestamp && (max_error > 0)) { > - ret = dev->driver->get_vblank_timestamp(dev, pipe, &max_error, > - tvblank, in_vblank_irq); > } > > /* GPU high precision timestamp query unsupported or failed. > @@ -1016,9 +1009,11 @@ static int __enable_vblank(struct drm_device *dev, unsigned int pipe) > > if (crtc->funcs->enable_vblank) > return crtc->funcs->enable_vblank(crtc); > + } else if (dev->driver->enable_vblank) { > + return dev->driver->enable_vblank(dev, pipe); > } > > - return dev->driver->enable_vblank(dev, pipe); > + return -EINVAL; > } > > static int drm_vblank_enable(struct drm_device *dev, unsigned int pipe) > @@ -1109,13 +1104,10 @@ static bool __vblank_disable_immediate(struct drm_device *dev, unsigned int pipe > return false; > > crtc = drm_crtc_from_index(dev, pipe); > - if (crtc && crtc->funcs->get_vblank_timestamp) > - return true; > - > - if (dev->driver->get_vblank_timestamp) > - return true; > + if (!crtc || !crtc->funcs->get_vblank_timestamp) > + return false; > > - return false; > + return true; > } > > static void drm_vblank_put(struct drm_device *dev, unsigned int pipe) > @@ -1798,7 +1790,6 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe) > struct drm_pending_vblank_event *e, *t; > ktime_t now; > u64 seq; > - bool high_prec; > > assert_spin_locked(&dev->event_lock); > > @@ -1818,10 +1809,8 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe) > send_vblank_event(dev, e, seq, now); > } > > - high_prec = crtc->funcs->get_vblank_timestamp || > - dev->driver->get_vblank_timestamp; > - > - trace_drm_vblank_event(pipe, seq, now, high_prec); > + trace_drm_vblank_event(pipe, seq, now, > + crtc->funcs->get_vblank_timestamp != NULL); > } > > /** > diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h > index b704e252f3b2..e290b3aca6eb 100644 > --- a/include/drm/drm_drv.h > +++ b/include/drm/drm_drv.h > @@ -268,104 +268,6 @@ struct drm_driver { > */ > void (*release) (struct drm_device *); > > - /** > - * @get_vblank_counter: > - * > - * Driver callback for fetching a raw hardware vblank counter for the > - * CRTC specified with the pipe argument. If a device doesn't have a > - * hardware counter, the driver can simply leave the hook as NULL. > - * The DRM core will account for missed vblank events while interrupts > - * where disabled based on system timestamps. > - * > - * Wraparound handling and loss of events due to modesetting is dealt > - * with in the DRM core code, as long as drivers call > - * drm_crtc_vblank_off() and drm_crtc_vblank_on() when disabling or > - * enabling a CRTC. > - * > - * This is deprecated and should not be used by new drivers. > - * Use &drm_crtc_funcs.get_vblank_counter instead. > - * > - * Returns: > - * > - * Raw vblank counter value. > - */ > - u32 (*get_vblank_counter) (struct drm_device *dev, unsigned int pipe); > - > - /** > - * @enable_vblank: > - * > - * Enable vblank interrupts for the CRTC specified with the pipe > - * argument. > - * > - * This is deprecated and should not be used by new drivers. > - * Use &drm_crtc_funcs.enable_vblank instead. > - * > - * Returns: > - * > - * Zero on success, appropriate errno if the given @crtc's vblank > - * interrupt cannot be enabled. > - */ > - int (*enable_vblank) (struct drm_device *dev, unsigned int pipe); > - > - /** > - * @disable_vblank: > - * > - * Disable vblank interrupts for the CRTC specified with the pipe > - * argument. > - * > - * This is deprecated and should not be used by new drivers. > - * Use &drm_crtc_funcs.disable_vblank instead. > - */ > - void (*disable_vblank) (struct drm_device *dev, unsigned int pipe); > - > - /** > - * @get_vblank_timestamp: > - * > - * Called by drm_get_last_vbltimestamp(). Should return a precise > - * timestamp when the most recent VBLANK interval ended or will end. > - * > - * Specifically, the timestamp in @vblank_time should correspond as > - * closely as possible to the time when the first video scanline of > - * the video frame after the end of VBLANK will start scanning out, > - * the time immediately after end of the VBLANK interval. If the > - * @crtc is currently inside VBLANK, this will be a time in the future. > - * If the @crtc is currently scanning out a frame, this will be the > - * past start time of the current scanout. This is meant to adhere > - * to the OpenML OML_sync_control extension specification. > - * > - * Paramters: > - * > - * dev: > - * dev DRM device handle. > - * pipe: > - * crtc for which timestamp should be returned. > - * max_error: > - * Maximum allowable timestamp error in nanoseconds. > - * Implementation should strive to provide timestamp > - * with an error of at most max_error nanoseconds. > - * Returns true upper bound on error for timestamp. > - * vblank_time: > - * Target location for returned vblank timestamp. > - * in_vblank_irq: > - * True when called from drm_crtc_handle_vblank(). Some drivers > - * need to apply some workarounds for gpu-specific vblank irq quirks > - * if flag is set. > - * > - * Returns: > - * > - * True on success, false on failure, which means the core should > - * fallback to a simple timestamp taken in drm_crtc_handle_vblank(). > - * > - * FIXME: > - * > - * We should move this hook to &struct drm_crtc_funcs like all the other > - * vblank hooks. > - */ > - bool (*get_vblank_timestamp) (struct drm_device *dev, unsigned int pipe, > - int *max_error, > - ktime_t *vblank_time, > - bool in_vblank_irq); > - > /** > * @irq_handler: > * > @@ -720,6 +622,9 @@ struct drm_driver { > int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv); > int (*dma_quiescent) (struct drm_device *); > int (*context_dtor) (struct drm_device *dev, int context); > + u32 (*get_vblank_counter)(struct drm_device *dev, unsigned int pipe); > + int (*enable_vblank)(struct drm_device *dev, unsigned int pipe); > + void (*disable_vblank)(struct drm_device *dev, unsigned int pipe); > int dev_priv_size; > }; > > -- > 2.24.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 X-Spam-Level: X-Spam-Status: No, score=-6.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 90DB3C33CAB for ; Sun, 12 Jan 2020 22:53:29 +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 653DC21556 for ; Sun, 12 Jan 2020 22:53:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="kb6TnFq/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 653DC21556 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch 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 9909C89FD7; Sun, 12 Jan 2020 22:53:27 +0000 (UTC) Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by gabe.freedesktop.org (Postfix) with ESMTPS id 667FE89FDB for ; Sun, 12 Jan 2020 22:53:26 +0000 (UTC) Received: by mail-pf1-x442.google.com with SMTP id x185so3951183pfc.5 for ; Sun, 12 Jan 2020 14:53:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=mN3OohFuWT/b3tQcks3MjC4mIBwZ0BmU1pug0HHFBA8=; b=kb6TnFq/1j0a2g5CEH0dwgYru/JrTDzsIQ5lH6fwGPfA4FHMT7MUtVeevbRwcdUKCr gJ1umclAsxpCWVsdc9lmxc17CoVkN91Y/fbNlb3MoFW2qbdl4QxvrgVFzjbau0cRitq5 sUrLF07n03/0kDexoiN5qBCebux94EmoDTI70= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=mN3OohFuWT/b3tQcks3MjC4mIBwZ0BmU1pug0HHFBA8=; b=cd4eqbLZ/ibtCqvDukQN8zqou+jneclsjwog8hYgNPnuZ15E4gcymb1vXQNsbYSM9P 7eRsNcXqSgvngj4HBZ2Q06cwMBToCwVg2aj3fc4Tt7NAHRP5awcRCfsrYr2ZlmsVO/XZ pJyMRksMiv5SSEmMP8O0rtLHqy1ngXyKxcAZap12D31big61zFXNNiThvNFXvMS83dcU WSvDWSZT1+iQM2aGKD5zYiGx3GirDdJyBeZvPpVco20Ty+gPl4qp15GwPH96eIKHtH+y Ygtl3w6z++XGcyGxhVgGO+W/CJduAG5dvHlb7l4DltnskG/BpUN/kjNArRjkikbNXYZq llIg== X-Gm-Message-State: APjAAAWELH/UdFTiQ29jqDl3l08mF/FyMCKDa7jiGSpjryIql4a40bCp Fe88RnHSlMVnmO5GTkd5KLegtg== X-Google-Smtp-Source: APXvYqzuVMccGIlYN3NWuH5sobRxngrV6L5TKIyuAMS6+VMeeMkB4pB7p1cgi1jZEAORT6jG0Ta+aQ== X-Received: by 2002:a62:3703:: with SMTP id e3mr16618728pfa.154.1578869606016; Sun, 12 Jan 2020 14:53:26 -0800 (PST) Received: from dvetter-linux.ger.corp.intel.com ([138.44.248.126]) by smtp.gmail.com with ESMTPSA id g67sm11800045pfb.66.2020.01.12.14.53.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Jan 2020 14:53:25 -0800 (PST) Date: Sun, 12 Jan 2020 23:53:12 +0100 From: Daniel Vetter To: Thomas Zimmermann Subject: Re: [PATCH 23/23] drm: Cleanup VBLANK callbacks in struct drm_driver Message-ID: <20200112225312.GC5340@dvetter-linux.ger.corp.intel.com> References: <20200110092127.27847-1-tzimmermann@suse.de> <20200110092127.27847-24-tzimmermann@suse.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200110092127.27847-24-tzimmermann@suse.de> X-Operating-System: Linux dvetter-linux.ger.corp.intel.com 5.2.11-200.fc30.x86_64 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: hamohammed.sa@gmail.com, airlied@linux.ie, nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, alexandre.torgue@st.com, thellstrom@vmware.com, sean@poorly.run, linux-graphics-maintainer@vmware.com, bskeggs@redhat.com, mcoquelin.stm32@gmail.com, sunpeng.li@amd.com, linux-arm-msm@vger.kernel.org, intel-gfx@lists.freedesktop.org, rodrigo.vivi@intel.com, vincent.abriou@st.com, rodrigosiqueiramelo@gmail.com, philippe.cornu@st.com, yannick.fertre@st.com, alexander.deucher@amd.com, freedreno@lists.freedesktop.org, christian.koenig@amd.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Fri, Jan 10, 2020 at 10:21:27AM +0100, Thomas Zimmermann wrote: > All non-legacy users of VBLANK functions in struct drm_driver have been > converted to use the respective interfaces in struct drm_crtc_funcs. The > remaining users of VBLANK callbacks in struct drm_driver are legacy drivers > with userspace modesetting. > > There are no users left of get_vblank_timestamp(), so the callback is > being removed. The other VBLANK callbacks are being moved to the legacy > section at the end of struct drm_driver. > > Signed-off-by: Thomas Zimmermann I think sprinkling some WARN_ON (in drm_dev_register or wherever) if new drivers try to use the legacy hooks would be really nice. Experience says someone is going to copypaste this stuff around forever otherwise. Reviewed-by: Daniel Vetter > --- > drivers/gpu/drm/drm_vblank.c | 39 +++++--------- > include/drm/drm_drv.h | 101 ++--------------------------------- > 2 files changed, 17 insertions(+), 123 deletions(-) > > diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c > index 7cf436a4b908..ceff68474d4d 100644 > --- a/drivers/gpu/drm/drm_vblank.c > +++ b/drivers/gpu/drm/drm_vblank.c > @@ -138,10 +138,9 @@ static u32 __get_vblank_counter(struct drm_device *dev, unsigned int pipe) > > if (crtc->funcs->get_vblank_counter) > return crtc->funcs->get_vblank_counter(crtc); > - } > - > - if (dev->driver->get_vblank_counter) > + } else if (dev->driver->get_vblank_counter) { > return dev->driver->get_vblank_counter(dev, pipe); > + } > > return drm_vblank_no_hw_counter(dev, pipe); > } > @@ -334,8 +333,7 @@ u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc) > unsigned long flags; > > WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) && > - !crtc->funcs->get_vblank_timestamp && > - !dev->driver->get_vblank_timestamp, > + !crtc->funcs->get_vblank_timestamp, > "This function requires support for accurate vblank timestamps."); > > spin_lock_irqsave(&dev->vblank_time_lock, flags); > @@ -357,13 +355,11 @@ static void __disable_vblank(struct drm_device *dev, unsigned int pipe) > if (WARN_ON(!crtc)) > return; > > - if (crtc->funcs->disable_vblank) { > + if (crtc->funcs->disable_vblank) > crtc->funcs->disable_vblank(crtc); > - return; > - } > + } else { > + dev->driver->disable_vblank(dev, pipe); > } > - > - dev->driver->disable_vblank(dev, pipe); > } > > /* > @@ -791,9 +787,6 @@ drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe, > > ret = crtc->funcs->get_vblank_timestamp(crtc, &max_error, > tvblank, in_vblank_irq); > - } else if (dev->driver->get_vblank_timestamp && (max_error > 0)) { > - ret = dev->driver->get_vblank_timestamp(dev, pipe, &max_error, > - tvblank, in_vblank_irq); > } > > /* GPU high precision timestamp query unsupported or failed. > @@ -1016,9 +1009,11 @@ static int __enable_vblank(struct drm_device *dev, unsigned int pipe) > > if (crtc->funcs->enable_vblank) > return crtc->funcs->enable_vblank(crtc); > + } else if (dev->driver->enable_vblank) { > + return dev->driver->enable_vblank(dev, pipe); > } > > - return dev->driver->enable_vblank(dev, pipe); > + return -EINVAL; > } > > static int drm_vblank_enable(struct drm_device *dev, unsigned int pipe) > @@ -1109,13 +1104,10 @@ static bool __vblank_disable_immediate(struct drm_device *dev, unsigned int pipe > return false; > > crtc = drm_crtc_from_index(dev, pipe); > - if (crtc && crtc->funcs->get_vblank_timestamp) > - return true; > - > - if (dev->driver->get_vblank_timestamp) > - return true; > + if (!crtc || !crtc->funcs->get_vblank_timestamp) > + return false; > > - return false; > + return true; > } > > static void drm_vblank_put(struct drm_device *dev, unsigned int pipe) > @@ -1798,7 +1790,6 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe) > struct drm_pending_vblank_event *e, *t; > ktime_t now; > u64 seq; > - bool high_prec; > > assert_spin_locked(&dev->event_lock); > > @@ -1818,10 +1809,8 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe) > send_vblank_event(dev, e, seq, now); > } > > - high_prec = crtc->funcs->get_vblank_timestamp || > - dev->driver->get_vblank_timestamp; > - > - trace_drm_vblank_event(pipe, seq, now, high_prec); > + trace_drm_vblank_event(pipe, seq, now, > + crtc->funcs->get_vblank_timestamp != NULL); > } > > /** > diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h > index b704e252f3b2..e290b3aca6eb 100644 > --- a/include/drm/drm_drv.h > +++ b/include/drm/drm_drv.h > @@ -268,104 +268,6 @@ struct drm_driver { > */ > void (*release) (struct drm_device *); > > - /** > - * @get_vblank_counter: > - * > - * Driver callback for fetching a raw hardware vblank counter for the > - * CRTC specified with the pipe argument. If a device doesn't have a > - * hardware counter, the driver can simply leave the hook as NULL. > - * The DRM core will account for missed vblank events while interrupts > - * where disabled based on system timestamps. > - * > - * Wraparound handling and loss of events due to modesetting is dealt > - * with in the DRM core code, as long as drivers call > - * drm_crtc_vblank_off() and drm_crtc_vblank_on() when disabling or > - * enabling a CRTC. > - * > - * This is deprecated and should not be used by new drivers. > - * Use &drm_crtc_funcs.get_vblank_counter instead. > - * > - * Returns: > - * > - * Raw vblank counter value. > - */ > - u32 (*get_vblank_counter) (struct drm_device *dev, unsigned int pipe); > - > - /** > - * @enable_vblank: > - * > - * Enable vblank interrupts for the CRTC specified with the pipe > - * argument. > - * > - * This is deprecated and should not be used by new drivers. > - * Use &drm_crtc_funcs.enable_vblank instead. > - * > - * Returns: > - * > - * Zero on success, appropriate errno if the given @crtc's vblank > - * interrupt cannot be enabled. > - */ > - int (*enable_vblank) (struct drm_device *dev, unsigned int pipe); > - > - /** > - * @disable_vblank: > - * > - * Disable vblank interrupts for the CRTC specified with the pipe > - * argument. > - * > - * This is deprecated and should not be used by new drivers. > - * Use &drm_crtc_funcs.disable_vblank instead. > - */ > - void (*disable_vblank) (struct drm_device *dev, unsigned int pipe); > - > - /** > - * @get_vblank_timestamp: > - * > - * Called by drm_get_last_vbltimestamp(). Should return a precise > - * timestamp when the most recent VBLANK interval ended or will end. > - * > - * Specifically, the timestamp in @vblank_time should correspond as > - * closely as possible to the time when the first video scanline of > - * the video frame after the end of VBLANK will start scanning out, > - * the time immediately after end of the VBLANK interval. If the > - * @crtc is currently inside VBLANK, this will be a time in the future. > - * If the @crtc is currently scanning out a frame, this will be the > - * past start time of the current scanout. This is meant to adhere > - * to the OpenML OML_sync_control extension specification. > - * > - * Paramters: > - * > - * dev: > - * dev DRM device handle. > - * pipe: > - * crtc for which timestamp should be returned. > - * max_error: > - * Maximum allowable timestamp error in nanoseconds. > - * Implementation should strive to provide timestamp > - * with an error of at most max_error nanoseconds. > - * Returns true upper bound on error for timestamp. > - * vblank_time: > - * Target location for returned vblank timestamp. > - * in_vblank_irq: > - * True when called from drm_crtc_handle_vblank(). Some drivers > - * need to apply some workarounds for gpu-specific vblank irq quirks > - * if flag is set. > - * > - * Returns: > - * > - * True on success, false on failure, which means the core should > - * fallback to a simple timestamp taken in drm_crtc_handle_vblank(). > - * > - * FIXME: > - * > - * We should move this hook to &struct drm_crtc_funcs like all the other > - * vblank hooks. > - */ > - bool (*get_vblank_timestamp) (struct drm_device *dev, unsigned int pipe, > - int *max_error, > - ktime_t *vblank_time, > - bool in_vblank_irq); > - > /** > * @irq_handler: > * > @@ -720,6 +622,9 @@ struct drm_driver { > int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv); > int (*dma_quiescent) (struct drm_device *); > int (*context_dtor) (struct drm_device *dev, int context); > + u32 (*get_vblank_counter)(struct drm_device *dev, unsigned int pipe); > + int (*enable_vblank)(struct drm_device *dev, unsigned int pipe); > + void (*disable_vblank)(struct drm_device *dev, unsigned int pipe); > int dev_priv_size; > }; > > -- > 2.24.1 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel 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=-6.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 A32B1C33CAA for ; Sun, 12 Jan 2020 22:53:34 +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 7449521556 for ; Sun, 12 Jan 2020 22:53:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="kb6TnFq/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7449521556 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 13D3E89FEC; Sun, 12 Jan 2020 22:53:28 +0000 (UTC) Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by gabe.freedesktop.org (Postfix) with ESMTPS id 83F7389FD7 for ; Sun, 12 Jan 2020 22:53:26 +0000 (UTC) Received: by mail-pf1-x444.google.com with SMTP id x6so3935843pfo.10 for ; Sun, 12 Jan 2020 14:53:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=mN3OohFuWT/b3tQcks3MjC4mIBwZ0BmU1pug0HHFBA8=; b=kb6TnFq/1j0a2g5CEH0dwgYru/JrTDzsIQ5lH6fwGPfA4FHMT7MUtVeevbRwcdUKCr gJ1umclAsxpCWVsdc9lmxc17CoVkN91Y/fbNlb3MoFW2qbdl4QxvrgVFzjbau0cRitq5 sUrLF07n03/0kDexoiN5qBCebux94EmoDTI70= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=mN3OohFuWT/b3tQcks3MjC4mIBwZ0BmU1pug0HHFBA8=; b=RduYWrBtgUnf+UByPQEPzrSQjII1dyZBHQ9b68GvhGR09jJa/kIKAINiL2DhlVIc6R qPfvRvwUpehKFO6afbLEQ6Lo4H+RzeliQnkQreJs7twbUu3YZxxZqaYa2+jx4+Jv+CaO t63yJBBEFDLN1zsmmsd0YRxDGPi3LDE/QTlMR6HV1jbBBEO6hqTzroB0EN+y4EbAWX8N 63AnLgxslpT/VCfyR7m6QfyyS/IqxPft2LcopV68MVeL0F39F3xeo16cK4nJyS9YX3gH KE4FKfoIHA629TO1zbYrGCWB20nvxlfUtL9dPG+Jr5KZhKHIrds5RqHc8IBxM8aFKl1i /A2g== X-Gm-Message-State: APjAAAVU9tjAd2wBbNikHxamZaZVx+6n7pCw0mxQpZaRLdNBAmfIMn3w 5R892+eHBxKfu2tP2JslhpDTPA== X-Google-Smtp-Source: APXvYqzuVMccGIlYN3NWuH5sobRxngrV6L5TKIyuAMS6+VMeeMkB4pB7p1cgi1jZEAORT6jG0Ta+aQ== X-Received: by 2002:a62:3703:: with SMTP id e3mr16618728pfa.154.1578869606016; Sun, 12 Jan 2020 14:53:26 -0800 (PST) Received: from dvetter-linux.ger.corp.intel.com ([138.44.248.126]) by smtp.gmail.com with ESMTPSA id g67sm11800045pfb.66.2020.01.12.14.53.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Jan 2020 14:53:25 -0800 (PST) Date: Sun, 12 Jan 2020 23:53:12 +0100 From: Daniel Vetter To: Thomas Zimmermann Message-ID: <20200112225312.GC5340@dvetter-linux.ger.corp.intel.com> References: <20200110092127.27847-1-tzimmermann@suse.de> <20200110092127.27847-24-tzimmermann@suse.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200110092127.27847-24-tzimmermann@suse.de> X-Operating-System: Linux dvetter-linux.ger.corp.intel.com 5.2.11-200.fc30.x86_64 Subject: Re: [Intel-gfx] [PATCH 23/23] drm: Cleanup VBLANK callbacks in struct drm_driver X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: hamohammed.sa@gmail.com, airlied@linux.ie, nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org, eric@anholt.net, amd-gfx@lists.freedesktop.org, benjamin.gaignard@linaro.org, alexandre.torgue@st.com, David1.Zhou@amd.com, thellstrom@vmware.com, linux-graphics-maintainer@vmware.com, bskeggs@redhat.com, harry.wentland@amd.com, mcoquelin.stm32@gmail.com, sunpeng.li@amd.com, linux-arm-msm@vger.kernel.org, intel-gfx@lists.freedesktop.org, vincent.abriou@st.com, rodrigosiqueiramelo@gmail.com, philippe.cornu@st.com, yannick.fertre@st.com, alexander.deucher@amd.com, freedreno@lists.freedesktop.org, christian.koenig@amd.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Fri, Jan 10, 2020 at 10:21:27AM +0100, Thomas Zimmermann wrote: > All non-legacy users of VBLANK functions in struct drm_driver have been > converted to use the respective interfaces in struct drm_crtc_funcs. The > remaining users of VBLANK callbacks in struct drm_driver are legacy drivers > with userspace modesetting. > > There are no users left of get_vblank_timestamp(), so the callback is > being removed. The other VBLANK callbacks are being moved to the legacy > section at the end of struct drm_driver. > > Signed-off-by: Thomas Zimmermann I think sprinkling some WARN_ON (in drm_dev_register or wherever) if new drivers try to use the legacy hooks would be really nice. Experience says someone is going to copypaste this stuff around forever otherwise. Reviewed-by: Daniel Vetter > --- > drivers/gpu/drm/drm_vblank.c | 39 +++++--------- > include/drm/drm_drv.h | 101 ++--------------------------------- > 2 files changed, 17 insertions(+), 123 deletions(-) > > diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c > index 7cf436a4b908..ceff68474d4d 100644 > --- a/drivers/gpu/drm/drm_vblank.c > +++ b/drivers/gpu/drm/drm_vblank.c > @@ -138,10 +138,9 @@ static u32 __get_vblank_counter(struct drm_device *dev, unsigned int pipe) > > if (crtc->funcs->get_vblank_counter) > return crtc->funcs->get_vblank_counter(crtc); > - } > - > - if (dev->driver->get_vblank_counter) > + } else if (dev->driver->get_vblank_counter) { > return dev->driver->get_vblank_counter(dev, pipe); > + } > > return drm_vblank_no_hw_counter(dev, pipe); > } > @@ -334,8 +333,7 @@ u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc) > unsigned long flags; > > WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) && > - !crtc->funcs->get_vblank_timestamp && > - !dev->driver->get_vblank_timestamp, > + !crtc->funcs->get_vblank_timestamp, > "This function requires support for accurate vblank timestamps."); > > spin_lock_irqsave(&dev->vblank_time_lock, flags); > @@ -357,13 +355,11 @@ static void __disable_vblank(struct drm_device *dev, unsigned int pipe) > if (WARN_ON(!crtc)) > return; > > - if (crtc->funcs->disable_vblank) { > + if (crtc->funcs->disable_vblank) > crtc->funcs->disable_vblank(crtc); > - return; > - } > + } else { > + dev->driver->disable_vblank(dev, pipe); > } > - > - dev->driver->disable_vblank(dev, pipe); > } > > /* > @@ -791,9 +787,6 @@ drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe, > > ret = crtc->funcs->get_vblank_timestamp(crtc, &max_error, > tvblank, in_vblank_irq); > - } else if (dev->driver->get_vblank_timestamp && (max_error > 0)) { > - ret = dev->driver->get_vblank_timestamp(dev, pipe, &max_error, > - tvblank, in_vblank_irq); > } > > /* GPU high precision timestamp query unsupported or failed. > @@ -1016,9 +1009,11 @@ static int __enable_vblank(struct drm_device *dev, unsigned int pipe) > > if (crtc->funcs->enable_vblank) > return crtc->funcs->enable_vblank(crtc); > + } else if (dev->driver->enable_vblank) { > + return dev->driver->enable_vblank(dev, pipe); > } > > - return dev->driver->enable_vblank(dev, pipe); > + return -EINVAL; > } > > static int drm_vblank_enable(struct drm_device *dev, unsigned int pipe) > @@ -1109,13 +1104,10 @@ static bool __vblank_disable_immediate(struct drm_device *dev, unsigned int pipe > return false; > > crtc = drm_crtc_from_index(dev, pipe); > - if (crtc && crtc->funcs->get_vblank_timestamp) > - return true; > - > - if (dev->driver->get_vblank_timestamp) > - return true; > + if (!crtc || !crtc->funcs->get_vblank_timestamp) > + return false; > > - return false; > + return true; > } > > static void drm_vblank_put(struct drm_device *dev, unsigned int pipe) > @@ -1798,7 +1790,6 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe) > struct drm_pending_vblank_event *e, *t; > ktime_t now; > u64 seq; > - bool high_prec; > > assert_spin_locked(&dev->event_lock); > > @@ -1818,10 +1809,8 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe) > send_vblank_event(dev, e, seq, now); > } > > - high_prec = crtc->funcs->get_vblank_timestamp || > - dev->driver->get_vblank_timestamp; > - > - trace_drm_vblank_event(pipe, seq, now, high_prec); > + trace_drm_vblank_event(pipe, seq, now, > + crtc->funcs->get_vblank_timestamp != NULL); > } > > /** > diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h > index b704e252f3b2..e290b3aca6eb 100644 > --- a/include/drm/drm_drv.h > +++ b/include/drm/drm_drv.h > @@ -268,104 +268,6 @@ struct drm_driver { > */ > void (*release) (struct drm_device *); > > - /** > - * @get_vblank_counter: > - * > - * Driver callback for fetching a raw hardware vblank counter for the > - * CRTC specified with the pipe argument. If a device doesn't have a > - * hardware counter, the driver can simply leave the hook as NULL. > - * The DRM core will account for missed vblank events while interrupts > - * where disabled based on system timestamps. > - * > - * Wraparound handling and loss of events due to modesetting is dealt > - * with in the DRM core code, as long as drivers call > - * drm_crtc_vblank_off() and drm_crtc_vblank_on() when disabling or > - * enabling a CRTC. > - * > - * This is deprecated and should not be used by new drivers. > - * Use &drm_crtc_funcs.get_vblank_counter instead. > - * > - * Returns: > - * > - * Raw vblank counter value. > - */ > - u32 (*get_vblank_counter) (struct drm_device *dev, unsigned int pipe); > - > - /** > - * @enable_vblank: > - * > - * Enable vblank interrupts for the CRTC specified with the pipe > - * argument. > - * > - * This is deprecated and should not be used by new drivers. > - * Use &drm_crtc_funcs.enable_vblank instead. > - * > - * Returns: > - * > - * Zero on success, appropriate errno if the given @crtc's vblank > - * interrupt cannot be enabled. > - */ > - int (*enable_vblank) (struct drm_device *dev, unsigned int pipe); > - > - /** > - * @disable_vblank: > - * > - * Disable vblank interrupts for the CRTC specified with the pipe > - * argument. > - * > - * This is deprecated and should not be used by new drivers. > - * Use &drm_crtc_funcs.disable_vblank instead. > - */ > - void (*disable_vblank) (struct drm_device *dev, unsigned int pipe); > - > - /** > - * @get_vblank_timestamp: > - * > - * Called by drm_get_last_vbltimestamp(). Should return a precise > - * timestamp when the most recent VBLANK interval ended or will end. > - * > - * Specifically, the timestamp in @vblank_time should correspond as > - * closely as possible to the time when the first video scanline of > - * the video frame after the end of VBLANK will start scanning out, > - * the time immediately after end of the VBLANK interval. If the > - * @crtc is currently inside VBLANK, this will be a time in the future. > - * If the @crtc is currently scanning out a frame, this will be the > - * past start time of the current scanout. This is meant to adhere > - * to the OpenML OML_sync_control extension specification. > - * > - * Paramters: > - * > - * dev: > - * dev DRM device handle. > - * pipe: > - * crtc for which timestamp should be returned. > - * max_error: > - * Maximum allowable timestamp error in nanoseconds. > - * Implementation should strive to provide timestamp > - * with an error of at most max_error nanoseconds. > - * Returns true upper bound on error for timestamp. > - * vblank_time: > - * Target location for returned vblank timestamp. > - * in_vblank_irq: > - * True when called from drm_crtc_handle_vblank(). Some drivers > - * need to apply some workarounds for gpu-specific vblank irq quirks > - * if flag is set. > - * > - * Returns: > - * > - * True on success, false on failure, which means the core should > - * fallback to a simple timestamp taken in drm_crtc_handle_vblank(). > - * > - * FIXME: > - * > - * We should move this hook to &struct drm_crtc_funcs like all the other > - * vblank hooks. > - */ > - bool (*get_vblank_timestamp) (struct drm_device *dev, unsigned int pipe, > - int *max_error, > - ktime_t *vblank_time, > - bool in_vblank_irq); > - > /** > * @irq_handler: > * > @@ -720,6 +622,9 @@ struct drm_driver { > int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv); > int (*dma_quiescent) (struct drm_device *); > int (*context_dtor) (struct drm_device *dev, int context); > + u32 (*get_vblank_counter)(struct drm_device *dev, unsigned int pipe); > + int (*enable_vblank)(struct drm_device *dev, unsigned int pipe); > + void (*disable_vblank)(struct drm_device *dev, unsigned int pipe); > int dev_priv_size; > }; > > -- > 2.24.1 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx 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=-6.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 A166FC33CA9 for ; Sun, 12 Jan 2020 22:53:33 +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 773A321556 for ; Sun, 12 Jan 2020 22:53:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="kb6TnFq/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 773A321556 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=amd-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F40A889FE6; Sun, 12 Jan 2020 22:53:27 +0000 (UTC) Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8AB6989FDB for ; Sun, 12 Jan 2020 22:53:26 +0000 (UTC) Received: by mail-pg1-x543.google.com with SMTP id x7so3777690pgl.11 for ; Sun, 12 Jan 2020 14:53:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=mN3OohFuWT/b3tQcks3MjC4mIBwZ0BmU1pug0HHFBA8=; b=kb6TnFq/1j0a2g5CEH0dwgYru/JrTDzsIQ5lH6fwGPfA4FHMT7MUtVeevbRwcdUKCr gJ1umclAsxpCWVsdc9lmxc17CoVkN91Y/fbNlb3MoFW2qbdl4QxvrgVFzjbau0cRitq5 sUrLF07n03/0kDexoiN5qBCebux94EmoDTI70= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=mN3OohFuWT/b3tQcks3MjC4mIBwZ0BmU1pug0HHFBA8=; b=dfAqWffONadr2KjncQJEmQu77q8bKNSqOsUgtEyAkWwQ1hAodZ1dx4Z/qIMdfmsODv 4mCP2NiyBabmpzsvUTMvxOxNSc3stp2QfjR+9kWfUkXFlVCUHgHwiWdX5nZDYy8zbhwD 5vs/vAtuNAhUDhzywjFf8C9wbZW8yLFfHPijnXD7PI218twQyS0GtFRJbarKiDl/qzI9 92bYtSbwfLbrsVjakmGZzIDsAoeHDQtLrZ/mWKDkykSZGbcOaq1GP9tEx2MTVPADkbEp 2M30N3TPyP9i0DOsWHqvRd9LpHDjpMdbmkEFnI9OKxGKEnYGq91KD5/oyDw6ekL5VTK3 d04w== X-Gm-Message-State: APjAAAUK0aSIB1vjjZDsn7J8QBktTThDV9k1TqD9z71pRfW94zkp1b+r s8IcavsmSGYZ5WdhOmvybGnQLA== X-Google-Smtp-Source: APXvYqzuVMccGIlYN3NWuH5sobRxngrV6L5TKIyuAMS6+VMeeMkB4pB7p1cgi1jZEAORT6jG0Ta+aQ== X-Received: by 2002:a62:3703:: with SMTP id e3mr16618728pfa.154.1578869606016; Sun, 12 Jan 2020 14:53:26 -0800 (PST) Received: from dvetter-linux.ger.corp.intel.com ([138.44.248.126]) by smtp.gmail.com with ESMTPSA id g67sm11800045pfb.66.2020.01.12.14.53.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Jan 2020 14:53:25 -0800 (PST) Date: Sun, 12 Jan 2020 23:53:12 +0100 From: Daniel Vetter To: Thomas Zimmermann Subject: Re: [PATCH 23/23] drm: Cleanup VBLANK callbacks in struct drm_driver Message-ID: <20200112225312.GC5340@dvetter-linux.ger.corp.intel.com> References: <20200110092127.27847-1-tzimmermann@suse.de> <20200110092127.27847-24-tzimmermann@suse.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200110092127.27847-24-tzimmermann@suse.de> X-Operating-System: Linux dvetter-linux.ger.corp.intel.com 5.2.11-200.fc30.x86_64 X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: hamohammed.sa@gmail.com, airlied@linux.ie, nouveau@lists.freedesktop.org, joonas.lahtinen@linux.intel.com, dri-devel@lists.freedesktop.org, eric@anholt.net, amd-gfx@lists.freedesktop.org, benjamin.gaignard@linaro.org, alexandre.torgue@st.com, David1.Zhou@amd.com, thellstrom@vmware.com, sean@poorly.run, patrik.r.jakobsson@gmail.com, linux-graphics-maintainer@vmware.com, bskeggs@redhat.com, harry.wentland@amd.com, mcoquelin.stm32@gmail.com, sunpeng.li@amd.com, linux-arm-msm@vger.kernel.org, intel-gfx@lists.freedesktop.org, maarten.lankhorst@linux.intel.com, jani.nikula@linux.intel.com, rodrigo.vivi@intel.com, vincent.abriou@st.com, rodrigosiqueiramelo@gmail.com, philippe.cornu@st.com, yannick.fertre@st.com, robdclark@gmail.com, daniel@ffwll.ch, alexander.deucher@amd.com, freedreno@lists.freedesktop.org, christian.koenig@amd.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: amd-gfx-bounces@lists.freedesktop.org Sender: "amd-gfx" On Fri, Jan 10, 2020 at 10:21:27AM +0100, Thomas Zimmermann wrote: > All non-legacy users of VBLANK functions in struct drm_driver have been > converted to use the respective interfaces in struct drm_crtc_funcs. The > remaining users of VBLANK callbacks in struct drm_driver are legacy drivers > with userspace modesetting. > > There are no users left of get_vblank_timestamp(), so the callback is > being removed. The other VBLANK callbacks are being moved to the legacy > section at the end of struct drm_driver. > > Signed-off-by: Thomas Zimmermann I think sprinkling some WARN_ON (in drm_dev_register or wherever) if new drivers try to use the legacy hooks would be really nice. Experience says someone is going to copypaste this stuff around forever otherwise. Reviewed-by: Daniel Vetter > --- > drivers/gpu/drm/drm_vblank.c | 39 +++++--------- > include/drm/drm_drv.h | 101 ++--------------------------------- > 2 files changed, 17 insertions(+), 123 deletions(-) > > diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c > index 7cf436a4b908..ceff68474d4d 100644 > --- a/drivers/gpu/drm/drm_vblank.c > +++ b/drivers/gpu/drm/drm_vblank.c > @@ -138,10 +138,9 @@ static u32 __get_vblank_counter(struct drm_device *dev, unsigned int pipe) > > if (crtc->funcs->get_vblank_counter) > return crtc->funcs->get_vblank_counter(crtc); > - } > - > - if (dev->driver->get_vblank_counter) > + } else if (dev->driver->get_vblank_counter) { > return dev->driver->get_vblank_counter(dev, pipe); > + } > > return drm_vblank_no_hw_counter(dev, pipe); > } > @@ -334,8 +333,7 @@ u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc) > unsigned long flags; > > WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) && > - !crtc->funcs->get_vblank_timestamp && > - !dev->driver->get_vblank_timestamp, > + !crtc->funcs->get_vblank_timestamp, > "This function requires support for accurate vblank timestamps."); > > spin_lock_irqsave(&dev->vblank_time_lock, flags); > @@ -357,13 +355,11 @@ static void __disable_vblank(struct drm_device *dev, unsigned int pipe) > if (WARN_ON(!crtc)) > return; > > - if (crtc->funcs->disable_vblank) { > + if (crtc->funcs->disable_vblank) > crtc->funcs->disable_vblank(crtc); > - return; > - } > + } else { > + dev->driver->disable_vblank(dev, pipe); > } > - > - dev->driver->disable_vblank(dev, pipe); > } > > /* > @@ -791,9 +787,6 @@ drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe, > > ret = crtc->funcs->get_vblank_timestamp(crtc, &max_error, > tvblank, in_vblank_irq); > - } else if (dev->driver->get_vblank_timestamp && (max_error > 0)) { > - ret = dev->driver->get_vblank_timestamp(dev, pipe, &max_error, > - tvblank, in_vblank_irq); > } > > /* GPU high precision timestamp query unsupported or failed. > @@ -1016,9 +1009,11 @@ static int __enable_vblank(struct drm_device *dev, unsigned int pipe) > > if (crtc->funcs->enable_vblank) > return crtc->funcs->enable_vblank(crtc); > + } else if (dev->driver->enable_vblank) { > + return dev->driver->enable_vblank(dev, pipe); > } > > - return dev->driver->enable_vblank(dev, pipe); > + return -EINVAL; > } > > static int drm_vblank_enable(struct drm_device *dev, unsigned int pipe) > @@ -1109,13 +1104,10 @@ static bool __vblank_disable_immediate(struct drm_device *dev, unsigned int pipe > return false; > > crtc = drm_crtc_from_index(dev, pipe); > - if (crtc && crtc->funcs->get_vblank_timestamp) > - return true; > - > - if (dev->driver->get_vblank_timestamp) > - return true; > + if (!crtc || !crtc->funcs->get_vblank_timestamp) > + return false; > > - return false; > + return true; > } > > static void drm_vblank_put(struct drm_device *dev, unsigned int pipe) > @@ -1798,7 +1790,6 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe) > struct drm_pending_vblank_event *e, *t; > ktime_t now; > u64 seq; > - bool high_prec; > > assert_spin_locked(&dev->event_lock); > > @@ -1818,10 +1809,8 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe) > send_vblank_event(dev, e, seq, now); > } > > - high_prec = crtc->funcs->get_vblank_timestamp || > - dev->driver->get_vblank_timestamp; > - > - trace_drm_vblank_event(pipe, seq, now, high_prec); > + trace_drm_vblank_event(pipe, seq, now, > + crtc->funcs->get_vblank_timestamp != NULL); > } > > /** > diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h > index b704e252f3b2..e290b3aca6eb 100644 > --- a/include/drm/drm_drv.h > +++ b/include/drm/drm_drv.h > @@ -268,104 +268,6 @@ struct drm_driver { > */ > void (*release) (struct drm_device *); > > - /** > - * @get_vblank_counter: > - * > - * Driver callback for fetching a raw hardware vblank counter for the > - * CRTC specified with the pipe argument. If a device doesn't have a > - * hardware counter, the driver can simply leave the hook as NULL. > - * The DRM core will account for missed vblank events while interrupts > - * where disabled based on system timestamps. > - * > - * Wraparound handling and loss of events due to modesetting is dealt > - * with in the DRM core code, as long as drivers call > - * drm_crtc_vblank_off() and drm_crtc_vblank_on() when disabling or > - * enabling a CRTC. > - * > - * This is deprecated and should not be used by new drivers. > - * Use &drm_crtc_funcs.get_vblank_counter instead. > - * > - * Returns: > - * > - * Raw vblank counter value. > - */ > - u32 (*get_vblank_counter) (struct drm_device *dev, unsigned int pipe); > - > - /** > - * @enable_vblank: > - * > - * Enable vblank interrupts for the CRTC specified with the pipe > - * argument. > - * > - * This is deprecated and should not be used by new drivers. > - * Use &drm_crtc_funcs.enable_vblank instead. > - * > - * Returns: > - * > - * Zero on success, appropriate errno if the given @crtc's vblank > - * interrupt cannot be enabled. > - */ > - int (*enable_vblank) (struct drm_device *dev, unsigned int pipe); > - > - /** > - * @disable_vblank: > - * > - * Disable vblank interrupts for the CRTC specified with the pipe > - * argument. > - * > - * This is deprecated and should not be used by new drivers. > - * Use &drm_crtc_funcs.disable_vblank instead. > - */ > - void (*disable_vblank) (struct drm_device *dev, unsigned int pipe); > - > - /** > - * @get_vblank_timestamp: > - * > - * Called by drm_get_last_vbltimestamp(). Should return a precise > - * timestamp when the most recent VBLANK interval ended or will end. > - * > - * Specifically, the timestamp in @vblank_time should correspond as > - * closely as possible to the time when the first video scanline of > - * the video frame after the end of VBLANK will start scanning out, > - * the time immediately after end of the VBLANK interval. If the > - * @crtc is currently inside VBLANK, this will be a time in the future. > - * If the @crtc is currently scanning out a frame, this will be the > - * past start time of the current scanout. This is meant to adhere > - * to the OpenML OML_sync_control extension specification. > - * > - * Paramters: > - * > - * dev: > - * dev DRM device handle. > - * pipe: > - * crtc for which timestamp should be returned. > - * max_error: > - * Maximum allowable timestamp error in nanoseconds. > - * Implementation should strive to provide timestamp > - * with an error of at most max_error nanoseconds. > - * Returns true upper bound on error for timestamp. > - * vblank_time: > - * Target location for returned vblank timestamp. > - * in_vblank_irq: > - * True when called from drm_crtc_handle_vblank(). Some drivers > - * need to apply some workarounds for gpu-specific vblank irq quirks > - * if flag is set. > - * > - * Returns: > - * > - * True on success, false on failure, which means the core should > - * fallback to a simple timestamp taken in drm_crtc_handle_vblank(). > - * > - * FIXME: > - * > - * We should move this hook to &struct drm_crtc_funcs like all the other > - * vblank hooks. > - */ > - bool (*get_vblank_timestamp) (struct drm_device *dev, unsigned int pipe, > - int *max_error, > - ktime_t *vblank_time, > - bool in_vblank_irq); > - > /** > * @irq_handler: > * > @@ -720,6 +622,9 @@ struct drm_driver { > int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv); > int (*dma_quiescent) (struct drm_device *); > int (*context_dtor) (struct drm_device *dev, int context); > + u32 (*get_vblank_counter)(struct drm_device *dev, unsigned int pipe); > + int (*enable_vblank)(struct drm_device *dev, unsigned int pipe); > + void (*disable_vblank)(struct drm_device *dev, unsigned int pipe); > int dev_priv_size; > }; > > -- > 2.24.1 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx