1*61046927SAndroid Build Coastguard Worker /**************************************************************************
2*61046927SAndroid Build Coastguard Worker *
3*61046927SAndroid Build Coastguard Worker * Copyright 2007 VMware, Inc., Bismarck, ND., USA
4*61046927SAndroid Build Coastguard Worker * All Rights Reserved.
5*61046927SAndroid Build Coastguard Worker *
6*61046927SAndroid Build Coastguard Worker * Permission is hereby granted, free of charge, to any person obtaining a
7*61046927SAndroid Build Coastguard Worker * copy of this software and associated documentation files (the
8*61046927SAndroid Build Coastguard Worker * "Software"), to deal in the Software without restriction, including
9*61046927SAndroid Build Coastguard Worker * without limitation the rights to use, copy, modify, merge, publish,
10*61046927SAndroid Build Coastguard Worker * distribute, sub license, and/or sell copies of the Software, and to
11*61046927SAndroid Build Coastguard Worker * permit persons to whom the Software is furnished to do so, subject to
12*61046927SAndroid Build Coastguard Worker * the following conditions:
13*61046927SAndroid Build Coastguard Worker *
14*61046927SAndroid Build Coastguard Worker * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15*61046927SAndroid Build Coastguard Worker * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16*61046927SAndroid Build Coastguard Worker * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
17*61046927SAndroid Build Coastguard Worker * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
18*61046927SAndroid Build Coastguard Worker * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19*61046927SAndroid Build Coastguard Worker * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20*61046927SAndroid Build Coastguard Worker * USE OR OTHER DEALINGS IN THE SOFTWARE.
21*61046927SAndroid Build Coastguard Worker *
22*61046927SAndroid Build Coastguard Worker * The above copyright notice and this permission notice (including the
23*61046927SAndroid Build Coastguard Worker * next paragraph) shall be included in all copies or substantial portions
24*61046927SAndroid Build Coastguard Worker * of the Software.
25*61046927SAndroid Build Coastguard Worker *
26*61046927SAndroid Build Coastguard Worker *
27*61046927SAndroid Build Coastguard Worker **************************************************************************/
28*61046927SAndroid Build Coastguard Worker
29*61046927SAndroid Build Coastguard Worker /*
30*61046927SAndroid Build Coastguard Worker * Authors:
31*61046927SAndroid Build Coastguard Worker * Keith Whitwell
32*61046927SAndroid Build Coastguard Worker */
33*61046927SAndroid Build Coastguard Worker #include "util/compiler.h"
34*61046927SAndroid Build Coastguard Worker #include "util/u_debug.h"
35*61046927SAndroid Build Coastguard Worker #include "sw/xlib/xlib_sw_winsys.h"
36*61046927SAndroid Build Coastguard Worker
37*61046927SAndroid Build Coastguard Worker #include "target-helpers/inline_sw_helper.h"
38*61046927SAndroid Build Coastguard Worker #include "target-helpers/inline_debug_helper.h"
39*61046927SAndroid Build Coastguard Worker
40*61046927SAndroid Build Coastguard Worker
41*61046927SAndroid Build Coastguard Worker
42*61046927SAndroid Build Coastguard Worker /* Helper function to build a subset of a driver stack consisting of
43*61046927SAndroid Build Coastguard Worker * one of the software rasterizers (llvmpipe, softpipe) and the
44*61046927SAndroid Build Coastguard Worker * xlib winsys.
45*61046927SAndroid Build Coastguard Worker */
46*61046927SAndroid Build Coastguard Worker struct pipe_screen *
47*61046927SAndroid Build Coastguard Worker xlib_create_screen( Display *display );
48*61046927SAndroid Build Coastguard Worker
49*61046927SAndroid Build Coastguard Worker struct pipe_screen *
xlib_create_screen(Display * display)50*61046927SAndroid Build Coastguard Worker xlib_create_screen( Display *display )
51*61046927SAndroid Build Coastguard Worker {
52*61046927SAndroid Build Coastguard Worker struct sw_winsys *winsys;
53*61046927SAndroid Build Coastguard Worker struct pipe_screen *screen = NULL;
54*61046927SAndroid Build Coastguard Worker
55*61046927SAndroid Build Coastguard Worker /* Create the underlying winsys, which performs presents to Xlib
56*61046927SAndroid Build Coastguard Worker * drawables:
57*61046927SAndroid Build Coastguard Worker */
58*61046927SAndroid Build Coastguard Worker winsys = xlib_create_sw_winsys( display );
59*61046927SAndroid Build Coastguard Worker if (winsys == NULL)
60*61046927SAndroid Build Coastguard Worker return NULL;
61*61046927SAndroid Build Coastguard Worker
62*61046927SAndroid Build Coastguard Worker /* Create a software rasterizer on top of that winsys:
63*61046927SAndroid Build Coastguard Worker */
64*61046927SAndroid Build Coastguard Worker screen = sw_screen_create( winsys );
65*61046927SAndroid Build Coastguard Worker if (screen == NULL)
66*61046927SAndroid Build Coastguard Worker goto fail;
67*61046927SAndroid Build Coastguard Worker
68*61046927SAndroid Build Coastguard Worker /* Inject any wrapping layers we want to here:
69*61046927SAndroid Build Coastguard Worker */
70*61046927SAndroid Build Coastguard Worker return debug_screen_wrap( screen );
71*61046927SAndroid Build Coastguard Worker
72*61046927SAndroid Build Coastguard Worker fail:
73*61046927SAndroid Build Coastguard Worker if (winsys)
74*61046927SAndroid Build Coastguard Worker winsys->destroy( winsys );
75*61046927SAndroid Build Coastguard Worker
76*61046927SAndroid Build Coastguard Worker return NULL;
77*61046927SAndroid Build Coastguard Worker }
78*61046927SAndroid Build Coastguard Worker
79