1af69d88dSmrg/*
2af69d88dSmrg * Copyright (c) 2013  Brian Paul   All Rights Reserved.
3af69d88dSmrg *
4af69d88dSmrg * Permission is hereby granted, free of charge, to any person obtaining a
5af69d88dSmrg * copy of this software and associated documentation files (the "Software"),
6af69d88dSmrg * to deal in the Software without restriction, including without limitation
7af69d88dSmrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8af69d88dSmrg * and/or sell copies of the Software, and to permit persons to whom the
9af69d88dSmrg * Software is furnished to do so, subject to the following conditions:
10af69d88dSmrg *
11af69d88dSmrg * The above copyright notice and this permission notice shall be included
12af69d88dSmrg * in all copies or substantial portions of the Software.
13af69d88dSmrg *
14af69d88dSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15af69d88dSmrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16af69d88dSmrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17af69d88dSmrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18af69d88dSmrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19af69d88dSmrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20af69d88dSmrg * OTHER DEALINGS IN THE SOFTWARE.
21af69d88dSmrg */
22af69d88dSmrg
23af69d88dSmrg
24af69d88dSmrg#include "target-helpers/inline_sw_helper.h"
25af69d88dSmrg#include "target-helpers/inline_debug_helper.h"
26af69d88dSmrg
27af69d88dSmrg#include "sw/null/null_sw_winsys.h"
28af69d88dSmrg
29af69d88dSmrg
30af69d88dSmrgstruct pipe_screen *
31af69d88dSmrgosmesa_create_screen(void);
32af69d88dSmrg
33af69d88dSmrg
34af69d88dSmrgstruct pipe_screen *
35af69d88dSmrgosmesa_create_screen(void)
36af69d88dSmrg{
37af69d88dSmrg   struct sw_winsys *winsys;
38af69d88dSmrg   struct pipe_screen *screen;
39af69d88dSmrg
40af69d88dSmrg   /* We use a null software winsys since we always just render to ordinary
41af69d88dSmrg    * driver resources.
42af69d88dSmrg    */
43af69d88dSmrg   winsys = null_sw_create();
44af69d88dSmrg   if (!winsys)
45af69d88dSmrg      return NULL;
46af69d88dSmrg
47af69d88dSmrg   /* Create llvmpipe or softpipe screen */
48af69d88dSmrg   screen = sw_screen_create(winsys);
49af69d88dSmrg   if (!screen) {
50af69d88dSmrg      winsys->destroy(winsys);
51af69d88dSmrg      return NULL;
52af69d88dSmrg   }
53af69d88dSmrg
54af69d88dSmrg   /* Inject optional trace, debug, etc. wrappers */
55af69d88dSmrg   return debug_screen_wrap(screen);
56af69d88dSmrg}
57