[Mesa-dev] [PATCH 1/3] gallium: add flush_resource context function

Marek Olšák maraeo at gmail.com
Mon Sep 9 07:11:07 PDT 2013


On Mon, Sep 9, 2013 at 11:52 AM, Grigori Goronzy <greg at chown.ath.cx> wrote:
> From: Marek Olšák <maraeo at gmail.com>
>
> r600g needs explicit flushing before DRI2 buffers are presented on the screen.
>
> v2: add (stub) implementations for all drivers, fix frontbuffer flushing
> ---
>  src/gallium/docs/source/context.rst                 | 13 +++++++++++++
>  src/gallium/drivers/freedreno/freedreno_resource.c  |  6 ++++++
>  src/gallium/drivers/galahad/glhd_context.c          |  7 +++++++
>  src/gallium/drivers/i915/i915_surface.c             |  6 ++++++
>  src/gallium/drivers/identity/id_context.c           | 11 +++++++++++
>  src/gallium/drivers/ilo/ilo_blit.c                  |  6 ++++++
>  src/gallium/drivers/llvmpipe/lp_surface.c           |  7 +++++++
>  src/gallium/drivers/noop/noop_pipe.c                |  8 ++++++++
>  src/gallium/drivers/nv30/nv30_miptree.c             |  6 ++++++
>  src/gallium/drivers/nv30/nv30_resource.c            |  1 +
>  src/gallium/drivers/nv30/nv30_resource.h            |  4 ++++
>  src/gallium/drivers/nv50/nv50_surface.c             |  7 +++++++
>  src/gallium/drivers/nvc0/nvc0_surface.c             |  7 +++++++
>  src/gallium/drivers/r300/r300_blit.c                |  6 ++++++
>  src/gallium/drivers/r600/r600_blit.c                |  6 ++++++
>  src/gallium/drivers/radeonsi/r600_blit.c            |  6 ++++++
>  src/gallium/drivers/rbug/rbug_context.c             | 15 +++++++++++++++
>  src/gallium/drivers/softpipe/sp_surface.c           |  7 +++++++
>  src/gallium/drivers/svga/svga_pipe_blit.c           |  8 ++++++++
>  src/gallium/drivers/trace/tr_context.c              | 21 +++++++++++++++++++++
>  src/gallium/include/pipe/p_context.h                | 13 +++++++++++++
>  .../state_trackers/dri/common/dri_drawable.c        |  4 ++++
>  src/gallium/state_trackers/dri/drm/dri2.c           | 10 +++++++---
>  23 files changed, 182 insertions(+), 3 deletions(-)
>
> diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst
> index 95f6b22..d5b4d77 100644
> --- a/src/gallium/docs/source/context.rst
> +++ b/src/gallium/docs/source/context.rst
> @@ -423,6 +423,19 @@ Flushing
>  ``flush``
>
>
> +``flush_resource``
> +
> +Flush the resource cache, so that the resource can be used
> +by an external client. Possible usage:
> +- flushing a resource before presenting it on the screen
> +- flushing a resource if some other process or device wants to use it
> +This shouldn't be used to flush caches if the resource is only managed
> +by a single pipe_screen and is not shared with another process.
> +(i.e. you shouldn't use it to flush caches explicitly if you want to e.g.
> +use the resource for texturing)
> +
> +
> +
>  Resource Busy Queries
>  ^^^^^^^^^^^^^^^^^^^^^
>
> diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c
> index 3e051ea..3a7e31c 100644
> --- a/src/gallium/drivers/freedreno/freedreno_resource.c
> +++ b/src/gallium/drivers/freedreno/freedreno_resource.c
> @@ -337,6 +337,11 @@ render_blit(struct pipe_context *pctx, struct pipe_blit_info *info)
>         return true;
>  }
>
> +static void
> +fd_flush_resource(struct pipe_context *ctx, struct pipe_resource *resource)
> +{
> +}
> +
>  void
>  fd_resource_screen_init(struct pipe_screen *pscreen)
>  {
> @@ -357,4 +362,5 @@ fd_resource_context_init(struct pipe_context *pctx)
>         pctx->surface_destroy = fd_surface_destroy;
>         pctx->resource_copy_region = fd_resource_copy_region;
>         pctx->blit = fd_blit;
> +       pctx->flush_resource = fd_flush_resource;
>  }
> diff --git a/src/gallium/drivers/galahad/glhd_context.c b/src/gallium/drivers/galahad/glhd_context.c
> index ee9de05..4b51b77 100644
> --- a/src/gallium/drivers/galahad/glhd_context.c
> +++ b/src/gallium/drivers/galahad/glhd_context.c
> @@ -783,6 +783,12 @@ galahad_context_blit(struct pipe_context *_pipe,
>  }
>
>  static void
> +galahad_context_flush_resource(struct pipe_context *ctx,
> +                               struct pipe_resource *resource)
> +{
> +}

galahad is like identity, it should redirect calls to the driver under it.

Marek


More information about the mesa-dev mailing list