From: Keith Packard <keithp@keithp.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: Dave Airlie <airlied@redhat.com>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] drm: Reorganize drm_pending_event to support future event types
Date: Thu, 06 Jul 2017 08:36:00 -0700 [thread overview]
Message-ID: <864lupd1cv.fsf@keithp.com> (raw)
In-Reply-To: <20170706073049.mfmjvujx4szf6qji@phenom.ffwll.local>
[-- Attachment #1.1: Type: text/plain, Size: 2699 bytes --]
Daniel Vetter <daniel@ffwll.ch> writes:
> A few nits below, but looks good otherwise.
Thanks.
>> static struct drm_pending_vblank_event *create_vblank_event(
>> - struct drm_device *dev, uint64_t user_data)
>> + struct drm_device *dev, struct drm_crtc *crtc, uint64_t user_data)
>
> Nit: Please also drop the dev argument, we have crtc->dev easily
> available. That fits better into my long-term goal of getting rid of the
> (dev, pipe) pairs everywhere in the vblank code and fully switching over
> to drm_crtc *.
As 'dev' isn't used anyways, this seems like a fine plan.
>> + switch (e->event.base.type) {
>> + case DRM_EVENT_VBLANK:
>> + case DRM_EVENT_FLIP_COMPLETE:
>> + if (seq)
>> + e->event.vbl.sequence = (u32) seq;
>> + if (now) {
>> + e->event.vbl.tv_sec = now->tv_sec;
>> + e->event.vbl.tv_usec = now->tv_nsec / 1000;
>> + }
>> + break;
>> + }
>
> Not sure why this change? Also prep for the new, presumably extended
> events? Seems at least slightly inconsistent with other paths, where we
> still unconditionally fill it in.
Yes, this prepares for the new events to make that patch smaller. The
places where the data are still unconditionally assigned should know
that the event in the struct is either a VBLANK or FLIP_COMPLETE.
>> + struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
>
> This'll oops on ums drivers since kms isn't set up.
How about this fix?
diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 857b7cf011e1..e39b2bd074e4 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -1355,7 +1355,6 @@ static int drm_queue_vblank_event(struct drm_device *dev, unsigned int pipe,
union drm_wait_vblank *vblwait,
struct drm_file *file_priv)
{
- struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
struct drm_pending_vblank_event *e;
struct timespec now;
@@ -1373,7 +1372,12 @@ static int drm_queue_vblank_event(struct drm_device *dev, unsigned int pipe,
e->event.base.type = DRM_EVENT_VBLANK;
e->event.base.length = sizeof(e->event.vbl);
e->event.vbl.user_data = vblwait->request.signal;
- e->event.vbl.crtc_id = crtc ? crtc->base.id : 0;
+ e->event.vbl.crtc_id = 0;
+ if (drm_core_check_feature(dev, DRIVER_MODESET)) {
+ struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
+ if (crtc)
+ e->event.vbl.crtc_id = crtc->base.id;
+ }
spin_lock_irqsave(&dev->event_lock, flags);
> Or maybe I shouldn't have told you this and seized this opportunity to
> break all the old drivers :-)
You now know my evil plan :-)
--
-keith
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
WARNING: multiple messages have this Message-ID (diff)
From: Keith Packard <keithp@keithp.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: linux-kernel@vger.kernel.org, Dave Airlie <airlied@redhat.com>,
Daniel Vetter <daniel@ffwll.ch>,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 2/3] drm: Reorganize drm_pending_event to support future event types
Date: Thu, 06 Jul 2017 08:36:00 -0700 [thread overview]
Message-ID: <864lupd1cv.fsf@keithp.com> (raw)
In-Reply-To: <20170706073049.mfmjvujx4szf6qji@phenom.ffwll.local>
[-- Attachment #1: Type: text/plain, Size: 2699 bytes --]
Daniel Vetter <daniel@ffwll.ch> writes:
> A few nits below, but looks good otherwise.
Thanks.
>> static struct drm_pending_vblank_event *create_vblank_event(
>> - struct drm_device *dev, uint64_t user_data)
>> + struct drm_device *dev, struct drm_crtc *crtc, uint64_t user_data)
>
> Nit: Please also drop the dev argument, we have crtc->dev easily
> available. That fits better into my long-term goal of getting rid of the
> (dev, pipe) pairs everywhere in the vblank code and fully switching over
> to drm_crtc *.
As 'dev' isn't used anyways, this seems like a fine plan.
>> + switch (e->event.base.type) {
>> + case DRM_EVENT_VBLANK:
>> + case DRM_EVENT_FLIP_COMPLETE:
>> + if (seq)
>> + e->event.vbl.sequence = (u32) seq;
>> + if (now) {
>> + e->event.vbl.tv_sec = now->tv_sec;
>> + e->event.vbl.tv_usec = now->tv_nsec / 1000;
>> + }
>> + break;
>> + }
>
> Not sure why this change? Also prep for the new, presumably extended
> events? Seems at least slightly inconsistent with other paths, where we
> still unconditionally fill it in.
Yes, this prepares for the new events to make that patch smaller. The
places where the data are still unconditionally assigned should know
that the event in the struct is either a VBLANK or FLIP_COMPLETE.
>> + struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
>
> This'll oops on ums drivers since kms isn't set up.
How about this fix?
diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 857b7cf011e1..e39b2bd074e4 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -1355,7 +1355,6 @@ static int drm_queue_vblank_event(struct drm_device *dev, unsigned int pipe,
union drm_wait_vblank *vblwait,
struct drm_file *file_priv)
{
- struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
struct drm_pending_vblank_event *e;
struct timespec now;
@@ -1373,7 +1372,12 @@ static int drm_queue_vblank_event(struct drm_device *dev, unsigned int pipe,
e->event.base.type = DRM_EVENT_VBLANK;
e->event.base.length = sizeof(e->event.vbl);
e->event.vbl.user_data = vblwait->request.signal;
- e->event.vbl.crtc_id = crtc ? crtc->base.id : 0;
+ e->event.vbl.crtc_id = 0;
+ if (drm_core_check_feature(dev, DRIVER_MODESET)) {
+ struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
+ if (crtc)
+ e->event.vbl.crtc_id = crtc->base.id;
+ }
spin_lock_irqsave(&dev->event_lock, flags);
> Or maybe I shouldn't have told you this and seized this opportunity to
> break all the old drivers :-)
You now know my evil plan :-)
--
-keith
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
next prev parent reply other threads:[~2017-07-06 15:36 UTC|newest]
Thread overview: 82+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-05 22:10 [PATCH 0/3] drm: Add CRTC-id based ioctls for vblank query/event Keith Packard
2017-07-05 22:10 ` Keith Packard
2017-07-05 22:10 ` [PATCH 1/3] drm: Widen vblank count to 64 bits. Change vblank time precision to ns Keith Packard
2017-07-05 22:10 ` Keith Packard
2017-07-06 7:19 ` Daniel Vetter
2017-07-06 7:19 ` Daniel Vetter
2017-07-06 14:59 ` Keith Packard
2017-07-06 14:59 ` Keith Packard
2017-07-07 12:16 ` Daniel Vetter
2017-07-07 12:16 ` Daniel Vetter
2017-07-25 20:54 ` Keith Packard
2017-07-25 20:54 ` Keith Packard
2017-07-06 7:45 ` Michel Dänzer
2017-07-06 7:45 ` Michel Dänzer
2017-07-06 8:05 ` Michel Dänzer
2017-07-06 8:05 ` Michel Dänzer
2017-07-06 15:11 ` Keith Packard
2017-07-06 15:04 ` Keith Packard
2017-07-06 15:04 ` Keith Packard
2017-07-07 1:34 ` Michel Dänzer
2017-07-07 1:34 ` Michel Dänzer
2017-07-07 2:05 ` Michel Dänzer
2017-07-07 2:05 ` Michel Dänzer
2017-07-05 22:10 ` [PATCH 2/3] drm: Reorganize drm_pending_event to support future event types Keith Packard
2017-07-05 22:10 ` Keith Packard
2017-07-06 7:30 ` Daniel Vetter
2017-07-06 15:36 ` Keith Packard [this message]
2017-07-06 15:36 ` Keith Packard
2017-07-07 12:05 ` Daniel Vetter
2017-07-07 12:05 ` Daniel Vetter
2017-07-05 22:10 ` [PATCH 3/3] drm: Add CRTC_GET_SEQUENCE and CRTC_QUEUE_SEQUENCE ioctls Keith Packard
2017-07-05 22:10 ` Keith Packard
2017-07-06 7:53 ` Daniel Vetter
2017-07-06 10:16 ` Ville Syrjälä
2017-07-06 10:16 ` Ville Syrjälä
2017-07-06 11:04 ` Daniel Vetter
2017-07-06 14:08 ` Ville Syrjälä
2017-07-06 16:28 ` Keith Packard
2017-07-06 16:28 ` Keith Packard
2017-07-06 17:59 ` Ville Syrjälä
2017-07-06 17:59 ` Ville Syrjälä
2017-07-06 18:22 ` Keith Packard
2017-07-06 18:22 ` Keith Packard
2017-07-06 18:59 ` Ville Syrjälä
2017-07-06 18:59 ` Ville Syrjälä
2017-07-06 19:46 ` Keith Packard
2017-07-06 19:46 ` Keith Packard
2017-07-06 16:27 ` Keith Packard
2017-07-06 16:27 ` Keith Packard
2017-07-06 21:49 ` Daniel Vetter
2017-07-06 21:49 ` Daniel Vetter
2017-08-01 5:03 ` [PATCH 0/3] drm: Add CRTC-id based ioctls for vblank query/event Keith Packard
2017-08-01 5:03 ` Keith Packard
2017-08-01 5:03 ` [PATCH 1/3] drm: Widen vblank UAPI to 64 bits. Change vblank time to ktime_t [v2] Keith Packard
2017-08-01 5:03 ` Keith Packard
2017-08-02 8:53 ` Daniel Vetter
2017-08-02 8:53 ` Daniel Vetter
2017-08-02 9:41 ` Michel Dänzer
2017-08-02 9:41 ` Michel Dänzer
2017-08-06 17:35 ` Keith Packard
2017-08-06 17:35 ` Keith Packard
2017-08-01 5:03 ` [PATCH 2/3] drm: Reorganize drm_pending_event to support future event types [v2] Keith Packard
2017-08-02 9:05 ` Daniel Vetter
2017-08-01 5:03 ` [PATCH 3/3] drm: Add CRTC_GET_SEQUENCE and CRTC_QUEUE_SEQUENCE ioctls [v2] Keith Packard
2017-08-01 5:03 ` Keith Packard
2017-08-02 9:25 ` Daniel Vetter
2017-08-02 9:25 ` Daniel Vetter
2017-08-06 3:32 ` Keith Packard
2017-08-06 3:32 ` Keith Packard
2017-08-07 3:02 ` Michel Dänzer
2017-08-07 3:02 ` Michel Dänzer
2017-08-07 8:34 ` Daniel Vetter
2017-08-07 8:34 ` Daniel Vetter
2017-10-09 17:18 ` Keith Packard
2017-10-09 17:18 ` Keith Packard
2017-10-10 8:55 ` Daniel Vetter
2017-10-10 8:55 ` Daniel Vetter
2017-08-02 9:45 ` Michel Dänzer
2017-08-06 3:42 ` Keith Packard
2017-08-06 3:42 ` Keith Packard
2017-08-07 3:03 ` Michel Dänzer
2017-08-07 3:03 ` Michel Dänzer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=864lupd1cv.fsf@keithp.com \
--to=keithp@keithp.com \
--cc=airlied@redhat.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.