[Mesa-dev] [PATCH 2/2] gallium: add texture update hook to screen

Jakob Bornecrantz wallbraker at gmail.com
Tue Mar 19 00:09:32 PDT 2013


On Tue, Mar 19, 2013 at 5:40 AM, Dave Airlie <airlied at gmail.com> wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> We have cases on virtual GPU hw that renders using a wrapped llvmpipe,
> that we can't produce the normal DRI2 semantics having the kernel/hw
> enforce synchronisation semantics. It is also suboptimal to flush
> all surfaces on the server side in the block handler. So there is
> already a dri/st hook to update the texture, so create a screen interface
> and call into it for the texture resource. The sw driver can then
> call into the displaytarget wrapper which will call into the outer
> wrapper driver to actually cause the flush to happen.
>
> This contains the llvmpipe and wrapper sw changes.
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>

Errr, what about using flush_frontbuffer, it seems todo
the exact same thing.

Cheers, Jakob.

> ---
>  src/gallium/drivers/llvmpipe/lp_texture.c         | 13 +++++++++++++
>  src/gallium/drivers/softpipe/sp_texture.h         |  2 +-
>  src/gallium/include/pipe/p_screen.h               |  3 +++
>  src/gallium/include/state_tracker/sw_winsys.h     |  6 ++++++
>  src/gallium/state_trackers/dri/drm/dri2.c         |  5 ++++-
>  src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c | 11 +++++++++++
>  6 files changed, 38 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c
> index f923292..48242d5 100644
> --- a/src/gallium/drivers/llvmpipe/lp_texture.c
> +++ b/src/gallium/drivers/llvmpipe/lp_texture.c
> @@ -1375,6 +1375,18 @@ llvmpipe_print_resources(void)
>  }
>  #endif
>
> +static void
> +llvmpipe_texture_update(struct pipe_screen *pscreen,
> +                        struct pipe_resource *pt)
> +{
> +   struct llvmpipe_screen *screen = llvmpipe_screen(pscreen);
> +   struct llvmpipe_resource *lpr = llvmpipe_resource(pt);
> +   struct sw_winsys *winsys = screen->winsys;
> +   if (!lpr->dt)
> +      return;
> +
> +   winsys->displaytarget_update(winsys, lpr->dt);
> +}
>
>  void
>  llvmpipe_init_screen_resource_funcs(struct pipe_screen *screen)
> @@ -1396,6 +1408,7 @@ llvmpipe_init_screen_resource_funcs(struct pipe_screen *screen)
>     screen->resource_from_handle = llvmpipe_resource_from_handle;
>     screen->resource_get_handle = llvmpipe_resource_get_handle;
>     screen->can_create_resource = llvmpipe_can_create_resource;
> +   screen->texture_update = llvmpipe_texture_update;
>  }
>
>
> diff --git a/src/gallium/drivers/softpipe/sp_texture.h b/src/gallium/drivers/softpipe/sp_texture.h
> index 533d625..04c6eaf 100644
> --- a/src/gallium/drivers/softpipe/sp_texture.h
> +++ b/src/gallium/drivers/softpipe/sp_texture.h
> @@ -46,7 +46,7 @@ struct softpipe_resource
>     struct pipe_resource base;
>
>     unsigned long level_offset[SP_MAX_TEXTURE_2D_LEVELS];
> -   unsigned stride[SP_MAX_TEXTURE_2D_LEVELS];
> +   int stride[SP_MAX_TEXTURE_2D_LEVELS];

Unrelated change...

Cheers, Jakob.


More information about the mesa-dev mailing list