From 9ff10b67bc1d69bef96cb24627481ab939ec1aa6 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sun, 6 Jun 2010 11:13:49 +0100 Subject: svga: Move bootstrap code to targets --- src/gallium/winsys/svga/drm/svga_drm_public.h | 41 +++++++++++++++++++++++++++ src/gallium/winsys/svga/drm/vmw_screen_dri.c | 39 ++++++------------------- 2 files changed, 49 insertions(+), 31 deletions(-) create mode 100644 src/gallium/winsys/svga/drm/svga_drm_public.h (limited to 'src/gallium/winsys/svga') diff --git a/src/gallium/winsys/svga/drm/svga_drm_public.h b/src/gallium/winsys/svga/drm/svga_drm_public.h new file mode 100644 index 0000000000..e98c89da1e --- /dev/null +++ b/src/gallium/winsys/svga/drm/svga_drm_public.h @@ -0,0 +1,41 @@ +/********************************************************** + * Copyright 2010 VMware, Inc. All rights reserved. + * + * 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, sublicense, 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 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 + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * 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. + * + **********************************************************/ + +/** + * @file + * VMware SVGA DRM winsys public interface. Used by targets to create a stack. + * + * @author Jakob Bornecrantz Fonseca + */ + +#ifndef SVGA_DRM_PUBLIC_H_ +#define SVGA_DRM_PUBLIC_H_ + +struct svga_winsys_screen; + +struct svga_winsys_screen * +svga_drm_winsys_screen_create(int fd); + +#endif /* SVGA_PUBLIC_H_ */ diff --git a/src/gallium/winsys/svga/drm/vmw_screen_dri.c b/src/gallium/winsys/svga/drm/vmw_screen_dri.c index fe28522691..1b0d10f60d 100644 --- a/src/gallium/winsys/svga/drm/vmw_screen_dri.c +++ b/src/gallium/winsys/svga/drm/vmw_screen_dri.c @@ -30,14 +30,14 @@ #include "util/u_format.h" #include "vmw_screen.h" -#include "trace/tr_drm.h" - #include "vmw_screen.h" #include "vmw_surface.h" #include "vmw_fence.h" #include "vmw_context.h" +#include "svga_drm_public.h" + +#include "state_tracker/drm_driver.h" -#include #include "vmwgfx_drm.h" #include @@ -84,15 +84,13 @@ vmw_dri1_check_version(const struct dri1_api_version *cur, return FALSE; } -/* This is actually the entrypoint to the entire driver, called by the - * libGL (or EGL, or ...) code via the drm_api_hooks table at the - * bottom of the file. +/* This is actually the entrypoint to the entire driver, + * called by the target bootstrap code. */ -static struct pipe_screen * -vmw_drm_create_screen(struct drm_api *drm_api, int fd) +struct svga_winsys_screen * +svga_drm_winsys_screen_create(int fd) { struct vmw_winsys_screen *vws; - struct pipe_screen *screen; boolean use_old_scanout_flag = FALSE; struct dri1_api_version drm_ver; @@ -123,16 +121,7 @@ vmw_drm_create_screen(struct drm_api *drm_api, int fd) vws->base.surface_from_handle = vmw_drm_surface_from_handle; vws->base.surface_get_handle = vmw_drm_surface_get_handle; - screen = svga_screen_create( &vws->base ); - if (!screen) - goto out_no_screen; - - return screen; - - /* Failure cases: - */ -out_no_screen: - vmw_winsys_destroy( vws ); + return &vws->base; out_no_vws: return NULL; @@ -253,15 +242,3 @@ vmw_drm_surface_get_handle(struct svga_winsys_screen *sws, return TRUE; } - -static struct drm_api vmw_drm_api_hooks = { - .name = "vmwgfx", - .driver_name = "vmwgfx", - .create_screen = vmw_drm_create_screen, - .destroy = NULL, -}; - -struct drm_api* drm_api_create() -{ - return trace_drm_create(&vmw_drm_api_hooks); -} -- cgit v1.2.3