From 007e0e3ef90d73f232c463e353da13378ffcef63 Mon Sep 17 00:00:00 2001 From: George Sapountzis Date: Thu, 25 Mar 2010 17:01:54 +0200 Subject: swrastg_dri: add winsys and target --- src/gallium/targets/dri-swrast/Makefile | 30 ++++++++ src/gallium/targets/dri-swrast/swrast_drm_api.c | 93 +++++++++++++++++++++++++ 2 files changed, 123 insertions(+) create mode 100644 src/gallium/targets/dri-swrast/Makefile create mode 100644 src/gallium/targets/dri-swrast/swrast_drm_api.c (limited to 'src/gallium/targets') diff --git a/src/gallium/targets/dri-swrast/Makefile b/src/gallium/targets/dri-swrast/Makefile new file mode 100644 index 0000000000..57a9e02a4b --- /dev/null +++ b/src/gallium/targets/dri-swrast/Makefile @@ -0,0 +1,30 @@ +TOP = ../../../.. +include $(TOP)/configs/current + +LIBNAME = swrastg_dri.so + +DRIVER_DEFINES = -D__NOT_HAVE_DRM_H + +PIPE_DRIVERS = \ + $(TOP)/src/gallium/state_trackers/drisw/libdrisw.a \ + $(TOP)/src/gallium/winsys/sw/dri/libswdri.a \ + $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a + +SWRAST_COMMON_GALLIUM_SOURCES = \ + $(TOP)/src/mesa/drivers/dri/common/utils.c \ + $(TOP)/src/mesa/drivers/dri/common/drisw_util.c \ + $(TOP)/src/mesa/drivers/dri/common/xmlconfig.c + +C_SOURCES = \ + swrast_drm_api.c \ + $(SWRAST_COMMON_GALLIUM_SOURCES) \ + $(DRIVER_SOURCES) + +ASM_SOURCES = + +include ../Makefile.dri + +INCLUDES += \ + -I$(TOP)/src/gallium/winsys/sw/dri + +symlinks: diff --git a/src/gallium/targets/dri-swrast/swrast_drm_api.c b/src/gallium/targets/dri-swrast/swrast_drm_api.c new file mode 100644 index 0000000000..211836d784 --- /dev/null +++ b/src/gallium/targets/dri-swrast/swrast_drm_api.c @@ -0,0 +1,93 @@ +/************************************************************************** + * + * Copyright 2009, VMware, Inc. + * All Rights Reserved. + * Copyright 2010 George Sapountzis + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#include "pipe/p_compiler.h" +#include "util/u_memory.h" + +#include "softpipe/sp_public.h" +#include "state_tracker/drm_api.h" +#include "state_tracker/sw_winsys.h" +#include "dri_sw_winsys.h" + +static struct pipe_screen * +swrast_create_screen(struct drm_api *api, + int drmFD, + struct drm_create_screen_arg *arg) +{ + struct sw_winsys *winsys = NULL; + struct pipe_screen *screen = NULL; + + (void) drmFD; + + if (arg != NULL) { + switch(arg->mode) { + case DRM_CREATE_DRISW: + break; + default: + return NULL; + } + } + + winsys = dri_create_sw_winsys(); + if (winsys == NULL) + return NULL; + + screen = softpipe_create_screen( winsys ); + if (screen == NULL) + goto fail; + + return screen; + +fail: + if (winsys) + winsys->destroy( winsys ); + + return NULL; +} + +static void +swrast_drm_api_destroy(struct drm_api *api) +{ + return; +} + +static struct drm_api swrast_drm_api = +{ + .name = "swrast", + .driver_name = "swrast", + .create_screen = swrast_create_screen, + .destroy = swrast_drm_api_destroy, +}; + +struct drm_api * +drm_api_create() +{ + return &swrast_drm_api; +} + +/* vim: set sw=3 ts=8 sts=3 expandtab: */ -- cgit v1.2.3