From d1e4117355f1db6ff87c837df6212bf6168e98a0 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Thu, 24 Feb 2011 12:59:41 +0100 Subject: 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 --- src/gallium/state_trackers/egl/common/native.h | 28 ++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/gallium/state_trackers/egl/common/native.h') diff --git a/src/gallium/state_trackers/egl/common/native.h b/src/gallium/state_trackers/egl/common/native.h index 42889075a3..9246f8c32a 100644 --- a/src/gallium/state_trackers/egl/common/native.h +++ b/src/gallium/state_trackers/egl/common/native.h @@ -141,6 +141,11 @@ struct native_display { */ struct pipe_screen *screen; + /** + * Context used for copy operations. + */ + struct pipe_context *pipe; + /** * Available for caller's use. */ @@ -223,6 +228,29 @@ native_attachment_mask_test(uint mask, enum native_attachment att) return !!(mask & (1 << att)); } +/** + * Get the display copy context + */ +static INLINE struct pipe_context * +ndpy_get_copy_context(struct native_display *ndpy) +{ + if (!ndpy->pipe) + ndpy->pipe = ndpy->screen->context_create(ndpy->screen, NULL); + return ndpy->pipe; +} + +/** + * Free display screen and context resources + */ +static INLINE void +ndpy_uninit(struct native_display *ndpy) +{ + if (ndpy->pipe) + ndpy->pipe->destroy(ndpy->pipe); + if (ndpy->screen) + ndpy->screen->destroy(ndpy->screen); +} + struct native_platform { const char *name; -- cgit v1.2.3