Path: blob/21.2-virgl/src/gallium/targets/osmesa/target.c
4565 views
/*1* Copyright (c) 2013 Brian Paul All Rights Reserved.2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* the rights to use, copy, modify, merge, publish, distribute, sublicense,7* and/or sell copies of the Software, and to permit persons to whom the8* Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice shall be included11* in all copies or substantial portions of the Software.12*13* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS14* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,15* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL16* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR17* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,18* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR19* OTHER DEALINGS IN THE SOFTWARE.20*/2122#include <stdio.h>2324#include "target-helpers/inline_sw_helper.h"25#include "target-helpers/inline_debug_helper.h"2627#include "sw/null/null_sw_winsys.h"282930struct pipe_screen *31osmesa_create_screen(void);323334struct pipe_screen *35osmesa_create_screen(void)36{37struct sw_winsys *winsys;38struct pipe_screen *screen;3940/* We use a null software winsys since we always just render to ordinary41* driver resources.42*/43winsys = null_sw_create();44if (!winsys) {45printf("OSMESA_TARGET: winsys is null\n");46return NULL;47}4849/* Create llvmpipe or softpipe screen */50screen = sw_screen_create(winsys);51if (!screen) {52printf("OSMESA_TARGET: generated screen is null\n");53winsys->destroy(winsys);54return NULL;55}5657printf("OSMESA_TARGET: screen=%p\n",screen);58/* Inject optional trace, debug, etc. wrappers */59return debug_screen_wrap(screen);60}616263