From 94bf657b2390a1cb72d748047e5c7014e4bc1752 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Wed, 3 Nov 2010 15:22:36 +0800 Subject: 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. --- src/gallium/state_trackers/egl/gdi/native_gdi.c | 29 +++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/gallium/state_trackers/egl/gdi') diff --git a/src/gallium/state_trackers/egl/gdi/native_gdi.c b/src/gallium/state_trackers/egl/gdi/native_gdi.c index 91701e5b7d..e010c1c4e6 100644 --- a/src/gallium/state_trackers/egl/gdi/native_gdi.c +++ b/src/gallium/state_trackers/egl/gdi/native_gdi.c @@ -159,6 +159,32 @@ gdi_surface_swap_buffers(struct native_surface *nsurf) return ret; } +static boolean +gdi_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 = gdi_surface_flush_frontbuffer(nsurf); + break; + case NATIVE_ATTACHMENT_BACK_LEFT: + ret = gdi_surface_swap_buffers(nsurf); + break; + default: + ret = FALSE; + break; + } + + return ret; +} + static boolean gdi_surface_validate(struct native_surface *nsurf, uint attachment_mask, unsigned int *seq_num, struct pipe_resource **textures, @@ -233,6 +259,7 @@ gdi_display_create_window_surface(struct native_display *ndpy, gsurf->base.destroy = gdi_surface_destroy; gsurf->base.swap_buffers = gdi_surface_swap_buffers; gsurf->base.flush_frontbuffer = gdi_surface_flush_frontbuffer; + xsurf->base.present = gdi_surface_present; gsurf->base.validate = gdi_surface_validate; gsurf->base.wait = gdi_surface_wait; @@ -321,6 +348,8 @@ gdi_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; -- cgit v1.2.3