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. --- .../state_trackers/egl/fbdev/native_fbdev.c | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src/gallium/state_trackers/egl/fbdev') diff --git a/src/gallium/state_trackers/egl/fbdev/native_fbdev.c b/src/gallium/state_trackers/egl/fbdev/native_fbdev.c index e459402076..728dba3ff4 100644 --- a/src/gallium/state_trackers/egl/fbdev/native_fbdev.c +++ b/src/gallium/state_trackers/egl/fbdev/native_fbdev.c @@ -137,6 +137,32 @@ fbdev_surface_swap_buffers(struct native_surface *nsurf) return ret; } +static boolean +fbdev_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 = fbdev_surface_flush_frontbuffer(nsurf); + break; + case NATIVE_ATTACHMENT_BACK_LEFT: + ret = fbdev_surface_swap_buffers(nsurf); + break; + default: + ret = FALSE; + break; + } + + return ret; +} + static void fbdev_surface_wait(struct native_surface *nsurf) { @@ -183,6 +209,7 @@ fbdev_display_create_scanout_surface(struct native_display *ndpy, fbsurf->base.destroy = fbdev_surface_destroy; fbsurf->base.swap_buffers = fbdev_surface_swap_buffers; fbsurf->base.flush_frontbuffer = fbdev_surface_flush_frontbuffer; + fbsurf->base.present = fbdev_surface_present; fbsurf->base.validate = fbdev_surface_validate; fbsurf->base.wait = fbdev_surface_wait; @@ -279,6 +306,9 @@ fbdev_display_get_param(struct native_display *ndpy, int val; switch (param) { + case NATIVE_PARAM_USE_NATIVE_BUFFER: + case NATIVE_PARAM_PRESERVE_BUFFER: + case NATIVE_PARAM_MAX_SWAP_INTERVAL: default: val = 0; break; -- cgit v1.2.3