1848b8605Smrg/*
2848b8605Smrg * Copyright (c) 2013  Brian Paul   All Rights Reserved.
3848b8605Smrg *
4848b8605Smrg * Permission is hereby granted, free of charge, to any person obtaining a
5848b8605Smrg * copy of this software and associated documentation files (the "Software"),
6848b8605Smrg * to deal in the Software without restriction, including without limitation
7848b8605Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8848b8605Smrg * and/or sell copies of the Software, and to permit persons to whom the
9848b8605Smrg * Software is furnished to do so, subject to the following conditions:
10848b8605Smrg *
11848b8605Smrg * The above copyright notice and this permission notice shall be included
12848b8605Smrg * in all copies or substantial portions of the Software.
13848b8605Smrg *
14848b8605Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15848b8605Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16848b8605Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17848b8605Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18848b8605Smrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19848b8605Smrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20848b8605Smrg * OTHER DEALINGS IN THE SOFTWARE.
21848b8605Smrg */
22848b8605Smrg
23848b8605Smrg
24848b8605Smrg#include "target-helpers/inline_sw_helper.h"
25848b8605Smrg#include "target-helpers/inline_debug_helper.h"
26848b8605Smrg
27848b8605Smrg#include "sw/null/null_sw_winsys.h"
28848b8605Smrg
29848b8605Smrg
30848b8605Smrgstruct pipe_screen *
31848b8605Smrgosmesa_create_screen(void);
32848b8605Smrg
33848b8605Smrg
34848b8605Smrgstruct pipe_screen *
35848b8605Smrgosmesa_create_screen(void)
36848b8605Smrg{
37848b8605Smrg   struct sw_winsys *winsys;
38848b8605Smrg   struct pipe_screen *screen;
39848b8605Smrg
40848b8605Smrg   /* We use a null software winsys since we always just render to ordinary
41848b8605Smrg    * driver resources.
42848b8605Smrg    */
43848b8605Smrg   winsys = null_sw_create();
44848b8605Smrg   if (!winsys)
45848b8605Smrg      return NULL;
46848b8605Smrg
47848b8605Smrg   /* Create llvmpipe or softpipe screen */
48848b8605Smrg   screen = sw_screen_create(winsys);
49848b8605Smrg   if (!screen) {
50848b8605Smrg      winsys->destroy(winsys);
51848b8605Smrg      return NULL;
52848b8605Smrg   }
53848b8605Smrg
54848b8605Smrg   /* Inject optional trace, debug, etc. wrappers */
55848b8605Smrg   return debug_screen_wrap(screen);
56848b8605Smrg}
57