[Mesa-dev] [PATCH 2/2] r600, compute: Allow image resource creation

Marek Olšák maraeo at gmail.com
Mon Jun 8 04:33:13 PDT 2015


On Mon, Jun 8, 2015 at 1:20 PM, Zoltan Gilian <zoltan.gilian at gmail.com> wrote:
> Allow creation and binding of compute image resources to be able to test the
> currently working pieces of OpenCL image support.
> ---
>  src/gallium/drivers/r600/evergreen_compute.c  | 2 +-
>  src/gallium/drivers/r600/evergreen_state.c    | 4 ++++
>  src/gallium/drivers/r600/r600_state_common.c  | 1 +
>  src/gallium/drivers/radeon/r600_pipe_common.c | 2 +-
>  4 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/drivers/r600/evergreen_compute.c b/src/gallium/drivers/r600/evergreen_compute.c
> index 4c3c34c..ecad25c 100644
> --- a/src/gallium/drivers/r600/evergreen_compute.c
> +++ b/src/gallium/drivers/r600/evergreen_compute.c
> @@ -666,7 +666,7 @@ void evergreen_set_cs_sampler_view(struct pipe_context *ctx_,
>                 if (resource[i]) {
>                         assert(i+1 < 12);
>                         /* XXX: Implement */
> -                       assert(!"Compute samplers not implemented.");
> +                       //assert(!"Compute samplers not implemented.");

Why keeping the assertion commented out?

>                         ///FETCH0 = VTX0 (param buffer),
>                         //FETCH1 = VTX1 (global buffer pool), FETCH2... = TEX
>                 }
> diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c
> index 4ddbc0b..5dba577 100644
> --- a/src/gallium/drivers/r600/evergreen_state.c
> +++ b/src/gallium/drivers/r600/evergreen_state.c
> @@ -299,6 +299,10 @@ boolean evergreen_is_format_supported(struct pipe_screen *screen,
>         if (usage & PIPE_BIND_TRANSFER_WRITE)
>                 retval |= PIPE_BIND_TRANSFER_WRITE;
>
> +       // XXX: review if something is not supported as a compute resource
> +       if (usage & PIPE_BIND_COMPUTE_RESOURCE)
> +               retval |= PIPE_BIND_COMPUTE_RESOURCE;
> +
>         return retval == usage;
>  }
>
> diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
> index 13dc9ee..0566d00 100644
> --- a/src/gallium/drivers/r600/r600_state_common.c
> +++ b/src/gallium/drivers/r600/r600_state_common.c
> @@ -594,6 +594,7 @@ static void r600_set_sampler_views(struct pipe_context *pipe, unsigned shader,
>         assert(start == 0); /* XXX fix below */
>
>         if (shader == PIPE_SHADER_COMPUTE) {
> +               /*XXX*/ if (!views) return;

Can you just fix evergreen_set_cs_sampler_view so that it supports views==NULL?

>                 evergreen_set_cs_sampler_view(pipe, start, count, views);
>                 return;
>         }
> diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
> index 3def444..d14791e 100644
> --- a/src/gallium/drivers/radeon/r600_pipe_common.c
> +++ b/src/gallium/drivers/radeon/r600_pipe_common.c
> @@ -631,7 +631,7 @@ static int r600_get_compute_param(struct pipe_screen *screen,
>         case PIPE_COMPUTE_CAP_IMAGES_SUPPORTED:
>                 if (ret) {
>                         uint32_t *images_supported = ret;
> -                       *images_supported = 0;
> +                       *images_supported = 1;

This will enable the feature for R600, R700, Evegreen, NI, SI, and
CIK, because this function is shared by all of them. I don't think you
intended that.

Anyway, I don't what Tom's policy on OpenCL is, but generally we don't
push incomplete features. A tessellation is an example of that. We've
had patches for about a year, but I can't send them to this mailing
list, because they are still not good enough.

Marek


More information about the mesa-dev mailing list