[Mesa-dev] [PATCH] gallium: add CAP for postprocess filters

Timothy Arceri tarceri at itsqueeze.com
Wed Apr 4 02:32:04 UTC 2018


On 04/04/18 11:58, Roland Scheidegger wrote:
> AFAIK these filters (and I've never looked into them) should be
> transparent to hw drivers. Hence a cap bit doesn't make sense, and if
> it's broken we shouldn't just paper over this.

I created a CAP because the AMD devs have no interest in supporting this 
feature [1]. Even if they are transparent to drivers I don't see why 
drivers should be forced to enable them if they don't want to. CCing 
Marek for his opinion.

[1] https://bugs.freedesktop.org/show_bug.cgi?id=99549#c3

> 
> Roland
> 
> Am 03.04.2018 um 13:38 schrieb Timothy Arceri:
>> For radeonsi these seem to have been somewhat broken for over a
>> year, and as of recently they cause the driver to crash.
>>
>> This patch adds a CAP for the filters and enables the CAP for all
>> driver except radeonsi.
>>
>> Bugzilla: https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.freedesktop.org_show-5Fbug.cgi-3Fid-3D99549&d=DwIGaQ&c=uilaK90D4TOVoH58JNXRgQ&r=_QIjpv-UJ77xEQY8fIYoQtr5qv8wKrPJc7v7_-CYAb0&m=FsyE0Iv-1HkgmJ_6JgvnISAuUbjQthRX9OcSu3BUhgc&s=5iJ7ErqsBvMPRH06U44_GD_7EvtIFP8hzyKeeDtIxxE&e=
>> Bugzilla: https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.freedesktop.org_show-5Fbug.cgi-3Fid-3D105026&d=DwIGaQ&c=uilaK90D4TOVoH58JNXRgQ&r=_QIjpv-UJ77xEQY8fIYoQtr5qv8wKrPJc7v7_-CYAb0&m=FsyE0Iv-1HkgmJ_6JgvnISAuUbjQthRX9OcSu3BUhgc&s=PeI7pgvz9cprwPELTcdw_TUZHrtj1tt6KjHa-4rVRtY&e=
>> ---
>>   src/gallium/docs/source/screen.rst               |  2 ++
>>   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_screen.c      | 15 ++++++++-------
>>   19 files changed, 28 insertions(+), 7 deletions(-)
>>
>> diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst
>> index 3837360fb40..22aba928580 100644
>> --- a/src/gallium/docs/source/screen.rst
>> +++ b/src/gallium/docs/source/screen.rst
>> @@ -420,6 +420,8 @@ 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_PP_FILTERS``: True if the driver supports the postprocess filters
>> +  available in gallium.
>>   
>>   
>>   .. _pipe_capf:
>> diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c b/src/gallium/drivers/etnaviv/etnaviv_screen.c
>> index 2ae4e86c631..d277ac834db 100644
>> --- a/src/gallium/drivers/etnaviv/etnaviv_screen.c
>> +++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c
>> @@ -140,6 +140,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_PP_FILTERS:
>>         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 f338d756dfe..42ab87514d8 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_PP_FILTERS:
>>   		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 59d2ec66284..8564a8567e4 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_PP_FILTERS:
>>         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 3f5d0327bf9..9290d3ec869 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_PP_FILTERS:
>>         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 1d1fbaad607..d3afd0cf493 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_PP_FILTERS:
>>         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 6fd2982e3cb..643c4516935 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_PP_FILTERS:
>>         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 b4a2c676f59..eb50f12bf76 100644
>> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
>> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
>> @@ -254,6 +254,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>>      case PIPE_CAP_COMPUTE:
>>      case PIPE_CAP_CAN_BIND_CONST_BUFFER_AS_VERTEX:
>>      case PIPE_CAP_ALLOW_MAPPED_BUFFERS_DURING_EXECUTION:
>> +   case PIPE_CAP_PP_FILTERS:
>>         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 8ea2e87ce68..0f49dcd4c04 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_PP_FILTERS:
>>               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 43f2dfae7ec..129e4af28e1 100644
>> --- a/src/gallium/drivers/r600/r600_pipe.c
>> +++ b/src/gallium/drivers/r600/r600_pipe.c
>> @@ -302,6 +302,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_PP_FILTERS:
>>   		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 fc2be33b3e4..2bf997a712a 100644
>> --- a/src/gallium/drivers/radeonsi/si_get.c
>> +++ b/src/gallium/drivers/radeonsi/si_get.c
>> @@ -275,6 +275,7 @@ static int si_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>>   	case PIPE_CAP_TILE_RASTER_ORDER:
>>   	case PIPE_CAP_MAX_COMBINED_SHADER_OUTPUT_RESOURCES:
>>   	case PIPE_CAP_CONTEXT_PRIORITY_MASK:
>> +	case PIPE_CAP_PP_FILTERS:
>>   		return 0;
>>   
>>   	case PIPE_CAP_FENCE_SIGNAL:
>> diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
>> index 25f6f74f366..46d88b72daa 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_PP_FILTERS:
>>         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 f5f07fa75eb..68c08b1f7bc 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_PP_FILTERS:
>>         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 880a177c399..791f843a6d4 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_PP_FILTERS:
>>         return 1;
>>   
>>      /* MSAA support
>> diff --git a/src/gallium/drivers/vc4/vc4_screen.c b/src/gallium/drivers/vc4/vc4_screen.c
>> index cead71b77cd..9624c91196b 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_PP_FILTERS:
>>                   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 271c2c878bb..e7356cf9c0a 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_PP_FILTERS:
>>                   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 02613f18663..a6555e2667d 100644
>> --- a/src/gallium/drivers/virgl/virgl_screen.c
>> +++ b/src/gallium/drivers/virgl/virgl_screen.c
>> @@ -198,6 +198,8 @@ virgl_get_param(struct pipe_screen *screen, enum pipe_cap param)
>>         return vscreen->caps.caps.v1.bset.has_sample_shading;
>>      case PIPE_CAP_CULL_DISTANCE:
>>         return vscreen->caps.caps.v1.bset.has_cull;
>> +   case PIPE_CAP_PP_FILTERS:
>> +      return 1;
>>      case PIPE_CAP_TEXTURE_GATHER_SM5:
>>      case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
>>      case PIPE_CAP_FAKE_SW_MSAA:
>> diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
>> index c4ae0532060..25338782f9e 100644
>> --- a/src/gallium/include/pipe/p_defines.h
>> +++ b/src/gallium/include/pipe/p_defines.h
>> @@ -795,6 +795,7 @@ enum pipe_cap
>>      PIPE_CAP_FENCE_SIGNAL,
>>      PIPE_CAP_CONSTBUF0_FLAGS,
>>      PIPE_CAP_PACKED_UNIFORMS,
>> +   PIPE_CAP_PP_FILTERS,
>>   };
>>   
>>   /**
>> diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c
>> index aaee9870776..20ce0723665 100644
>> --- a/src/gallium/state_trackers/dri/dri_screen.c
>> +++ b/src/gallium/state_trackers/dri/dri_screen.c
>> @@ -487,13 +487,14 @@ dri_destroy_screen(__DRIscreen * sPriv)
>>   }
>>   
>>   static void
>> -dri_postprocessing_init(struct dri_screen *screen)
>> +dri_postprocessing_init(struct dri_screen *screen,
>> +                        struct pipe_screen *pscreen)
>>   {
>> -   unsigned i;
>> -
>> -   for (i = 0; i < PP_FILTERS; i++) {
>> -      screen->pp_enabled[i] = driQueryOptioni(&screen->dev->option_cache,
>> -                                              pp_filters[i].name);
>> +   if (pscreen->get_param(pscreen, PIPE_CAP_PP_FILTERS)) {
>> +      for (unsigned i = 0; i < PP_FILTERS; i++) {
>> +         screen->pp_enabled[i] = driQueryOptioni(&screen->dev->option_cache,
>> +                                                 pp_filters[i].name);
>> +      }
>>      }
>>   }
>>   
>> @@ -542,7 +543,7 @@ dri_init_screen_helper(struct dri_screen *screen,
>>      else
>>         screen->target = PIPE_TEXTURE_RECT;
>>   
>> -   dri_postprocessing_init(screen);
>> +   dri_postprocessing_init(screen, pscreen);
>>   
>>      screen->st_api->query_versions(screen->st_api, &screen->base,
>>                                     &screen->options,
>>
> 


More information about the mesa-dev mailing list