summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/egl/x11/native_dri2.c
diff options
context:
space:
mode:
authorChia-I Wu <olv@lunarg.com>2010-02-21 10:58:22 +0800
committerChia-I Wu <olv@lunarg.com>2010-03-05 10:19:05 +0800
commite38f28ddedd6d4902ae18b1bf243e67d4b16decb (patch)
tree30237b21b483746ecf2263c16ed380062e1fae53 /src/gallium/state_trackers/egl/x11/native_dri2.c
parent45df4bad9fc0379f05197bee10c03fd351f24094 (diff)
st/egl: Add event support to the native display interface.
There is only invalid_surface event right now. When EGL receives the event, it sets the force_validate flag of the context binding to the surface. This helps skip an unnecessary check.
Diffstat (limited to 'src/gallium/state_trackers/egl/x11/native_dri2.c')
-rw-r--r--src/gallium/state_trackers/egl/x11/native_dri2.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/gallium/state_trackers/egl/x11/native_dri2.c b/src/gallium/state_trackers/egl/x11/native_dri2.c
index 74d3d104b9..858033e1c1 100644
--- a/src/gallium/state_trackers/egl/x11/native_dri2.c
+++ b/src/gallium/state_trackers/egl/x11/native_dri2.c
@@ -48,6 +48,8 @@ struct dri2_display {
Display *dpy;
boolean own_dpy;
+ struct native_event_handler *event_handler;
+
struct drm_api *api;
struct x11_screen *xscr;
int xscr_number;
@@ -324,8 +326,11 @@ dri2_surface_flush_frontbuffer(struct native_surface *nsurf)
DRI2BufferFakeFrontLeft, DRI2BufferFrontLeft);
/* force buffers to be updated in next validation call */
- if (!dri2_surface_receive_events(&dri2surf->base))
+ if (!dri2_surface_receive_events(&dri2surf->base)) {
dri2surf->server_stamp++;
+ dri2dpy->event_handler->invalid_surface(&dri2dpy->base,
+ &dri2surf->base, dri2surf->server_stamp);
+ }
return TRUE;
}
@@ -353,8 +358,11 @@ dri2_surface_swap_buffers(struct native_surface *nsurf)
DRI2BufferFrontLeft, DRI2BufferFakeFrontLeft);
/* force buffers to be updated in next validation call */
- if (!dri2_surface_receive_events(&dri2surf->base))
+ if (!dri2_surface_receive_events(&dri2surf->base)) {
dri2surf->server_stamp++;
+ dri2dpy->event_handler->invalid_surface(&dri2dpy->base,
+ &dri2surf->base, dri2surf->server_stamp);
+ }
return TRUE;
}
@@ -737,7 +745,10 @@ dri2_display_invalidate_buffers(struct x11_screen *xscr, Drawable drawable,
return;
dri2surf = dri2_surface(nsurf);
+
dri2surf->server_stamp++;
+ dri2dpy->event_handler->invalid_surface(&dri2dpy->base,
+ &dri2surf->base, dri2surf->server_stamp);
}
/**
@@ -796,7 +807,9 @@ dri2_display_hash_table_compare(void *key1, void *key2)
}
struct native_display *
-x11_create_dri2_display(EGLNativeDisplayType dpy, struct drm_api *api)
+x11_create_dri2_display(EGLNativeDisplayType dpy,
+ struct native_event_handler *event_handler,
+ struct drm_api *api)
{
struct dri2_display *dri2dpy;
@@ -804,6 +817,7 @@ x11_create_dri2_display(EGLNativeDisplayType dpy, struct drm_api *api)
if (!dri2dpy)
return NULL;
+ dri2dpy->event_handler = event_handler;
dri2dpy->api = api;
dri2dpy->dpy = dpy;