On Tue, 2009-06-30 at 03:27 -0700, Jakob Bornecrantz wrote:
> Module: Mesa
> Branch: master
> Commit: 303cbb45b558a2b94e6922252cf57d115ba60b82
> URL:    
> http://cgit.freedesktop.org/mesa/mesa/commit/?id=303cbb45b558a2b94e6922252cf57d115ba60b82
> 
> Author: Jakob Bornecrantz <ja...@vmware.com>
> Date:   Tue Jun 30 11:49:43 2009 +0200
> 
> drm/st: Return drm_api struct from a function
> 
> ---
> 
>  src/gallium/drivers/i915simple/i915_texture.c      |    3 +-
>  src/gallium/drivers/i915simple/i915_winsys.h       |    4 ++-
>  src/gallium/drivers/softpipe/sp_texture.c          |    3 +-
>  src/gallium/drivers/softpipe/sp_winsys.h           |    5 ++-
>  src/gallium/include/state_tracker/drm_api.h        |   38 
> +++++++++++---------
>  src/gallium/state_trackers/dri/dri_context.c       |    2 +-
>  src/gallium/state_trackers/dri/dri_drawable.c      |   10 ++++--
>  src/gallium/state_trackers/dri/dri_screen.c        |    6 ++-
>  src/gallium/state_trackers/dri/dri_screen.h        |    1 +
>  src/gallium/state_trackers/egl/egl_context.c       |    2 +-
>  src/gallium/state_trackers/egl/egl_surface.c       |    2 +-
>  src/gallium/state_trackers/egl/egl_tracker.c       |    5 ++-
>  src/gallium/state_trackers/egl/egl_tracker.h       |    1 +
>  src/gallium/state_trackers/xorg/xorg_crtc.c        |    8 ++--
>  src/gallium/state_trackers/xorg/xorg_dri2.c        |    4 +-
>  src/gallium/state_trackers/xorg/xorg_driver.c      |    5 ++-
>  src/gallium/state_trackers/xorg/xorg_exa.c         |    6 ++--
>  src/gallium/state_trackers/xorg/xorg_tracker.h     |    1 +
>  src/gallium/winsys/drm/intel/gem/intel_be_api.c    |   18 ++++++---
>  src/gallium/winsys/drm/intel/gem/intel_be_api.h    |    7 +++-
>  .../winsys/drm/intel/gem/intel_be_context.c        |    2 +-
>  src/gallium/winsys/drm/intel/gem/intel_be_device.c |   17 ++++++---
>  src/gallium/winsys/drm/intel/gem/intel_be_device.h |   11 ++++--
>  23 files changed, 102 insertions(+), 59 deletions(-)
> 
> diff --git a/src/gallium/drivers/i915simple/i915_texture.c 
> b/src/gallium/drivers/i915simple/i915_texture.c
> index ca8e87a..211ba09 100644
> --- a/src/gallium/drivers/i915simple/i915_texture.c
> +++ b/src/gallium/drivers/i915simple/i915_texture.c
> @@ -738,7 +738,8 @@ i915_init_screen_texture_functions(struct pipe_screen 
> *screen)
>     screen->tex_surface_destroy = i915_tex_surface_destroy;
>  }
> 
> -boolean i915_get_texture_buffer( struct pipe_texture *texture,
> +boolean i915_get_texture_buffer( struct drm_api *api,
> +                                 struct pipe_texture *texture,
>                                   struct pipe_buffer **buf,
>                                   unsigned *stride )
>  {
> diff --git a/src/gallium/drivers/i915simple/i915_winsys.h 
> b/src/gallium/drivers/i915simple/i915_winsys.h
> index ff5b34f..58599da 100644
> --- a/src/gallium/drivers/i915simple/i915_winsys.h
> +++ b/src/gallium/drivers/i915simple/i915_winsys.h
> @@ -61,6 +61,7 @@ struct pipe_buffer;
>  struct pipe_fence_handle;
>  struct pipe_winsys;
>  struct pipe_screen;
> +struct drm_api;
> 
> 
>  /**
> @@ -132,7 +133,8 @@ struct pipe_context *i915_create_context( struct 
> pipe_screen *screen,
>   *
>   * This is needed for example kms.
>   */
> -boolean i915_get_texture_buffer( struct pipe_texture *texture,
> +boolean i915_get_texture_buffer( struct drm_api *api,
> +                                 struct pipe_texture *texture,
>                                   struct pipe_buffer **buf,
>                                   unsigned *stride );
> 
> diff --git a/src/gallium/drivers/softpipe/sp_texture.c 
> b/src/gallium/drivers/softpipe/sp_texture.c
> index 7a533da..41d8a0f 100644
> --- a/src/gallium/drivers/softpipe/sp_texture.c
> +++ b/src/gallium/drivers/softpipe/sp_texture.c
> @@ -403,7 +403,8 @@ softpipe_init_screen_texture_funcs(struct pipe_screen 
> *screen)
> 
> 
>  boolean
> -softpipe_get_texture_buffer( struct pipe_texture *texture,
> +softpipe_get_texture_buffer( struct drm_api *api,
> +                             struct pipe_texture *texture,
>                               struct pipe_buffer **buf,
>                               unsigned *stride )
>  {
> diff --git a/src/gallium/drivers/softpipe/sp_winsys.h 
> b/src/gallium/drivers/softpipe/sp_winsys.h
> index 9e57186..3edcbeb 100644
> --- a/src/gallium/drivers/softpipe/sp_winsys.h
> +++ b/src/gallium/drivers/softpipe/sp_winsys.h
> @@ -39,7 +39,7 @@
>  extern "C" {
>  #endif
> 
> -
> +struct drm_api;
>  struct pipe_screen;
>  struct pipe_winsys;
>  struct pipe_context;
> @@ -53,7 +53,8 @@ softpipe_create_screen(struct pipe_winsys *);
> 
> 
>  boolean
> -softpipe_get_texture_buffer( struct pipe_texture *texture,
> +softpipe_get_texture_buffer( struct drm_api *api,
> +                             struct pipe_texture *texture,
>                               struct pipe_buffer **buf,
>                               unsigned *stride );

Jakob,

What's going on with this change?  I'm not really sure that softpipe
should be growing a dependency on the drm_api struct.  Can you please
explain what's going on here?

The (non-existent!) description of your change doesn't make any of this
clear and doesn't give any indication why softpipe or any other
os-independent code is being modified in this way.  

I suspect what you want to do is leave the os-independent code as it
was, and place wrapper functions in a winsys or somewhere else that call
into the os-independent code after discarding the drm_api parameter.  

Try and imagine a situation where there is a peer to drm_api for some
other OS, or even an alternate implementation for DRI/DRI2 that used
some different interface -- the driver shouldn't be coded to one over
the other, but should remain neutral and be parameterized in the winsys.

When doing vaguely controversial things like this, it would be
preferable to post the patch for review ahead of time, and at least put
some description of your thinking into the change comment...

Keith



------------------------------------------------------------------------------
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to