From 76aed4b070be8950fd8ea5caff59321885ff0a06 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sat, 29 May 2010 11:33:14 +0200 Subject: gallium: Add drm driver interface This interfacre replaces the drm_api api it works very much the same way as drm_api but with the exception that its meant for the target to implement it. And it does not export a get function and neither a destroy function. --- src/gallium/include/state_tracker/drm_driver.h | 71 ++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 src/gallium/include/state_tracker/drm_driver.h diff --git a/src/gallium/include/state_tracker/drm_driver.h b/src/gallium/include/state_tracker/drm_driver.h new file mode 100644 index 0000000000..d94c1e6a7c --- /dev/null +++ b/src/gallium/include/state_tracker/drm_driver.h @@ -0,0 +1,71 @@ + +#ifndef _DRM_DRIVER_H_ +#define _DRM_DRIVER_H_ + +#include "pipe/p_compiler.h" + +struct pipe_screen; +struct pipe_winsys; +struct pipe_context; +struct pipe_resource; + +#define DRM_API_HANDLE_TYPE_SHARED 0 +#define DRM_API_HANDLE_TYPE_KMS 1 + +/** + * For use with pipe_screen::{texture_from_handle|texture_get_handle}. + */ +struct winsys_handle +{ + /** + * Unused for texture_from_handle, always + * DRM_API_HANDLE_TYPE_SHARED. Input to texture_get_handle, + * use TEXTURE_USAGE to select handle for kms or ipc. + */ + unsigned type; + /** + * Input to texture_from_handle. + * Output for texture_get_handle. + */ + unsigned handle; + /** + * Input to texture_from_handle. + * Output for texture_get_handle. + */ + unsigned stride; +}; + +struct drm_driver_descriptor +{ + /** + * Identifying sufix/prefix of the binary, used by egl. + */ + const char *name; + + /** + * Kernel driver name, as accepted by drmOpenByName. + */ + const char *driver_name; + + /** + * Create a pipe srcreen. + * + * This function does any wrapping of the screen. + * For example wrapping trace or rbug debugging drivers around it. + */ + struct pipe_screen* (*create_screen)(int drm_fd); +}; + +extern struct drm_driver_descriptor driver_descriptor; + +/** + * Instantiate a drm_driver_descriptor struct. + */ +#define DRM_DRIVER_DESCRIPTOR(name_str, driver_name_str, func) \ +struct drm_driver_descriptor driver_descriptor = { \ + .name = name_str, \ + .driver_name = driver_name_str, \ + .create_screen = func, \ +}; + +#endif -- cgit v1.2.3 From f9d9574913c5edb92191ac3f5e8d011452427852 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Thu, 27 May 2010 00:38:30 +0200 Subject: gallium: Convert state trackers to drm driver interface --- src/gallium/state_trackers/dri/common/dri_screen.h | 2 -- src/gallium/state_trackers/dri/drm/dri2.c | 5 ++- src/gallium/state_trackers/dri/sw/drisw.c | 1 - src/gallium/state_trackers/egl/kms/native_kms.c | 41 +++++----------------- src/gallium/state_trackers/egl/kms/native_kms.h | 2 -- src/gallium/state_trackers/egl/x11/native_dri2.c | 15 +++----- src/gallium/state_trackers/egl/x11/native_x11.c | 30 ++++++---------- src/gallium/state_trackers/egl/x11/native_x11.h | 4 +-- src/gallium/state_trackers/xorg/xorg_crtc.c | 1 + src/gallium/state_trackers/xorg/xorg_dri2.c | 2 ++ src/gallium/state_trackers/xorg/xorg_driver.c | 27 +++----------- src/gallium/state_trackers/xorg/xorg_tracker.h | 2 -- src/gallium/targets/xorg-radeon/Makefile | 1 + 13 files changed, 35 insertions(+), 98 deletions(-) diff --git a/src/gallium/state_trackers/dri/common/dri_screen.h b/src/gallium/state_trackers/dri/common/dri_screen.h index 9ff925d4be..087ae8d2a4 100644 --- a/src/gallium/state_trackers/dri/common/dri_screen.h +++ b/src/gallium/state_trackers/dri/common/dri_screen.h @@ -39,7 +39,6 @@ #include "pipe/p_context.h" #include "pipe/p_state.h" #include "state_tracker/st_api.h" -#include "state_tracker/drm_api.h" struct dri_context; struct dri_drawable; @@ -75,7 +74,6 @@ struct dri_screen enum st_attachment_type statt); /* gallium */ - struct drm_api *api; boolean d_depth_bits_last; boolean sd_depth_bits_last; boolean auto_fake_front; diff --git a/src/gallium/state_trackers/dri/drm/dri2.c b/src/gallium/state_trackers/dri/drm/dri2.c index f4cc8d77eb..b3bf21f49b 100644 --- a/src/gallium/state_trackers/dri/drm/dri2.c +++ b/src/gallium/state_trackers/dri/drm/dri2.c @@ -33,7 +33,7 @@ #include "util/u_inlines.h" #include "util/u_format.h" #include "util/u_debug.h" -#include "state_tracker/drm_api.h" +#include "state_tracker/drm_driver.h" #include "dri_screen.h" #include "dri_context.h" @@ -508,7 +508,6 @@ dri2_init_screen(__DRIscreen * sPriv) if (!screen) return NULL; - screen->api = drm_api_create(); screen->sPriv = sPriv; screen->fd = sPriv->fd; screen->lookup_egl_image = dri2_lookup_egl_image; @@ -518,7 +517,7 @@ dri2_init_screen(__DRIscreen * sPriv) sPriv->private = (void *)screen; sPriv->extensions = dri_screen_extensions; - pscreen = screen->api->create_screen(screen->api, screen->fd); + pscreen = driver_descriptor.create_screen(screen->fd); /* dri_init_screen_helper checks pscreen for us */ configs = dri_init_screen_helper(screen, pscreen, 32); diff --git a/src/gallium/state_trackers/dri/sw/drisw.c b/src/gallium/state_trackers/dri/sw/drisw.c index dcf645593f..23e99aa0ad 100644 --- a/src/gallium/state_trackers/dri/sw/drisw.c +++ b/src/gallium/state_trackers/dri/sw/drisw.c @@ -255,7 +255,6 @@ drisw_init_screen(__DRIscreen * sPriv) if (!screen) return NULL; - screen->api = NULL; /* not needed */ screen->sPriv = sPriv; screen->fd = -1; screen->allocate_textures = drisw_allocate_textures; diff --git a/src/gallium/state_trackers/egl/kms/native_kms.c b/src/gallium/state_trackers/egl/kms/native_kms.c index bfb4a9d258..8f667f1ec1 100644 --- a/src/gallium/state_trackers/egl/kms/native_kms.c +++ b/src/gallium/state_trackers/egl/kms/native_kms.c @@ -33,6 +33,7 @@ #include "egllog.h" #include "native_kms.h" +#include "state_tracker/drm_driver.h" static boolean kms_surface_validate(struct native_surface *nsurf, uint attachment_mask, @@ -657,8 +658,6 @@ kms_display_destroy(struct native_display *ndpy) if (kdpy->fd >= 0) drmClose(kdpy->fd); - if (kdpy->api && kdpy->api->destroy) - kdpy->api->destroy(kdpy->api); FREE(kdpy); } @@ -674,7 +673,7 @@ kms_display_init_screen(struct native_display *ndpy) fd = kdpy->fd; if (fd >= 0) { drmVersionPtr version = drmGetVersion(fd); - if (!version || strcmp(version->name, kdpy->api->driver_name)) { + if (!version || strcmp(version->name, driver_descriptor.driver_name)) { if (version) { _eglLog(_EGL_WARNING, "unknown driver name %s", version->name); drmFreeVersion(version); @@ -689,7 +688,7 @@ kms_display_init_screen(struct native_display *ndpy) drmFreeVersion(version); } else { - fd = drmOpen(kdpy->api->driver_name, NULL); + fd = drmOpen(driver_descriptor.driver_name, NULL); } if (fd < 0) { @@ -704,7 +703,7 @@ kms_display_init_screen(struct native_display *ndpy) } #endif - kdpy->base.screen = kdpy->api->create_screen(kdpy->api, fd); + kdpy->base.screen = driver_descriptor.create_screen(fd); if (!kdpy->base.screen) { _eglLog(_EGL_WARNING, "failed to create DRM screen"); drmClose(fd); @@ -724,8 +723,7 @@ static struct native_display_modeset kms_display_modeset = { }; static struct native_display * -kms_create_display(int fd, struct native_event_handler *event_handler, - struct drm_api *api) +kms_create_display(int fd, struct native_event_handler *event_handler) { struct kms_display *kdpy; @@ -734,14 +732,6 @@ kms_create_display(int fd, struct native_event_handler *event_handler, return NULL; kdpy->event_handler = event_handler; - - kdpy->api = api; - if (!kdpy->api) { - _eglLog(_EGL_WARNING, "failed to create DRM API"); - FREE(kdpy); - return NULL; - } - kdpy->fd = fd; if (!kms_display_init_screen(&kdpy->base)) { kms_display_destroy(&kdpy->base); @@ -790,21 +780,13 @@ native_get_probe_result(struct native_probe *nprobe) return NATIVE_PROBE_UNKNOWN; } -/* the api is destroyed with the native display */ -static struct drm_api *drm_api; - const char * native_get_name(void) { static char kms_name[32]; - if (!drm_api) - drm_api = drm_api_create(); - if (drm_api) - util_snprintf(kms_name, sizeof(kms_name), "KMS/%s", drm_api->name); - else - util_snprintf(kms_name, sizeof(kms_name), "KMS"); + util_snprintf(kms_name, sizeof(kms_name), "KMS/%s", driver_descriptor.name); return kms_name; } @@ -816,15 +798,8 @@ native_create_display(EGLNativeDisplayType dpy, struct native_display *ndpy = NULL; int fd; - if (!drm_api) - drm_api = drm_api_create(); - - if (drm_api) { - /* well, this makes fd 0 being ignored */ - fd = (dpy != EGL_DEFAULT_DISPLAY) ? - (int) pointer_to_intptr((void *) dpy) : -1; - ndpy = kms_create_display(fd, event_handler, drm_api); - } + fd = (dpy != EGL_DEFAULT_DISPLAY) ? (int) pointer_to_intptr((void *) dpy) : -1; + ndpy = kms_create_display(fd, event_handler); return ndpy; } diff --git a/src/gallium/state_trackers/egl/kms/native_kms.h b/src/gallium/state_trackers/egl/kms/native_kms.h index d69c8d38c8..14cf5a641a 100644 --- a/src/gallium/state_trackers/egl/kms/native_kms.h +++ b/src/gallium/state_trackers/egl/kms/native_kms.h @@ -32,7 +32,6 @@ #include "pipe/p_compiler.h" #include "util/u_format.h" #include "pipe/p_state.h" -#include "state_tracker/drm_api.h" #include "common/native.h" #include "common/native_helper.h" @@ -53,7 +52,6 @@ struct kms_display { struct native_event_handler *event_handler; int fd; - struct drm_api *api; drmModeResPtr resources; struct kms_config *config; diff --git a/src/gallium/state_trackers/egl/x11/native_dri2.c b/src/gallium/state_trackers/egl/x11/native_dri2.c index 3f802dd713..0ce7c0be64 100644 --- a/src/gallium/state_trackers/egl/x11/native_dri2.c +++ b/src/gallium/state_trackers/egl/x11/native_dri2.c @@ -32,7 +32,7 @@ #include "pipe/p_screen.h" #include "pipe/p_context.h" #include "pipe/p_state.h" -#include "state_tracker/drm_api.h" +#include "state_tracker/drm_driver.h" #include "egllog.h" #include "native_x11.h" @@ -50,7 +50,6 @@ struct dri2_display { struct native_event_handler *event_handler; - struct drm_api *api; struct x11_screen *xscr; int xscr_number; const char *dri_driver; @@ -662,8 +661,6 @@ dri2_display_destroy(struct native_display *ndpy) x11_screen_destroy(dri2dpy->xscr); if (dri2dpy->own_dpy) XCloseDisplay(dri2dpy->dpy); - if (dri2dpy->api && dri2dpy->api->destroy) - dri2dpy->api->destroy(dri2dpy->api); FREE(dri2dpy); } @@ -695,7 +692,7 @@ static boolean dri2_display_init_screen(struct native_display *ndpy) { struct dri2_display *dri2dpy = dri2_display(ndpy); - const char *driver = dri2dpy->api->name; + const char *driver = driver_descriptor.name; int fd; if (!x11_screen_support(dri2dpy->xscr, X11_SCREEN_EXTENSION_DRI2) || @@ -709,7 +706,7 @@ dri2_display_init_screen(struct native_display *ndpy) if (!dri2dpy->dri_driver || !driver || strcmp(dri2dpy->dri_driver, driver) != 0) { _eglLog(_EGL_WARNING, "Driver mismatch: %s != %s", - dri2dpy->dri_driver, dri2dpy->api->name); + dri2dpy->dri_driver, driver); return FALSE; } @@ -718,7 +715,7 @@ dri2_display_init_screen(struct native_display *ndpy) if (fd < 0) return FALSE; - dri2dpy->base.screen = dri2dpy->api->create_screen(dri2dpy->api, fd); + dri2dpy->base.screen = driver_descriptor.create_screen(fd); if (!dri2dpy->base.screen) { _eglLog(_EGL_WARNING, "failed to create DRM screen"); return FALSE; @@ -742,8 +739,7 @@ dri2_display_hash_table_compare(void *key1, void *key2) struct native_display * x11_create_dri2_display(EGLNativeDisplayType dpy, - struct native_event_handler *event_handler, - struct drm_api *api) + struct native_event_handler *event_handler) { struct dri2_display *dri2dpy; @@ -752,7 +748,6 @@ x11_create_dri2_display(EGLNativeDisplayType dpy, return NULL; dri2dpy->event_handler = event_handler; - dri2dpy->api = api; dri2dpy->dpy = dpy; if (!dri2dpy->dpy) { diff --git a/src/gallium/state_trackers/egl/x11/native_x11.c b/src/gallium/state_trackers/egl/x11/native_x11.c index b6d51bbf9f..5d71778410 100644 --- a/src/gallium/state_trackers/egl/x11/native_x11.c +++ b/src/gallium/state_trackers/egl/x11/native_x11.c @@ -27,15 +27,14 @@ #include "util/u_debug.h" #include "util/u_memory.h" #include "util/u_string.h" -#include "state_tracker/drm_api.h" #include "egllog.h" #include "native_x11.h" #include "x11_screen.h" -#define X11_PROBE_MAGIC 0x11980BE /* "X11PROBE" */ +#include "state_tracker/drm_driver.h" -static struct drm_api *api; +#define X11_PROBE_MAGIC 0x11980BE /* "X11PROBE" */ static void x11_probe_destroy(struct native_probe *nprobe) @@ -96,15 +95,12 @@ native_get_probe_result(struct native_probe *nprobe) if (!nprobe || nprobe->magic != X11_PROBE_MAGIC) return NATIVE_PROBE_UNKNOWN; - if (!api) - api = drm_api_create(); - /* this is a software driver */ - if (!api) + if (!driver_descriptor.create_screen) return NATIVE_PROBE_SUPPORTED; /* the display does not support DRI2 or the driver mismatches */ - if (!nprobe->data || strcmp(api->name, (const char *) nprobe->data) != 0) + if (!nprobe->data || strcmp(driver_descriptor.name, (const char *) nprobe->data) != 0) return NATIVE_PROBE_FALLBACK; return NATIVE_PROBE_EXACT; @@ -115,13 +111,7 @@ native_get_name(void) { static char x11_name[32]; - if (!api) - api = drm_api_create(); - - if (api) - util_snprintf(x11_name, sizeof(x11_name), "X11/%s", api->name); - else - util_snprintf(x11_name, sizeof(x11_name), "X11"); + util_snprintf(x11_name, sizeof(x11_name), "X11/%s", driver_descriptor.name); return x11_name; } @@ -133,12 +123,12 @@ native_create_display(EGLNativeDisplayType dpy, struct native_display *ndpy = NULL; boolean force_sw; - if (!api) - api = drm_api_create(); - force_sw = debug_get_bool_option("EGL_SOFTWARE", FALSE); - if (api && !force_sw) { - ndpy = x11_create_dri2_display(dpy, event_handler, api); + if (!driver_descriptor.create_screen) + force_sw = TRUE; + + if (!force_sw) { + ndpy = x11_create_dri2_display(dpy, event_handler); } if (!ndpy) { diff --git a/src/gallium/state_trackers/egl/x11/native_x11.h b/src/gallium/state_trackers/egl/x11/native_x11.h index 1678403b45..e16da935c0 100644 --- a/src/gallium/state_trackers/egl/x11/native_x11.h +++ b/src/gallium/state_trackers/egl/x11/native_x11.h @@ -26,7 +26,6 @@ #ifndef _NATIVE_X11_H_ #define _NATIVE_X11_H_ -#include "state_tracker/drm_api.h" #include "common/native.h" struct native_display * @@ -35,7 +34,6 @@ x11_create_ximage_display(EGLNativeDisplayType dpy, struct native_display * x11_create_dri2_display(EGLNativeDisplayType dpy, - struct native_event_handler *event_handler, - struct drm_api *api); + struct native_event_handler *event_handler); #endif /* _NATIVE_X11_H_ */ diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c b/src/gallium/state_trackers/xorg/xorg_crtc.c index f1a07bd863..627754a0a4 100644 --- a/src/gallium/state_trackers/xorg/xorg_crtc.c +++ b/src/gallium/state_trackers/xorg/xorg_crtc.c @@ -50,6 +50,7 @@ #include #endif +#include "state_tracker/drm_driver.h" #include "util/u_inlines.h" #include "util/u_rect.h" diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c index 4e01bd1030..704aed6a82 100644 --- a/src/gallium/state_trackers/xorg/xorg_dri2.c +++ b/src/gallium/state_trackers/xorg/xorg_dri2.c @@ -42,6 +42,8 @@ #include "util/u_format.h" +#include "state_tracker/drm_driver.h" + /* Make all the #if cases in the code esier to read */ #ifndef DRI2INFOREC_VERSION #define DRI2INFOREC_VERSION 1 diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c index 6b6e2009fe..9357cd5763 100644 --- a/src/gallium/state_trackers/xorg/xorg_driver.c +++ b/src/gallium/state_trackers/xorg/xorg_driver.c @@ -51,6 +51,7 @@ #include +#include "state_tracker/drm_driver.h" #include "pipe/p_context.h" #include "xorg_tracker.h" #include "xorg_winsys.h" @@ -267,18 +268,12 @@ drv_init_drm(ScrnInfoPtr pScrn) ); - ms->api = drm_api_create(); - ms->fd = drmOpen(ms->api ? ms->api->driver_name : NULL, BusID); + ms->fd = drmOpen(driver_descriptor.driver_name, BusID); xfree(BusID); if (ms->fd >= 0) return TRUE; - if (ms->api && ms->api->destroy) - ms->api->destroy(ms->api); - - ms->api = NULL; - return FALSE; } @@ -290,10 +285,6 @@ drv_close_drm(ScrnInfoPtr pScrn) { modesettingPtr ms = modesettingPTR(pScrn); - if (ms->api && ms->api->destroy) - ms->api->destroy(ms->api); - ms->api = NULL; - drmClose(ms->fd); ms->fd = -1; @@ -314,17 +305,10 @@ drv_init_resource_management(ScrnInfoPtr pScrn) if (ms->screen || ms->kms) return TRUE; - if (ms->api) { - ms->screen = ms->api->create_screen(ms->api, ms->fd); - - if (ms->screen) - return TRUE; + ms->screen = driver_descriptor.create_screen(ms->fd); - if (ms->api->destroy) - ms->api->destroy(ms->api); - - ms->api = NULL; - } + if (ms->screen) + return TRUE; #ifdef HAVE_LIBKMS if (!kms_create(ms->fd, &ms->kms)) @@ -430,7 +414,6 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags) } ms->fd = -1; - ms->api = NULL; if (!drv_init_drm(pScrn)) return FALSE; diff --git a/src/gallium/state_trackers/xorg/xorg_tracker.h b/src/gallium/state_trackers/xorg/xorg_tracker.h index 25da9b1a3b..cc2d379af1 100644 --- a/src/gallium/state_trackers/xorg/xorg_tracker.h +++ b/src/gallium/state_trackers/xorg/xorg_tracker.h @@ -49,7 +49,6 @@ #include "pipe/p_screen.h" #include "util/u_inlines.h" #include "util/u_debug.h" -#include "state_tracker/drm_api.h" #define DRV_ERROR(msg) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, msg); @@ -123,7 +122,6 @@ typedef struct _modesettingRec struct kms_bo *root_bo; /* gallium */ - struct drm_api *api; struct pipe_screen *screen; struct pipe_context *ctx; boolean d_depth_bits_last; diff --git a/src/gallium/targets/xorg-radeon/Makefile b/src/gallium/targets/xorg-radeon/Makefile index a4951c4bba..c438ec4847 100644 --- a/src/gallium/targets/xorg-radeon/Makefile +++ b/src/gallium/targets/xorg-radeon/Makefile @@ -4,6 +4,7 @@ include $(TOP)/configs/current LIBNAME = radeon_drv.so C_SOURCES = \ + radeon_target.c \ radeon_xorg.c DRIVER_DEFINES = \ -- cgit v1.2.3 From e72b15aa47c24b920c708e1dc47f69a070d50d51 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 1 Jun 2010 04:00:02 +0100 Subject: gallium: drm api compat helper This is temporary untill all drivers have moved to the new drm driver descriptor interface. --- .../auxiliary/target-helpers/drm_api_compat.h | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/gallium/auxiliary/target-helpers/drm_api_compat.h diff --git a/src/gallium/auxiliary/target-helpers/drm_api_compat.h b/src/gallium/auxiliary/target-helpers/drm_api_compat.h new file mode 100644 index 0000000000..324c6f2ba9 --- /dev/null +++ b/src/gallium/auxiliary/target-helpers/drm_api_compat.h @@ -0,0 +1,46 @@ +/* + * This file contain a small backwards compatible shim between + * the old depricated drm_api and the drm_driver interface. + */ + +#ifndef DRM_API_COMPAT_H +#define DRM_API_COMPAT_H + +#ifdef _DRM_API_H_ +#error "Included drm_api.h before drm_api_compat.h" +#endif + +#include "state_tracker/drm_driver.h" + +/* + * XXX Hack, can't include both drm_api and drm_driver. Due to name + * collition of winsys_handle, just use a define to rename it. + */ +#define winsys_handle HACK_winsys_handle +#include "state_tracker/drm_api.h" +#undef winsys_handle + +static INLINE struct pipe_screen * +drm_api_compat_create_screen(int fd) +{ + static struct drm_api *api; + if (!api) + api = drm_api_create(); + + if (!api) + return NULL; + + return api->create_screen(api, fd); +} + +/** + * Instanciate a drm_driver descriptor. + */ +#define DRM_API_COMPAT_STRUCT(name_str, driver_name_str) \ +struct drm_driver_descriptor driver_descriptor = { \ + .name = name_str, \ + .driver_name = driver_name_str, \ + .create_screen = drm_api_compat_create_screen, \ +}; + +#endif -- cgit v1.2.3 From c1a19689b83a9569b30ba43c168fdca328cb9f2e Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 1 Jun 2010 04:06:52 +0100 Subject: gallium: Make all drm drivers use the new drm compat helper --- src/gallium/targets/dri-i915/Makefile | 1 + src/gallium/targets/dri-i915/SConscript | 2 +- src/gallium/targets/dri-i915/dummy.c | 0 src/gallium/targets/dri-i915/target.c | 4 ++++ src/gallium/targets/dri-i965/Makefile | 1 + src/gallium/targets/dri-i965/SConscript | 2 +- src/gallium/targets/dri-i965/dummy.c | 0 src/gallium/targets/dri-i965/target.c | 4 ++++ src/gallium/targets/dri-nouveau/Makefile | 1 + src/gallium/targets/dri-nouveau/target.c | 4 ++++ src/gallium/targets/dri-r600/Makefile | 1 + src/gallium/targets/dri-r600/SConscript | 2 +- src/gallium/targets/dri-r600/dummy.c | 0 src/gallium/targets/dri-r600/target.c | 4 ++++ src/gallium/targets/dri-radeong/Makefile | 1 + src/gallium/targets/dri-radeong/SConscript | 2 +- src/gallium/targets/dri-radeong/dummy.c | 0 src/gallium/targets/dri-radeong/target.c | 4 ++++ src/gallium/targets/dri-vmwgfx/Makefile | 1 + src/gallium/targets/dri-vmwgfx/SConscript | 2 +- src/gallium/targets/dri-vmwgfx/dummy.c | 0 src/gallium/targets/dri-vmwgfx/target.c | 4 ++++ src/gallium/targets/egl-i915/Makefile | 2 +- src/gallium/targets/egl-i915/dummy.c | 3 --- src/gallium/targets/egl-i915/target.c | 8 ++++++++ src/gallium/targets/egl-i965/Makefile | 2 +- src/gallium/targets/egl-i965/dummy.c | 3 --- src/gallium/targets/egl-i965/target.c | 8 ++++++++ src/gallium/targets/egl-nouveau/Makefile | 2 +- src/gallium/targets/egl-nouveau/dummy.c | 3 --- src/gallium/targets/egl-nouveau/target.c | 8 ++++++++ src/gallium/targets/egl-radeon/Makefile | 2 +- src/gallium/targets/egl-radeon/dummy.c | 3 --- src/gallium/targets/egl-radeon/target.c | 8 ++++++++ src/gallium/targets/egl-vmwgfx/Makefile | 2 +- src/gallium/targets/egl-vmwgfx/dummy.c | 3 --- src/gallium/targets/egl-vmwgfx/target.c | 7 +++++++ src/gallium/targets/xorg-i915/Makefile | 1 + src/gallium/targets/xorg-i915/intel_target.c | 4 ++++ src/gallium/targets/xorg-i965/Makefile | 1 + src/gallium/targets/xorg-i965/intel_target.c | 4 ++++ src/gallium/targets/xorg-nouveau/Makefile | 1 + src/gallium/targets/xorg-nouveau/nouveau_target.c | 4 ++++ src/gallium/targets/xorg-radeon/radeon_target.c | 4 ++++ src/gallium/targets/xorg-vmwgfx/Makefile | 1 + src/gallium/targets/xorg-vmwgfx/vmw_target.c | 4 ++++ 46 files changed, 103 insertions(+), 25 deletions(-) delete mode 100644 src/gallium/targets/dri-i915/dummy.c create mode 100644 src/gallium/targets/dri-i915/target.c delete mode 100644 src/gallium/targets/dri-i965/dummy.c create mode 100644 src/gallium/targets/dri-i965/target.c create mode 100644 src/gallium/targets/dri-nouveau/target.c delete mode 100644 src/gallium/targets/dri-r600/dummy.c create mode 100644 src/gallium/targets/dri-r600/target.c delete mode 100644 src/gallium/targets/dri-radeong/dummy.c create mode 100644 src/gallium/targets/dri-radeong/target.c delete mode 100644 src/gallium/targets/dri-vmwgfx/dummy.c create mode 100644 src/gallium/targets/dri-vmwgfx/target.c delete mode 100644 src/gallium/targets/egl-i915/dummy.c create mode 100644 src/gallium/targets/egl-i915/target.c delete mode 100644 src/gallium/targets/egl-i965/dummy.c create mode 100644 src/gallium/targets/egl-i965/target.c delete mode 100644 src/gallium/targets/egl-nouveau/dummy.c create mode 100644 src/gallium/targets/egl-nouveau/target.c delete mode 100644 src/gallium/targets/egl-radeon/dummy.c create mode 100644 src/gallium/targets/egl-radeon/target.c delete mode 100644 src/gallium/targets/egl-vmwgfx/dummy.c create mode 100644 src/gallium/targets/egl-vmwgfx/target.c create mode 100644 src/gallium/targets/xorg-i915/intel_target.c create mode 100644 src/gallium/targets/xorg-i965/intel_target.c create mode 100644 src/gallium/targets/xorg-nouveau/nouveau_target.c create mode 100644 src/gallium/targets/xorg-radeon/radeon_target.c create mode 100644 src/gallium/targets/xorg-vmwgfx/vmw_target.c diff --git a/src/gallium/targets/dri-i915/Makefile b/src/gallium/targets/dri-i915/Makefile index fdcfd08c22..24ef989ad2 100644 --- a/src/gallium/targets/dri-i915/Makefile +++ b/src/gallium/targets/dri-i915/Makefile @@ -13,6 +13,7 @@ PIPE_DRIVERS = \ $(TOP)/src/gallium/drivers/i915/libi915.a C_SOURCES = \ + target.c \ $(COMMON_GALLIUM_SOURCES) \ $(DRIVER_SOURCES) diff --git a/src/gallium/targets/dri-i915/SConscript b/src/gallium/targets/dri-i915/SConscript index 65c4239887..5da2a0a403 100644 --- a/src/gallium/targets/dri-i915/SConscript +++ b/src/gallium/targets/dri-i915/SConscript @@ -22,6 +22,6 @@ env.Prepend(LIBS = [ env.LoadableModule( target = 'i915_dri.so', - source = 'dummy.c', + source = 'target.c', SHLIBPREFIX = '', ) diff --git a/src/gallium/targets/dri-i915/dummy.c b/src/gallium/targets/dri-i915/dummy.c deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/gallium/targets/dri-i915/target.c b/src/gallium/targets/dri-i915/target.c new file mode 100644 index 0000000000..8fd7308893 --- /dev/null +++ b/src/gallium/targets/dri-i915/target.c @@ -0,0 +1,4 @@ + +#include "target-helpers/drm_api_compat.h" + +DRM_API_COMPAT_STRUCT("i915", "i915") diff --git a/src/gallium/targets/dri-i965/Makefile b/src/gallium/targets/dri-i965/Makefile index 13987c643e..b068430ecf 100644 --- a/src/gallium/targets/dri-i965/Makefile +++ b/src/gallium/targets/dri-i965/Makefile @@ -15,6 +15,7 @@ PIPE_DRIVERS = \ $(TOP)/src/gallium/drivers/i965/libi965.a C_SOURCES = \ + target.c \ $(COMMON_GALLIUM_SOURCES) \ $(DRIVER_SOURCES) diff --git a/src/gallium/targets/dri-i965/SConscript b/src/gallium/targets/dri-i965/SConscript index 13ac5a2d8e..9e12c61aab 100644 --- a/src/gallium/targets/dri-i965/SConscript +++ b/src/gallium/targets/dri-i965/SConscript @@ -24,6 +24,6 @@ env.Prepend(LIBS = [ env.LoadableModule( target = 'i965_dri.so', - source = 'dummy.c', + source = 'target.c', SHLIBPREFIX = '', ) diff --git a/src/gallium/targets/dri-i965/dummy.c b/src/gallium/targets/dri-i965/dummy.c deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/gallium/targets/dri-i965/target.c b/src/gallium/targets/dri-i965/target.c new file mode 100644 index 0000000000..9fe2227edd --- /dev/null +++ b/src/gallium/targets/dri-i965/target.c @@ -0,0 +1,4 @@ + +#include "target-helpers/drm_api_compat.h" + +DRM_API_COMPAT_STRUCT("i965", "i915") diff --git a/src/gallium/targets/dri-nouveau/Makefile b/src/gallium/targets/dri-nouveau/Makefile index 74d352c6a7..bf594ce483 100644 --- a/src/gallium/targets/dri-nouveau/Makefile +++ b/src/gallium/targets/dri-nouveau/Makefile @@ -11,6 +11,7 @@ PIPE_DRIVERS = \ $(TOP)/src/gallium/drivers/nouveau/libnouveau.a C_SOURCES = \ + target.c \ $(COMMON_GALLIUM_SOURCES) \ $(DRIVER_SOURCES) diff --git a/src/gallium/targets/dri-nouveau/target.c b/src/gallium/targets/dri-nouveau/target.c new file mode 100644 index 0000000000..e16e86cd3d --- /dev/null +++ b/src/gallium/targets/dri-nouveau/target.c @@ -0,0 +1,4 @@ + +#include "target-helpers/drm_api_compat.h" + +DRM_API_COMPAT_STRUCT("nouveau", "nouveau") diff --git a/src/gallium/targets/dri-r600/Makefile b/src/gallium/targets/dri-r600/Makefile index 0213200fbc..136fbb260b 100644 --- a/src/gallium/targets/dri-r600/Makefile +++ b/src/gallium/targets/dri-r600/Makefile @@ -12,6 +12,7 @@ PIPE_DRIVERS = \ $(TOP)/src/gallium/drivers/r600/libr600.a C_SOURCES = \ + target.c \ $(COMMON_GALLIUM_SOURCES) \ $(DRIVER_SOURCES) diff --git a/src/gallium/targets/dri-r600/SConscript b/src/gallium/targets/dri-r600/SConscript index 6c23c050eb..d24251673c 100644 --- a/src/gallium/targets/dri-r600/SConscript +++ b/src/gallium/targets/dri-r600/SConscript @@ -22,6 +22,6 @@ env.Prepend(LIBS = [ env.SharedLibrary( target ='r600_dri.so', - source = 'dummy.c', + source = 'target.c', SHLIBPREFIX = '', ) diff --git a/src/gallium/targets/dri-r600/dummy.c b/src/gallium/targets/dri-r600/dummy.c deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/gallium/targets/dri-r600/target.c b/src/gallium/targets/dri-r600/target.c new file mode 100644 index 0000000000..3f09a7c5a9 --- /dev/null +++ b/src/gallium/targets/dri-r600/target.c @@ -0,0 +1,4 @@ + +#include "target-helpers/drm_api_compat.h" + +DRM_API_COMPAT_STRUCT("r600", "radeon") diff --git a/src/gallium/targets/dri-radeong/Makefile b/src/gallium/targets/dri-radeong/Makefile index 8ef24c0821..d67d7d7ac2 100644 --- a/src/gallium/targets/dri-radeong/Makefile +++ b/src/gallium/targets/dri-radeong/Makefile @@ -12,6 +12,7 @@ PIPE_DRIVERS = \ $(TOP)/src/gallium/drivers/r300/libr300.a C_SOURCES = \ + target.c \ $(COMMON_GALLIUM_SOURCES) \ $(DRIVER_SOURCES) diff --git a/src/gallium/targets/dri-radeong/SConscript b/src/gallium/targets/dri-radeong/SConscript index 4c6cfb84eb..c1d4eeecee 100644 --- a/src/gallium/targets/dri-radeong/SConscript +++ b/src/gallium/targets/dri-radeong/SConscript @@ -22,6 +22,6 @@ env.Prepend(LIBS = [ env.SharedLibrary( target ='radeon_dri.so', - source = 'dummy.c', + source = 'target.c', SHLIBPREFIX = '', ) diff --git a/src/gallium/targets/dri-radeong/dummy.c b/src/gallium/targets/dri-radeong/dummy.c deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/gallium/targets/dri-radeong/target.c b/src/gallium/targets/dri-radeong/target.c new file mode 100644 index 0000000000..06b64820cf --- /dev/null +++ b/src/gallium/targets/dri-radeong/target.c @@ -0,0 +1,4 @@ + +#include "target-helpers/drm_api_compat.h" + +DRM_API_COMPAT_STRUCT("radeon", "radeon") diff --git a/src/gallium/targets/dri-vmwgfx/Makefile b/src/gallium/targets/dri-vmwgfx/Makefile index b5b679f3c7..8e3cd6ff28 100644 --- a/src/gallium/targets/dri-vmwgfx/Makefile +++ b/src/gallium/targets/dri-vmwgfx/Makefile @@ -11,6 +11,7 @@ PIPE_DRIVERS = \ $(TOP)/src/gallium/drivers/svga/libsvga.a C_SOURCES = \ + target.c \ $(COMMON_GALLIUM_SOURCES) include ../Makefile.dri diff --git a/src/gallium/targets/dri-vmwgfx/SConscript b/src/gallium/targets/dri-vmwgfx/SConscript index 09a0c254c3..3d0c5495da 100644 --- a/src/gallium/targets/dri-vmwgfx/SConscript +++ b/src/gallium/targets/dri-vmwgfx/SConscript @@ -20,6 +20,6 @@ env.Prepend(LIBS = [ env.LoadableModule( target = 'vmwgfx_dri.so', - source = 'dummy.c', + source = 'target.c', SHLIBPREFIX = '', ) diff --git a/src/gallium/targets/dri-vmwgfx/dummy.c b/src/gallium/targets/dri-vmwgfx/dummy.c deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/gallium/targets/dri-vmwgfx/target.c b/src/gallium/targets/dri-vmwgfx/target.c new file mode 100644 index 0000000000..3d1990fc1b --- /dev/null +++ b/src/gallium/targets/dri-vmwgfx/target.c @@ -0,0 +1,4 @@ + +#include "target-helpers/drm_api_compat.h" + +DRM_API_COMPAT_STRUCT("vmwgfx", "vmwgfx") diff --git a/src/gallium/targets/egl-i915/Makefile b/src/gallium/targets/egl-i915/Makefile index a4b41842ff..a118f16929 100644 --- a/src/gallium/targets/egl-i915/Makefile +++ b/src/gallium/targets/egl-i915/Makefile @@ -2,7 +2,7 @@ TOP = ../../../.. include $(TOP)/configs/current EGL_DRIVER_NAME = i915 -EGL_DRIVER_SOURCES = dummy.c +EGL_DRIVER_SOURCES = target.c EGL_DRIVER_LIBS = -ldrm_intel EGL_DRIVER_PIPES = \ diff --git a/src/gallium/targets/egl-i915/dummy.c b/src/gallium/targets/egl-i915/dummy.c deleted file mode 100644 index 3181d0ba7e..0000000000 --- a/src/gallium/targets/egl-i915/dummy.c +++ /dev/null @@ -1,3 +0,0 @@ -/* A poor man's --whole-archive for EGL drivers */ -void *_eglMain(void *); -void *_eglWholeArchive = (void *) _eglMain; diff --git a/src/gallium/targets/egl-i915/target.c b/src/gallium/targets/egl-i915/target.c new file mode 100644 index 0000000000..fd68c4bd45 --- /dev/null +++ b/src/gallium/targets/egl-i915/target.c @@ -0,0 +1,8 @@ + +#include "target-helpers/drm_api_compat.h" + +DRM_API_COMPAT_STRUCT("i915", "i915") + +/* A poor man's --whole-archive for EGL drivers */ +void *_eglMain(void *); +void *_eglWholeArchive = (void *) _eglMain; diff --git a/src/gallium/targets/egl-i965/Makefile b/src/gallium/targets/egl-i965/Makefile index d4730824a5..542200481d 100644 --- a/src/gallium/targets/egl-i965/Makefile +++ b/src/gallium/targets/egl-i965/Makefile @@ -2,7 +2,7 @@ TOP = ../../../.. include $(TOP)/configs/current EGL_DRIVER_NAME = i965 -EGL_DRIVER_SOURCES = dummy.c +EGL_DRIVER_SOURCES = target.c EGL_DRIVER_LIBS = -ldrm_intel EGL_DRIVER_PIPES = \ diff --git a/src/gallium/targets/egl-i965/dummy.c b/src/gallium/targets/egl-i965/dummy.c deleted file mode 100644 index 3181d0ba7e..0000000000 --- a/src/gallium/targets/egl-i965/dummy.c +++ /dev/null @@ -1,3 +0,0 @@ -/* A poor man's --whole-archive for EGL drivers */ -void *_eglMain(void *); -void *_eglWholeArchive = (void *) _eglMain; diff --git a/src/gallium/targets/egl-i965/target.c b/src/gallium/targets/egl-i965/target.c new file mode 100644 index 0000000000..2f97bcecf2 --- /dev/null +++ b/src/gallium/targets/egl-i965/target.c @@ -0,0 +1,8 @@ + +#include "target-helpers/drm_api_compat.h" + +DRM_API_COMPAT_STRUCT("i965", "i915") + +/* A poor man's --whole-archive for EGL drivers */ +void *_eglMain(void *); +void *_eglWholeArchive = (void *) _eglMain; diff --git a/src/gallium/targets/egl-nouveau/Makefile b/src/gallium/targets/egl-nouveau/Makefile index e3fa8937e8..3f0a373e43 100644 --- a/src/gallium/targets/egl-nouveau/Makefile +++ b/src/gallium/targets/egl-nouveau/Makefile @@ -2,7 +2,7 @@ TOP = ../../../.. include $(TOP)/configs/current EGL_DRIVER_NAME = nouveau -EGL_DRIVER_SOURCES = dummy.c +EGL_DRIVER_SOURCES = target.c EGL_DRIVER_LIBS = -ldrm_nouveau EGL_DRIVER_PIPES = \ diff --git a/src/gallium/targets/egl-nouveau/dummy.c b/src/gallium/targets/egl-nouveau/dummy.c deleted file mode 100644 index 3181d0ba7e..0000000000 --- a/src/gallium/targets/egl-nouveau/dummy.c +++ /dev/null @@ -1,3 +0,0 @@ -/* A poor man's --whole-archive for EGL drivers */ -void *_eglMain(void *); -void *_eglWholeArchive = (void *) _eglMain; diff --git a/src/gallium/targets/egl-nouveau/target.c b/src/gallium/targets/egl-nouveau/target.c new file mode 100644 index 0000000000..49545c63e1 --- /dev/null +++ b/src/gallium/targets/egl-nouveau/target.c @@ -0,0 +1,8 @@ + +#include "target-helpers/drm_api_compat.h" + +DRM_API_COMPAT_STRUCT("nouveau", "nouveau") + +/* A poor man's --whole-archive for EGL drivers */ +void *_eglMain(void *); +void *_eglWholeArchive = (void *) _eglMain; diff --git a/src/gallium/targets/egl-radeon/Makefile b/src/gallium/targets/egl-radeon/Makefile index 8fcca26826..c988b48cd0 100644 --- a/src/gallium/targets/egl-radeon/Makefile +++ b/src/gallium/targets/egl-radeon/Makefile @@ -2,7 +2,7 @@ TOP = ../../../.. include $(TOP)/configs/current EGL_DRIVER_NAME = radeon -EGL_DRIVER_SOURCES = dummy.c +EGL_DRIVER_SOURCES = target.c EGL_DRIVER_LIBS = -ldrm_radeon EGL_DRIVER_PIPES = \ diff --git a/src/gallium/targets/egl-radeon/dummy.c b/src/gallium/targets/egl-radeon/dummy.c deleted file mode 100644 index 3181d0ba7e..0000000000 --- a/src/gallium/targets/egl-radeon/dummy.c +++ /dev/null @@ -1,3 +0,0 @@ -/* A poor man's --whole-archive for EGL drivers */ -void *_eglMain(void *); -void *_eglWholeArchive = (void *) _eglMain; diff --git a/src/gallium/targets/egl-radeon/target.c b/src/gallium/targets/egl-radeon/target.c new file mode 100644 index 0000000000..03b982ae83 --- /dev/null +++ b/src/gallium/targets/egl-radeon/target.c @@ -0,0 +1,8 @@ + +#include "target-helpers/drm_api_compat.h" + +DRM_API_COMPAT_STRUCT("radeon", "radeon") + +/* A poor man's --whole-archive for EGL drivers */ +void *_eglMain(void *); +void *_eglWholeArchive = (void *) _eglMain; diff --git a/src/gallium/targets/egl-vmwgfx/Makefile b/src/gallium/targets/egl-vmwgfx/Makefile index a9f6874b98..a25bf8885d 100644 --- a/src/gallium/targets/egl-vmwgfx/Makefile +++ b/src/gallium/targets/egl-vmwgfx/Makefile @@ -2,7 +2,7 @@ TOP = ../../../.. include $(TOP)/configs/current EGL_DRIVER_NAME = vmwgfx -EGL_DRIVER_SOURCES = dummy.c +EGL_DRIVER_SOURCES = target.c EGL_DRIVER_LIBS = EGL_DRIVER_PIPES = \ diff --git a/src/gallium/targets/egl-vmwgfx/dummy.c b/src/gallium/targets/egl-vmwgfx/dummy.c deleted file mode 100644 index 3181d0ba7e..0000000000 --- a/src/gallium/targets/egl-vmwgfx/dummy.c +++ /dev/null @@ -1,3 +0,0 @@ -/* A poor man's --whole-archive for EGL drivers */ -void *_eglMain(void *); -void *_eglWholeArchive = (void *) _eglMain; diff --git a/src/gallium/targets/egl-vmwgfx/target.c b/src/gallium/targets/egl-vmwgfx/target.c new file mode 100644 index 0000000000..39a829a230 --- /dev/null +++ b/src/gallium/targets/egl-vmwgfx/target.c @@ -0,0 +1,7 @@ +#include "target-helpers/drm_api_compat.h" + +DRM_API_COMPAT_STRUCT("vmwgfx", "vmwgfx") + +/* A poor man's --whole-archive for EGL drivers */ +void *_eglMain(void *); +void *_eglWholeArchive = (void *) _eglMain; diff --git a/src/gallium/targets/xorg-i915/Makefile b/src/gallium/targets/xorg-i915/Makefile index 18f07d6d8f..4f9202b052 100644 --- a/src/gallium/targets/xorg-i915/Makefile +++ b/src/gallium/targets/xorg-i915/Makefile @@ -4,6 +4,7 @@ include $(TOP)/configs/current LIBNAME = modesetting_drv.so C_SOURCES = \ + intel_target.c \ intel_xorg.c DRIVER_DEFINES = \ diff --git a/src/gallium/targets/xorg-i915/intel_target.c b/src/gallium/targets/xorg-i915/intel_target.c new file mode 100644 index 0000000000..4eff93c074 --- /dev/null +++ b/src/gallium/targets/xorg-i915/intel_target.c @@ -0,0 +1,4 @@ + +#include "target-helpers/drm_api_compat.h" + +DRM_API_COMPAT_STRUCT("modesetting", "i915") diff --git a/src/gallium/targets/xorg-i965/Makefile b/src/gallium/targets/xorg-i965/Makefile index 2b0c7d6fdf..b23a2deab9 100644 --- a/src/gallium/targets/xorg-i965/Makefile +++ b/src/gallium/targets/xorg-i965/Makefile @@ -4,6 +4,7 @@ include $(TOP)/configs/current LIBNAME = i965g_drv.so C_SOURCES = \ + intel_target.c \ intel_xorg.c DRIVER_DEFINES = \ diff --git a/src/gallium/targets/xorg-i965/intel_target.c b/src/gallium/targets/xorg-i965/intel_target.c new file mode 100644 index 0000000000..2b0f545877 --- /dev/null +++ b/src/gallium/targets/xorg-i965/intel_target.c @@ -0,0 +1,4 @@ + +#include "target-helpers/drm_api_compat.h" + +DRM_API_COMPAT_STRUCT("i965g", "i915") diff --git a/src/gallium/targets/xorg-nouveau/Makefile b/src/gallium/targets/xorg-nouveau/Makefile index f50872362f..066ec6a813 100644 --- a/src/gallium/targets/xorg-nouveau/Makefile +++ b/src/gallium/targets/xorg-nouveau/Makefile @@ -4,6 +4,7 @@ include $(TOP)/configs/current LIBNAME = modesetting_drv.so C_SOURCES = \ + nouveau_target.c \ nouveau_xorg.c DRIVER_DEFINES = \ diff --git a/src/gallium/targets/xorg-nouveau/nouveau_target.c b/src/gallium/targets/xorg-nouveau/nouveau_target.c new file mode 100644 index 0000000000..e16e86cd3d --- /dev/null +++ b/src/gallium/targets/xorg-nouveau/nouveau_target.c @@ -0,0 +1,4 @@ + +#include "target-helpers/drm_api_compat.h" + +DRM_API_COMPAT_STRUCT("nouveau", "nouveau") diff --git a/src/gallium/targets/xorg-radeon/radeon_target.c b/src/gallium/targets/xorg-radeon/radeon_target.c new file mode 100644 index 0000000000..06b64820cf --- /dev/null +++ b/src/gallium/targets/xorg-radeon/radeon_target.c @@ -0,0 +1,4 @@ + +#include "target-helpers/drm_api_compat.h" + +DRM_API_COMPAT_STRUCT("radeon", "radeon") diff --git a/src/gallium/targets/xorg-vmwgfx/Makefile b/src/gallium/targets/xorg-vmwgfx/Makefile index c0ff999116..0cc9be212b 100644 --- a/src/gallium/targets/xorg-vmwgfx/Makefile +++ b/src/gallium/targets/xorg-vmwgfx/Makefile @@ -8,6 +8,7 @@ C_SOURCES = \ vmw_video.c \ vmw_ioctl.c \ vmw_ctrl.c \ + vmw_target.c \ vmw_screen.c DRIVER_INCLUDES = \ diff --git a/src/gallium/targets/xorg-vmwgfx/vmw_target.c b/src/gallium/targets/xorg-vmwgfx/vmw_target.c new file mode 100644 index 0000000000..3d1990fc1b --- /dev/null +++ b/src/gallium/targets/xorg-vmwgfx/vmw_target.c @@ -0,0 +1,4 @@ + +#include "target-helpers/drm_api_compat.h" + +DRM_API_COMPAT_STRUCT("vmwgfx", "vmwgfx") -- cgit v1.2.3 From 16fa300d55f789cfd71b1d61e3ff74d2eafd12ab Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 1 Jun 2010 07:56:33 +0100 Subject: swrastg: Use new drm_driver interface in EGL The EGL state tracker is really weird in how it does software, in the past we would just not return a drm_api struct but now, there is no callback to get a function so we just set the create_screen hock to NULL to make it switch to software. --- src/gallium/targets/egl-swrast/swrast_glue.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/gallium/targets/egl-swrast/swrast_glue.c b/src/gallium/targets/egl-swrast/swrast_glue.c index defd11c687..3c29be83a7 100644 --- a/src/gallium/targets/egl-swrast/swrast_glue.c +++ b/src/gallium/targets/egl-swrast/swrast_glue.c @@ -1,10 +1,11 @@ -#include "state_tracker/drm_api.h" -struct drm_api * -drm_api_create() -{ - return NULL; -} +#include "state_tracker/drm_driver.h" + +struct drm_driver_descriptor drm_driver = { + .name = "swrast"; + .driver_name = NULL; + .create_screen = NULL; +}; /* A poor man's --whole-archive for EGL drivers */ void *_eglMain(void *); -- cgit v1.2.3 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/drivers/svga/svga_public.h | 42 +++++++++++++++++++++++++++ src/gallium/drivers/svga/svga_screen.c | 1 + src/gallium/drivers/svga/svga_winsys.h | 3 -- src/gallium/targets/dri-vmwgfx/target.c | 17 +++++++++-- src/gallium/targets/egl-vmwgfx/target.c | 18 ++++++++++-- src/gallium/targets/xorg-vmwgfx/vmw_target.c | 17 +++++++++-- src/gallium/winsys/svga/drm/svga_drm_public.h | 41 ++++++++++++++++++++++++++ src/gallium/winsys/svga/drm/vmw_screen_dri.c | 39 +++++-------------------- 8 files changed, 138 insertions(+), 40 deletions(-) create mode 100644 src/gallium/drivers/svga/svga_public.h create mode 100644 src/gallium/winsys/svga/drm/svga_drm_public.h diff --git a/src/gallium/drivers/svga/svga_public.h b/src/gallium/drivers/svga/svga_public.h new file mode 100644 index 0000000000..ded2e2482a --- /dev/null +++ b/src/gallium/drivers/svga/svga_public.h @@ -0,0 +1,42 @@ +/********************************************************** + * 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 public interface. Used by targets to create a stack. + * + * @author Jakob Bornecrantz Fonseca + */ + +#ifndef SVGA_PUBLIC_H_ +#define SVGA_PUBLIC_H_ + +struct pipe_screen; +struct svga_winsys_screen; + +struct pipe_screen * +svga_screen_create(struct svga_winsys_screen *sws); + +#endif /* SVGA_PUBLIC_H_ */ diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c index 54d9faeb72..077ff9a2cf 100644 --- a/src/gallium/drivers/svga/svga_screen.c +++ b/src/gallium/drivers/svga/svga_screen.c @@ -29,6 +29,7 @@ #include "util/u_math.h" #include "svga_winsys.h" +#include "svga_public.h" #include "svga_context.h" #include "svga_screen.h" #include "svga_resource_texture.h" diff --git a/src/gallium/drivers/svga/svga_winsys.h b/src/gallium/drivers/svga/svga_winsys.h index a2dcc84f7d..5e4bdeff2e 100644 --- a/src/gallium/drivers/svga/svga_winsys.h +++ b/src/gallium/drivers/svga/svga_winsys.h @@ -288,9 +288,6 @@ struct svga_winsys_screen }; -struct pipe_screen * -svga_screen_create(struct svga_winsys_screen *sws); - struct svga_winsys_screen * svga_winsys_screen(struct pipe_screen *screen); diff --git a/src/gallium/targets/dri-vmwgfx/target.c b/src/gallium/targets/dri-vmwgfx/target.c index 3d1990fc1b..5f69653582 100644 --- a/src/gallium/targets/dri-vmwgfx/target.c +++ b/src/gallium/targets/dri-vmwgfx/target.c @@ -1,4 +1,17 @@ -#include "target-helpers/drm_api_compat.h" +#include "state_tracker/drm_driver.h" +#include "svga/drm/svga_drm_public.h" +#include "svga/svga_public.h" -DRM_API_COMPAT_STRUCT("vmwgfx", "vmwgfx") +static struct pipe_screen * +create_screen(int fd) +{ + struct svga_winsys_screen *sws; + sws = svga_drm_winsys_screen_create(fd); + if (!sws) + return NULL; + + return svga_screen_create(sws); +} + +DRM_DRIVER_DESCRIPTOR("vmwgfx", "vmwgfx", create_screen) diff --git a/src/gallium/targets/egl-vmwgfx/target.c b/src/gallium/targets/egl-vmwgfx/target.c index 39a829a230..7dd0bb0dc2 100644 --- a/src/gallium/targets/egl-vmwgfx/target.c +++ b/src/gallium/targets/egl-vmwgfx/target.c @@ -1,6 +1,20 @@ -#include "target-helpers/drm_api_compat.h" -DRM_API_COMPAT_STRUCT("vmwgfx", "vmwgfx") +#include "state_tracker/drm_driver.h" +#include "svga/drm/svga_drm_public.h" +#include "svga/svga_public.h" + +static struct pipe_screen * +create_screen(int fd) +{ + struct svga_winsys_screen *sws; + sws = svga_drm_winsys_screen_create(fd); + if (!sws) + return NULL; + + return svga_screen_create(sws); +} + +DRM_DRIVER_DESCRIPTOR("vmwgfx", "vmwgfx", create_screen) /* A poor man's --whole-archive for EGL drivers */ void *_eglMain(void *); diff --git a/src/gallium/targets/xorg-vmwgfx/vmw_target.c b/src/gallium/targets/xorg-vmwgfx/vmw_target.c index 3d1990fc1b..5f69653582 100644 --- a/src/gallium/targets/xorg-vmwgfx/vmw_target.c +++ b/src/gallium/targets/xorg-vmwgfx/vmw_target.c @@ -1,4 +1,17 @@ -#include "target-helpers/drm_api_compat.h" +#include "state_tracker/drm_driver.h" +#include "svga/drm/svga_drm_public.h" +#include "svga/svga_public.h" -DRM_API_COMPAT_STRUCT("vmwgfx", "vmwgfx") +static struct pipe_screen * +create_screen(int fd) +{ + struct svga_winsys_screen *sws; + sws = svga_drm_winsys_screen_create(fd); + if (!sws) + return NULL; + + return svga_screen_create(sws); +} + +DRM_DRIVER_DESCRIPTOR("vmwgfx", "vmwgfx", create_screen) 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 From c7015877beedd9831402755dbc58afddcbbd5339 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 1 Jun 2010 04:38:24 +0100 Subject: i915g: Move bootstrap code to targets --- src/gallium/drivers/i915/i915_public.h | 13 +++++++++++++ src/gallium/drivers/i915/i915_screen.c | 1 + src/gallium/drivers/i915/i915_winsys.h | 7 ------- src/gallium/targets/dri-i915/target.c | 17 +++++++++++++++-- src/gallium/targets/egl-i915/target.c | 17 +++++++++++++++-- src/gallium/targets/xorg-i915/intel_target.c | 17 +++++++++++++++-- src/gallium/winsys/i915/drm/i915_drm_buffer.c | 2 +- src/gallium/winsys/i915/drm/i915_drm_public.h | 9 +++++++++ src/gallium/winsys/i915/drm/i915_drm_winsys.c | 27 +++++---------------------- src/gallium/winsys/i915/drm/i915_drm_winsys.h | 1 - src/gallium/winsys/i915/sw/i915_sw_public.h | 9 +++++++++ src/gallium/winsys/i915/sw/i915_sw_winsys.c | 8 ++++---- src/gallium/winsys/i915/sw/i915_sw_winsys.h | 1 - 13 files changed, 87 insertions(+), 42 deletions(-) create mode 100644 src/gallium/drivers/i915/i915_public.h create mode 100644 src/gallium/winsys/i915/drm/i915_drm_public.h create mode 100644 src/gallium/winsys/i915/sw/i915_sw_public.h diff --git a/src/gallium/drivers/i915/i915_public.h b/src/gallium/drivers/i915/i915_public.h new file mode 100644 index 0000000000..588654d608 --- /dev/null +++ b/src/gallium/drivers/i915/i915_public.h @@ -0,0 +1,13 @@ + +#ifndef I915_PUBLIC_H +#define I915_PUBLIC_H + +struct i915_winsys; +struct pipe_screen; + +/** + * Create i915 pipe_screen. + */ +struct pipe_screen * i915_screen_create(struct i915_winsys *iws); + +#endif diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c index f82426520c..bb0b85d74c 100644 --- a/src/gallium/drivers/i915/i915_screen.c +++ b/src/gallium/drivers/i915/i915_screen.c @@ -36,6 +36,7 @@ #include "i915_surface.h" #include "i915_resource.h" #include "i915_winsys.h" +#include "i915_public.h" /* diff --git a/src/gallium/drivers/i915/i915_winsys.h b/src/gallium/drivers/i915/i915_winsys.h index 3aba19fe6a..5385e403d2 100644 --- a/src/gallium/drivers/i915/i915_winsys.h +++ b/src/gallium/drivers/i915/i915_winsys.h @@ -222,11 +222,4 @@ struct i915_winsys { void (*destroy)(struct i915_winsys *iws); }; - -/** - * Create i915 pipe_screen. - */ -struct pipe_screen *i915_screen_create(struct i915_winsys *iws); - - #endif diff --git a/src/gallium/targets/dri-i915/target.c b/src/gallium/targets/dri-i915/target.c index 8fd7308893..a79238f3a0 100644 --- a/src/gallium/targets/dri-i915/target.c +++ b/src/gallium/targets/dri-i915/target.c @@ -1,4 +1,17 @@ -#include "target-helpers/drm_api_compat.h" +#include "state_tracker/drm_driver.h" +#include "i915/drm/i915_drm_public.h" +#include "i915/i915_public.h" -DRM_API_COMPAT_STRUCT("i915", "i915") +static struct pipe_screen * +create_screen(int fd) +{ + struct i915_winsys *iws; + iws = i915_drm_winsys_create(fd); + if (!iws) + return NULL; + + return i915_screen_create(iws); +} + +DRM_DRIVER_DESCRIPTOR("i915", "i915", create_screen) diff --git a/src/gallium/targets/egl-i915/target.c b/src/gallium/targets/egl-i915/target.c index fd68c4bd45..2887716643 100644 --- a/src/gallium/targets/egl-i915/target.c +++ b/src/gallium/targets/egl-i915/target.c @@ -1,7 +1,20 @@ -#include "target-helpers/drm_api_compat.h" +#include "state_tracker/drm_driver.h" +#include "i915/drm/i915_drm_public.h" +#include "i915/i915_public.h" -DRM_API_COMPAT_STRUCT("i915", "i915") +static struct pipe_screen * +create_screen(int fd) +{ + struct i915_winsys *iws; + iws = i915_drm_winsys_create(fd); + if (!iws) + return NULL; + + return i915_screen_create(iws); +} + +DRM_DRIVER_DESCRIPTOR("i915", "i915", create_screen) /* A poor man's --whole-archive for EGL drivers */ void *_eglMain(void *); diff --git a/src/gallium/targets/xorg-i915/intel_target.c b/src/gallium/targets/xorg-i915/intel_target.c index 4eff93c074..a79238f3a0 100644 --- a/src/gallium/targets/xorg-i915/intel_target.c +++ b/src/gallium/targets/xorg-i915/intel_target.c @@ -1,4 +1,17 @@ -#include "target-helpers/drm_api_compat.h" +#include "state_tracker/drm_driver.h" +#include "i915/drm/i915_drm_public.h" +#include "i915/i915_public.h" -DRM_API_COMPAT_STRUCT("modesetting", "i915") +static struct pipe_screen * +create_screen(int fd) +{ + struct i915_winsys *iws; + iws = i915_drm_winsys_create(fd); + if (!iws) + return NULL; + + return i915_screen_create(iws); +} + +DRM_DRIVER_DESCRIPTOR("i915", "i915", create_screen) diff --git a/src/gallium/winsys/i915/drm/i915_drm_buffer.c b/src/gallium/winsys/i915/drm/i915_drm_buffer.c index 3bd85026b2..6b06e7ae99 100644 --- a/src/gallium/winsys/i915/drm/i915_drm_buffer.c +++ b/src/gallium/winsys/i915/drm/i915_drm_buffer.c @@ -1,5 +1,5 @@ -#include "state_tracker/drm_api.h" +#include "state_tracker/drm_driver.h" #include "i915_drm_winsys.h" #include "util/u_memory.h" diff --git a/src/gallium/winsys/i915/drm/i915_drm_public.h b/src/gallium/winsys/i915/drm/i915_drm_public.h new file mode 100644 index 0000000000..b828d8d670 --- /dev/null +++ b/src/gallium/winsys/i915/drm/i915_drm_public.h @@ -0,0 +1,9 @@ + +#ifndef I915_DRM_PUBLIC_H +#define I915_DRM_PUBLIC_H + +struct i915_winsys; + +struct i915_winsys * i915_drm_winsys_create(int drmFD); + +#endif diff --git a/src/gallium/winsys/i915/drm/i915_drm_winsys.c b/src/gallium/winsys/i915/drm/i915_drm_winsys.c index 5a6b45e6c9..83651b4c47 100644 --- a/src/gallium/winsys/i915/drm/i915_drm_winsys.c +++ b/src/gallium/winsys/i915/drm/i915_drm_winsys.c @@ -1,14 +1,11 @@ #include -#include "state_tracker/drm_api.h" +#include "state_tracker/drm_driver.h" #include "i915_drm_winsys.h" +#include "i915_drm_public.h" #include "util/u_memory.h" -#include "i915/i915_context.h" -#include "i915/i915_screen.h" - -#include "trace/tr_drm.h" /* * Helper functions @@ -48,8 +45,8 @@ i915_drm_winsys_destroy(struct i915_winsys *iws) FREE(idws); } -static struct pipe_screen * -i915_drm_create_screen(struct drm_api *api, int drmFD) +struct i915_winsys * +i915_drm_winsys_create(int drmFD) { struct i915_drm_winsys *idws; unsigned int deviceID; @@ -75,19 +72,5 @@ i915_drm_create_screen(struct drm_api *api, int drmFD) idws->dump_cmd = debug_get_bool_option("INTEL_DUMP_CMD", FALSE); - return i915_screen_create(&idws->base); -} - -static struct drm_api i915_drm_api = -{ - .name = "i915", - .driver_name = "i915", - .create_screen = i915_drm_create_screen, - .destroy = NULL, -}; - -struct drm_api * -drm_api_create() -{ - return trace_drm_create(&i915_drm_api); + return &idws->base; } diff --git a/src/gallium/winsys/i915/drm/i915_drm_winsys.h b/src/gallium/winsys/i915/drm/i915_drm_winsys.h index 99667bde4e..1b93ddc734 100644 --- a/src/gallium/winsys/i915/drm/i915_drm_winsys.h +++ b/src/gallium/winsys/i915/drm/i915_drm_winsys.h @@ -34,7 +34,6 @@ i915_drm_winsys(struct i915_winsys *iws) return (struct i915_drm_winsys *)iws; } -struct i915_drm_winsys * i915_drm_winsys_create(int fd, unsigned pci_id); struct pipe_fence_handle * i915_drm_fence_create(drm_intel_bo *bo); void i915_drm_winsys_init_batchbuffer_functions(struct i915_drm_winsys *idws); diff --git a/src/gallium/winsys/i915/sw/i915_sw_public.h b/src/gallium/winsys/i915/sw/i915_sw_public.h new file mode 100644 index 0000000000..e951a32917 --- /dev/null +++ b/src/gallium/winsys/i915/sw/i915_sw_public.h @@ -0,0 +1,9 @@ + +#ifndef I915_SW_PUBLIC_H +#define I915_SW_PUBLIC_H + +struct i915_winsys; + +struct i915_winsys * i915_sw_winsys_create(void); + +#endif diff --git a/src/gallium/winsys/i915/sw/i915_sw_winsys.c b/src/gallium/winsys/i915/sw/i915_sw_winsys.c index bb1c107c05..058ddc44aa 100644 --- a/src/gallium/winsys/i915/sw/i915_sw_winsys.c +++ b/src/gallium/winsys/i915/sw/i915_sw_winsys.c @@ -1,5 +1,6 @@ #include "i915_sw_winsys.h" +#include "i915_sw_public.h" #include "util/u_memory.h" @@ -28,8 +29,8 @@ i915_sw_destroy(struct i915_winsys *iws) */ -struct pipe_screen * -i915_sw_create_screen() +struct i915_winsys * +i915_sw_winsys_create() { struct i915_sw_winsys *isws; unsigned int deviceID; @@ -51,6 +52,5 @@ i915_sw_create_screen() isws->dump_cmd = debug_get_bool_option("INTEL_DUMP_CMD", FALSE); - /* XXX so this will leak winsys:es */ - return i915_screen_create(&isws->base); + return &isws->base; } diff --git a/src/gallium/winsys/i915/sw/i915_sw_winsys.h b/src/gallium/winsys/i915/sw/i915_sw_winsys.h index b8aa9ef4ac..b7b43669f3 100644 --- a/src/gallium/winsys/i915/sw/i915_sw_winsys.h +++ b/src/gallium/winsys/i915/sw/i915_sw_winsys.h @@ -25,7 +25,6 @@ i915_sw_winsys(struct i915_winsys *iws) return (struct i915_sw_winsys *)iws; } -struct pipe_screen* i915_sw_create_screen(void); struct pipe_fence_handle * i915_sw_fence_create(void); void i915_sw_winsys_init_batchbuffer_functions(struct i915_sw_winsys *idws); -- cgit v1.2.3 From 6e3fc2de2a185775a721b3633f420aa3d2c9a949 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sun, 6 Jun 2010 11:56:23 +0100 Subject: r300g: Move bootstrap code to targets --- src/gallium/drivers/r300/r300_public.h | 9 +++++++++ src/gallium/drivers/r300/r300_screen.c | 3 ++- src/gallium/drivers/r300/r300_winsys.h | 3 --- src/gallium/targets/dri-radeong/target.c | 17 +++++++++++++++-- src/gallium/targets/egl-radeon/target.c | 17 +++++++++++++++-- src/gallium/targets/xorg-radeon/radeon_target.c | 17 +++++++++++++++-- src/gallium/winsys/radeon/drm/radeon_drm.c | 18 +++--------------- src/gallium/winsys/radeon/drm/radeon_drm.h | 7 +------ src/gallium/winsys/radeon/drm/radeon_drm_public.h | 9 +++++++++ src/gallium/winsys/radeon/drm/radeon_r300.c | 2 +- 10 files changed, 70 insertions(+), 32 deletions(-) create mode 100644 src/gallium/drivers/r300/r300_public.h create mode 100644 src/gallium/winsys/radeon/drm/radeon_drm_public.h diff --git a/src/gallium/drivers/r300/r300_public.h b/src/gallium/drivers/r300/r300_public.h new file mode 100644 index 0000000000..8e7a963c55 --- /dev/null +++ b/src/gallium/drivers/r300/r300_public.h @@ -0,0 +1,9 @@ + +#ifndef R300_PUBLIC_H +#define R300_PUBLIC_H + +struct r300_winsys_screen; + +struct pipe_screen* r300_screen_create(struct r300_winsys_screen *rws); + +#endif diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 497e24b760..fd522b84e1 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -30,6 +30,7 @@ #include "r300_screen_buffer.h" #include "r300_state_inlines.h" #include "r300_winsys.h" +#include "r300_public.h" /* Return the identifier behind whom the brave coders responsible for this * amalgamation of code, sweat, and duct tape, routinely obscure their names. @@ -366,7 +367,7 @@ static int r300_fence_finish(struct pipe_screen *screen, return 0; /* 0 == success */ } -struct pipe_screen* r300_create_screen(struct r300_winsys_screen *rws) +struct pipe_screen* r300_screen_create(struct r300_winsys_screen *rws) { struct r300_screen *r300screen = CALLOC_STRUCT(r300_screen); diff --git a/src/gallium/drivers/r300/r300_winsys.h b/src/gallium/drivers/r300/r300_winsys.h index 6ce218923b..8a8888d481 100644 --- a/src/gallium/drivers/r300/r300_winsys.h +++ b/src/gallium/drivers/r300/r300_winsys.h @@ -180,7 +180,4 @@ struct r300_winsys_screen { struct r300_winsys_screen * r300_winsys_screen(struct pipe_screen *screen); -/* Creates a new r300 screen. */ -struct pipe_screen* r300_create_screen(struct r300_winsys_screen *rws); - #endif /* R300_WINSYS_H */ diff --git a/src/gallium/targets/dri-radeong/target.c b/src/gallium/targets/dri-radeong/target.c index 06b64820cf..2c1beb633e 100644 --- a/src/gallium/targets/dri-radeong/target.c +++ b/src/gallium/targets/dri-radeong/target.c @@ -1,4 +1,17 @@ -#include "target-helpers/drm_api_compat.h" +#include "state_tracker/drm_driver.h" +#include "radeon/drm/radeon_drm_public.h" +#include "r300/r300_public.h" -DRM_API_COMPAT_STRUCT("radeon", "radeon") +static struct pipe_screen * +create_screen(int fd) +{ + struct r300_winsys_screen *sws; + sws = r300_drm_winsys_screen_create(fd); + if (!sws) + return NULL; + + return r300_screen_create(sws); +} + +DRM_DRIVER_DESCRIPTOR("radeon", "radeon", create_screen) diff --git a/src/gallium/targets/egl-radeon/target.c b/src/gallium/targets/egl-radeon/target.c index 03b982ae83..5117eb86f9 100644 --- a/src/gallium/targets/egl-radeon/target.c +++ b/src/gallium/targets/egl-radeon/target.c @@ -1,7 +1,20 @@ -#include "target-helpers/drm_api_compat.h" +#include "state_tracker/drm_driver.h" +#include "radeon/drm/radeon_drm_public.h" +#include "r300/r300_public.h" -DRM_API_COMPAT_STRUCT("radeon", "radeon") +static struct pipe_screen * +create_screen(int fd) +{ + struct r300_winsys_screen *sws; + sws = r300_drm_winsys_screen_create(fd); + if (!sws) + return NULL; + + return r300_screen_create(sws); +} + +DRM_DRIVER_DESCRIPTOR("radeon", "radeon", create_screen) /* A poor man's --whole-archive for EGL drivers */ void *_eglMain(void *); diff --git a/src/gallium/targets/xorg-radeon/radeon_target.c b/src/gallium/targets/xorg-radeon/radeon_target.c index 06b64820cf..2c1beb633e 100644 --- a/src/gallium/targets/xorg-radeon/radeon_target.c +++ b/src/gallium/targets/xorg-radeon/radeon_target.c @@ -1,4 +1,17 @@ -#include "target-helpers/drm_api_compat.h" +#include "state_tracker/drm_driver.h" +#include "radeon/drm/radeon_drm_public.h" +#include "r300/r300_public.h" -DRM_API_COMPAT_STRUCT("radeon", "radeon") +static struct pipe_screen * +create_screen(int fd) +{ + struct r300_winsys_screen *sws; + sws = r300_drm_winsys_screen_create(fd); + if (!sws) + return NULL; + + return r300_screen_create(sws); +} + +DRM_DRIVER_DESCRIPTOR("radeon", "radeon", create_screen) diff --git a/src/gallium/winsys/radeon/drm/radeon_drm.c b/src/gallium/winsys/radeon/drm/radeon_drm.c index 59f1b10230..e9a276362f 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm.c @@ -32,9 +32,9 @@ #include "radeon_drm.h" #include "radeon_r300.h" #include "radeon_buffer.h" +#include "radeon_drm_public.h" #include "r300_winsys.h" -#include "trace/tr_drm.h" #include "util/u_memory.h" @@ -153,7 +153,7 @@ static void do_ioctls(int fd, struct radeon_libdrm_winsys* winsys) } /* Create a pipe_screen. */ -struct pipe_screen* radeon_create_screen(struct drm_api* api, int drmFB) +struct r300_winsys_screen* r300_drm_winsys_screen_create(int drmFB) { struct radeon_libdrm_winsys* rws; boolean ret; @@ -171,22 +171,10 @@ struct pipe_screen* radeon_create_screen(struct drm_api* api, int drmFB) ret = radeon_setup_winsys(drmFB, rws); if (ret == FALSE) goto fail; - return r300_create_screen(&rws->base); + return &rws->base; } fail: FREE(rws); return NULL; } - -static struct drm_api radeon_drm_api_hooks = { - .name = "radeon", - .driver_name = "radeon", - .create_screen = radeon_create_screen, - .destroy = NULL, -}; - -struct drm_api* drm_api_create() -{ - return trace_drm_create(&radeon_drm_api_hooks); -} diff --git a/src/gallium/winsys/radeon/drm/radeon_drm.h b/src/gallium/winsys/radeon/drm/radeon_drm.h index 3544c926d9..df6dd91ad5 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm.h +++ b/src/gallium/winsys/radeon/drm/radeon_drm.h @@ -30,12 +30,7 @@ #ifndef RADEON_DRM_H #define RADEON_DRM_H -#include "state_tracker/drm_api.h" - - -struct pipe_screen* radeon_create_screen(struct drm_api* api, int drmFB); - -void radeon_destroy_drm_api(struct drm_api* api); +#include "state_tracker/drm_driver.h" /* Guess at whether this chipset should use r300g. * diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_public.h b/src/gallium/winsys/radeon/drm/radeon_drm_public.h new file mode 100644 index 0000000000..0d96ae8c47 --- /dev/null +++ b/src/gallium/winsys/radeon/drm/radeon_drm_public.h @@ -0,0 +1,9 @@ + +#ifndef RADEON_DRM_PUBLIC_H +#define RADEON_DRM_PUBLIC_H + +struct r300_winsys_screen; + +struct r300_winsys_screen *r300_drm_winsys_screen_create(int drmFD); + +#endif diff --git a/src/gallium/winsys/radeon/drm/radeon_r300.c b/src/gallium/winsys/radeon/drm/radeon_r300.c index 70ae01a694..a9b36578ef 100644 --- a/src/gallium/winsys/radeon/drm/radeon_r300.c +++ b/src/gallium/winsys/radeon/drm/radeon_r300.c @@ -25,7 +25,7 @@ #include "radeon_bo_gem.h" #include "radeon_cs_gem.h" -#include "state_tracker/drm_api.h" +#include "state_tracker/drm_driver.h" static struct r300_winsys_buffer * radeon_r300_winsys_buffer_create(struct r300_winsys_screen *rws, -- cgit v1.2.3 From 0ee7a17d0ca14ddbf4ef48da764627851eca048c Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Mon, 14 Jun 2010 17:37:21 +0200 Subject: swrastg: Fix glue file --- src/gallium/targets/egl-swrast/swrast_glue.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gallium/targets/egl-swrast/swrast_glue.c b/src/gallium/targets/egl-swrast/swrast_glue.c index 3c29be83a7..24f77826d4 100644 --- a/src/gallium/targets/egl-swrast/swrast_glue.c +++ b/src/gallium/targets/egl-swrast/swrast_glue.c @@ -2,9 +2,9 @@ #include "state_tracker/drm_driver.h" struct drm_driver_descriptor drm_driver = { - .name = "swrast"; - .driver_name = NULL; - .create_screen = NULL; + .name = "swrast", + .driver_name = NULL, + .create_screen = NULL, }; /* A poor man's --whole-archive for EGL drivers */ -- cgit v1.2.3 From bd739e95763d8051679649cc44d16d4fcbb0fec1 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 18 Jun 2010 19:07:04 +0200 Subject: target-helpers: Add inline helpers --- .../auxiliary/target-helpers/inline_sw_helper.h | 63 ++++++++++++++++++++++ .../target-helpers/inline_wrapper_sw_helper.h | 34 ++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 src/gallium/auxiliary/target-helpers/inline_sw_helper.h create mode 100644 src/gallium/auxiliary/target-helpers/inline_wrapper_sw_helper.h diff --git a/src/gallium/auxiliary/target-helpers/inline_sw_helper.h b/src/gallium/auxiliary/target-helpers/inline_sw_helper.h new file mode 100644 index 0000000000..036c1ee48a --- /dev/null +++ b/src/gallium/auxiliary/target-helpers/inline_sw_helper.h @@ -0,0 +1,63 @@ + +#ifndef INLINE_SW_HELPER_H +#define INLINE_SW_HELPER_H + +#include "pipe/p_compiler.h" +#include "util/u_debug.h" +#include "state_tracker/sw_winsys.h" + + +/* Helper function to choose and instantiate one of the software rasterizers: + * cell, llvmpipe, softpipe. + */ + +#ifdef GALLIUM_SOFTPIPE +#include "softpipe/sp_public.h" +#endif + +#ifdef GALLIUM_LLVMPIPE +#include "llvmpipe/lp_public.h" +#endif + +#ifdef GALLIUM_CELL +#include "cell/ppu/cell_public.h" +#endif + +static INLINE struct pipe_screen * +sw_screen_create(struct sw_winsys *winsys) +{ + const char *default_driver; + const char *driver; + struct pipe_screen *screen = NULL; + +#if defined(GALLIUM_CELL) + default_driver = "cell"; +#elif defined(GALLIUM_LLVMPIPE) + default_driver = "llvmpipe"; +#elif defined(GALLIUM_SOFTPIPE) + default_driver = "softpipe"; +#else + default_driver = ""; +#endif + + driver = debug_get_option("GALLIUM_DRIVER", default_driver); + +#if defined(GALLIUM_CELL) + if (screen == NULL && strcmp(driver, "cell") == 0) + screen = cell_create_screen(winsys); +#endif + +#if defined(GALLIUM_LLVMPIPE) + if (screen == NULL && strcmp(driver, "llvmpipe") == 0) + screen = llvmpipe_create_screen(winsys); +#endif + +#if defined(GALLIUM_SOFTPIPE) + if (screen == NULL) + screen = softpipe_create_screen(winsys); +#endif + + return screen; +} + +#endif diff --git a/src/gallium/auxiliary/target-helpers/inline_wrapper_sw_helper.h b/src/gallium/auxiliary/target-helpers/inline_wrapper_sw_helper.h new file mode 100644 index 0000000000..0b4e740403 --- /dev/null +++ b/src/gallium/auxiliary/target-helpers/inline_wrapper_sw_helper.h @@ -0,0 +1,34 @@ + +#ifndef INLINE_WRAPPER_SW_HELPER_H +#define INLINE_WRAPPER_SW_HELPER_H + +#include "target-helpers/inline_sw_helper.h" +#include "sw/wrapper/wrapper_sw_winsys.h" + +/** + * Try to wrap a hw screen with a software screen. + * On failure will return given screen. + */ +static INLINE struct pipe_screen * +sw_screen_wrap(struct pipe_screen *screen) +{ + struct sw_winsys *sws; + struct pipe_screen *sw_screen; + + sws = wrapper_sw_winsys_warp_pipe_screen(screen); + if (!sws) + goto err; + + sw_screen = sw_screen_create(sws); + if (sw_screen == screen) + goto err_winsys; + + return sw_screen; + +err_winsys: + sws->destroy(sws); +err: + return screen; +} + +#endif -- cgit v1.2.3 From 2b15e37348ca234c5a3352db55babb7bd293b708 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Wed, 23 Jun 2010 02:28:47 +0200 Subject: i965g: Moved pci_id to winsys struct --- src/gallium/drivers/i965/brw_screen.c | 8 ++++---- src/gallium/drivers/i965/brw_winsys.h | 3 ++- src/gallium/winsys/i965/drm/i965_drm_api.c | 6 ++---- src/gallium/winsys/i965/drm/i965_drm_buffer.c | 4 ++-- src/gallium/winsys/i965/drm/i965_drm_winsys.h | 2 -- src/gallium/winsys/i965/xlib/xlib_i965.c | 3 ++- 6 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/gallium/drivers/i965/brw_screen.c b/src/gallium/drivers/i965/brw_screen.c index 50a446db91..eb75427eb4 100644 --- a/src/gallium/drivers/i965/brw_screen.c +++ b/src/gallium/drivers/i965/brw_screen.c @@ -350,7 +350,7 @@ brw_destroy_screen(struct pipe_screen *screen) * Create a new brw_screen object */ struct pipe_screen * -brw_create_screen(struct brw_winsys_screen *sws, uint pci_id) +brw_create_screen(struct brw_winsys_screen *sws) { struct brw_screen *bscreen; struct brw_chipset chipset; @@ -365,9 +365,9 @@ brw_create_screen(struct brw_winsys_screen *sws, uint pci_id) memset(&chipset, 0, sizeof chipset); - chipset.pci_id = pci_id; + chipset.pci_id = sws->pci_id; - switch (pci_id) { + switch (chipset.pci_id) { case PCI_CHIP_I965_G: case PCI_CHIP_I965_Q: case PCI_CHIP_I965_G_1: @@ -393,7 +393,7 @@ brw_create_screen(struct brw_winsys_screen *sws, uint pci_id) default: debug_printf("%s: unknown pci id 0x%x, cannot create screen\n", - __FUNCTION__, pci_id); + __FUNCTION__, chipset.pci_id); return NULL; } diff --git a/src/gallium/drivers/i965/brw_winsys.h b/src/gallium/drivers/i965/brw_winsys.h index f30c7f1813..adb0006c38 100644 --- a/src/gallium/drivers/i965/brw_winsys.h +++ b/src/gallium/drivers/i965/brw_winsys.h @@ -147,6 +147,7 @@ static INLINE void make_reloc(struct brw_winsys_reloc *reloc, struct brw_winsys_screen { + unsigned pci_id; /** * Buffer functions. @@ -264,7 +265,7 @@ bo_reference(struct brw_winsys_buffer **ptr, struct brw_winsys_buffer *buf) /** * Create brw pipe_screen. */ -struct pipe_screen *brw_create_screen(struct brw_winsys_screen *iws, unsigned pci_id); +struct pipe_screen *brw_create_screen(struct brw_winsys_screen *iws); diff --git a/src/gallium/winsys/i965/drm/i965_drm_api.c b/src/gallium/winsys/i965/drm/i965_drm_api.c index 87ee8070b1..124dc26606 100644 --- a/src/gallium/winsys/i965/drm/i965_drm_api.c +++ b/src/gallium/winsys/i965/drm/i965_drm_api.c @@ -56,7 +56,6 @@ static struct pipe_screen * i965_libdrm_create_screen(struct drm_api *api, int drmFD) { struct i965_libdrm_winsys *idws; - unsigned int deviceID; debug_printf("%s\n", __FUNCTION__); @@ -64,12 +63,11 @@ i965_libdrm_create_screen(struct drm_api *api, int drmFD) if (!idws) return NULL; - i965_libdrm_get_device_id(&deviceID); + i965_libdrm_get_device_id(&idws->base.pci_id); i965_libdrm_winsys_init_buffer_functions(idws); idws->fd = drmFD; - idws->id = deviceID; idws->base.destroy = i965_libdrm_winsys_destroy; @@ -78,7 +76,7 @@ i965_libdrm_create_screen(struct drm_api *api, int drmFD) idws->send_cmd = !debug_get_bool_option("BRW_NO_HW", FALSE); - return brw_create_screen(&idws->base, deviceID); + return brw_create_screen(&idws->base); } struct drm_api i965_libdrm_api = diff --git a/src/gallium/winsys/i965/drm/i965_drm_buffer.c b/src/gallium/winsys/i965/drm/i965_drm_buffer.c index fb5e50ce81..9e9d59d5b4 100644 --- a/src/gallium/winsys/i965/drm/i965_drm_buffer.c +++ b/src/gallium/winsys/i965/drm/i965_drm_buffer.c @@ -322,7 +322,7 @@ i965_libdrm_bo_subdata(struct brw_winsys_buffer *buffer, nr_reloc); if (BRW_DUMP) - brw_dump_data( idws->id, + brw_dump_data( idws->base.pci_id, data_type, buf->bo->offset + offset, data, size ); @@ -460,7 +460,7 @@ i965_libdrm_bo_flush_range(struct brw_winsys_buffer *buffer, offset, length); if (BRW_DUMP) - brw_dump_data( idws->id, + brw_dump_data( idws->base.pci_id, buf->data_type, buf->bo->offset + offset, (char*)buf->bo->virtual + offset, diff --git a/src/gallium/winsys/i965/drm/i965_drm_winsys.h b/src/gallium/winsys/i965/drm/i965_drm_winsys.h index c6a7d4a8c5..3856e1c87f 100644 --- a/src/gallium/winsys/i965/drm/i965_drm_winsys.h +++ b/src/gallium/winsys/i965/drm/i965_drm_winsys.h @@ -22,8 +22,6 @@ struct i965_libdrm_winsys boolean send_cmd; int fd; /**< Drm file discriptor */ - - unsigned id; }; static INLINE struct i965_libdrm_winsys * diff --git a/src/gallium/winsys/i965/xlib/xlib_i965.c b/src/gallium/winsys/i965/xlib/xlib_i965.c index 063e9f600b..baadd6e89c 100644 --- a/src/gallium/winsys/i965/xlib/xlib_i965.c +++ b/src/gallium/winsys/i965/xlib/xlib_i965.c @@ -395,6 +395,7 @@ xlib_create_brw_winsys_screen( void ) return NULL; ws->used = 0; + ws->base.pci_id = PCI_CHIP_GM45_GM; ws->base.destroy = xlib_brw_winsys_destroy; ws->base.bo_alloc = xlib_brw_bo_alloc; @@ -452,7 +453,7 @@ xlib_create_i965_screen( void ) if (winsys == NULL) return NULL; - screen = brw_create_screen(winsys, PCI_CHIP_GM45_GM); + screen = brw_create_screen(winsys); if (screen == NULL) goto fail; -- cgit v1.2.3 From 0106be903a08635fa752c65a94e7e244db3d1aff Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Wed, 23 Jun 2010 02:41:49 +0200 Subject: i965g: Rename winsys file --- src/gallium/winsys/i965/drm/Makefile | 2 +- src/gallium/winsys/i965/drm/SConscript | 2 +- src/gallium/winsys/i965/drm/i965_drm_api.c | 102 -------------------------- src/gallium/winsys/i965/drm/i965_drm_winsys.c | 102 ++++++++++++++++++++++++++ 4 files changed, 104 insertions(+), 104 deletions(-) delete mode 100644 src/gallium/winsys/i965/drm/i965_drm_api.c create mode 100644 src/gallium/winsys/i965/drm/i965_drm_winsys.c diff --git a/src/gallium/winsys/i965/drm/Makefile b/src/gallium/winsys/i965/drm/Makefile index bbb71e25d8..46f98d7a24 100644 --- a/src/gallium/winsys/i965/drm/Makefile +++ b/src/gallium/winsys/i965/drm/Makefile @@ -5,7 +5,7 @@ LIBNAME = i965drm C_SOURCES = \ i965_drm_buffer.c \ - i965_drm_api.c + i965_drm_winsys.c LIBRARY_INCLUDES = $(shell pkg-config libdrm --cflags-only-I) diff --git a/src/gallium/winsys/i965/drm/SConscript b/src/gallium/winsys/i965/drm/SConscript index abf9aac5c0..785be449f7 100644 --- a/src/gallium/winsys/i965/drm/SConscript +++ b/src/gallium/winsys/i965/drm/SConscript @@ -5,8 +5,8 @@ env = env.Clone() env.ParseConfig('pkg-config --cflags libdrm') i965drm_sources = [ - 'i965_drm_api.c', 'i965_drm_buffer.c', + 'i965_drm_winsys.c', ] i965drm = env.ConvenienceLibrary( diff --git a/src/gallium/winsys/i965/drm/i965_drm_api.c b/src/gallium/winsys/i965/drm/i965_drm_api.c deleted file mode 100644 index 124dc26606..0000000000 --- a/src/gallium/winsys/i965/drm/i965_drm_api.c +++ /dev/null @@ -1,102 +0,0 @@ - -#include -#include "state_tracker/drm_api.h" - -#include "i965_drm_winsys.h" -#include "util/u_memory.h" - -#include "i965/brw_context.h" /* XXX: shouldn't be doing this */ -#include "i965/brw_screen.h" /* XXX: shouldn't be doing this */ - -#include "trace/tr_drm.h" - -#include "../../sw/drm/sw_drm_api.h" - -/* - * Helper functions - */ - - -static void -i965_libdrm_get_device_id(unsigned int *device_id) -{ - char path[512]; - FILE *file; - void *shutup_gcc; - - /* - * FIXME: Fix this up to use a drm ioctl or whatever. - */ - - snprintf(path, sizeof(path), "/sys/class/drm/card0/device/device"); - file = fopen(path, "r"); - if (!file) { - return; - } - - shutup_gcc = fgets(path, sizeof(path), file); - sscanf(path, "%x", device_id); - fclose(file); -} - -static void -i965_libdrm_winsys_destroy(struct brw_winsys_screen *iws) -{ - struct i965_libdrm_winsys *idws = i965_libdrm_winsys(iws); - - if (BRW_DUMP) - debug_printf("%s\n", __FUNCTION__); - - drm_intel_bufmgr_destroy(idws->gem); - - FREE(idws); -} - -static struct pipe_screen * -i965_libdrm_create_screen(struct drm_api *api, int drmFD) -{ - struct i965_libdrm_winsys *idws; - - debug_printf("%s\n", __FUNCTION__); - - idws = CALLOC_STRUCT(i965_libdrm_winsys); - if (!idws) - return NULL; - - i965_libdrm_get_device_id(&idws->base.pci_id); - - i965_libdrm_winsys_init_buffer_functions(idws); - - idws->fd = drmFD; - - idws->base.destroy = i965_libdrm_winsys_destroy; - - idws->gem = drm_intel_bufmgr_gem_init(idws->fd, BRW_BATCH_SIZE); - drm_intel_bufmgr_gem_enable_reuse(idws->gem); - - idws->send_cmd = !debug_get_bool_option("BRW_NO_HW", FALSE); - - return brw_create_screen(&idws->base); -} - -struct drm_api i965_libdrm_api = -{ - .name = "i965", - .driver_name = "i915", - .create_screen = i965_libdrm_create_screen, - .destroy = NULL, -}; - -struct drm_api * -drm_api_create() -{ - struct drm_api *api = NULL; - - if (api == NULL && debug_get_bool_option("BRW_SOFTPIPE", FALSE)) - api = sw_drm_api_create(&i965_libdrm_api); - - if (api == NULL) - api = &i965_libdrm_api; - - return trace_drm_create(api); -} diff --git a/src/gallium/winsys/i965/drm/i965_drm_winsys.c b/src/gallium/winsys/i965/drm/i965_drm_winsys.c new file mode 100644 index 0000000000..124dc26606 --- /dev/null +++ b/src/gallium/winsys/i965/drm/i965_drm_winsys.c @@ -0,0 +1,102 @@ + +#include +#include "state_tracker/drm_api.h" + +#include "i965_drm_winsys.h" +#include "util/u_memory.h" + +#include "i965/brw_context.h" /* XXX: shouldn't be doing this */ +#include "i965/brw_screen.h" /* XXX: shouldn't be doing this */ + +#include "trace/tr_drm.h" + +#include "../../sw/drm/sw_drm_api.h" + +/* + * Helper functions + */ + + +static void +i965_libdrm_get_device_id(unsigned int *device_id) +{ + char path[512]; + FILE *file; + void *shutup_gcc; + + /* + * FIXME: Fix this up to use a drm ioctl or whatever. + */ + + snprintf(path, sizeof(path), "/sys/class/drm/card0/device/device"); + file = fopen(path, "r"); + if (!file) { + return; + } + + shutup_gcc = fgets(path, sizeof(path), file); + sscanf(path, "%x", device_id); + fclose(file); +} + +static void +i965_libdrm_winsys_destroy(struct brw_winsys_screen *iws) +{ + struct i965_libdrm_winsys *idws = i965_libdrm_winsys(iws); + + if (BRW_DUMP) + debug_printf("%s\n", __FUNCTION__); + + drm_intel_bufmgr_destroy(idws->gem); + + FREE(idws); +} + +static struct pipe_screen * +i965_libdrm_create_screen(struct drm_api *api, int drmFD) +{ + struct i965_libdrm_winsys *idws; + + debug_printf("%s\n", __FUNCTION__); + + idws = CALLOC_STRUCT(i965_libdrm_winsys); + if (!idws) + return NULL; + + i965_libdrm_get_device_id(&idws->base.pci_id); + + i965_libdrm_winsys_init_buffer_functions(idws); + + idws->fd = drmFD; + + idws->base.destroy = i965_libdrm_winsys_destroy; + + idws->gem = drm_intel_bufmgr_gem_init(idws->fd, BRW_BATCH_SIZE); + drm_intel_bufmgr_gem_enable_reuse(idws->gem); + + idws->send_cmd = !debug_get_bool_option("BRW_NO_HW", FALSE); + + return brw_create_screen(&idws->base); +} + +struct drm_api i965_libdrm_api = +{ + .name = "i965", + .driver_name = "i915", + .create_screen = i965_libdrm_create_screen, + .destroy = NULL, +}; + +struct drm_api * +drm_api_create() +{ + struct drm_api *api = NULL; + + if (api == NULL && debug_get_bool_option("BRW_SOFTPIPE", FALSE)) + api = sw_drm_api_create(&i965_libdrm_api); + + if (api == NULL) + api = &i965_libdrm_api; + + return trace_drm_create(api); +} -- cgit v1.2.3 From 41e0f6bc2f943a05766872d419e4398ddd37b42a Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 18 Jun 2010 19:07:26 +0200 Subject: i965g: Move bootstrap code to targets --- src/gallium/drivers/i965/brw_public.h | 13 ++++++++++ src/gallium/drivers/i965/brw_screen.c | 3 ++- src/gallium/drivers/i965/brw_winsys.h | 6 ----- src/gallium/targets/dri-i965/Makefile | 5 ++-- src/gallium/targets/dri-i965/SConscript | 2 ++ src/gallium/targets/dri-i965/target.c | 27 ++++++++++++++++++-- src/gallium/targets/egl-i965/Makefile | 4 ++- src/gallium/targets/egl-i965/target.c | 27 ++++++++++++++++++-- src/gallium/targets/xorg-i965/Makefile | 3 ++- src/gallium/targets/xorg-i965/intel_target.c | 27 ++++++++++++++++++-- src/gallium/winsys/i965/drm/i965_drm_public.h | 9 +++++++ src/gallium/winsys/i965/drm/i965_drm_winsys.c | 36 +++------------------------ src/gallium/winsys/i965/drm/i965_drm_winsys.h | 2 -- 13 files changed, 113 insertions(+), 51 deletions(-) create mode 100644 src/gallium/drivers/i965/brw_public.h create mode 100644 src/gallium/winsys/i965/drm/i965_drm_public.h diff --git a/src/gallium/drivers/i965/brw_public.h b/src/gallium/drivers/i965/brw_public.h new file mode 100644 index 0000000000..be2cd6b5c4 --- /dev/null +++ b/src/gallium/drivers/i965/brw_public.h @@ -0,0 +1,13 @@ + +#ifndef BRW_PUBLIC_H +#define BRW_PUBLIC_H + +struct brw_winsys_screen; +struct pipe_screen; + +/** + * Create brw AKA i965 pipe_screen. + */ +struct pipe_screen * brw_screen_create(struct brw_winsys_screen *bws); + +#endif diff --git a/src/gallium/drivers/i965/brw_screen.c b/src/gallium/drivers/i965/brw_screen.c index eb75427eb4..bdfead73cc 100644 --- a/src/gallium/drivers/i965/brw_screen.c +++ b/src/gallium/drivers/i965/brw_screen.c @@ -34,6 +34,7 @@ #include "brw_context.h" #include "brw_screen.h" #include "brw_winsys.h" +#include "brw_public.h" #include "brw_debug.h" #include "brw_resource.h" @@ -350,7 +351,7 @@ brw_destroy_screen(struct pipe_screen *screen) * Create a new brw_screen object */ struct pipe_screen * -brw_create_screen(struct brw_winsys_screen *sws) +brw_screen_create(struct brw_winsys_screen *sws) { struct brw_screen *bscreen; struct brw_chipset chipset; diff --git a/src/gallium/drivers/i965/brw_winsys.h b/src/gallium/drivers/i965/brw_winsys.h index adb0006c38..a06f8bb7d6 100644 --- a/src/gallium/drivers/i965/brw_winsys.h +++ b/src/gallium/drivers/i965/brw_winsys.h @@ -262,12 +262,6 @@ bo_reference(struct brw_winsys_buffer **ptr, struct brw_winsys_buffer *buf) } -/** - * Create brw pipe_screen. - */ -struct pipe_screen *brw_create_screen(struct brw_winsys_screen *iws); - - /************************************************************************* * Cooperative dumping between winsys and driver. TODO: make this diff --git a/src/gallium/targets/dri-i965/Makefile b/src/gallium/targets/dri-i965/Makefile index b068430ecf..76350caf9d 100644 --- a/src/gallium/targets/dri-i965/Makefile +++ b/src/gallium/targets/dri-i965/Makefile @@ -8,10 +8,8 @@ PIPE_DRIVERS = \ $(TOP)/src/gallium/winsys/i965/drm/libi965drm.a \ $(TOP)/src/gallium/drivers/trace/libtrace.a \ $(TOP)/src/gallium/drivers/rbug/librbug.a \ - $(TOP)/src/gallium/winsys/sw/drm/libswdrm.a \ $(TOP)/src/gallium/winsys/sw/wrapper/libwsw.a \ $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \ - $(TOP)/src/gallium/drivers/identity/libidentity.a \ $(TOP)/src/gallium/drivers/i965/libi965.a C_SOURCES = \ @@ -19,6 +17,9 @@ C_SOURCES = \ $(COMMON_GALLIUM_SOURCES) \ $(DRIVER_SOURCES) +DRIVER_DEFINES = \ + -DGALLIUM_SOFTPIPE + include ../Makefile.dri DRI_LIB_DEPS += -ldrm_intel diff --git a/src/gallium/targets/dri-i965/SConscript b/src/gallium/targets/dri-i965/SConscript index 9e12c61aab..da1a8654a8 100644 --- a/src/gallium/targets/dri-i965/SConscript +++ b/src/gallium/targets/dri-i965/SConscript @@ -8,6 +8,8 @@ env = drienv.Clone() env.ParseConfig('pkg-config --cflags --libs libdrm_intel') +env.Append(CPPDEFINES = 'GALLIUM_SOFTPIPE') + env.Prepend(LIBS = [ st_dri, i965drm, diff --git a/src/gallium/targets/dri-i965/target.c b/src/gallium/targets/dri-i965/target.c index 9fe2227edd..36424c60a1 100644 --- a/src/gallium/targets/dri-i965/target.c +++ b/src/gallium/targets/dri-i965/target.c @@ -1,4 +1,27 @@ -#include "target-helpers/drm_api_compat.h" +#include "target-helpers/inline_wrapper_sw_helper.h" +#include "state_tracker/drm_driver.h" +#include "i965/drm/i965_drm_public.h" +#include "i965/brw_public.h" -DRM_API_COMPAT_STRUCT("i965", "i915") +static struct pipe_screen * +create_screen(int fd) +{ + struct brw_winsys_screen *bws; + struct pipe_screen *screen; + + bws = i965_drm_winsys_screen_create(fd); + if (!bws) + return NULL; + + screen = brw_screen_create(bws); + if (!screen) + return NULL; + + if (debug_get_bool_option("BRW_SOFTPIPE", FALSE)) + screen = sw_screen_wrap(screen); + + return screen; +} + +DRM_DRIVER_DESCRIPTOR("i915", "i965", create_screen) diff --git a/src/gallium/targets/egl-i965/Makefile b/src/gallium/targets/egl-i965/Makefile index 542200481d..fe3091190c 100644 --- a/src/gallium/targets/egl-i965/Makefile +++ b/src/gallium/targets/egl-i965/Makefile @@ -5,12 +5,14 @@ EGL_DRIVER_NAME = i965 EGL_DRIVER_SOURCES = target.c EGL_DRIVER_LIBS = -ldrm_intel +EGL_DRIVER_DEFINES = \ + -DGALLIUM_SOFTPIPE + EGL_DRIVER_PIPES = \ $(TOP)/src/gallium/winsys/i965/drm/libi965drm.a \ $(TOP)/src/gallium/drivers/trace/libtrace.a \ $(TOP)/src/gallium/drivers/rbug/librbug.a \ $(TOP)/src/gallium/drivers/i965/libi965.a \ - $(TOP)/src/gallium/winsys/sw/drm/libswdrm.a \ $(TOP)/src/gallium/winsys/sw/wrapper/libwsw.a \ $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a diff --git a/src/gallium/targets/egl-i965/target.c b/src/gallium/targets/egl-i965/target.c index 2f97bcecf2..ba1eeadd21 100644 --- a/src/gallium/targets/egl-i965/target.c +++ b/src/gallium/targets/egl-i965/target.c @@ -1,7 +1,30 @@ -#include "target-helpers/drm_api_compat.h" +#include "target-helpers/inline_wrapper_sw_helper.h" +#include "state_tracker/drm_driver.h" +#include "i965/drm/i965_drm_public.h" +#include "i965/brw_public.h" -DRM_API_COMPAT_STRUCT("i965", "i915") +static struct pipe_screen * +create_screen(int fd) +{ + struct brw_winsys_screen *bws; + struct pipe_screen *screen; + + bws = i965_drm_winsys_screen_create(fd); + if (!bws) + return NULL; + + screen = brw_screen_create(bws); + if (!screen) + return NULL; + + if (debug_get_bool_option("BRW_SOFTPIPE", FALSE)) + screen = sw_screen_wrap(screen); + + return screen; +} + +DRM_DRIVER_DESCRIPTOR("i915", "i965", create_screen) /* A poor man's --whole-archive for EGL drivers */ void *_eglMain(void *); diff --git a/src/gallium/targets/xorg-i965/Makefile b/src/gallium/targets/xorg-i965/Makefile index b23a2deab9..eede9f2325 100644 --- a/src/gallium/targets/xorg-i965/Makefile +++ b/src/gallium/targets/xorg-i965/Makefile @@ -8,7 +8,7 @@ C_SOURCES = \ intel_xorg.c DRIVER_DEFINES = \ - -DHAVE_CONFIG_H + -DHAVE_CONFIG_H -DGALLIUM_SOFTPIPE DRIVER_LINKS = \ $(TOP)/src/gallium/state_trackers/xorg/libxorgtracker.a \ @@ -16,6 +16,7 @@ DRIVER_LINKS = \ $(TOP)/src/gallium/drivers/i965/libi965.a \ $(TOP)/src/gallium/drivers/trace/libtrace.a \ $(TOP)/src/gallium/drivers/rbug/librbug.a \ + $(TOP)/src/gallium/winsys/sw/wrapper/libwsw.a \ $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \ $(GALLIUM_AUXILIARIES) \ $(shell pkg-config --libs libdrm libdrm_intel) diff --git a/src/gallium/targets/xorg-i965/intel_target.c b/src/gallium/targets/xorg-i965/intel_target.c index 2b0f545877..36424c60a1 100644 --- a/src/gallium/targets/xorg-i965/intel_target.c +++ b/src/gallium/targets/xorg-i965/intel_target.c @@ -1,4 +1,27 @@ -#include "target-helpers/drm_api_compat.h" +#include "target-helpers/inline_wrapper_sw_helper.h" +#include "state_tracker/drm_driver.h" +#include "i965/drm/i965_drm_public.h" +#include "i965/brw_public.h" -DRM_API_COMPAT_STRUCT("i965g", "i915") +static struct pipe_screen * +create_screen(int fd) +{ + struct brw_winsys_screen *bws; + struct pipe_screen *screen; + + bws = i965_drm_winsys_screen_create(fd); + if (!bws) + return NULL; + + screen = brw_screen_create(bws); + if (!screen) + return NULL; + + if (debug_get_bool_option("BRW_SOFTPIPE", FALSE)) + screen = sw_screen_wrap(screen); + + return screen; +} + +DRM_DRIVER_DESCRIPTOR("i915", "i965", create_screen) diff --git a/src/gallium/winsys/i965/drm/i965_drm_public.h b/src/gallium/winsys/i965/drm/i965_drm_public.h new file mode 100644 index 0000000000..2913b07974 --- /dev/null +++ b/src/gallium/winsys/i965/drm/i965_drm_public.h @@ -0,0 +1,9 @@ + +#ifndef I965_DRM_PUBLIC_H +#define I965_DRM_PUBLIC_H + +struct brw_winsys_screen; + +struct brw_winsys_screen * i965_drm_winsys_screen_create(int drmFD); + +#endif diff --git a/src/gallium/winsys/i965/drm/i965_drm_winsys.c b/src/gallium/winsys/i965/drm/i965_drm_winsys.c index 124dc26606..dfb3660439 100644 --- a/src/gallium/winsys/i965/drm/i965_drm_winsys.c +++ b/src/gallium/winsys/i965/drm/i965_drm_winsys.c @@ -3,15 +3,9 @@ #include "state_tracker/drm_api.h" #include "i965_drm_winsys.h" +#include "i965_drm_public.h" #include "util/u_memory.h" -#include "i965/brw_context.h" /* XXX: shouldn't be doing this */ -#include "i965/brw_screen.h" /* XXX: shouldn't be doing this */ - -#include "trace/tr_drm.h" - -#include "../../sw/drm/sw_drm_api.h" - /* * Helper functions */ @@ -52,8 +46,8 @@ i965_libdrm_winsys_destroy(struct brw_winsys_screen *iws) FREE(idws); } -static struct pipe_screen * -i965_libdrm_create_screen(struct drm_api *api, int drmFD) +struct brw_winsys_screen * +i965_drm_winsys_screen_create(int drmFD) { struct i965_libdrm_winsys *idws; @@ -76,27 +70,5 @@ i965_libdrm_create_screen(struct drm_api *api, int drmFD) idws->send_cmd = !debug_get_bool_option("BRW_NO_HW", FALSE); - return brw_create_screen(&idws->base); -} - -struct drm_api i965_libdrm_api = -{ - .name = "i965", - .driver_name = "i915", - .create_screen = i965_libdrm_create_screen, - .destroy = NULL, -}; - -struct drm_api * -drm_api_create() -{ - struct drm_api *api = NULL; - - if (api == NULL && debug_get_bool_option("BRW_SOFTPIPE", FALSE)) - api = sw_drm_api_create(&i965_libdrm_api); - - if (api == NULL) - api = &i965_libdrm_api; - - return trace_drm_create(api); + return &idws->base; } diff --git a/src/gallium/winsys/i965/drm/i965_drm_winsys.h b/src/gallium/winsys/i965/drm/i965_drm_winsys.h index 3856e1c87f..82dbe61cc5 100644 --- a/src/gallium/winsys/i965/drm/i965_drm_winsys.h +++ b/src/gallium/winsys/i965/drm/i965_drm_winsys.h @@ -30,8 +30,6 @@ i965_libdrm_winsys(struct brw_winsys_screen *iws) return (struct i965_libdrm_winsys *)iws; } -struct i965_libdrm_winsys *i965_libdrm_winsys_create(int fd, unsigned pci_id); - void i965_libdrm_winsys_init_buffer_functions(struct i965_libdrm_winsys *idws); -- cgit v1.2.3 From 23a915e2cfbc95c018946155eb301ffad3a0d550 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Wed, 23 Jun 2010 03:31:18 +0200 Subject: gallium: Drop sw drm winsys Last user went away --- configure.ac | 2 +- src/gallium/winsys/sw/drm/Makefile | 12 ---- src/gallium/winsys/sw/drm/SConscript | 21 ------- src/gallium/winsys/sw/drm/sw_drm_api.c | 103 --------------------------------- src/gallium/winsys/sw/drm/sw_drm_api.h | 34 ----------- 5 files changed, 1 insertion(+), 171 deletions(-) delete mode 100644 src/gallium/winsys/sw/drm/Makefile delete mode 100644 src/gallium/winsys/sw/drm/SConscript delete mode 100644 src/gallium/winsys/sw/drm/sw_drm_api.c delete mode 100644 src/gallium/winsys/sw/drm/sw_drm_api.h diff --git a/configure.ac b/configure.ac index 6fc0e2a55c..4a676d4abd 100644 --- a/configure.ac +++ b/configure.ac @@ -486,7 +486,7 @@ xlib) dri) SRC_DIRS="$SRC_DIRS glx" DRIVER_DIRS="dri" - GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib sw/dri sw/drm" + GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib sw/dri" ;; osmesa) DRIVER_DIRS="osmesa" diff --git a/src/gallium/winsys/sw/drm/Makefile b/src/gallium/winsys/sw/drm/Makefile deleted file mode 100644 index 79664536aa..0000000000 --- a/src/gallium/winsys/sw/drm/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -TOP = ../../../../.. -include $(TOP)/configs/current - -LIBNAME = swdrm - -C_SOURCES = sw_drm_api.c - -LIBRARY_INCLUDES = - -LIBRARY_DEFINES = - -include ../../../Makefile.template diff --git a/src/gallium/winsys/sw/drm/SConscript b/src/gallium/winsys/sw/drm/SConscript deleted file mode 100644 index 15a2e05d5a..0000000000 --- a/src/gallium/winsys/sw/drm/SConscript +++ /dev/null @@ -1,21 +0,0 @@ -####################################################################### -# SConscript for xlib winsys - - -Import('*') - -env = env.Clone() - -env.Append(CPPPATH = [ - '#/src/gallium/include', - '#/src/gallium/auxiliary', - '#/src/gallium/drivers', -]) - -ws_drm = env.ConvenienceLibrary( - target = 'ws_drm', - source = [ - 'sw_drm_api.c', - ] -) -Export('ws_drm') diff --git a/src/gallium/winsys/sw/drm/sw_drm_api.c b/src/gallium/winsys/sw/drm/sw_drm_api.c deleted file mode 100644 index 7b86382619..0000000000 --- a/src/gallium/winsys/sw/drm/sw_drm_api.c +++ /dev/null @@ -1,103 +0,0 @@ -/********************************************************** - * 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. - * - **********************************************************/ - - -#include "util/u_memory.h" -#include "softpipe/sp_public.h" -#include "state_tracker/drm_api.h" -#include "../../sw/wrapper/wrapper_sw_winsys.h" -#include "sw_drm_api.h" - - -/* - * Defines - */ - - -struct sw_drm_api -{ - struct drm_api base; - struct drm_api *api; - struct sw_winsys *sw; -}; - -static INLINE struct sw_drm_api * -sw_drm_api(struct drm_api *api) -{ - return (struct sw_drm_api *)api; -} - - -/* - * Exported functions - */ - - -static struct pipe_screen * -sw_drm_create_screen(struct drm_api *_api, int drmFD) -{ - struct sw_drm_api *swapi = sw_drm_api(_api); - struct drm_api *api = swapi->api; - struct sw_winsys *sww; - struct pipe_screen *screen; - - screen = api->create_screen(api, drmFD); - if (!screen) - return NULL; - - sww = wrapper_sw_winsys_warp_pipe_screen(screen); - if (!sww) - return NULL; - - return softpipe_create_screen(sww); -} - -static void -sw_drm_destroy(struct drm_api *api) -{ - struct sw_drm_api *swapi = sw_drm_api(api); - if (swapi->api->destroy) - swapi->api->destroy(swapi->api); - - FREE(swapi); -} - -struct drm_api * -sw_drm_api_create(struct drm_api *api) -{ - struct sw_drm_api *swapi = CALLOC_STRUCT(sw_drm_api); - - if (!swapi) - return api; - - swapi->base.name = api->name; - swapi->base.driver_name = api->driver_name; - swapi->base.create_screen = sw_drm_create_screen; - swapi->base.destroy = sw_drm_destroy; - - swapi->api = api; - - return &swapi->base; -} diff --git a/src/gallium/winsys/sw/drm/sw_drm_api.h b/src/gallium/winsys/sw/drm/sw_drm_api.h deleted file mode 100644 index ce90a04ae0..0000000000 --- a/src/gallium/winsys/sw/drm/sw_drm_api.h +++ /dev/null @@ -1,34 +0,0 @@ -/********************************************************** - * 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. - * - **********************************************************/ - - -#ifndef SW_DRM_API_H -#define SW_DRM_API_H - -struct drm_api; - -struct drm_api * sw_drm_api_create(struct drm_api *api); - -#endif -- cgit v1.2.3 From 10e3b9f4d029df5c6c01a5d76c9085c48d82ac43 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Wed, 23 Jun 2010 22:49:11 +0200 Subject: nouveau: Rename winsys file --- src/gallium/winsys/nouveau/drm/Makefile | 2 +- src/gallium/winsys/nouveau/drm/nouveau_drm_api.c | 85 ---------------------- src/gallium/winsys/nouveau/drm/nouveau_drm_api.h | 30 -------- .../winsys/nouveau/drm/nouveau_drm_winsys.c | 85 ++++++++++++++++++++++ .../winsys/nouveau/drm/nouveau_drm_winsys.h | 30 ++++++++ 5 files changed, 116 insertions(+), 116 deletions(-) delete mode 100644 src/gallium/winsys/nouveau/drm/nouveau_drm_api.c delete mode 100644 src/gallium/winsys/nouveau/drm/nouveau_drm_api.h create mode 100644 src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c create mode 100644 src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.h diff --git a/src/gallium/winsys/nouveau/drm/Makefile b/src/gallium/winsys/nouveau/drm/Makefile index 71029858f7..74a3c6a0d7 100644 --- a/src/gallium/winsys/nouveau/drm/Makefile +++ b/src/gallium/winsys/nouveau/drm/Makefile @@ -3,7 +3,7 @@ include $(TOP)/configs/current LIBNAME = nouveaudrm -C_SOURCES = nouveau_drm_api.c +C_SOURCES = nouveau_drm_winsys.c LIBRARY_INCLUDES = $(shell pkg-config libdrm libdrm_nouveau --cflags-only-I) LIBRARY_DEFINES = $(shell pkg-config libdrm libdrm_nouveau --cflags-only-other) diff --git a/src/gallium/winsys/nouveau/drm/nouveau_drm_api.c b/src/gallium/winsys/nouveau/drm/nouveau_drm_api.c deleted file mode 100644 index 2f24431462..0000000000 --- a/src/gallium/winsys/nouveau/drm/nouveau_drm_api.c +++ /dev/null @@ -1,85 +0,0 @@ -#include "pipe/p_context.h" -#include "pipe/p_state.h" -#include "util/u_format.h" -#include "util/u_memory.h" -#include "util/u_inlines.h" - -#include "nouveau_drm_api.h" - -#include "nouveau_drmif.h" -#include "nouveau_channel.h" -#include "nouveau_bo.h" - -#include "nouveau/nouveau_winsys.h" -#include "nouveau/nouveau_screen.h" - -static void -nouveau_drm_destroy_winsys(struct pipe_winsys *s) -{ - struct nouveau_winsys *nv_winsys = nouveau_winsys(s); - struct nouveau_screen *nv_screen= nouveau_screen(nv_winsys->pscreen); - nouveau_device_close(&nv_screen->device); - FREE(nv_winsys); -} - -static struct pipe_screen * -nouveau_drm_create_screen(struct drm_api *api, int fd) -{ - struct nouveau_winsys *nvws; - struct pipe_winsys *ws; - struct nouveau_device *dev = NULL; - struct pipe_screen *(*init)(struct pipe_winsys *, - struct nouveau_device *); - int ret; - - ret = nouveau_device_open_existing(&dev, 0, fd, 0); - if (ret) - return NULL; - - switch (dev->chipset & 0xf0) { - case 0x30: - case 0x40: - case 0x60: - init = nvfx_screen_create; - break; - case 0x50: - case 0x80: - case 0x90: - case 0xa0: - init = nv50_screen_create; - break; - default: - debug_printf("%s: unknown chipset nv%02x\n", __func__, - dev->chipset); - return NULL; - } - - nvws = CALLOC_STRUCT(nouveau_winsys); - if (!nvws) { - nouveau_device_close(&dev); - return NULL; - } - ws = &nvws->base; - ws->destroy = nouveau_drm_destroy_winsys; - - nvws->pscreen = init(ws, dev); - if (!nvws->pscreen) { - ws->destroy(ws); - return NULL; - } - - return nvws->pscreen; -} - -static struct drm_api nouveau_drm_api_hooks = { - .name = "nouveau", - .driver_name = "nouveau", - .create_screen = nouveau_drm_create_screen, - .destroy = NULL, -}; - -struct drm_api * -drm_api_create() { - return &nouveau_drm_api_hooks; -} - diff --git a/src/gallium/winsys/nouveau/drm/nouveau_drm_api.h b/src/gallium/winsys/nouveau/drm/nouveau_drm_api.h deleted file mode 100644 index ba6305c17e..0000000000 --- a/src/gallium/winsys/nouveau/drm/nouveau_drm_api.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef __NOUVEAU_DRM_API_H__ -#define __NOUVEAU_DRM_API_H__ - -#include "state_tracker/drm_api.h" - -#include "util/u_simple_screen.h" - -#include "nouveau_dri.h" - -struct nouveau_winsys { - struct pipe_winsys base; - - struct pipe_screen *pscreen; - - struct pipe_surface *front; -}; - -static INLINE struct nouveau_winsys * -nouveau_winsys(struct pipe_winsys *ws) -{ - return (struct nouveau_winsys *)ws; -} - -static INLINE struct nouveau_winsys * -nouveau_winsys_screen(struct pipe_screen *pscreen) -{ - return nouveau_winsys(pscreen->winsys); -} - -#endif diff --git a/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c new file mode 100644 index 0000000000..418f1d708a --- /dev/null +++ b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c @@ -0,0 +1,85 @@ +#include "pipe/p_context.h" +#include "pipe/p_state.h" +#include "util/u_format.h" +#include "util/u_memory.h" +#include "util/u_inlines.h" + +#include "nouveau_drm_winsys.h" + +#include "nouveau_drmif.h" +#include "nouveau_channel.h" +#include "nouveau_bo.h" + +#include "nouveau/nouveau_winsys.h" +#include "nouveau/nouveau_screen.h" + +static void +nouveau_drm_destroy_winsys(struct pipe_winsys *s) +{ + struct nouveau_winsys *nv_winsys = nouveau_winsys(s); + struct nouveau_screen *nv_screen= nouveau_screen(nv_winsys->pscreen); + nouveau_device_close(&nv_screen->device); + FREE(nv_winsys); +} + +static struct pipe_screen * +nouveau_drm_create_screen(struct drm_api *api, int fd) +{ + struct nouveau_winsys *nvws; + struct pipe_winsys *ws; + struct nouveau_device *dev = NULL; + struct pipe_screen *(*init)(struct pipe_winsys *, + struct nouveau_device *); + int ret; + + ret = nouveau_device_open_existing(&dev, 0, fd, 0); + if (ret) + return NULL; + + switch (dev->chipset & 0xf0) { + case 0x30: + case 0x40: + case 0x60: + init = nvfx_screen_create; + break; + case 0x50: + case 0x80: + case 0x90: + case 0xa0: + init = nv50_screen_create; + break; + default: + debug_printf("%s: unknown chipset nv%02x\n", __func__, + dev->chipset); + return NULL; + } + + nvws = CALLOC_STRUCT(nouveau_winsys); + if (!nvws) { + nouveau_device_close(&dev); + return NULL; + } + ws = &nvws->base; + ws->destroy = nouveau_drm_destroy_winsys; + + nvws->pscreen = init(ws, dev); + if (!nvws->pscreen) { + ws->destroy(ws); + return NULL; + } + + return nvws->pscreen; +} + +static struct drm_api nouveau_drm_api_hooks = { + .name = "nouveau", + .driver_name = "nouveau", + .create_screen = nouveau_drm_create_screen, + .destroy = NULL, +}; + +struct drm_api * +drm_api_create() { + return &nouveau_drm_api_hooks; +} + diff --git a/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.h b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.h new file mode 100644 index 0000000000..ae3ab17d74 --- /dev/null +++ b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.h @@ -0,0 +1,30 @@ +#ifndef __NOUVEAU_DRM_WINSYS_H__ +#define __NOUVEAU_DRM_WINSYS_H__ + +#include "state_tracker/drm_api.h" + +#include "util/u_simple_screen.h" + +#include "nouveau_dri.h" + +struct nouveau_winsys { + struct pipe_winsys base; + + struct pipe_screen *pscreen; + + struct pipe_surface *front; +}; + +static INLINE struct nouveau_winsys * +nouveau_winsys(struct pipe_winsys *ws) +{ + return (struct nouveau_winsys *)ws; +} + +static INLINE struct nouveau_winsys * +nouveau_winsys_screen(struct pipe_screen *pscreen) +{ + return nouveau_winsys(pscreen->winsys); +} + +#endif -- cgit v1.2.3 From cf91accc93b9f172b2f7c970f39e69b268a5bb26 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Wed, 23 Jun 2010 23:03:28 +0200 Subject: nouveau: Move bootstrap code to targets Well sorta, at least I removed the drm_api dependancy and the target can layer anything it wants to now. --- src/gallium/targets/dri-nouveau/target.c | 17 +++++++++++++++-- src/gallium/targets/egl-nouveau/target.c | 17 +++++++++++++++-- src/gallium/targets/xorg-nouveau/nouveau_target.c | 17 +++++++++++++++-- src/gallium/winsys/nouveau/drm/nouveau_drm_public.h | 9 +++++++++ src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c | 18 +++--------------- src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.h | 2 -- 6 files changed, 57 insertions(+), 23 deletions(-) create mode 100644 src/gallium/winsys/nouveau/drm/nouveau_drm_public.h diff --git a/src/gallium/targets/dri-nouveau/target.c b/src/gallium/targets/dri-nouveau/target.c index e16e86cd3d..ca3ec53029 100644 --- a/src/gallium/targets/dri-nouveau/target.c +++ b/src/gallium/targets/dri-nouveau/target.c @@ -1,4 +1,17 @@ -#include "target-helpers/drm_api_compat.h" +#include "state_tracker/drm_driver.h" +#include "nouveau/drm/nouveau_drm_public.h" -DRM_API_COMPAT_STRUCT("nouveau", "nouveau") +static struct pipe_screen * +create_screen(int fd) +{ + struct pipe_screen *screen; + + screen = nouveau_drm_screen_create(fd); + if (!screen) + return NULL; + + return screen; +} + +DRM_DRIVER_DESCRIPTOR("nouveau", "nouveau", create_screen) diff --git a/src/gallium/targets/egl-nouveau/target.c b/src/gallium/targets/egl-nouveau/target.c index 49545c63e1..7d0b141e5a 100644 --- a/src/gallium/targets/egl-nouveau/target.c +++ b/src/gallium/targets/egl-nouveau/target.c @@ -1,7 +1,20 @@ -#include "target-helpers/drm_api_compat.h" +#include "state_tracker/drm_driver.h" +#include "nouveau/drm/nouveau_drm_public.h" -DRM_API_COMPAT_STRUCT("nouveau", "nouveau") +static struct pipe_screen * +create_screen(int fd) +{ + struct pipe_screen *screen; + + screen = nouveau_drm_screen_create(fd); + if (!screen) + return NULL; + + return screen; +} + +DRM_DRIVER_DESCRIPTOR("nouveau", "nouveau", create_screen) /* A poor man's --whole-archive for EGL drivers */ void *_eglMain(void *); diff --git a/src/gallium/targets/xorg-nouveau/nouveau_target.c b/src/gallium/targets/xorg-nouveau/nouveau_target.c index e16e86cd3d..ca3ec53029 100644 --- a/src/gallium/targets/xorg-nouveau/nouveau_target.c +++ b/src/gallium/targets/xorg-nouveau/nouveau_target.c @@ -1,4 +1,17 @@ -#include "target-helpers/drm_api_compat.h" +#include "state_tracker/drm_driver.h" +#include "nouveau/drm/nouveau_drm_public.h" -DRM_API_COMPAT_STRUCT("nouveau", "nouveau") +static struct pipe_screen * +create_screen(int fd) +{ + struct pipe_screen *screen; + + screen = nouveau_drm_screen_create(fd); + if (!screen) + return NULL; + + return screen; +} + +DRM_DRIVER_DESCRIPTOR("nouveau", "nouveau", create_screen) diff --git a/src/gallium/winsys/nouveau/drm/nouveau_drm_public.h b/src/gallium/winsys/nouveau/drm/nouveau_drm_public.h new file mode 100644 index 0000000000..67b7c4429d --- /dev/null +++ b/src/gallium/winsys/nouveau/drm/nouveau_drm_public.h @@ -0,0 +1,9 @@ + +#ifndef __NOUVEAU_DRM_PUBLIC_H__ +#define __NOUVEAU_DRM_PUBLIC_H__ + +struct pipe_screen; + +struct pipe_screen *nouveau_drm_screen_create(int drmFD); + +#endif diff --git a/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c index 418f1d708a..660dbd0c33 100644 --- a/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c +++ b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c @@ -5,6 +5,7 @@ #include "util/u_inlines.h" #include "nouveau_drm_winsys.h" +#include "nouveau_drm_public.h" #include "nouveau_drmif.h" #include "nouveau_channel.h" @@ -22,8 +23,8 @@ nouveau_drm_destroy_winsys(struct pipe_winsys *s) FREE(nv_winsys); } -static struct pipe_screen * -nouveau_drm_create_screen(struct drm_api *api, int fd) +struct pipe_screen * +nouveau_drm_screen_create(int fd) { struct nouveau_winsys *nvws; struct pipe_winsys *ws; @@ -70,16 +71,3 @@ nouveau_drm_create_screen(struct drm_api *api, int fd) return nvws->pscreen; } - -static struct drm_api nouveau_drm_api_hooks = { - .name = "nouveau", - .driver_name = "nouveau", - .create_screen = nouveau_drm_create_screen, - .destroy = NULL, -}; - -struct drm_api * -drm_api_create() { - return &nouveau_drm_api_hooks; -} - diff --git a/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.h b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.h index ae3ab17d74..9e529ecad3 100644 --- a/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.h +++ b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.h @@ -1,8 +1,6 @@ #ifndef __NOUVEAU_DRM_WINSYS_H__ #define __NOUVEAU_DRM_WINSYS_H__ -#include "state_tracker/drm_api.h" - #include "util/u_simple_screen.h" #include "nouveau_dri.h" -- cgit v1.2.3 From 92fde20de33d9ffb4ddce9b03eebbfbffe9d93bc Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Thu, 24 Jun 2010 02:10:18 +0200 Subject: r600g: Move bootstrap code to target --- src/gallium/drivers/r600/r600_buffer.c | 2 +- src/gallium/drivers/r600/r600_public.h | 9 +++++++ src/gallium/drivers/r600/r600_screen.c | 3 ++- src/gallium/drivers/r600/r600_texture.c | 2 +- src/gallium/drivers/r600/radeon.h | 2 -- src/gallium/targets/dri-r600/target.c | 23 ++++++++++++++++-- src/gallium/winsys/r600/drm/r600_drm.c | 34 ++++----------------------- src/gallium/winsys/r600/drm/r600_drm_public.h | 9 +++++++ 8 files changed, 48 insertions(+), 36 deletions(-) create mode 100644 src/gallium/drivers/r600/r600_public.h create mode 100644 src/gallium/winsys/r600/drm/r600_drm_public.h diff --git a/src/gallium/drivers/r600/r600_buffer.c b/src/gallium/drivers/r600/r600_buffer.c index 272f4dd673..bc6e336ba7 100644 --- a/src/gallium/drivers/r600/r600_buffer.c +++ b/src/gallium/drivers/r600/r600_buffer.c @@ -29,7 +29,7 @@ #include #include #include -#include "state_tracker/drm_api.h" +#include "state_tracker/drm_driver.h" #include "r600_screen.h" #include "r600_context.h" diff --git a/src/gallium/drivers/r600/r600_public.h b/src/gallium/drivers/r600/r600_public.h new file mode 100644 index 0000000000..1d89c9f9f6 --- /dev/null +++ b/src/gallium/drivers/r600/r600_public.h @@ -0,0 +1,9 @@ + +#ifndef R600_PUBLIC_H +#define R600_PUBLIC_H + +struct radeon; + +struct pipe_screen* r600_screen_create(struct radeon *rw); + +#endif diff --git a/src/gallium/drivers/r600/r600_screen.c b/src/gallium/drivers/r600/r600_screen.c index 1d83383fd9..20758b049c 100644 --- a/src/gallium/drivers/r600/r600_screen.c +++ b/src/gallium/drivers/r600/r600_screen.c @@ -31,6 +31,7 @@ #include "r600_screen.h" #include "r600_texture.h" #include "r600_context.h" +#include "r600_public.h" #include static const char* r600_get_vendor(struct pipe_screen* pscreen) @@ -240,7 +241,7 @@ static void r600_destroy_screen(struct pipe_screen* pscreen) FREE(rscreen); } -struct pipe_screen *radeon_create_screen(struct radeon *rw) +struct pipe_screen *r600_screen_create(struct radeon *rw) { struct r600_screen* rscreen; diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 7d94bbe510..903cfad80a 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -29,7 +29,7 @@ #include #include #include -#include "state_tracker/drm_api.h" +#include "state_tracker/drm_driver.h" #include "r600_screen.h" #include "r600_texture.h" diff --git a/src/gallium/drivers/r600/radeon.h b/src/gallium/drivers/r600/radeon.h index ec94b112d6..2a82aadd8c 100644 --- a/src/gallium/drivers/r600/radeon.h +++ b/src/gallium/drivers/r600/radeon.h @@ -28,8 +28,6 @@ typedef uint8_t u8; struct radeon; -struct pipe_screen *radeon_create_screen(struct radeon *rw); - enum radeon_family { CHIP_UNKNOWN, CHIP_R100, diff --git a/src/gallium/targets/dri-r600/target.c b/src/gallium/targets/dri-r600/target.c index 3f09a7c5a9..40ad8a09ca 100644 --- a/src/gallium/targets/dri-r600/target.c +++ b/src/gallium/targets/dri-r600/target.c @@ -1,4 +1,23 @@ -#include "target-helpers/drm_api_compat.h" +#include "state_tracker/drm_driver.h" +#include "r600/drm/r600_drm_public.h" +#include "r600/r600_public.h" -DRM_API_COMPAT_STRUCT("r600", "radeon") +static struct pipe_screen * +create_screen(int fd) +{ + struct radeon *rw; + struct pipe_screen *screen; + + rw = r600_drm_winsys_create(fd); + if (!rw) + return NULL; + + screen = r600_screen_create(rw); + if (!screen) + return NULL; + + return screen; +} + +DRM_DRIVER_DESCRIPTOR("r600", "radeon", create_screen) diff --git a/src/gallium/winsys/r600/drm/r600_drm.c b/src/gallium/winsys/r600/drm/r600_drm.c index b772ff0dd9..469f1446d0 100644 --- a/src/gallium/winsys/r600/drm/r600_drm.c +++ b/src/gallium/winsys/r600/drm/r600_drm.c @@ -26,21 +26,18 @@ * Joakim Sindholt */ #include -#include "trace/tr_drm.h" #include "util/u_inlines.h" #include "util/u_debug.h" -#include "state_tracker/drm_api.h" #include "radeon_priv.h" #include "r600_screen.h" #include "r600_texture.h" +#include "r600_public.h" +#include "r600_drm_public.h" +#include "state_tracker/drm_driver.h" -static struct pipe_screen *r600_drm_create_screen(struct drm_api* api, int drmfd) +struct radeon *r600_drm_winsys_create(int drmfd) { - struct radeon *rw = radeon_new(drmfd, 0); - - if (rw == NULL) - return NULL; - return radeon_create_screen(rw); + return radeon_new(drmfd, 0); } boolean r600_buffer_get_handle(struct radeon *rw, @@ -63,24 +60,3 @@ boolean r600_buffer_get_handle(struct radeon *rw, whandle->handle = rbuffer->flink; return TRUE; } - -static void r600_drm_api_destroy(struct drm_api *api) -{ - return; -} - -struct drm_api drm_api_hooks = { - .name = "r600", - .driver_name = "r600", - .create_screen = r600_drm_create_screen, - .destroy = r600_drm_api_destroy, -}; - -struct drm_api* drm_api_create() -{ -#ifdef DEBUG - return trace_drm_create(&drm_api_hooks); -#else - return &drm_api_hooks; -#endif -} diff --git a/src/gallium/winsys/r600/drm/r600_drm_public.h b/src/gallium/winsys/r600/drm/r600_drm_public.h new file mode 100644 index 0000000000..84f2dce437 --- /dev/null +++ b/src/gallium/winsys/r600/drm/r600_drm_public.h @@ -0,0 +1,9 @@ + +#ifndef R600_DRM_PUBLIC_H +#define R600_DRM_PUBLIC_H + +struct radeon; + +struct radeon *r600_drm_winsys_create(int drmFD); + +#endif -- cgit v1.2.3 From e47d32d721a76b5df3b640ccdc9bad15dffb8450 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Wed, 23 Jun 2010 23:14:22 +0200 Subject: gallium: Remove drm_api and all references to it --- .../auxiliary/target-helpers/drm_api_compat.h | 46 ---------- src/gallium/drivers/identity/Makefile | 3 +- src/gallium/drivers/identity/SConscript | 1 - src/gallium/drivers/identity/id_drm.c | 93 ------------------- src/gallium/drivers/identity/id_drm.h | 35 ------- src/gallium/drivers/trace/Makefile | 1 - src/gallium/drivers/trace/SConscript | 1 - src/gallium/drivers/trace/tr_drm.c | 101 --------------------- src/gallium/drivers/trace/tr_drm.h | 35 ------- src/gallium/include/state_tracker/drm_api.h | 57 ------------ src/gallium/targets/dri-swrast/swrast_drm_api.c | 1 - 11 files changed, 1 insertion(+), 373 deletions(-) delete mode 100644 src/gallium/auxiliary/target-helpers/drm_api_compat.h delete mode 100644 src/gallium/drivers/identity/id_drm.c delete mode 100644 src/gallium/drivers/identity/id_drm.h delete mode 100644 src/gallium/drivers/trace/tr_drm.c delete mode 100644 src/gallium/drivers/trace/tr_drm.h delete mode 100644 src/gallium/include/state_tracker/drm_api.h diff --git a/src/gallium/auxiliary/target-helpers/drm_api_compat.h b/src/gallium/auxiliary/target-helpers/drm_api_compat.h deleted file mode 100644 index 324c6f2ba9..0000000000 --- a/src/gallium/auxiliary/target-helpers/drm_api_compat.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * This file contain a small backwards compatible shim between - * the old depricated drm_api and the drm_driver interface. - */ - -#ifndef DRM_API_COMPAT_H -#define DRM_API_COMPAT_H - -#ifdef _DRM_API_H_ -#error "Included drm_api.h before drm_api_compat.h" -#endif - -#include "state_tracker/drm_driver.h" - -/* - * XXX Hack, can't include both drm_api and drm_driver. Due to name - * collition of winsys_handle, just use a define to rename it. - */ -#define winsys_handle HACK_winsys_handle -#include "state_tracker/drm_api.h" -#undef winsys_handle - -static INLINE struct pipe_screen * -drm_api_compat_create_screen(int fd) -{ - static struct drm_api *api; - if (!api) - api = drm_api_create(); - - if (!api) - return NULL; - - return api->create_screen(api, fd); -} - -/** - * Instanciate a drm_driver descriptor. - */ -#define DRM_API_COMPAT_STRUCT(name_str, driver_name_str) \ -struct drm_driver_descriptor driver_descriptor = { \ - .name = name_str, \ - .driver_name = driver_name_str, \ - .create_screen = drm_api_compat_create_screen, \ -}; - -#endif diff --git a/src/gallium/drivers/identity/Makefile b/src/gallium/drivers/identity/Makefile index e32b9102e5..74692d9761 100644 --- a/src/gallium/drivers/identity/Makefile +++ b/src/gallium/drivers/identity/Makefile @@ -6,7 +6,6 @@ LIBNAME = identity C_SOURCES = \ id_objects.c \ id_context.c \ - id_screen.c \ - id_drm.c + id_screen.c include ../../Makefile.template diff --git a/src/gallium/drivers/identity/SConscript b/src/gallium/drivers/identity/SConscript index 2a68891c28..b364e0acc8 100644 --- a/src/gallium/drivers/identity/SConscript +++ b/src/gallium/drivers/identity/SConscript @@ -6,7 +6,6 @@ identity = env.ConvenienceLibrary( target = 'identity', source = [ 'id_context.c', - 'id_drm.c', 'id_objects.c', 'id_screen.c', ]) diff --git a/src/gallium/drivers/identity/id_drm.c b/src/gallium/drivers/identity/id_drm.c deleted file mode 100644 index 15d01519f8..0000000000 --- a/src/gallium/drivers/identity/id_drm.c +++ /dev/null @@ -1,93 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 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, 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 "state_tracker/drm_api.h" - -#include "util/u_memory.h" -#include "id_drm.h" -#include "id_screen.h" -#include "id_public.h" - -struct identity_drm_api -{ - struct drm_api base; - - struct drm_api *api; -}; - -static INLINE struct identity_drm_api * -identity_drm_api(struct drm_api *_api) -{ - return (struct identity_drm_api *)_api; -} - -static struct pipe_screen * -identity_drm_create_screen(struct drm_api *_api, int fd) -{ - struct identity_drm_api *id_api = identity_drm_api(_api); - struct drm_api *api = id_api->api; - struct pipe_screen *screen; - - screen = api->create_screen(api, fd); - - return identity_screen_create(screen); -} - -static void -identity_drm_destroy(struct drm_api *_api) -{ - struct identity_drm_api *id_api = identity_drm_api(_api); - struct drm_api *api = id_api->api; - api->destroy(api); - - FREE(id_api); -} - -struct drm_api * -identity_drm_create(struct drm_api *api) -{ - struct identity_drm_api *id_api; - - if (!api) - goto error; - - id_api = CALLOC_STRUCT(identity_drm_api); - - if (!id_api) - goto error; - - id_api->base.name = api->name; - id_api->base.driver_name = api->driver_name; - id_api->base.create_screen = identity_drm_create_screen; - id_api->base.destroy = identity_drm_destroy; - id_api->api = api; - - return &id_api->base; - -error: - return api; -} diff --git a/src/gallium/drivers/identity/id_drm.h b/src/gallium/drivers/identity/id_drm.h deleted file mode 100644 index cf2ad2ce07..0000000000 --- a/src/gallium/drivers/identity/id_drm.h +++ /dev/null @@ -1,35 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 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, 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. - * - **************************************************************************/ - -#ifndef ID_DRM_H -#define ID_DRM_H - -struct drm_api; - -struct drm_api* identity_drm_create(struct drm_api *api); - -#endif /* ID_DRM_H */ diff --git a/src/gallium/drivers/trace/Makefile b/src/gallium/drivers/trace/Makefile index 1b0c087a2a..99e5fb81c2 100644 --- a/src/gallium/drivers/trace/Makefile +++ b/src/gallium/drivers/trace/Makefile @@ -8,7 +8,6 @@ C_SOURCES = \ tr_dump.c \ tr_dump_state.c \ tr_screen.c \ - tr_drm.c \ tr_texture.c include ../../Makefile.template diff --git a/src/gallium/drivers/trace/SConscript b/src/gallium/drivers/trace/SConscript index 0dc43a9ec4..06b0c4863a 100644 --- a/src/gallium/drivers/trace/SConscript +++ b/src/gallium/drivers/trace/SConscript @@ -6,7 +6,6 @@ trace = env.ConvenienceLibrary( target = 'trace', source = [ 'tr_context.c', - 'tr_drm.c', 'tr_dump.c', 'tr_dump_state.c', 'tr_screen.c', diff --git a/src/gallium/drivers/trace/tr_drm.c b/src/gallium/drivers/trace/tr_drm.c deleted file mode 100644 index e685033212..0000000000 --- a/src/gallium/drivers/trace/tr_drm.c +++ /dev/null @@ -1,101 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 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, 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 "state_tracker/drm_api.h" - -#include "util/u_memory.h" -#include "rbug/rbug_public.h" -#include "tr_drm.h" -#include "tr_screen.h" -#include "tr_public.h" - -struct trace_drm_api -{ - struct drm_api base; - - struct drm_api *api; -}; - -static INLINE struct trace_drm_api * -trace_drm_api(struct drm_api *_api) -{ - return (struct trace_drm_api *)_api; -} - -static struct pipe_screen * -trace_drm_create_screen(struct drm_api *_api, int fd) -{ - struct trace_drm_api *tr_api = trace_drm_api(_api); - struct drm_api *api = tr_api->api; - struct pipe_screen *screen; - - /* TODO trace call */ - - screen = api->create_screen(api, fd); - - return trace_screen_create(rbug_screen_create(screen)); -} - -static void -trace_drm_destroy(struct drm_api *_api) -{ - struct trace_drm_api *tr_api = trace_drm_api(_api); - struct drm_api *api = tr_api->api; - - if (api->destroy) - api->destroy(api); - - FREE(tr_api); -} - -struct drm_api * -trace_drm_create(struct drm_api *api) -{ - struct trace_drm_api *tr_api; - - if (!api) - goto error; - - if (!trace_enabled() && !rbug_enabled()) - goto error; - - tr_api = CALLOC_STRUCT(trace_drm_api); - - if (!tr_api) - goto error; - - tr_api->base.name = api->name; - tr_api->base.driver_name = api->driver_name; - tr_api->base.create_screen = trace_drm_create_screen; - tr_api->base.destroy = trace_drm_destroy; - tr_api->api = api; - - return &tr_api->base; - -error: - return api; -} diff --git a/src/gallium/drivers/trace/tr_drm.h b/src/gallium/drivers/trace/tr_drm.h deleted file mode 100644 index 845c66a32a..0000000000 --- a/src/gallium/drivers/trace/tr_drm.h +++ /dev/null @@ -1,35 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 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, 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. - * - **************************************************************************/ - -#ifndef TR_DRM_H -#define TR_DRM_H - -struct drm_api; - -struct drm_api* trace_drm_create(struct drm_api *api); - -#endif /* ID_DRM_H */ diff --git a/src/gallium/include/state_tracker/drm_api.h b/src/gallium/include/state_tracker/drm_api.h deleted file mode 100644 index 4572c7e042..0000000000 --- a/src/gallium/include/state_tracker/drm_api.h +++ /dev/null @@ -1,57 +0,0 @@ - -#ifndef _DRM_API_H_ -#define _DRM_API_H_ - -#include "pipe/p_compiler.h" - -struct pipe_screen; -struct pipe_winsys; -struct pipe_context; -struct pipe_resource; - -#define DRM_API_HANDLE_TYPE_SHARED 0 -#define DRM_API_HANDLE_TYPE_KMS 1 - -/** - * For use with pipe_screen::{texture_from_handle|texture_get_handle}. - */ -struct winsys_handle -{ - /** - * Unused for texture_from_handle, always - * DRM_API_HANDLE_TYPE_SHARED. Input to texture_get_handle, - * use TEXTURE_USAGE to select handle for kms or ipc. - */ - unsigned type; - /** - * Input to texture_from_handle. - * Output for texture_get_handle. - */ - unsigned handle; - /** - * Input to texture_from_handle. - * Output for texture_get_handle. - */ - unsigned stride; -}; - -struct drm_api -{ - void (*destroy)(struct drm_api *api); - - const char *name; - - /** - * Kernel driver name, as accepted by drmOpenByName. - */ - const char *driver_name; - - /** - * Create a pipe srcreen. - */ - struct pipe_screen* (*create_screen)(struct drm_api *api, int drm_fd); -}; - -extern struct drm_api * drm_api_create(void); - -#endif diff --git a/src/gallium/targets/dri-swrast/swrast_drm_api.c b/src/gallium/targets/dri-swrast/swrast_drm_api.c index 84142be80c..ddf78406d5 100644 --- a/src/gallium/targets/dri-swrast/swrast_drm_api.c +++ b/src/gallium/targets/dri-swrast/swrast_drm_api.c @@ -28,7 +28,6 @@ #include "pipe/p_compiler.h" #include "util/u_memory.h" -#include "state_tracker/drm_api.h" #include "state_tracker/sw_winsys.h" #include "dri_sw_winsys.h" #include "trace/tr_public.h" -- cgit v1.2.3 From 59981d418f14f684c9e8d86358e7520abf34a7c9 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Wed, 23 Jun 2010 23:51:52 +0200 Subject: gallium: Fix scons build --- src/gallium/targets/SConscript.dri | 1 + src/gallium/winsys/SConscript | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/targets/SConscript.dri b/src/gallium/targets/SConscript.dri index 74b53e5023..e5981c2461 100644 --- a/src/gallium/targets/SConscript.dri +++ b/src/gallium/targets/SConscript.dri @@ -13,6 +13,7 @@ drienv.Replace(CPPPATH = [ '#src/gallium/include', '#src/gallium/auxiliary', '#src/gallium/drivers', + '#src/gallium/winsys', '#src/mesa', '#src/mesa/main', '#src/mesa/glapi', diff --git a/src/gallium/winsys/SConscript b/src/gallium/winsys/SConscript index 907ac90bf0..65b12287df 100644 --- a/src/gallium/winsys/SConscript +++ b/src/gallium/winsys/SConscript @@ -17,7 +17,6 @@ if 'gdi' in env['winsys']: if env['dri']: SConscript([ - 'sw/drm/SConscript', 'sw/dri/SConscript', ]) -- cgit v1.2.3 From ea1786ec5b1385fe26927e206ca81d87ca70ca6a Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Thu, 24 Jun 2010 00:50:08 +0200 Subject: gallium: Add debug target helper --- .../auxiliary/target-helpers/inline_debug_helper.h | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/gallium/auxiliary/target-helpers/inline_debug_helper.h diff --git a/src/gallium/auxiliary/target-helpers/inline_debug_helper.h b/src/gallium/auxiliary/target-helpers/inline_debug_helper.h new file mode 100644 index 0000000000..1bc329c9f0 --- /dev/null +++ b/src/gallium/auxiliary/target-helpers/inline_debug_helper.h @@ -0,0 +1,36 @@ + +#ifndef INLINE_DEBUG_HELPER_H +#define INLINE_DEBUG_HELPER_H + +#include "pipe/p_compiler.h" +#include "util/u_debug.h" + + +/* Helper function to wrap a screen with + * one or more debug driver: rbug, trace. + */ + +#ifdef GALLIUM_TRACE +#include "trace/tr_public.h" +#endif + +#ifdef GALLIUM_RBUG +#include "rbug/rbug_public.h" +#endif + +static INLINE struct pipe_screen * +debug_screen_wrap(struct pipe_screen *screen) +{ + +#if defined(GALLIUM_RBUG) + screen = rbug_screen_create(screen); +#endif + +#if defined(GALLIUM_TRACE) + screen = trace_screen_create(screen); +#endif + + return screen; +} + +#endif -- cgit v1.2.3 From 57d14f2fbbfc50656be76fa0f77e1ed505180204 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Thu, 24 Jun 2010 01:53:05 +0200 Subject: gallium: Use debugging helper in all drm targets --- src/gallium/targets/dri-i915/Makefile | 3 +++ src/gallium/targets/dri-i915/SConscript | 2 ++ src/gallium/targets/dri-i915/target.c | 11 ++++++++++- src/gallium/targets/dri-i965/Makefile | 2 +- src/gallium/targets/dri-i965/SConscript | 6 +++++- src/gallium/targets/dri-i965/target.c | 3 +++ src/gallium/targets/dri-nouveau/Makefile | 5 +++++ src/gallium/targets/dri-nouveau/target.c | 3 +++ src/gallium/targets/dri-r600/Makefile | 3 +++ src/gallium/targets/dri-r600/SConscript | 2 ++ src/gallium/targets/dri-r600/target.c | 3 +++ src/gallium/targets/dri-radeong/Makefile | 3 +++ src/gallium/targets/dri-radeong/SConscript | 2 ++ src/gallium/targets/dri-radeong/target.c | 11 ++++++++++- src/gallium/targets/dri-vmwgfx/Makefile | 3 +++ src/gallium/targets/dri-vmwgfx/SConscript | 2 ++ src/gallium/targets/dri-vmwgfx/target.c | 11 ++++++++++- src/gallium/targets/egl-i915/Makefile | 3 +++ src/gallium/targets/egl-i915/target.c | 11 ++++++++++- src/gallium/targets/egl-i965/Makefile | 2 +- src/gallium/targets/egl-i965/target.c | 3 +++ src/gallium/targets/egl-nouveau/Makefile | 5 +++++ src/gallium/targets/egl-nouveau/target.c | 3 +++ src/gallium/targets/egl-radeon/Makefile | 3 +++ src/gallium/targets/egl-radeon/target.c | 11 ++++++++++- src/gallium/targets/egl-vmwgfx/Makefile | 3 +++ src/gallium/targets/egl-vmwgfx/target.c | 11 ++++++++++- src/gallium/targets/xorg-i915/Makefile | 2 +- src/gallium/targets/xorg-i915/intel_target.c | 11 ++++++++++- src/gallium/targets/xorg-i965/Makefile | 3 ++- src/gallium/targets/xorg-i965/intel_target.c | 3 +++ src/gallium/targets/xorg-nouveau/Makefile | 4 +++- src/gallium/targets/xorg-nouveau/nouveau_target.c | 3 +++ src/gallium/targets/xorg-radeon/Makefile | 2 +- src/gallium/targets/xorg-radeon/radeon_target.c | 11 ++++++++++- src/gallium/targets/xorg-vmwgfx/Makefile | 3 +++ src/gallium/targets/xorg-vmwgfx/vmw_target.c | 11 ++++++++++- 37 files changed, 167 insertions(+), 16 deletions(-) diff --git a/src/gallium/targets/dri-i915/Makefile b/src/gallium/targets/dri-i915/Makefile index 24ef989ad2..26726b24a0 100644 --- a/src/gallium/targets/dri-i915/Makefile +++ b/src/gallium/targets/dri-i915/Makefile @@ -17,6 +17,9 @@ C_SOURCES = \ $(COMMON_GALLIUM_SOURCES) \ $(DRIVER_SOURCES) +DRIVER_DEFINES = \ + -DGALLIUM_RBUG -DGALLIUM_TRACE + include ../Makefile.dri DRI_LIB_DEPS += -ldrm_intel diff --git a/src/gallium/targets/dri-i915/SConscript b/src/gallium/targets/dri-i915/SConscript index 5da2a0a403..5659bc8027 100644 --- a/src/gallium/targets/dri-i915/SConscript +++ b/src/gallium/targets/dri-i915/SConscript @@ -8,6 +8,8 @@ env = drienv.Clone() env.ParseConfig('pkg-config --cflags --libs libdrm_intel') +env.Append(CPPDEFINES = ['GALLIUM_RBUG', 'GALLIUM_TRACE']) + env.Prepend(LIBS = [ st_dri, i915drm, diff --git a/src/gallium/targets/dri-i915/target.c b/src/gallium/targets/dri-i915/target.c index a79238f3a0..8c8ef7e02b 100644 --- a/src/gallium/targets/dri-i915/target.c +++ b/src/gallium/targets/dri-i915/target.c @@ -1,5 +1,6 @@ #include "state_tracker/drm_driver.h" +#include "target-helpers/inline_debug_helper.h" #include "i915/drm/i915_drm_public.h" #include "i915/i915_public.h" @@ -7,11 +8,19 @@ static struct pipe_screen * create_screen(int fd) { struct i915_winsys *iws; + struct pipe_screen *screen; + iws = i915_drm_winsys_create(fd); if (!iws) return NULL; - return i915_screen_create(iws); + screen = i915_screen_create(iws); + if (!screen) + return NULL; + + screen = debug_screen_wrap(screen); + + return screen; } DRM_DRIVER_DESCRIPTOR("i915", "i915", create_screen) diff --git a/src/gallium/targets/dri-i965/Makefile b/src/gallium/targets/dri-i965/Makefile index 76350caf9d..3679c075b2 100644 --- a/src/gallium/targets/dri-i965/Makefile +++ b/src/gallium/targets/dri-i965/Makefile @@ -18,7 +18,7 @@ C_SOURCES = \ $(DRIVER_SOURCES) DRIVER_DEFINES = \ - -DGALLIUM_SOFTPIPE + -DGALLIUM_SOFTPIPE -DGALLIUM_RBUG -DGALLIUM_TRACE include ../Makefile.dri diff --git a/src/gallium/targets/dri-i965/SConscript b/src/gallium/targets/dri-i965/SConscript index da1a8654a8..7eb3c436a3 100644 --- a/src/gallium/targets/dri-i965/SConscript +++ b/src/gallium/targets/dri-i965/SConscript @@ -8,7 +8,11 @@ env = drienv.Clone() env.ParseConfig('pkg-config --cflags --libs libdrm_intel') -env.Append(CPPDEFINES = 'GALLIUM_SOFTPIPE') +env.Append(CPPDEFINES = [ + 'GALLIUM_SOFTPIPE', + 'GALLIUM_RBUG', + 'GALLIUM_TRACE' +]) env.Prepend(LIBS = [ st_dri, diff --git a/src/gallium/targets/dri-i965/target.c b/src/gallium/targets/dri-i965/target.c index 36424c60a1..ce97f82027 100644 --- a/src/gallium/targets/dri-i965/target.c +++ b/src/gallium/targets/dri-i965/target.c @@ -1,5 +1,6 @@ #include "target-helpers/inline_wrapper_sw_helper.h" +#include "target-helpers/inline_debug_helper.h" #include "state_tracker/drm_driver.h" #include "i965/drm/i965_drm_public.h" #include "i965/brw_public.h" @@ -21,6 +22,8 @@ create_screen(int fd) if (debug_get_bool_option("BRW_SOFTPIPE", FALSE)) screen = sw_screen_wrap(screen); + screen = debug_screen_wrap(screen); + return screen; } diff --git a/src/gallium/targets/dri-nouveau/Makefile b/src/gallium/targets/dri-nouveau/Makefile index bf594ce483..2f64f312b8 100644 --- a/src/gallium/targets/dri-nouveau/Makefile +++ b/src/gallium/targets/dri-nouveau/Makefile @@ -6,6 +6,8 @@ LIBNAME = nouveau_dri.so PIPE_DRIVERS = \ $(TOP)/src/gallium/state_trackers/dri/drm/libdridrm.a \ $(TOP)/src/gallium/winsys/nouveau/drm/libnouveaudrm.a \ + $(TOP)/src/gallium/drivers/trace/libtrace.a \ + $(TOP)/src/gallium/drivers/rbug/librbug.a \ $(TOP)/src/gallium/drivers/nvfx/libnvfx.a \ $(TOP)/src/gallium/drivers/nv50/libnv50.a \ $(TOP)/src/gallium/drivers/nouveau/libnouveau.a @@ -15,6 +17,9 @@ C_SOURCES = \ $(COMMON_GALLIUM_SOURCES) \ $(DRIVER_SOURCES) +DRIVER_DEFINES = \ + -DGALLIUM_RBUG -DGALLIUM_TRACE + include ../Makefile.dri DRI_LIB_DEPS += $(shell pkg-config libdrm_nouveau --libs) diff --git a/src/gallium/targets/dri-nouveau/target.c b/src/gallium/targets/dri-nouveau/target.c index ca3ec53029..e725a4d9b7 100644 --- a/src/gallium/targets/dri-nouveau/target.c +++ b/src/gallium/targets/dri-nouveau/target.c @@ -1,4 +1,5 @@ +#include "target-helpers/inline_debug_helper.h" #include "state_tracker/drm_driver.h" #include "nouveau/drm/nouveau_drm_public.h" @@ -11,6 +12,8 @@ create_screen(int fd) if (!screen) return NULL; + screen = debug_screen_wrap(screen); + return screen; } diff --git a/src/gallium/targets/dri-r600/Makefile b/src/gallium/targets/dri-r600/Makefile index 136fbb260b..932303d194 100644 --- a/src/gallium/targets/dri-r600/Makefile +++ b/src/gallium/targets/dri-r600/Makefile @@ -16,6 +16,9 @@ C_SOURCES = \ $(COMMON_GALLIUM_SOURCES) \ $(DRIVER_SOURCES) +DRIVER_DEFINES = \ + -DGALLIUM_RBUG -DGALLIUM_TRACE + include ../Makefile.dri DRI_LIB_DEPS += -ldrm_radeon diff --git a/src/gallium/targets/dri-r600/SConscript b/src/gallium/targets/dri-r600/SConscript index d24251673c..97c5df01fe 100644 --- a/src/gallium/targets/dri-r600/SConscript +++ b/src/gallium/targets/dri-r600/SConscript @@ -8,6 +8,8 @@ env = drienv.Clone() env.ParseConfig('pkg-config --cflags --libs libdrm_radeon') +env.Append(CPPDEFINES = ['GALLIUM_RBUG', 'GALLIUM_TRACE']) + env.Prepend(LIBS = [ st_dri, r600drm, diff --git a/src/gallium/targets/dri-r600/target.c b/src/gallium/targets/dri-r600/target.c index 40ad8a09ca..a01f4ed49f 100644 --- a/src/gallium/targets/dri-r600/target.c +++ b/src/gallium/targets/dri-r600/target.c @@ -1,5 +1,6 @@ #include "state_tracker/drm_driver.h" +#include "target-helpers/inline_debug_helper.h" #include "r600/drm/r600_drm_public.h" #include "r600/r600_public.h" @@ -17,6 +18,8 @@ create_screen(int fd) if (!screen) return NULL; + screen = debug_screen_wrap(screen); + return screen; } diff --git a/src/gallium/targets/dri-radeong/Makefile b/src/gallium/targets/dri-radeong/Makefile index d67d7d7ac2..28647540b0 100644 --- a/src/gallium/targets/dri-radeong/Makefile +++ b/src/gallium/targets/dri-radeong/Makefile @@ -16,6 +16,9 @@ C_SOURCES = \ $(COMMON_GALLIUM_SOURCES) \ $(DRIVER_SOURCES) +DRIVER_DEFINES = \ + -DGALLIUM_RBUG -DGALLIUM_TRACE + include ../Makefile.dri DRI_LIB_DEPS += -ldrm_radeon diff --git a/src/gallium/targets/dri-radeong/SConscript b/src/gallium/targets/dri-radeong/SConscript index c1d4eeecee..ffac73af84 100644 --- a/src/gallium/targets/dri-radeong/SConscript +++ b/src/gallium/targets/dri-radeong/SConscript @@ -8,6 +8,8 @@ env = drienv.Clone() env.ParseConfig('pkg-config --cflags --libs libdrm_radeon') +env.Append(CPPDEFINES = ['GALLIUM_RBUG', 'GALLIUM_TRACE']) + env.Prepend(LIBS = [ st_dri, radeonwinsys, diff --git a/src/gallium/targets/dri-radeong/target.c b/src/gallium/targets/dri-radeong/target.c index 2c1beb633e..5a0a8dc573 100644 --- a/src/gallium/targets/dri-radeong/target.c +++ b/src/gallium/targets/dri-radeong/target.c @@ -1,4 +1,5 @@ +#include "target-helpers/inline_debug_helper.h" #include "state_tracker/drm_driver.h" #include "radeon/drm/radeon_drm_public.h" #include "r300/r300_public.h" @@ -7,11 +8,19 @@ static struct pipe_screen * create_screen(int fd) { struct r300_winsys_screen *sws; + struct pipe_screen *screen; + sws = r300_drm_winsys_screen_create(fd); if (!sws) return NULL; - return r300_screen_create(sws); + screen = r300_screen_create(sws); + if (!screen) + return NULL; + + screen = debug_screen_wrap(screen); + + return screen; } DRM_DRIVER_DESCRIPTOR("radeon", "radeon", create_screen) diff --git a/src/gallium/targets/dri-vmwgfx/Makefile b/src/gallium/targets/dri-vmwgfx/Makefile index 8e3cd6ff28..97c703b373 100644 --- a/src/gallium/targets/dri-vmwgfx/Makefile +++ b/src/gallium/targets/dri-vmwgfx/Makefile @@ -14,6 +14,9 @@ C_SOURCES = \ target.c \ $(COMMON_GALLIUM_SOURCES) +DRIVER_DEFINES = \ + -DGALLIUM_RBUG -DGALLIUM_TRACE + include ../Makefile.dri symlinks: diff --git a/src/gallium/targets/dri-vmwgfx/SConscript b/src/gallium/targets/dri-vmwgfx/SConscript index 3d0c5495da..7afabc7429 100644 --- a/src/gallium/targets/dri-vmwgfx/SConscript +++ b/src/gallium/targets/dri-vmwgfx/SConscript @@ -6,6 +6,8 @@ if not 'svga' in env['drivers']: env = drienv.Clone() +env.Append(CPPDEFINES = ['GALLIUM_RBUG', 'GALLIUM_TRACE']) + env.Prepend(LIBS = [ st_dri, svgadrm, diff --git a/src/gallium/targets/dri-vmwgfx/target.c b/src/gallium/targets/dri-vmwgfx/target.c index 5f69653582..15089d6db2 100644 --- a/src/gallium/targets/dri-vmwgfx/target.c +++ b/src/gallium/targets/dri-vmwgfx/target.c @@ -1,4 +1,5 @@ +#include "target-helpers/inline_debug_helper.h" #include "state_tracker/drm_driver.h" #include "svga/drm/svga_drm_public.h" #include "svga/svga_public.h" @@ -7,11 +8,19 @@ static struct pipe_screen * create_screen(int fd) { struct svga_winsys_screen *sws; + struct pipe_screen *screen; + sws = svga_drm_winsys_screen_create(fd); if (!sws) return NULL; - return svga_screen_create(sws); + screen = svga_screen_create(sws); + if (!screen) + return NULL; + + screen = debug_screen_wrap(screen); + + return screen; } DRM_DRIVER_DESCRIPTOR("vmwgfx", "vmwgfx", create_screen) diff --git a/src/gallium/targets/egl-i915/Makefile b/src/gallium/targets/egl-i915/Makefile index a118f16929..c3ffe78029 100644 --- a/src/gallium/targets/egl-i915/Makefile +++ b/src/gallium/targets/egl-i915/Makefile @@ -5,6 +5,9 @@ EGL_DRIVER_NAME = i915 EGL_DRIVER_SOURCES = target.c EGL_DRIVER_LIBS = -ldrm_intel +EGL_DRIVER_DEFINES = \ + -DGALLIUM_RBUG -DGALLIUM_TRACE + EGL_DRIVER_PIPES = \ $(TOP)/src/gallium/winsys/i915/drm/libi915drm.a \ $(TOP)/src/gallium/drivers/trace/libtrace.a \ diff --git a/src/gallium/targets/egl-i915/target.c b/src/gallium/targets/egl-i915/target.c index 2887716643..070e2c0964 100644 --- a/src/gallium/targets/egl-i915/target.c +++ b/src/gallium/targets/egl-i915/target.c @@ -1,5 +1,6 @@ #include "state_tracker/drm_driver.h" +#include "target-helpers/inline_debug_helper.h" #include "i915/drm/i915_drm_public.h" #include "i915/i915_public.h" @@ -7,11 +8,19 @@ static struct pipe_screen * create_screen(int fd) { struct i915_winsys *iws; + struct pipe_screen *screen; + iws = i915_drm_winsys_create(fd); if (!iws) return NULL; - return i915_screen_create(iws); + screen = i915_screen_create(iws); + if (!screen) + return NULL; + + screen = debug_screen_wrap(screen); + + return screen; } DRM_DRIVER_DESCRIPTOR("i915", "i915", create_screen) diff --git a/src/gallium/targets/egl-i965/Makefile b/src/gallium/targets/egl-i965/Makefile index fe3091190c..44e435452e 100644 --- a/src/gallium/targets/egl-i965/Makefile +++ b/src/gallium/targets/egl-i965/Makefile @@ -6,7 +6,7 @@ EGL_DRIVER_SOURCES = target.c EGL_DRIVER_LIBS = -ldrm_intel EGL_DRIVER_DEFINES = \ - -DGALLIUM_SOFTPIPE + -DGALLIUM_SOFTPIPE -DGALLIUM_RBUG -DGALLIUM_TRACE EGL_DRIVER_PIPES = \ $(TOP)/src/gallium/winsys/i965/drm/libi965drm.a \ diff --git a/src/gallium/targets/egl-i965/target.c b/src/gallium/targets/egl-i965/target.c index ba1eeadd21..1195b510a0 100644 --- a/src/gallium/targets/egl-i965/target.c +++ b/src/gallium/targets/egl-i965/target.c @@ -1,5 +1,6 @@ #include "target-helpers/inline_wrapper_sw_helper.h" +#include "target-helpers/inline_debug_helper.h" #include "state_tracker/drm_driver.h" #include "i965/drm/i965_drm_public.h" #include "i965/brw_public.h" @@ -21,6 +22,8 @@ create_screen(int fd) if (debug_get_bool_option("BRW_SOFTPIPE", FALSE)) screen = sw_screen_wrap(screen); + screen = debug_screen_wrap(screen); + return screen; } diff --git a/src/gallium/targets/egl-nouveau/Makefile b/src/gallium/targets/egl-nouveau/Makefile index 3f0a373e43..0e16f11324 100644 --- a/src/gallium/targets/egl-nouveau/Makefile +++ b/src/gallium/targets/egl-nouveau/Makefile @@ -5,8 +5,13 @@ EGL_DRIVER_NAME = nouveau EGL_DRIVER_SOURCES = target.c EGL_DRIVER_LIBS = -ldrm_nouveau +EGL_DRIVER_DEFINES = \ + -DGALLIUM_RBUG -DGALLIUM_TRACE + EGL_DRIVER_PIPES = \ $(TOP)/src/gallium/winsys/nouveau/drm/libnouveaudrm.a \ + $(TOP)/src/gallium/drivers/trace/libtrace.a \ + $(TOP)/src/gallium/drivers/rbug/librbug.a \ $(TOP)/src/gallium/drivers/nvfx/libnvfx.a \ $(TOP)/src/gallium/drivers/nv50/libnv50.a \ $(TOP)/src/gallium/drivers/nouveau/libnouveau.a diff --git a/src/gallium/targets/egl-nouveau/target.c b/src/gallium/targets/egl-nouveau/target.c index 7d0b141e5a..cf569ea62c 100644 --- a/src/gallium/targets/egl-nouveau/target.c +++ b/src/gallium/targets/egl-nouveau/target.c @@ -1,4 +1,5 @@ +#include "target-helpers/inline_debug_helper.h" #include "state_tracker/drm_driver.h" #include "nouveau/drm/nouveau_drm_public.h" @@ -11,6 +12,8 @@ create_screen(int fd) if (!screen) return NULL; + screen = debug_screen_wrap(screen); + return screen; } diff --git a/src/gallium/targets/egl-radeon/Makefile b/src/gallium/targets/egl-radeon/Makefile index c988b48cd0..2adc027b8f 100644 --- a/src/gallium/targets/egl-radeon/Makefile +++ b/src/gallium/targets/egl-radeon/Makefile @@ -5,6 +5,9 @@ EGL_DRIVER_NAME = radeon EGL_DRIVER_SOURCES = target.c EGL_DRIVER_LIBS = -ldrm_radeon +EGL_DRIVER_DEFINES = \ + -DGALLIUM_RBUG -DGALLIUM_TRACE + EGL_DRIVER_PIPES = \ $(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \ $(TOP)/src/gallium/drivers/trace/libtrace.a \ diff --git a/src/gallium/targets/egl-radeon/target.c b/src/gallium/targets/egl-radeon/target.c index 5117eb86f9..ce07327b8f 100644 --- a/src/gallium/targets/egl-radeon/target.c +++ b/src/gallium/targets/egl-radeon/target.c @@ -1,4 +1,5 @@ +#include "target-helpers/inline_debug_helper.h" #include "state_tracker/drm_driver.h" #include "radeon/drm/radeon_drm_public.h" #include "r300/r300_public.h" @@ -7,11 +8,19 @@ static struct pipe_screen * create_screen(int fd) { struct r300_winsys_screen *sws; + struct pipe_screen *screen; + sws = r300_drm_winsys_screen_create(fd); if (!sws) return NULL; - return r300_screen_create(sws); + screen = r300_screen_create(sws); + if (!screen) + return NULL; + + screen = debug_screen_wrap(screen); + + return screen; } DRM_DRIVER_DESCRIPTOR("radeon", "radeon", create_screen) diff --git a/src/gallium/targets/egl-vmwgfx/Makefile b/src/gallium/targets/egl-vmwgfx/Makefile index a25bf8885d..92ec4cbdd6 100644 --- a/src/gallium/targets/egl-vmwgfx/Makefile +++ b/src/gallium/targets/egl-vmwgfx/Makefile @@ -5,6 +5,9 @@ EGL_DRIVER_NAME = vmwgfx EGL_DRIVER_SOURCES = target.c EGL_DRIVER_LIBS = +EGL_DRIVER_DEFINES = \ + -DGALLIUM_RBUG -DGALLIUM_TRACE + EGL_DRIVER_PIPES = \ $(TOP)/src/gallium/winsys/svga/drm/libsvgadrm.a \ $(TOP)/src/gallium/drivers/trace/libtrace.a \ diff --git a/src/gallium/targets/egl-vmwgfx/target.c b/src/gallium/targets/egl-vmwgfx/target.c index 7dd0bb0dc2..4e9f51c5dc 100644 --- a/src/gallium/targets/egl-vmwgfx/target.c +++ b/src/gallium/targets/egl-vmwgfx/target.c @@ -1,4 +1,5 @@ +#include "target-helpers/inline_debug_helper.h" #include "state_tracker/drm_driver.h" #include "svga/drm/svga_drm_public.h" #include "svga/svga_public.h" @@ -7,11 +8,19 @@ static struct pipe_screen * create_screen(int fd) { struct svga_winsys_screen *sws; + struct pipe_screen *screen; + sws = svga_drm_winsys_screen_create(fd); if (!sws) return NULL; - return svga_screen_create(sws); + screen = svga_screen_create(sws); + if (!screen) + return NULL; + + screen = debug_screen_wrap(screen); + + return screen; } DRM_DRIVER_DESCRIPTOR("vmwgfx", "vmwgfx", create_screen) diff --git a/src/gallium/targets/xorg-i915/Makefile b/src/gallium/targets/xorg-i915/Makefile index 4f9202b052..3ab7285fb9 100644 --- a/src/gallium/targets/xorg-i915/Makefile +++ b/src/gallium/targets/xorg-i915/Makefile @@ -8,7 +8,7 @@ C_SOURCES = \ intel_xorg.c DRIVER_DEFINES = \ - -DHAVE_CONFIG_H + -DHAVE_CONFIG_H -DGALLIUM_RBUG -DGALLIUM_TRACE DRIVER_LINKS = \ $(TOP)/src/gallium/state_trackers/xorg/libxorgtracker.a \ diff --git a/src/gallium/targets/xorg-i915/intel_target.c b/src/gallium/targets/xorg-i915/intel_target.c index a79238f3a0..8c8ef7e02b 100644 --- a/src/gallium/targets/xorg-i915/intel_target.c +++ b/src/gallium/targets/xorg-i915/intel_target.c @@ -1,5 +1,6 @@ #include "state_tracker/drm_driver.h" +#include "target-helpers/inline_debug_helper.h" #include "i915/drm/i915_drm_public.h" #include "i915/i915_public.h" @@ -7,11 +8,19 @@ static struct pipe_screen * create_screen(int fd) { struct i915_winsys *iws; + struct pipe_screen *screen; + iws = i915_drm_winsys_create(fd); if (!iws) return NULL; - return i915_screen_create(iws); + screen = i915_screen_create(iws); + if (!screen) + return NULL; + + screen = debug_screen_wrap(screen); + + return screen; } DRM_DRIVER_DESCRIPTOR("i915", "i915", create_screen) diff --git a/src/gallium/targets/xorg-i965/Makefile b/src/gallium/targets/xorg-i965/Makefile index eede9f2325..9bb8252be2 100644 --- a/src/gallium/targets/xorg-i965/Makefile +++ b/src/gallium/targets/xorg-i965/Makefile @@ -8,7 +8,8 @@ C_SOURCES = \ intel_xorg.c DRIVER_DEFINES = \ - -DHAVE_CONFIG_H -DGALLIUM_SOFTPIPE + -DHAVE_CONFIG_H -DGALLIUM_SOFTPIPE \ + -DGALLIUM_RBUG -DGALLIUM_TRACE DRIVER_LINKS = \ $(TOP)/src/gallium/state_trackers/xorg/libxorgtracker.a \ diff --git a/src/gallium/targets/xorg-i965/intel_target.c b/src/gallium/targets/xorg-i965/intel_target.c index 36424c60a1..ce97f82027 100644 --- a/src/gallium/targets/xorg-i965/intel_target.c +++ b/src/gallium/targets/xorg-i965/intel_target.c @@ -1,5 +1,6 @@ #include "target-helpers/inline_wrapper_sw_helper.h" +#include "target-helpers/inline_debug_helper.h" #include "state_tracker/drm_driver.h" #include "i965/drm/i965_drm_public.h" #include "i965/brw_public.h" @@ -21,6 +22,8 @@ create_screen(int fd) if (debug_get_bool_option("BRW_SOFTPIPE", FALSE)) screen = sw_screen_wrap(screen); + screen = debug_screen_wrap(screen); + return screen; } diff --git a/src/gallium/targets/xorg-nouveau/Makefile b/src/gallium/targets/xorg-nouveau/Makefile index 066ec6a813..93f53e63bf 100644 --- a/src/gallium/targets/xorg-nouveau/Makefile +++ b/src/gallium/targets/xorg-nouveau/Makefile @@ -8,11 +8,13 @@ C_SOURCES = \ nouveau_xorg.c DRIVER_DEFINES = \ - -DHAVE_CONFIG_H + -DHAVE_CONFIG_H -DGALLIUM_RBUG -DGALLIUM_TRACE DRIVER_LINKS = \ $(TOP)/src/gallium/state_trackers/xorg/libxorgtracker.a \ $(TOP)/src/gallium/winsys/nouveau/drm/libnouveaudrm.a \ + $(TOP)/src/gallium/drivers/trace/libtrace.a \ + $(TOP)/src/gallium/drivers/rbug/librbug.a \ $(TOP)/src/gallium/drivers/nvfx/libnvfx.a \ $(TOP)/src/gallium/drivers/nv50/libnv50.a \ $(TOP)/src/gallium/drivers/nouveau/libnouveau.a \ diff --git a/src/gallium/targets/xorg-nouveau/nouveau_target.c b/src/gallium/targets/xorg-nouveau/nouveau_target.c index ca3ec53029..e725a4d9b7 100644 --- a/src/gallium/targets/xorg-nouveau/nouveau_target.c +++ b/src/gallium/targets/xorg-nouveau/nouveau_target.c @@ -1,4 +1,5 @@ +#include "target-helpers/inline_debug_helper.h" #include "state_tracker/drm_driver.h" #include "nouveau/drm/nouveau_drm_public.h" @@ -11,6 +12,8 @@ create_screen(int fd) if (!screen) return NULL; + screen = debug_screen_wrap(screen); + return screen; } diff --git a/src/gallium/targets/xorg-radeon/Makefile b/src/gallium/targets/xorg-radeon/Makefile index c438ec4847..ba7caea155 100644 --- a/src/gallium/targets/xorg-radeon/Makefile +++ b/src/gallium/targets/xorg-radeon/Makefile @@ -8,7 +8,7 @@ C_SOURCES = \ radeon_xorg.c DRIVER_DEFINES = \ - -DHAVE_CONFIG_H + -DHAVE_CONFIG_H -DGALLIUM_RBUG -DGALLIUM_TRACE DRIVER_LINKS = \ $(TOP)/src/gallium/state_trackers/xorg/libxorgtracker.a \ diff --git a/src/gallium/targets/xorg-radeon/radeon_target.c b/src/gallium/targets/xorg-radeon/radeon_target.c index 2c1beb633e..5a0a8dc573 100644 --- a/src/gallium/targets/xorg-radeon/radeon_target.c +++ b/src/gallium/targets/xorg-radeon/radeon_target.c @@ -1,4 +1,5 @@ +#include "target-helpers/inline_debug_helper.h" #include "state_tracker/drm_driver.h" #include "radeon/drm/radeon_drm_public.h" #include "r300/r300_public.h" @@ -7,11 +8,19 @@ static struct pipe_screen * create_screen(int fd) { struct r300_winsys_screen *sws; + struct pipe_screen *screen; + sws = r300_drm_winsys_screen_create(fd); if (!sws) return NULL; - return r300_screen_create(sws); + screen = r300_screen_create(sws); + if (!screen) + return NULL; + + screen = debug_screen_wrap(screen); + + return screen; } DRM_DRIVER_DESCRIPTOR("radeon", "radeon", create_screen) diff --git a/src/gallium/targets/xorg-vmwgfx/Makefile b/src/gallium/targets/xorg-vmwgfx/Makefile index 0cc9be212b..73a2cea232 100644 --- a/src/gallium/targets/xorg-vmwgfx/Makefile +++ b/src/gallium/targets/xorg-vmwgfx/Makefile @@ -16,8 +16,11 @@ DRIVER_INCLUDES = \ DRIVER_DEFINES = \ -std=gnu99 \ + -DGALLIUM_RBUG \ + -DGALLIUM_TRACE \ -DHAVE_CONFIG_H + DRIVER_LINKS = \ $(TOP)/src/gallium/state_trackers/xorg/libxorgtracker.a \ $(TOP)/src/gallium/winsys/svga/drm/libsvgadrm.a \ diff --git a/src/gallium/targets/xorg-vmwgfx/vmw_target.c b/src/gallium/targets/xorg-vmwgfx/vmw_target.c index 5f69653582..15089d6db2 100644 --- a/src/gallium/targets/xorg-vmwgfx/vmw_target.c +++ b/src/gallium/targets/xorg-vmwgfx/vmw_target.c @@ -1,4 +1,5 @@ +#include "target-helpers/inline_debug_helper.h" #include "state_tracker/drm_driver.h" #include "svga/drm/svga_drm_public.h" #include "svga/svga_public.h" @@ -7,11 +8,19 @@ static struct pipe_screen * create_screen(int fd) { struct svga_winsys_screen *sws; + struct pipe_screen *screen; + sws = svga_drm_winsys_screen_create(fd); if (!sws) return NULL; - return svga_screen_create(sws); + screen = svga_screen_create(sws); + if (!screen) + return NULL; + + screen = debug_screen_wrap(screen); + + return screen; } DRM_DRIVER_DESCRIPTOR("vmwgfx", "vmwgfx", create_screen) -- cgit v1.2.3 From 44c64596d17423dc560434dcbd209997d87b2a29 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Thu, 24 Jun 2010 00:44:53 +0200 Subject: swrastg: Use target-helpers --- src/gallium/targets/dri-swrast/Makefile | 4 +- src/gallium/targets/dri-swrast/SConscript | 6 ++- src/gallium/targets/dri-swrast/swrast_drm_api.c | 57 +++---------------------- 3 files changed, 13 insertions(+), 54 deletions(-) diff --git a/src/gallium/targets/dri-swrast/Makefile b/src/gallium/targets/dri-swrast/Makefile index 0a53eb56c4..948c45abe5 100644 --- a/src/gallium/targets/dri-swrast/Makefile +++ b/src/gallium/targets/dri-swrast/Makefile @@ -3,7 +3,9 @@ include $(TOP)/configs/current LIBNAME = swrastg_dri.so -DRIVER_DEFINES = -D__NOT_HAVE_DRM_H -DGALLIUM_SOFTPIPE +DRIVER_DEFINES = \ + -D__NOT_HAVE_DRM_H -DGALLIUM_SOFTPIPE \ + -DGALLIUM_RBUG -DGALLIUM_TRACE PIPE_DRIVERS = \ $(TOP)/src/gallium/state_trackers/dri/sw/libdrisw.a \ diff --git a/src/gallium/targets/dri-swrast/SConscript b/src/gallium/targets/dri-swrast/SConscript index 679afab41c..d814347119 100644 --- a/src/gallium/targets/dri-swrast/SConscript +++ b/src/gallium/targets/dri-swrast/SConscript @@ -18,7 +18,11 @@ env.Prepend(LIBS = [ ]) if True: - env.Append(CPPDEFINES = 'GALLIUM_SOFTPIPE') + env.Append(CPPDEFINES = [ + 'GALLIUM_SOFTPIPE', + 'GALLIUM_RBUG', + 'GALLIUM_TRACE', + ]) env.Prepend(LIBS = [softpipe]) if env['llvm']: diff --git a/src/gallium/targets/dri-swrast/swrast_drm_api.c b/src/gallium/targets/dri-swrast/swrast_drm_api.c index ddf78406d5..8d741c6343 100644 --- a/src/gallium/targets/dri-swrast/swrast_drm_api.c +++ b/src/gallium/targets/dri-swrast/swrast_drm_api.c @@ -28,60 +28,11 @@ #include "pipe/p_compiler.h" #include "util/u_memory.h" -#include "state_tracker/sw_winsys.h" #include "dri_sw_winsys.h" -#include "trace/tr_public.h" -/* Copied from targets/libgl-xlib */ +#include "target-helpers/inline_debug_helper.h" +#include "target-helpers/inline_sw_helper.h" -#ifdef GALLIUM_SOFTPIPE -#include "softpipe/sp_public.h" -#endif - -#ifdef GALLIUM_LLVMPIPE -#include "llvmpipe/lp_public.h" -#endif - -#ifdef GALLIUM_CELL -#include "cell/ppu/cell_public.h" -#endif - -static struct pipe_screen * -swrast_create_screen(struct sw_winsys *winsys) -{ - const char *default_driver; - const char *driver; - struct pipe_screen *screen = NULL; - -#if defined(GALLIUM_CELL) - default_driver = "cell"; -#elif defined(GALLIUM_LLVMPIPE) - default_driver = "llvmpipe"; -#elif defined(GALLIUM_SOFTPIPE) - default_driver = "softpipe"; -#else - default_driver = ""; -#endif - - driver = debug_get_option("GALLIUM_DRIVER", default_driver); - -#if defined(GALLIUM_CELL) - if (screen == NULL && strcmp(driver, "cell") == 0) - screen = cell_create_screen( winsys ); -#endif - -#if defined(GALLIUM_LLVMPIPE) - if (screen == NULL && strcmp(driver, "llvmpipe") == 0) - screen = llvmpipe_create_screen( winsys ); -#endif - -#if defined(GALLIUM_SOFTPIPE) - if (screen == NULL) - screen = softpipe_create_screen( winsys ); -#endif - - return trace_screen_create(screen);; -} struct pipe_screen * drisw_create_screen(struct drisw_loader_funcs *lf) @@ -93,10 +44,12 @@ drisw_create_screen(struct drisw_loader_funcs *lf) if (winsys == NULL) return NULL; - screen = swrast_create_screen(winsys); + screen = sw_screen_create(winsys); if (!screen) goto fail; + screen = debug_screen_wrap(screen); + return screen; fail: -- cgit v1.2.3 From 09b73b2a5f012128f9d3cf6c8189d68fbfcd4e1c Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Thu, 24 Jun 2010 02:30:00 +0200 Subject: i965g: Remove last references to drm_api --- src/gallium/winsys/i965/drm/i965_drm_buffer.c | 2 +- src/gallium/winsys/i965/drm/i965_drm_winsys.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/winsys/i965/drm/i965_drm_buffer.c b/src/gallium/winsys/i965/drm/i965_drm_buffer.c index 9e9d59d5b4..ed62db60bb 100644 --- a/src/gallium/winsys/i965/drm/i965_drm_buffer.c +++ b/src/gallium/winsys/i965/drm/i965_drm_buffer.c @@ -1,5 +1,5 @@ -#include "state_tracker/drm_api.h" +#include "state_tracker/drm_driver.h" #include "i965_drm_winsys.h" #include "util/u_memory.h" #include "util/u_inlines.h" diff --git a/src/gallium/winsys/i965/drm/i965_drm_winsys.c b/src/gallium/winsys/i965/drm/i965_drm_winsys.c index dfb3660439..b08e622db9 100644 --- a/src/gallium/winsys/i965/drm/i965_drm_winsys.c +++ b/src/gallium/winsys/i965/drm/i965_drm_winsys.c @@ -1,6 +1,6 @@ #include -#include "state_tracker/drm_api.h" +#include "state_tracker/drm_driver.h" #include "i965_drm_winsys.h" #include "i965_drm_public.h" -- cgit v1.2.3 From 9ca563a9a8573bf79821abc75ccf0fdade19c8a9 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Thu, 24 Jun 2010 02:36:30 +0200 Subject: nouveau: Remove reference to drm_api --- src/gallium/drivers/nouveau/nouveau_screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c b/src/gallium/drivers/nouveau/nouveau_screen.c index 60bdd7276a..6fe1eb6953 100644 --- a/src/gallium/drivers/nouveau/nouveau_screen.c +++ b/src/gallium/drivers/nouveau/nouveau_screen.c @@ -15,7 +15,7 @@ #include "nouveau_screen.h" /* XXX this should go away */ -#include "state_tracker/drm_api.h" +#include "state_tracker/drm_driver.h" #include "util/u_simple_screen.h" static const char * -- cgit v1.2.3