From b9706886dbc1fd2eb3c671a8ecd3670f7a680fb9 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 25 May 2010 18:58:33 +0100 Subject: [PATCH] drm_api: Remove type argument from create screen callback With the removal of DRI1 support there where no use of this argument, some drivers didn't even properly check it. --- src/gallium/drivers/identity/id_drm.c | 8 +--- src/gallium/drivers/trace/tr_drm.c | 9 +--- src/gallium/include/state_tracker/drm_api.h | 19 +------- src/gallium/state_trackers/dri/drm/dri2.c | 2 +- .../state_trackers/egl/x11/native_dri2.c | 2 +- src/gallium/state_trackers/xorg/xorg_driver.c | 2 +- src/gallium/winsys/i915/drm/i915_drm_api.c | 12 +---- src/gallium/winsys/i965/drm/i965_drm_api.c | 12 +---- src/gallium/winsys/radeon/drm/radeon_drm.c | 4 +- src/gallium/winsys/radeon/drm/radeon_drm.h | 4 +- src/gallium/winsys/svga/drm/vmw_screen_dri.c | 45 +++++++------------ src/gallium/winsys/sw/drm/sw_drm_api.c | 5 +-- 12 files changed, 30 insertions(+), 94 deletions(-) diff --git a/src/gallium/drivers/identity/id_drm.c b/src/gallium/drivers/identity/id_drm.c index a9d41af18c7..15d01519f80 100644 --- a/src/gallium/drivers/identity/id_drm.c +++ b/src/gallium/drivers/identity/id_drm.c @@ -46,17 +46,13 @@ identity_drm_api(struct drm_api *_api) } static struct pipe_screen * -identity_drm_create_screen(struct drm_api *_api, int fd, - struct drm_create_screen_arg *arg) +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; - if (arg && arg->mode != DRM_CREATE_NORMAL) - return NULL; - - screen = api->create_screen(api, fd, arg); + screen = api->create_screen(api, fd); return identity_screen_create(screen); } diff --git a/src/gallium/drivers/trace/tr_drm.c b/src/gallium/drivers/trace/tr_drm.c index 9c7d39201a9..e6850332121 100644 --- a/src/gallium/drivers/trace/tr_drm.c +++ b/src/gallium/drivers/trace/tr_drm.c @@ -47,8 +47,7 @@ trace_drm_api(struct drm_api *_api) } static struct pipe_screen * -trace_drm_create_screen(struct drm_api *_api, int fd, - struct drm_create_screen_arg *arg) +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; @@ -56,11 +55,7 @@ trace_drm_create_screen(struct drm_api *_api, int fd, /* TODO trace call */ - if (arg && arg->mode != DRM_CREATE_NORMAL) - return NULL; - - screen = api->create_screen(api, fd, arg); - + screen = api->create_screen(api, fd); return trace_screen_create(rbug_screen_create(screen)); } diff --git a/src/gallium/include/state_tracker/drm_api.h b/src/gallium/include/state_tracker/drm_api.h index 8fd0995444d..4572c7e0423 100644 --- a/src/gallium/include/state_tracker/drm_api.h +++ b/src/gallium/include/state_tracker/drm_api.h @@ -9,13 +9,6 @@ struct pipe_winsys; struct pipe_context; struct pipe_resource; -enum drm_create_screen_mode { - DRM_CREATE_NORMAL = 0, - DRM_CREATE_DRI1, - DRM_CREATE_DRIVER = 1024, - DRM_CREATE_MAX -}; - #define DRM_API_HANDLE_TYPE_SHARED 0 #define DRM_API_HANDLE_TYPE_KMS 1 @@ -42,15 +35,6 @@ struct winsys_handle unsigned stride; }; -/** - * Modes other than DRM_CREATE_NORMAL derive from this struct. - */ -/*@{*/ -struct drm_create_screen_arg { - enum drm_create_screen_mode mode; -}; -/*@}*/ - struct drm_api { void (*destroy)(struct drm_api *api); @@ -65,8 +49,7 @@ struct drm_api /** * Create a pipe srcreen. */ - struct pipe_screen* (*create_screen)(struct drm_api *api, int drm_fd, - struct drm_create_screen_arg *arg); + struct pipe_screen* (*create_screen)(struct drm_api *api, int drm_fd); }; extern struct drm_api * drm_api_create(void); diff --git a/src/gallium/state_trackers/dri/drm/dri2.c b/src/gallium/state_trackers/dri/drm/dri2.c index 6c022f4bbf3..f4cc8d77ebd 100644 --- a/src/gallium/state_trackers/dri/drm/dri2.c +++ b/src/gallium/state_trackers/dri/drm/dri2.c @@ -518,7 +518,7 @@ dri2_init_screen(__DRIscreen * sPriv) sPriv->private = (void *)screen; sPriv->extensions = dri_screen_extensions; - pscreen = screen->api->create_screen(screen->api, screen->fd, NULL); + pscreen = screen->api->create_screen(screen->api, 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/egl/x11/native_dri2.c b/src/gallium/state_trackers/egl/x11/native_dri2.c index 63877ed5e51..3f802dd713f 100644 --- a/src/gallium/state_trackers/egl/x11/native_dri2.c +++ b/src/gallium/state_trackers/egl/x11/native_dri2.c @@ -718,7 +718,7 @@ dri2_display_init_screen(struct native_display *ndpy) if (fd < 0) return FALSE; - dri2dpy->base.screen = dri2dpy->api->create_screen(dri2dpy->api, fd, NULL); + dri2dpy->base.screen = dri2dpy->api->create_screen(dri2dpy->api, fd); if (!dri2dpy->base.screen) { _eglLog(_EGL_WARNING, "failed to create DRM screen"); return FALSE; diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c index 44520b81b66..84c0545b1b7 100644 --- a/src/gallium/state_trackers/xorg/xorg_driver.c +++ b/src/gallium/state_trackers/xorg/xorg_driver.c @@ -311,7 +311,7 @@ drv_init_resource_management(ScrnInfoPtr pScrn) return TRUE; if (ms->api) { - ms->screen = ms->api->create_screen(ms->api, ms->fd, NULL); + ms->screen = ms->api->create_screen(ms->api, ms->fd); if (ms->screen) return TRUE; diff --git a/src/gallium/winsys/i915/drm/i915_drm_api.c b/src/gallium/winsys/i915/drm/i915_drm_api.c index 5dfd5a78798..b95df40e86c 100644 --- a/src/gallium/winsys/i915/drm/i915_drm_api.c +++ b/src/gallium/winsys/i915/drm/i915_drm_api.c @@ -49,21 +49,11 @@ i915_drm_winsys_destroy(struct i915_winsys *iws) } static struct pipe_screen * -i915_drm_create_screen(struct drm_api *api, int drmFD, - struct drm_create_screen_arg *arg) +i915_drm_create_screen(struct drm_api *api, int drmFD) { struct i915_drm_winsys *idws; unsigned int deviceID; - if (arg != NULL) { - switch(arg->mode) { - case DRM_CREATE_NORMAL: - break; - default: - return NULL; - } - } - idws = CALLOC_STRUCT(i915_drm_winsys); if (!idws) return NULL; diff --git a/src/gallium/winsys/i965/drm/i965_drm_api.c b/src/gallium/winsys/i965/drm/i965_drm_api.c index bd4dcfc9be7..87ee8070b1d 100644 --- a/src/gallium/winsys/i965/drm/i965_drm_api.c +++ b/src/gallium/winsys/i965/drm/i965_drm_api.c @@ -53,23 +53,13 @@ i965_libdrm_winsys_destroy(struct brw_winsys_screen *iws) } static struct pipe_screen * -i965_libdrm_create_screen(struct drm_api *api, int drmFD, - struct drm_create_screen_arg *arg) +i965_libdrm_create_screen(struct drm_api *api, int drmFD) { struct i965_libdrm_winsys *idws; unsigned int deviceID; debug_printf("%s\n", __FUNCTION__); - if (arg != NULL) { - switch(arg->mode) { - case DRM_CREATE_NORMAL: - break; - default: - return NULL; - } - } - idws = CALLOC_STRUCT(i965_libdrm_winsys); if (!idws) return NULL; diff --git a/src/gallium/winsys/radeon/drm/radeon_drm.c b/src/gallium/winsys/radeon/drm/radeon_drm.c index 8d981b22e3d..59f1b10230e 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm.c @@ -153,9 +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 drm_create_screen_arg *arg) +struct pipe_screen* radeon_create_screen(struct drm_api* api, int drmFB) { struct radeon_libdrm_winsys* rws; boolean ret; diff --git a/src/gallium/winsys/radeon/drm/radeon_drm.h b/src/gallium/winsys/radeon/drm/radeon_drm.h index 78451b6f011..3544c926d99 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm.h +++ b/src/gallium/winsys/radeon/drm/radeon_drm.h @@ -33,9 +33,7 @@ #include "state_tracker/drm_api.h" -struct pipe_screen* radeon_create_screen(struct drm_api* api, - int drmFB, - struct drm_create_screen_arg *arg); +struct pipe_screen* radeon_create_screen(struct drm_api* api, int drmFB); void radeon_destroy_drm_api(struct drm_api* api); diff --git a/src/gallium/winsys/svga/drm/vmw_screen_dri.c b/src/gallium/winsys/svga/drm/vmw_screen_dri.c index 4a710564b43..fe285226918 100644 --- a/src/gallium/winsys/svga/drm/vmw_screen_dri.c +++ b/src/gallium/winsys/svga/drm/vmw_screen_dri.c @@ -89,44 +89,31 @@ vmw_dri1_check_version(const struct dri1_api_version *cur, * bottom of the file. */ static struct pipe_screen * -vmw_drm_create_screen(struct drm_api *drm_api, - int fd, - struct drm_create_screen_arg *arg) +vmw_drm_create_screen(struct drm_api *drm_api, int fd) { struct vmw_winsys_screen *vws; struct pipe_screen *screen; boolean use_old_scanout_flag = FALSE; - if (!arg || arg->mode == DRM_CREATE_NORMAL) { - struct dri1_api_version drm_ver; - drmVersionPtr ver; + struct dri1_api_version drm_ver; + drmVersionPtr ver; - ver = drmGetVersion(fd); - if (ver == NULL) - return NULL; + ver = drmGetVersion(fd); + if (ver == NULL) + return NULL; - drm_ver.major = ver->version_major; - drm_ver.minor = ver->version_minor; - drm_ver.patch_level = 0; /* ??? */ + drm_ver.major = ver->version_major; + drm_ver.minor = ver->version_minor; + drm_ver.patch_level = 0; /* ??? */ - drmFreeVersion(ver); - if (!vmw_dri1_check_version(&drm_ver, &drm_required, - &drm_compat, "vmwgfx drm driver")) - return NULL; + drmFreeVersion(ver); + if (!vmw_dri1_check_version(&drm_ver, &drm_required, + &drm_compat, "vmwgfx drm driver")) + return NULL; - if (!vmw_dri1_check_version(&drm_ver, &drm_scanout, - &drm_compat, "use old scanout field (not a error)")) - use_old_scanout_flag = TRUE; - } - - if (arg != NULL) { - switch (arg->mode) { - case DRM_CREATE_NORMAL: - break; - default: - return NULL; - } - } + if (!vmw_dri1_check_version(&drm_ver, &drm_scanout, + &drm_compat, "use old scanout field (not a error)")) + use_old_scanout_flag = TRUE; vws = vmw_winsys_create( fd, use_old_scanout_flag ); if (!vws) diff --git a/src/gallium/winsys/sw/drm/sw_drm_api.c b/src/gallium/winsys/sw/drm/sw_drm_api.c index 2ccde610e60..7b86382619e 100644 --- a/src/gallium/winsys/sw/drm/sw_drm_api.c +++ b/src/gallium/winsys/sw/drm/sw_drm_api.c @@ -56,15 +56,14 @@ sw_drm_api(struct drm_api *api) static struct pipe_screen * -sw_drm_create_screen(struct drm_api *_api, int drmFD, - struct drm_create_screen_arg *arg) +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, arg); + screen = api->create_screen(api, drmFD); if (!screen) return NULL; -- 2.30.2