summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/egl/common/egl_g3d_api.c
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2011-02-24 12:59:41 +0100
committerThomas Hellstrom <thellstrom@vmware.com>2011-03-01 10:36:18 +0100
commitd1e4117355f1db6ff87c837df6212bf6168e98a0 (patch)
tree04a254ee07a5574c2ba9c08e812e46e6554fc91d /src/gallium/state_trackers/egl/common/egl_g3d_api.c
parent186d3bc7a3389b78a851e34d8f970c28b8db1608 (diff)
st/egl: Move the copy context to the native display structure
This makes it usable also for native helpers. Also add inline functions to access the context and to uninit the native display structure. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Diffstat (limited to 'src/gallium/state_trackers/egl/common/egl_g3d_api.c')
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d_api.c15
1 files changed, 6 insertions, 9 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 c9f94a3c49..2068256dff 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
@@ -640,6 +640,7 @@ egl_g3d_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
_EGLContext *ctx = _eglGetCurrentContext();
struct native_surface *nsurf;
struct pipe_resource *ptex;
+ struct pipe_context *pipe;
if (!gsurf->render_texture)
return EGL_TRUE;
@@ -655,22 +656,18 @@ egl_g3d_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, NULL);
}
- /* create a pipe context to copy surfaces */
- if (!gdpy->pipe) {
- gdpy->pipe =
- gdpy->native->screen->context_create(gdpy->native->screen, NULL);
- if (!gdpy->pipe)
- return EGL_FALSE;
- }
+ pipe = ndpy_get_copy_context(gdpy->native);
+ if (!pipe)
+ return EGL_FALSE;
ptex = get_pipe_resource(gdpy->native, nsurf, NATIVE_ATTACHMENT_FRONT_LEFT);
if (ptex) {
struct pipe_box src_box;
u_box_origin_2d(ptex->width0, ptex->height0, &src_box);
- gdpy->pipe->resource_copy_region(gdpy->pipe, ptex, 0, 0, 0, 0,
+ pipe->resource_copy_region(pipe, ptex, 0, 0, 0, 0,
gsurf->render_texture, 0, &src_box);
- gdpy->pipe->flush(gdpy->pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
+ pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
nsurf->present(nsurf, NATIVE_ATTACHMENT_FRONT_LEFT, FALSE, 0);
pipe_resource_reference(&ptex, NULL);