#include "pipe/p_compiler.h"
#include "pipe/p_context.h"
+#include "pipe/p_screen.h"
#include "util/u_debug.h"
#include "util/u_memory.h"
-#include "target-helpers/wrap_screen.h"
-#include "state_tracker/xlib_sw_winsys.h"
-
-#ifdef GALLIUM_SOFTPIPE
-#include "softpipe/sp_public.h"
-#endif
-
-#ifdef GALLIUM_LLVMPIPE
-#include "llvmpipe/lp_public.h"
-#endif
-
-/* Haven't figured out a decent way to build the helper code yet -
- * #include it here temporarily.
- */
-#include "sw/sw_public.h"
-#include "sw/sw.c"
-
+#include "target-helpers/inline_sw_helper.h"
+#include "target-helpers/inline_debug_helper.h"
+#include "state_tracker/xlibsw_api.h"
#include "state_tracker/graw.h"
+#include "sw/xlib/xlib_sw_winsys.h"
#include <X11/Xlib.h>
#include <X11/Xlibint.h>
static struct pipe_screen *
graw_create_screen( void )
{
- const char *default_driver;
- const char *driver;
struct pipe_screen *screen = NULL;
struct sw_winsys *winsys = NULL;
if (winsys == NULL)
return NULL;
-#if defined(GALLIUM_LLVMPIPE)
- default_driver = "llvmpipe";
-#elif defined(GALLIUM_SOFTPIPE)
- default_driver = "softpipe";
-#else
- default_driver = "";
-#endif
-
- driver = debug_get_option("GALLIUM_DRIVER", default_driver);
-
-#if defined(GALLIUM_LLVMPIPE)
- if (screen == NULL && strcmp(driver, "llvmpipe") == 0)
- screen = llvmpipe_create_screen( winsys );
-#endif
-
-#if defined(GALLIUM_SOFTPIPE)
- if (screen == NULL)
- screen = softpipe_create_screen( winsys );
-#endif
+ screen = sw_screen_create( winsys );
/* Inject any wrapping layers we want to here:
*/
- return gallium_wrap_screen( screen );
+ return debug_screen_wrap( screen );
}
-
-
-
struct pipe_screen *
graw_create_window_and_screen( int x,
int y,
root = RootWindow( graw.display, scrnum );
- if (format != PIPE_FORMAT_R8G8B8A8_UNORM)
- goto fail;
-
if (graw.display == NULL)
goto fail;
exit(1);
}
+ /* See if the requirested pixel format matches the visual */
+ if (visinfo->red_mask == 0xff0000 &&
+ visinfo->green_mask == 0xff00 &&
+ visinfo->blue_mask == 0xff) {
+ if (format != PIPE_FORMAT_BGRA8888_UNORM)
+ goto fail;
+ }
+ else if (visinfo->red_mask == 0xff &&
+ visinfo->green_mask == 0xff00 &&
+ visinfo->blue_mask == 0xff0000) {
+ if (format != PIPE_FORMAT_RGBA8888_UNORM)
+ goto fail;
+ }
+ else {
+ goto fail;
+ }
+
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
if (screen == NULL)
goto fail;
- XFree(visinfo);
+ free(visinfo);
return screen;
fail:
if (screen)
screen->destroy(screen);
- if (xlib_handle)
- FREE(xlib_handle);
+ FREE(xlib_handle);
- if (visinfo)
- XFree(visinfo);
+ free(visinfo);
if (win)
XDestroyWindow(graw.display, win);