summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stone <daniels@collabora.com>2012-01-12 14:31:26 (GMT)
committerDaniel Stone <daniels@collabora.com>2012-01-12 14:31:26 (GMT)
commit3a2f0f567a4f9c816b9015999fdf5ed81f568905 (patch)
tree82ebb26ed3f465f7a7f4442468c01e3083fde28e
parent05550b0daf287c307053c0e3cd1d6127e7b16522 (diff)
downloadxf86-video-ti81xx-3a2f0f567a4f9c816b9015999fdf5ed81f568905.tar.gz
xf86-video-ti81xx-3a2f0f567a4f9c816b9015999fdf5ed81f568905.tar.xz
Factor out completion event code
Signed-off-by: Daniel Stone <daniels@collabora.com>
-rw-r--r--src/xv.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/src/xv.c b/src/xv.c
index e964fdf..20339d8 100644
--- a/src/xv.c
+++ b/src/xv.c
@@ -309,6 +309,27 @@ static void ti81xx_video_buffer_put(ScrnInfoPtr xf86_screen,
buf->status = BUFFER_STATUS_FREE;
}
+static void ti81xx_video_completion_send(struct ti81xx_video_priv *video_priv,
+ ClientPtr client, uint32_t fb_id)
+{
+ xvEvent ev;
+
+ if (video_priv->xv_event_base == 0) {
+ ExtensionEntry *ext_entry = CheckExtension(XvName);
+ if (!ext_entry)
+ FatalError("ti81xx_video_buffer_ready: Couldn't look up Xv extension\n");
+ video_priv->xv_event_base = ext_entry->eventBase;
+ }
+
+ memset(&ev, 0, sizeof(ev));
+ ev.u.u.type = video_priv->xv_event_base + XvFrameNotify;
+ ev.u.u.sequenceNumber = client->sequence;
+ ev.u.frameNotify.time = GetTimeInMillis();
+ ev.u.frameNotify.port = video_priv->dix_port->id;
+ ev.u.frameNotify.fb_id = fb_id;
+ WriteEventsToClient(client, 1, (xEvent *) &ev);
+}
+
void ti81xx_video_buffer_ready(ScrnInfoPtr xf86_screen,
struct drm_ti81xx_event_buffer_ready *event)
{
@@ -317,7 +338,6 @@ void ti81xx_video_buffer_ready(ScrnInfoPtr xf86_screen,
struct ti81xx_buffer *buf;
int i, j, retire = 0;
uint32_t retire_fb_id;
- xvEvent ev;
ClientPtr client;
for (i = 0; i < screen_priv->num_video_ports; i++) {
@@ -372,19 +392,7 @@ void ti81xx_video_buffer_ready(ScrnInfoPtr xf86_screen,
if (!client)
return;
- memset(&ev, 0, sizeof(ev));
- if (video_priv->xv_event_base == 0) {
- ExtensionEntry *ext_entry = CheckExtension(XvName);
- if (!ext_entry)
- FatalError("ti81xx_video_buffer_ready: Couldn't look up Xv extension\n");
- video_priv->xv_event_base = ext_entry->eventBase;
- }
- ev.u.u.type = video_priv->xv_event_base + XvFrameNotify;
- ev.u.u.sequenceNumber = client->sequence;
- ev.u.frameNotify.time = GetTimeInMillis();
- ev.u.frameNotify.port = video_priv->dix_port->id;
- ev.u.frameNotify.fb_id = retire_fb_id;
- WriteEventsToClient(client, 1, (xEvent *) &ev);
+ ti81xx_video_completion_send(video_priv, client, retire_fb_id);
}
}