[Mesa-dev] [PATCH rfc 2/3] gallium: add PIPE_CAP_BUFFER_AGE

Marek Olšák maraeo at gmail.com
Thu Jul 5 21:23:47 UTC 2018


Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek

On Wed, Jul 4, 2018 at 10:31 PM, Qiang Yu <yuq825 at gmail.com> wrote:
> For gallium drivers to expose EGL/GLX_EXT_buffer_age.
>
> Signed-off-by: Qiang Yu <yuq825 at gmail.com>
> ---
>  src/gallium/docs/source/screen.rst                  | 1 +
>  src/gallium/drivers/etnaviv/etnaviv_screen.c        | 1 +
>  src/gallium/drivers/freedreno/freedreno_screen.c    | 1 +
>  src/gallium/drivers/i915/i915_screen.c              | 1 +
>  src/gallium/drivers/llvmpipe/lp_screen.c            | 1 +
>  src/gallium/drivers/nouveau/nv30/nv30_screen.c      | 1 +
>  src/gallium/drivers/nouveau/nv50/nv50_screen.c      | 1 +
>  src/gallium/drivers/nouveau/nvc0/nvc0_screen.c      | 1 +
>  src/gallium/drivers/r300/r300_screen.c              | 1 +
>  src/gallium/drivers/r600/r600_pipe.c                | 1 +
>  src/gallium/drivers/radeonsi/si_get.c               | 1 +
>  src/gallium/drivers/softpipe/sp_screen.c            | 1 +
>  src/gallium/drivers/svga/svga_screen.c              | 1 +
>  src/gallium/drivers/swr/swr_screen.cpp              | 1 +
>  src/gallium/drivers/vc4/vc4_screen.c                | 1 +
>  src/gallium/drivers/vc5/vc5_screen.c                | 1 +
>  src/gallium/drivers/virgl/virgl_screen.c            | 2 ++
>  src/gallium/include/pipe/p_defines.h                | 1 +
>  src/gallium/state_trackers/dri/dri_query_renderer.c | 4 +++-
>  19 files changed, 22 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst
> index 3837360fb4..427944bf70 100644
> --- a/src/gallium/docs/source/screen.rst
> +++ b/src/gallium/docs/source/screen.rst
> @@ -420,6 +420,7 @@ The integer capabilities:
>    by the driver, and the driver can throw assertion failures.
>  * ``PIPE_CAP_PACKED_UNIFORMS``: True if the driver supports packed uniforms
>    as opposed to padding to vec4s.
> +* ``PIPE_CAP_BUFFER_AGE``: True if the driver wants to expose EGL/GLX_EXT_buffer_age.
>
>
>  .. _pipe_capf:
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c b/src/gallium/drivers/etnaviv/etnaviv_screen.c
> index b0f8b4bebe..1b4276a36e 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_screen.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c
> @@ -144,6 +144,7 @@ etna_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>     case PIPE_CAP_TGSI_TEXCOORD:
>     case PIPE_CAP_VERTEX_COLOR_UNCLAMPED:
>     case PIPE_CAP_MIXED_COLOR_DEPTH_BITS:
> +   case PIPE_CAP_BUFFER_AGE:
>        return 1;
>     case PIPE_CAP_NATIVE_FENCE_FD:
>        return screen->drm_version >= ETNA_DRM_VERSION_FENCE_FD;
> diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c
> index f338d756df..a7c6f4453e 100644
> --- a/src/gallium/drivers/freedreno/freedreno_screen.c
> +++ b/src/gallium/drivers/freedreno/freedreno_screen.c
> @@ -186,6 +186,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>         case PIPE_CAP_MIXED_COLOR_DEPTH_BITS:
>         case PIPE_CAP_TEXTURE_BARRIER:
>         case PIPE_CAP_INVALIDATE_BUFFER:
> +       case PIPE_CAP_BUFFER_AGE:
>                 return 1;
>
>         case PIPE_CAP_VERTEXID_NOBASE:
> diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c
> index 59d2ec6628..168912946c 100644
> --- a/src/gallium/drivers/i915/i915_screen.c
> +++ b/src/gallium/drivers/i915/i915_screen.c
> @@ -205,6 +205,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
>     case PIPE_CAP_VERTEX_COLOR_CLAMPED:
>     case PIPE_CAP_USER_VERTEX_BUFFERS:
>     case PIPE_CAP_MIXED_COLOR_DEPTH_BITS:
> +   case PIPE_CAP_BUFFER_AGE:
>        return 1;
>
>     /* Unsupported features (boolean caps). */
> diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
> index 3f5d0327bf..495e3f96b6 100644
> --- a/src/gallium/drivers/llvmpipe/lp_screen.c
> +++ b/src/gallium/drivers/llvmpipe/lp_screen.c
> @@ -110,6 +110,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
>     case PIPE_CAP_NPOT_TEXTURES:
>     case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES:
>     case PIPE_CAP_MIXED_COLOR_DEPTH_BITS:
> +   case PIPE_CAP_BUFFER_AGE:
>        return 1;
>     case PIPE_CAP_SM3:
>        return 1;
> diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> index 1d1fbaad60..47030210b3 100644
> --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> @@ -94,6 +94,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>     case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY:
>     case PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER:
>     case PIPE_CAP_ALLOW_MAPPED_BUFFERS_DURING_EXECUTION:
> +   case PIPE_CAP_BUFFER_AGE:
>        return 1;
>     /* nv35 capabilities */
>     case PIPE_CAP_DEPTH_BOUNDS_TEST:
> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> index 6fd2982e3c..1dca07caf9 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> @@ -199,6 +199,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>     case PIPE_CAP_TGSI_CLOCK:
>     case PIPE_CAP_CAN_BIND_CONST_BUFFER_AS_VERTEX:
>     case PIPE_CAP_ALLOW_MAPPED_BUFFERS_DURING_EXECUTION:
> +   case PIPE_CAP_BUFFER_AGE:
>        return 1;
>     case PIPE_CAP_SEAMLESS_CUBE_MAP:
>        return 1; /* class_3d >= NVA0_3D_CLASS; */
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> index eb50149b64..c9e416216b 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> @@ -255,6 +255,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>     case PIPE_CAP_CAN_BIND_CONST_BUFFER_AS_VERTEX:
>     case PIPE_CAP_ALLOW_MAPPED_BUFFERS_DURING_EXECUTION:
>     case PIPE_CAP_QUERY_SO_OVERFLOW:
> +   case PIPE_CAP_BUFFER_AGE:
>        return 1;
>     case PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER:
>        return nouveau_screen(pscreen)->vram_domain & NOUVEAU_BO_VRAM ? 1 : 0;
> diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
> index 8ea2e87ce6..f45803112f 100644
> --- a/src/gallium/drivers/r300/r300_screen.c
> +++ b/src/gallium/drivers/r300/r300_screen.c
> @@ -111,6 +111,7 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
>          case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
>          case PIPE_CAP_CLIP_HALFZ:
>          case PIPE_CAP_ALLOW_MAPPED_BUFFERS_DURING_EXECUTION:
> +        case PIPE_CAP_BUFFER_AGE:
>              return 1;
>
>          case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT:
> diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
> index b27ab755dd..f00bf501f8 100644
> --- a/src/gallium/drivers/r600/r600_pipe.c
> +++ b/src/gallium/drivers/r600/r600_pipe.c
> @@ -306,6 +306,7 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
>         case PIPE_CAP_CAN_BIND_CONST_BUFFER_AS_VERTEX:
>         case PIPE_CAP_ALLOW_MAPPED_BUFFERS_DURING_EXECUTION:
>         case PIPE_CAP_ROBUST_BUFFER_ACCESS_BEHAVIOR:
> +       case PIPE_CAP_BUFFER_AGE:
>                 return 1;
>
>         case PIPE_CAP_DEVICE_RESET_STATUS_QUERY:
> diff --git a/src/gallium/drivers/radeonsi/si_get.c b/src/gallium/drivers/radeonsi/si_get.c
> index 6bfbc4d0c4..5736f0b8b6 100644
> --- a/src/gallium/drivers/radeonsi/si_get.c
> +++ b/src/gallium/drivers/radeonsi/si_get.c
> @@ -194,6 +194,7 @@ static int si_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>         case PIPE_CAP_SIGNED_VERTEX_BUFFER_OFFSET:
>         case PIPE_CAP_TGSI_VOTE:
>         case PIPE_CAP_TGSI_FS_FBFETCH:
> +       case PIPE_CAP_BUFFER_AGE:
>                 return 1;
>
>         case PIPE_CAP_TGSI_BALLOT:
> diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
> index 25f6f74f36..1347b9feb2 100644
> --- a/src/gallium/drivers/softpipe/sp_screen.c
> +++ b/src/gallium/drivers/softpipe/sp_screen.c
> @@ -68,6 +68,7 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
>     case PIPE_CAP_NPOT_TEXTURES:
>     case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES:
>     case PIPE_CAP_MIXED_COLOR_DEPTH_BITS:
> +   case PIPE_CAP_BUFFER_AGE:
>        return 1;
>     case PIPE_CAP_SM3:
>        return 1;
> diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c
> index f5f07fa75e..edb73317fe 100644
> --- a/src/gallium/drivers/svga/svga_screen.c
> +++ b/src/gallium/drivers/svga/svga_screen.c
> @@ -185,6 +185,7 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
>     case PIPE_CAP_NPOT_TEXTURES:
>     case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES:
>     case PIPE_CAP_MIXED_COLOR_DEPTH_BITS:
> +   case PIPE_CAP_BUFFER_AGE:
>        return 1;
>     case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS:
>        /*
> diff --git a/src/gallium/drivers/swr/swr_screen.cpp b/src/gallium/drivers/swr/swr_screen.cpp
> index 880a177c39..16edfefebc 100644
> --- a/src/gallium/drivers/swr/swr_screen.cpp
> +++ b/src/gallium/drivers/swr/swr_screen.cpp
> @@ -245,6 +245,7 @@ swr_get_param(struct pipe_screen *screen, enum pipe_cap param)
>     case PIPE_CAP_CULL_DISTANCE:
>     case PIPE_CAP_CUBE_MAP_ARRAY:
>     case PIPE_CAP_DOUBLES:
> +   case PIPE_CAP_BUFFER_AGE:
>        return 1;
>
>     /* MSAA support
> diff --git a/src/gallium/drivers/vc4/vc4_screen.c b/src/gallium/drivers/vc4/vc4_screen.c
> index cead71b77c..b7c390fe44 100644
> --- a/src/gallium/drivers/vc4/vc4_screen.c
> +++ b/src/gallium/drivers/vc4/vc4_screen.c
> @@ -146,6 +146,7 @@ vc4_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>          case PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY:
>          case PIPE_CAP_ALLOW_MAPPED_BUFFERS_DURING_EXECUTION:
>          case PIPE_CAP_TEXTURE_BARRIER:
> +        case PIPE_CAP_BUFFER_AGE:
>                  return 1;
>
>          case PIPE_CAP_TILE_RASTER_ORDER:
> diff --git a/src/gallium/drivers/vc5/vc5_screen.c b/src/gallium/drivers/vc5/vc5_screen.c
> index 271c2c878b..5eab7c423d 100644
> --- a/src/gallium/drivers/vc5/vc5_screen.c
> +++ b/src/gallium/drivers/vc5/vc5_screen.c
> @@ -110,6 +110,7 @@ vc5_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>          case PIPE_CAP_DRAW_INDIRECT:
>          case PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION:
>          case PIPE_CAP_SIGNED_VERTEX_BUFFER_OFFSET:
> +        case PIPE_CAP_BUFFER_AGE:
>                  return 1;
>
>          case PIPE_CAP_INDEP_BLEND_ENABLE:
> diff --git a/src/gallium/drivers/virgl/virgl_screen.c b/src/gallium/drivers/virgl/virgl_screen.c
> index 02613f1866..4ad5bbd614 100644
> --- a/src/gallium/drivers/virgl/virgl_screen.c
> +++ b/src/gallium/drivers/virgl/virgl_screen.c
> @@ -183,6 +183,8 @@ virgl_get_param(struct pipe_screen *screen, enum pipe_cap param)
>        return 1;
>     case PIPE_CAP_TGSI_VS_LAYER_VIEWPORT:
>        return 0;
> +   case PIPE_CAP_BUFFER_AGE:
> +      return 1;
>     case PIPE_CAP_MAX_GEOMETRY_OUTPUT_VERTICES:
>        return vscreen->caps.caps.v2.max_geom_output_vertices;
>     case PIPE_CAP_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS:
> diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
> index 5ce8052ad1..39aa358e3d 100644
> --- a/src/gallium/include/pipe/p_defines.h
> +++ b/src/gallium/include/pipe/p_defines.h
> @@ -796,6 +796,7 @@ enum pipe_cap
>     PIPE_CAP_CONSTBUF0_FLAGS,
>     PIPE_CAP_PACKED_UNIFORMS,
>     PIPE_CAP_FORCE_COMPUTE_MINMAX_INDICES,
> +   PIPE_CAP_BUFFER_AGE,
>  };
>
>  /**
> diff --git a/src/gallium/state_trackers/dri/dri_query_renderer.c b/src/gallium/state_trackers/dri/dri_query_renderer.c
> index a88658b573..6874c332e1 100644
> --- a/src/gallium/state_trackers/dri/dri_query_renderer.c
> +++ b/src/gallium/state_trackers/dri/dri_query_renderer.c
> @@ -63,7 +63,9 @@ dri2_query_renderer_integer(__DRIscreen *_screen, int param,
>           return -1;
>        return 0;
>     case __DRI2_RENDERER_EXPOSE_BUFFER_AGE:
> -      value[0] = 1;
> +      value[0] =
> +         screen->base.screen->get_param(screen->base.screen,
> +                                        PIPE_CAP_BUFFER_AGE);
>        return 0;
>     default:
>        return driQueryRendererIntegerCommon(_screen, param, value);
> --
> 2.17.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list