diff options
author | Chia-I Wu <olv@lunarg.com> | 2010-11-03 15:22:36 +0800 |
---|---|---|
committer | Chia-I Wu <olv@lunarg.com> | 2010-11-03 16:04:59 +0800 |
commit | 94bf657b2390a1cb72d748047e5c7014e4bc1752 (patch) | |
tree | 3b204d554ccec7b2406a58bab74bf2494c661f2f /src/gallium/state_trackers/egl/x11 | |
parent | c9186bd5886f4e05fd62a98d42404eda2a99416c (diff) |
st/egl: Add native_surface::present callback.
The callback presents the given attachment to the native engine. It
allows the swap behavior and interval to be controlled. It will replace
native_surface::flush_frontbuffer and native_surface::swap_buffers
shortly.
Diffstat (limited to 'src/gallium/state_trackers/egl/x11')
-rw-r--r-- | src/gallium/state_trackers/egl/x11/native_dri2.c | 34 | ||||
-rw-r--r-- | src/gallium/state_trackers/egl/x11/native_ximage.c | 29 |
2 files changed, 62 insertions, 1 deletions
diff --git a/src/gallium/state_trackers/egl/x11/native_dri2.c b/src/gallium/state_trackers/egl/x11/native_dri2.c index 1169e273c3..a8df58a076 100644 --- a/src/gallium/state_trackers/egl/x11/native_dri2.c +++ b/src/gallium/state_trackers/egl/x11/native_dri2.c @@ -338,6 +338,32 @@ dri2_surface_swap_buffers(struct native_surface *nsurf) } static boolean +dri2_surface_present(struct native_surface *nsurf, + enum native_attachment natt, + boolean preserve, + uint swap_interval) +{ + boolean ret; + + if (swap_interval) + return FALSE; + + switch (natt) { + case NATIVE_ATTACHMENT_FRONT_LEFT: + ret = dri2_surface_flush_frontbuffer(nsurf); + break; + case NATIVE_ATTACHMENT_BACK_LEFT: + ret = dri2_surface_swap_buffers(nsurf); + break; + default: + ret = FALSE; + break; + } + + return ret; +} + +static boolean dri2_surface_validate(struct native_surface *nsurf, uint attachment_mask, unsigned int *seq_num, struct pipe_resource **textures, int *width, int *height) @@ -432,6 +458,7 @@ dri2_display_create_surface(struct native_display *ndpy, dri2surf->base.destroy = dri2_surface_destroy; dri2surf->base.swap_buffers = dri2_surface_swap_buffers; dri2surf->base.flush_frontbuffer = dri2_surface_flush_frontbuffer; + dri2surf->base.present = dri2_surface_present; dri2surf->base.validate = dri2_surface_validate; dri2surf->base.wait = dri2_surface_wait; @@ -630,9 +657,14 @@ dri2_display_get_param(struct native_display *ndpy, switch (param) { case NATIVE_PARAM_USE_NATIVE_BUFFER: - /* DRI2GetBuffers use the native buffers */ + /* DRI2GetBuffers uses the native buffers */ + val = TRUE; + break; + case NATIVE_PARAM_PRESERVE_BUFFER: + /* DRI2CopyRegion is used */ val = TRUE; break; + case NATIVE_PARAM_MAX_SWAP_INTERVAL: default: val = 0; break; diff --git a/src/gallium/state_trackers/egl/x11/native_ximage.c b/src/gallium/state_trackers/egl/x11/native_ximage.c index 4b32f6e36e..8e1ea4f45c 100644 --- a/src/gallium/state_trackers/egl/x11/native_ximage.c +++ b/src/gallium/state_trackers/egl/x11/native_ximage.c @@ -175,6 +175,32 @@ ximage_surface_swap_buffers(struct native_surface *nsurf) } static boolean +ximage_surface_present(struct native_surface *nsurf, + enum native_attachment natt, + boolean preserve, + uint swap_interval) +{ + boolean ret; + + if (preserve || swap_interval) + return FALSE; + + switch (natt) { + case NATIVE_ATTACHMENT_FRONT_LEFT: + ret = ximage_surface_flush_frontbuffer(nsurf); + break; + case NATIVE_ATTACHMENT_BACK_LEFT: + ret = ximage_surface_swap_buffers(nsurf); + break; + default: + ret = FALSE; + break; + } + + return ret; +} + +static boolean ximage_surface_validate(struct native_surface *nsurf, uint attachment_mask, unsigned int *seq_num, struct pipe_resource **textures, int *width, int *height) @@ -259,6 +285,7 @@ ximage_display_create_surface(struct native_display *ndpy, xsurf->base.destroy = ximage_surface_destroy; xsurf->base.swap_buffers = ximage_surface_swap_buffers; xsurf->base.flush_frontbuffer = ximage_surface_flush_frontbuffer; + xsurf->base.present = ximage_surface_present; xsurf->base.validate = ximage_surface_validate; xsurf->base.wait = ximage_surface_wait; @@ -416,6 +443,8 @@ ximage_display_get_param(struct native_display *ndpy, /* private buffers are allocated */ val = FALSE; break; + case NATIVE_PARAM_PRESERVE_BUFFER: + case NATIVE_PARAM_MAX_SWAP_INTERVAL: default: val = 0; break; |