drm/st: Remove drm_api struct from drivers
authorJakob Bornecrantz <jakob@vmware.com>
Tue, 30 Jun 2009 23:16:56 +0000 (01:16 +0200)
committerJakob Bornecrantz <jakob@vmware.com>
Tue, 30 Jun 2009 23:20:04 +0000 (01:20 +0200)
Remove the drm_api from the functions in the softpipe and
i915simple drivers. Create wrapper functions in the
backends instead.

src/gallium/drivers/i915simple/i915_texture.c
src/gallium/drivers/i915simple/i915_winsys.h
src/gallium/drivers/softpipe/sp_texture.c
src/gallium/drivers/softpipe/sp_winsys.h
src/gallium/winsys/drm/intel/gem/intel_be_api.c
src/gallium/winsys/drm/intel/gem/intel_be_device.c
src/gallium/winsys/drm/intel/gem/intel_be_device.h

index 211ba09fda869d94c5fffff2dc43760f0eeb73ae..ca8e87af8d1b3f85dfbaa3130b80b22c1330028f 100644 (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 )
 {
index 58599daa80539364a7c58e9903fdf8d8ecfb0a9a..ff5b34f193ab33498cd0b95409cc678e9240cd88 100644 (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 );
 
index 41d8a0f93e287e636af8f6a7fd4436f64fde4451..7a533dad9f014fc6c0f03b92ab53d15c0065236b 100644 (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 )
 {
index 3edcbeb558fd9f4e766f0d5f879d300cc50c1d19..9e571862b7516f7a0fbd33119c8fb78532be9ff0 100644 (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 );
 
index d22d11e7237018194f024e123bfecdb32c699803..09d4ba472907e845c5689d5903429768bd729964 100644 (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,
index 2d531279f77f60f98dd5423bd8a0c8861a50d199..e3630f5d120fbb7729bc9bc8cddbcad772474d74 100644 (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);
 
index 777161daca09591588b2a9390de57bc8fbc8721b..56d95bd7fe01bcb93745c2ccfab81eb099dec2f1 100644 (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.
  *