From: Paulo Zanoni <przanoni@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org, Paulo Zanoni <paulo.r.zanoni@intel.com>
Subject: [RFC 5/7] drm: change the drm vblank callback item type
Date: Wed, 19 Nov 2014 17:47:13 -0200 [thread overview]
Message-ID: <1416426435-2237-7-git-send-email-przanoni@gmail.com> (raw)
In-Reply-To: <1416426435-2237-1-git-send-email-przanoni@gmail.com>
From: Paulo Zanoni <paulo.r.zanoni@intel.com>
Now that we have created drm_vblank_wait_item, let's use it as the
type passed. In the future, callers will have to use container_of to
find our their original allocated structure, just like we're doing
with the send_vblank_event() callback.
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
drivers/gpu/drm/drm_irq.c | 40 ++++++++++++++++++-------------------
drivers/gpu/drm/i915/i915_debugfs.c | 4 +++-
include/drm/drmP.h | 4 +++-
3 files changed, 26 insertions(+), 22 deletions(-)
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index a82e5ca..4c03240 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -881,10 +881,13 @@ u32 drm_vblank_count_and_time(struct drm_device *dev, int crtc,
EXPORT_SYMBOL(drm_vblank_count_and_time);
static void send_vblank_event(struct drm_device *dev,
- struct drm_pending_vblank_event *e,
+ struct drm_vblank_wait_item *item,
unsigned long seq, struct timeval *now,
bool premature)
{
+ struct drm_pending_vblank_event *e =
+ container_of(item, struct drm_pending_vblank_event, item);
+
WARN_ON_SMP(!spin_is_locked(&dev->event_lock));
e->event.sequence = seq;
e->event.tv_sec = now->tv_sec;
@@ -919,7 +922,7 @@ void drm_send_vblank_event(struct drm_device *dev, int crtc,
now = get_drm_timestamp();
}
e->item.pipe = crtc;
- send_vblank_event(dev, e, seq, &now, false);
+ send_vblank_event(dev, &e->item, seq, &now, false);
}
EXPORT_SYMBOL(drm_send_vblank_event);
@@ -1109,18 +1112,18 @@ void drm_crtc_wait_one_vblank(struct drm_crtc *crtc)
EXPORT_SYMBOL(drm_crtc_wait_one_vblank);
static void drm_wait_vblank_callback(struct drm_device *dev,
- struct drm_pending_vblank_event *e,
+ struct drm_vblank_wait_item *item,
unsigned long seq, struct timeval *now,
bool premature)
{
- if (e->item.callback_from_work) {
- e->item.callback_args.dev = dev;
- e->item.callback_args.seq = seq;
- e->item.callback_args.now = now;
- e->item.callback_args.premature = premature;
- schedule_work(&e->item.callback_work);
+ if (item->callback_from_work) {
+ item->callback_args.dev = dev;
+ item->callback_args.seq = seq;
+ item->callback_args.now = now;
+ item->callback_args.premature = premature;
+ schedule_work(&item->callback_work);
} else {
- e->item.callback(dev, e, seq, now, premature);
+ item->callback(dev, item, seq, now, premature);
}
}
@@ -1176,7 +1179,7 @@ void drm_vblank_off(struct drm_device *dev, int crtc)
e->item.wanted_seq, seq);
list_del(&e->base.link);
drm_vblank_put(dev, e->item.pipe);
- drm_wait_vblank_callback(dev, e, seq, &now, true);
+ drm_wait_vblank_callback(dev, &e->item, seq, &now, true);
}
spin_unlock_irqrestore(&dev->event_lock, irqflags);
}
@@ -1390,14 +1393,11 @@ int drm_modeset_ctl(struct drm_device *dev, void *data,
static void drm_vblank_event_work_func(struct work_struct *work)
{
- struct drm_pending_vblank_event *e =
- container_of(work, struct drm_pending_vblank_event,
- item.callback_work);
+ struct drm_vblank_wait_item *item =
+ container_of(work, struct drm_vblank_wait_item, callback_work);
- e->item.callback(e->item.callback_args.dev, e,
- e->item.callback_args.seq,
- e->item.callback_args.now,
- e->item.callback_args.premature);
+ item->callback(item->callback_args.dev, item, item->callback_args.seq,
+ item->callback_args.now, item->callback_args.premature);
}
static int drm_queue_vblank_event(struct drm_device *dev, int pipe,
@@ -1472,7 +1472,7 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe,
e->item.wanted_seq = vblwait->request.sequence;
if ((seq - vblwait->request.sequence) <= (1 << 23)) {
drm_vblank_put(dev, pipe);
- drm_wait_vblank_callback(dev, e, seq, &now, false);
+ drm_wait_vblank_callback(dev, &e->item, seq, &now, false);
vblwait->reply.sequence = seq;
} else {
/* drm_handle_vblank_events will call drm_vblank_put */
@@ -1654,7 +1654,7 @@ static void drm_handle_vblank_events(struct drm_device *dev, int crtc)
list_del(&e->base.link);
drm_vblank_put(dev, e->item.pipe);
- drm_wait_vblank_callback(dev, e, seq, &now, false);
+ drm_wait_vblank_callback(dev, &e->item, seq, &now, false);
}
trace_drm_vblank_event(crtc, seq);
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 95cf6d3..b5c3f81 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -2722,10 +2722,12 @@ struct vblank_data {
};
static void vblank_callback(struct drm_device *dev,
- struct drm_pending_vblank_event *e,
+ struct drm_vblank_wait_item *item,
unsigned long seq, struct timeval *now,
bool premature)
{
+ struct drm_pending_vblank_event *e =
+ container_of(item, struct drm_pending_vblank_event, item);
struct vblank_data *data = (struct vblank_data *)e->event.user_data;
WARN_ON(data->can_sleep != drm_can_sleep());
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index dcec05b..474c892 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -660,8 +660,10 @@ struct drm_minor {
struct drm_mode_group mode_group;
};
+struct drm_vblank_wait_item;
+
typedef void (*drm_vblank_callback_t)(struct drm_device *dev,
- struct drm_pending_vblank_event *e,
+ struct drm_vblank_wait_item *item,
unsigned long seq, struct timeval *now,
bool premature);
--
2.1.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2014-11-19 19:47 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-19 19:47 [RFC 0/7+1] Add in-kernel vblank delaying mechanism Paulo Zanoni
2014-11-19 19:47 ` [RFC] drm: add a mechanism for drivers to schedule vblank callbacks Paulo Zanoni
2014-12-03 2:13 ` [Intel-gfx] " Matt Roper
2014-11-19 19:47 ` [RFC 1/7] drm: allow the drivers to call the vblank IOCTL internally Paulo Zanoni
2014-12-03 2:14 ` Matt Roper
2014-11-19 19:47 ` [RFC 2/7] drm: allow drm_wait_vblank_kernel() callback from workqueues Paulo Zanoni
2014-12-05 0:34 ` [Intel-gfx] " Matt Roper
2014-11-19 19:47 ` [RFC 3/7] drm: introduce struct drm_vblank_wait_item Paulo Zanoni
2014-12-05 2:27 ` Matt Roper
2014-11-19 19:47 ` [RFC 4/7] drm: add wanted_seq to drm_vblank_wait_item Paulo Zanoni
2014-11-19 19:47 ` Paulo Zanoni [this message]
2014-11-19 19:47 ` [RFC 6/7] drm: make vblank_event_list handle drm_vblank_wait_item types Paulo Zanoni
2014-12-05 2:27 ` [Intel-gfx] " Matt Roper
2014-11-19 19:47 ` [RFC 7/7] drm: make the callers of drm_wait_vblank() allocate the memory Paulo Zanoni
2014-11-26 17:19 ` [RFC 0/7+1] Add in-kernel vblank delaying mechanism Daniel Vetter
2014-11-26 23:25 ` Dave Airlie
2014-11-27 10:06 ` Daniel Vetter
2014-12-04 17:09 ` Daniel Vetter
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=1416426435-2237-7-git-send-email-przanoni@gmail.com \
--to=przanoni@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=paulo.r.zanoni@intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox