From 3a3a31bf88c42890fbc2e4211981f97bd43dff4a Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sun, 7 Feb 2010 20:17:48 +0800 Subject: winsys/xlib, st/es: Advertise st_api.h support. This is done by defining one of st_module_OpenGL_ES1, st_module_OpenGL_ES2, and st_module_OpenGL. --- src/gallium/targets/libgl-xlib/xlib.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/gallium/targets/libgl-xlib') diff --git a/src/gallium/targets/libgl-xlib/xlib.c b/src/gallium/targets/libgl-xlib/xlib.c index 05dc8db57d..50dd99ffce 100644 --- a/src/gallium/targets/libgl-xlib/xlib.c +++ b/src/gallium/targets/libgl-xlib/xlib.c @@ -39,9 +39,15 @@ #include "target-helpers/wrap_screen.h" #include "xm_public.h" +#include "state_tracker/st_manager.h" + /* advertise OpenGL support */ PUBLIC const int st_api_OpenGL = 1; +PUBLIC const struct st_module st_module_OpenGL = { + .api = ST_API_OPENGL, + .create_api = st_manager_create_api +}; /* Helper function to build a subset of a driver stack consisting of * one of the software rasterizers (cell, llvmpipe, softpipe) and the -- cgit v1.2.3 From 813c58d77e21cb59adb914b4b4ee26be758ff0ea Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sat, 13 Mar 2010 15:57:15 +0800 Subject: st/glx: Make xmesa_create_st_api a callback of xm_driver. Instead of guessing the API in st/glx, let the target decide how to create st_api. --- src/gallium/state_trackers/glx/xlib/xm_api.c | 2 +- src/gallium/state_trackers/glx/xlib/xm_public.h | 12 ++++++++---- src/gallium/state_trackers/glx/xlib/xm_st.c | 11 ----------- src/gallium/state_trackers/glx/xlib/xm_st.h | 3 --- src/gallium/targets/libgl-xlib/xlib.c | 3 ++- 5 files changed, 11 insertions(+), 20 deletions(-) (limited to 'src/gallium/targets/libgl-xlib') diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c index 3ea4d77805..82384a4d28 100644 --- a/src/gallium/state_trackers/glx/xlib/xm_api.c +++ b/src/gallium/state_trackers/glx/xlib/xm_api.c @@ -708,7 +708,7 @@ xmesa_init( Display *display ) if (firstTime) { pipe_mutex_init(_xmesa_lock); screen = driver.create_pipe_screen( display ); - stapi = xmesa_create_st_api(); + stapi = driver.create_st_api(); smapi = CALLOC_STRUCT(st_manager); if (smapi) smapi->screen = screen; diff --git a/src/gallium/state_trackers/glx/xlib/xm_public.h b/src/gallium/state_trackers/glx/xlib/xm_public.h index ac6a8ffb27..950eb21521 100644 --- a/src/gallium/state_trackers/glx/xlib/xm_public.h +++ b/src/gallium/state_trackers/glx/xlib/xm_public.h @@ -26,19 +26,23 @@ * **************************************************************************/ -#ifndef XM_WINSYS_H -#define XM_WINSYS_H +#ifndef XM_PUBLIC_H +#define XM_PUBLIC_H -struct xm_driver; +#include + +struct pipe_screen; +struct st_api; /* This is the driver interface required by the glx/xlib state tracker. */ struct xm_driver { struct pipe_screen *(*create_pipe_screen)( Display *display ); + struct st_api *(*create_st_api)( void ); }; extern void xmesa_set_driver( const struct xm_driver *driver ); -#endif +#endif /* XM_PUBLIC_H */ diff --git a/src/gallium/state_trackers/glx/xlib/xm_st.c b/src/gallium/state_trackers/glx/xlib/xm_st.c index d462776363..abe3b5429b 100644 --- a/src/gallium/state_trackers/glx/xlib/xm_st.c +++ b/src/gallium/state_trackers/glx/xlib/xm_st.c @@ -31,11 +31,6 @@ #include "xm_api.h" #include "xm_st.h" -/* support OpenGL by default */ -#ifndef XMESA_ST_MODULE -#define XMESA_ST_MODULE st_module_OpenGL -#endif - struct xmesa_st_framebuffer { struct pipe_screen *screen; XMesaBuffer buffer; @@ -267,9 +262,3 @@ xmesa_copy_st_framebuffer(struct st_framebuffer_iface *stfbi, { /* TODO */ } - -struct st_api * -xmesa_create_st_api(void) -{ - return XMESA_ST_MODULE.create_api(); -} diff --git a/src/gallium/state_trackers/glx/xlib/xm_st.h b/src/gallium/state_trackers/glx/xlib/xm_st.h index 7ca7afe253..b22a837380 100644 --- a/src/gallium/state_trackers/glx/xlib/xm_st.h +++ b/src/gallium/state_trackers/glx/xlib/xm_st.h @@ -33,9 +33,6 @@ #include "xm_api.h" -struct st_api * -xmesa_create_st_api(void); - struct st_framebuffer_iface * xmesa_create_st_framebuffer(struct pipe_screen *screen, XMesaBuffer b); diff --git a/src/gallium/targets/libgl-xlib/xlib.c b/src/gallium/targets/libgl-xlib/xlib.c index 50dd99ffce..1e6769367f 100644 --- a/src/gallium/targets/libgl-xlib/xlib.c +++ b/src/gallium/targets/libgl-xlib/xlib.c @@ -104,9 +104,10 @@ fail: return NULL; } -struct xm_driver xlib_driver = +static struct xm_driver xlib_driver = { .create_pipe_screen = swrast_xlib_create_screen, + .create_st_api = st_manager_create_api, }; -- cgit v1.2.3