drm/st: Remove drm_api struct from drivers

Remove the drm_api from the functions in the softpipe and
	i915simple drivers. Create wrapper functions in the
	backends instead.
This commit is contained in:
Jakob Bornecrantz 2009-07-01 01:16:56 +02:00
parent 119eb40942
commit 64849d1236
7 changed files with 33 additions and 12 deletions

View File

@ -738,8 +738,7 @@ i915_init_screen_texture_functions(struct pipe_screen *screen)
screen->tex_surface_destroy = i915_tex_surface_destroy;
}
boolean i915_get_texture_buffer( struct drm_api *api,
struct pipe_texture *texture,
boolean i915_get_texture_buffer( struct pipe_texture *texture,
struct pipe_buffer **buf,
unsigned *stride )
{

View File

@ -61,7 +61,6 @@ struct pipe_buffer;
struct pipe_fence_handle;
struct pipe_winsys;
struct pipe_screen;
struct drm_api;
/**
@ -133,8 +132,7 @@ struct pipe_context *i915_create_context( struct pipe_screen *screen,
*
* This is needed for example kms.
*/
boolean i915_get_texture_buffer( struct drm_api *api,
struct pipe_texture *texture,
boolean i915_get_texture_buffer( struct pipe_texture *texture,
struct pipe_buffer **buf,
unsigned *stride );

View File

@ -403,8 +403,7 @@ softpipe_init_screen_texture_funcs(struct pipe_screen *screen)
boolean
softpipe_get_texture_buffer( struct drm_api *api,
struct pipe_texture *texture,
softpipe_get_texture_buffer( struct pipe_texture *texture,
struct pipe_buffer **buf,
unsigned *stride )
{

View File

@ -39,7 +39,7 @@
extern "C" {
#endif
struct drm_api;
struct pipe_screen;
struct pipe_winsys;
struct pipe_context;
@ -53,8 +53,7 @@ softpipe_create_screen(struct pipe_winsys *);
boolean
softpipe_get_texture_buffer( struct drm_api *api,
struct pipe_texture *texture,
softpipe_get_texture_buffer( struct pipe_texture *texture,
struct pipe_buffer **buf,
unsigned *stride );

View File

@ -14,7 +14,7 @@ struct drm_api intel_be_drm_api =
.create_context = intel_be_create_context,
/* intel_be_device.c */
.create_screen = intel_be_create_screen,
.buffer_from_texture = i915_get_texture_buffer,
.buffer_from_texture = intel_be_get_texture_buffer,
.buffer_from_handle = intel_be_buffer_from_handle,
.handle_from_buffer = intel_be_handle_from_buffer,
.global_handle_from_buffer = intel_be_global_handle_from_buffer,

View File

@ -142,6 +142,24 @@ err:
return NULL;
}
boolean
intel_be_get_texture_buffer(struct drm_api *api,
struct pipe_texture *texture,
struct pipe_buffer **buffer,
unsigned *stride)
{
struct intel_be_device *dev;
if (!texture)
return FALSE;
dev = intel_be_device(texture->screen->winsys);
if (dev->softpipe)
return softpipe_get_texture_buffer(texture, buffer, stride);
else
return i915_get_texture_buffer(texture, buffer, stride);
}
struct pipe_buffer *
intel_be_buffer_from_handle(struct drm_api *api,
struct pipe_screen *screen,
@ -344,7 +362,6 @@ intel_be_create_screen(struct drm_api *api, int drmFD,
if (dev->softpipe) {
screen = softpipe_create_screen(&dev->base);
intel_be_drm_api.buffer_from_texture = softpipe_get_texture_buffer;
} else
screen = i915_create_screen(&dev->base, deviceID);

View File

@ -52,6 +52,15 @@ struct intel_be_buffer {
unsigned flink;
};
/*
* Wrapper for driver get_texture_buffer functions.
*/
boolean
intel_be_get_texture_buffer(struct drm_api *api,
struct pipe_texture *texture,
struct pipe_buffer **buffer,
unsigned *stride);
/**
* Create a be buffer from a drm bo handle.
*