summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/egl/common
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2011-09-02 21:26:24 +0800
committerChia-I Wu <[email protected]>2011-09-08 11:16:11 +0800
commit08e1076fd2d3f6fb879dd2529e7d035d6a399da2 (patch)
treeaeec3914333754dc2745c4f747a3a6bc69f4a1e0 /src/gallium/state_trackers/egl/common
parentc0470bf77a038fd45441d1e55e6c89100996ff4b (diff)
st/egl: add native_present_control
Replace the parameters of native_surface::present by a struct, native_present_control. Using a struct allows us to add more control options without having to update each backend every time.
Diffstat (limited to 'src/gallium/state_trackers/egl/common')
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d_api.c11
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d_st.c7
-rw-r--r--src/gallium/state_trackers/egl/common/native.h18
-rw-r--r--src/gallium/state_trackers/egl/common/native_helper.c6
4 files changed, 32 insertions, 10 deletions
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_api.c b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
index f897054a540..27bc8be4e48 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
@@ -551,6 +551,7 @@ egl_g3d_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf)
struct egl_g3d_surface *gsurf = egl_g3d_surface(surf);
_EGLContext *ctx = _eglGetCurrentContext();
struct egl_g3d_context *gctx = NULL;
+ struct native_present_control ctrl;
/* no-op for pixmap or pbuffer surface */
if (gsurf->base.Type == EGL_PIXMAP_BIT ||
@@ -569,10 +570,12 @@ egl_g3d_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf)
gctx->stctxi->flush(gctx->stctxi, ST_FLUSH_FRONT, NULL);
}
- return gsurf->native->present(gsurf->native,
- NATIVE_ATTACHMENT_BACK_LEFT,
- gsurf->base.SwapBehavior == EGL_BUFFER_PRESERVED,
- gsurf->base.SwapInterval);
+ memset(&ctrl, 0, sizeof(ctrl));
+ ctrl.natt = NATIVE_ATTACHMENT_BACK_LEFT;
+ ctrl.preserve = (gsurf->base.SwapBehavior == EGL_BUFFER_PRESERVED);
+ ctrl.swap_interval = gsurf->base.SwapInterval;
+
+ return gsurf->native->present(gsurf->native, &ctrl);
}
static EGLBoolean
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_st.c b/src/gallium/state_trackers/egl/common/egl_g3d_st.c
index b839f848d7b..50ed669ba30 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_st.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_st.c
@@ -192,9 +192,12 @@ egl_g3d_st_framebuffer_flush_front(struct st_framebuffer_iface *stfbi,
{
_EGLSurface *surf = (_EGLSurface *) stfbi->st_manager_private;
struct egl_g3d_surface *gsurf = egl_g3d_surface(surf);
+ struct native_present_control ctrl;
- return gsurf->native->present(gsurf->native,
- NATIVE_ATTACHMENT_FRONT_LEFT, FALSE, 0);
+ memset(&ctrl, 0, sizeof(ctrl));
+ ctrl.natt = NATIVE_ATTACHMENT_FRONT_LEFT;
+
+ return gsurf->native->present(gsurf->native, &ctrl);
}
static boolean
diff --git a/src/gallium/state_trackers/egl/common/native.h b/src/gallium/state_trackers/egl/common/native.h
index 58593a489cd..0c86b752c92 100644
--- a/src/gallium/state_trackers/egl/common/native.h
+++ b/src/gallium/state_trackers/egl/common/native.h
@@ -73,6 +73,20 @@ enum native_param_type {
NATIVE_PARAM_MAX_SWAP_INTERVAL
};
+/**
+ * Control how a surface presentation should happen.
+ */
+struct native_present_control {
+ /**< the attachment to present */
+ enum native_attachment natt;
+
+ /**< the contents of the presented attachment should be preserved */
+ boolean preserve;
+
+ /**< wait until the given vsyncs has passed since the last presentation */
+ uint swap_interval;
+};
+
struct native_surface {
/**
* Available for caller's use.
@@ -85,9 +99,7 @@ struct native_surface {
* Present the given buffer to the native engine.
*/
boolean (*present)(struct native_surface *nsurf,
- enum native_attachment natt,
- boolean preserve,
- uint swap_interval);
+ const struct native_present_control *ctrl);
/**
* Validate the buffers of the surface. textures, if not NULL, points to an
diff --git a/src/gallium/state_trackers/egl/common/native_helper.c b/src/gallium/state_trackers/egl/common/native_helper.c
index cca1e1c6295..ebe5144b367 100644
--- a/src/gallium/state_trackers/egl/common/native_helper.c
+++ b/src/gallium/state_trackers/egl/common/native_helper.c
@@ -393,12 +393,16 @@ native_display_copy_to_pixmap(struct native_display *ndpy,
dst = tmp[natt];
if (dst && dst->format == src->format) {
+ struct native_present_control ctrl;
struct pipe_box src_box;
u_box_origin_2d(src->width0, src->height0, &src_box);
pipe->resource_copy_region(pipe, dst, 0, 0, 0, 0, src, 0, &src_box);
pipe->flush(pipe, NULL);
- nsurf->present(nsurf, natt, FALSE, 0);
+
+ memset(&ctrl, 0, sizeof(ctrl));
+ ctrl.natt = natt;
+ nsurf->present(nsurf, &ctrl);
}
if (dst)