[Mesa-dev] [PATCH] gallium: add CAPs returning PCI device location
Brian Paul
brianp at vmware.com
Wed Mar 2 16:00:17 UTC 2016
On 03/02/2016 08:46 AM, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> ---
> These will be queried by our OpenCL stack to identify the device.
> The radeon code depends on a patch I haven't sent out yet.
>
> src/gallium/docs/source/screen.rst | 4 ++++
> src/gallium/drivers/freedreno/freedreno_screen.c | 4 ++++
> src/gallium/drivers/i915/i915_screen.c | 4 ++++
> src/gallium/drivers/ilo/ilo_screen.c | 4 ++++
> src/gallium/drivers/llvmpipe/lp_screen.c | 4 ++++
> src/gallium/drivers/nouveau/nv30/nv30_screen.c | 4 ++++
> src/gallium/drivers/nouveau/nv50/nv50_screen.c | 4 ++++
> src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 4 ++++
> src/gallium/drivers/r300/r300_screen.c | 8 ++++++++
> src/gallium/drivers/r600/r600_pipe.c | 8 ++++++++
> src/gallium/drivers/radeonsi/si_pipe.c | 8 ++++++++
> src/gallium/drivers/softpipe/sp_screen.c | 4 ++++
> src/gallium/drivers/svga/svga_screen.c | 4 ++++
> src/gallium/drivers/vc4/vc4_screen.c | 4 ++++
> src/gallium/drivers/virgl/virgl_screen.c | 4 ++++
> src/gallium/include/pipe/p_defines.h | 4 ++++
> 16 files changed, 76 insertions(+)
>
> diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst
> index b5d691f..46ec381 100644
> --- a/src/gallium/docs/source/screen.rst
> +++ b/src/gallium/docs/source/screen.rst
> @@ -319,6 +319,10 @@ The integer capabilities:
> adjusted appropriately.
> * ``PIPE_CAP_QUERY_BUFFER_OBJECT``: Driver supports
> context::get_query_result_resource callback.
> +* ``PIPE_CAP_PCI_GROUP``: Return the PCI segment group number.
> +* ``PIPE_CAP_PCI_BUS``: Return the PCI bus number.
> +* ``PIPE_CAP_PCI_DEVICE``: Return the PCI device number.
> +* ``PIPE_CAP_PCI_FUNCTION``: Return the PCI function number.
>
>
> .. _pipe_capf:
> diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c
> index 1565a1d..d47cb07 100644
> --- a/src/gallium/drivers/freedreno/freedreno_screen.c
> +++ b/src/gallium/drivers/freedreno/freedreno_screen.c
> @@ -166,6 +166,10 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
> case PIPE_CAP_TEXTURE_MIRROR_CLAMP:
> case PIPE_CAP_COMPUTE:
> case PIPE_CAP_QUERY_MEMORY_INFO:
> + case PIPE_CAP_PCI_GROUP:
> + case PIPE_CAP_PCI_BUS:
> + case PIPE_CAP_PCI_DEVICE:
> + case PIPE_CAP_PCI_FUNCTION:
> return 0;
>
> case PIPE_CAP_SM3:
> diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c
> index 8d010f9..f4aa310 100644
> --- a/src/gallium/drivers/i915/i915_screen.c
> +++ b/src/gallium/drivers/i915/i915_screen.c
> @@ -265,6 +265,10 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
> case PIPE_CAP_BUFFER_SAMPLER_VIEW_RGBA_ONLY:
> case PIPE_CAP_SURFACE_REINTERPRET_BLOCKS:
> case PIPE_CAP_QUERY_MEMORY_INFO:
> + case PIPE_CAP_PCI_GROUP:
> + case PIPE_CAP_PCI_BUS:
> + case PIPE_CAP_PCI_DEVICE:
> + case PIPE_CAP_PCI_FUNCTION:
> return 0;
>
> case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS:
> diff --git a/src/gallium/drivers/ilo/ilo_screen.c b/src/gallium/drivers/ilo/ilo_screen.c
> index ef9da6b..548d215 100644
> --- a/src/gallium/drivers/ilo/ilo_screen.c
> +++ b/src/gallium/drivers/ilo/ilo_screen.c
> @@ -493,6 +493,10 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param)
> case PIPE_CAP_SURFACE_REINTERPRET_BLOCKS:
> case PIPE_CAP_QUERY_BUFFER_OBJECT:
> case PIPE_CAP_QUERY_MEMORY_INFO:
> + case PIPE_CAP_PCI_GROUP:
> + case PIPE_CAP_PCI_BUS:
> + case PIPE_CAP_PCI_DEVICE:
> + case PIPE_CAP_PCI_FUNCTION:
> return 0;
>
> case PIPE_CAP_VENDOR_ID:
> diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
> index 2c66bf4..2529b54 100644
> --- a/src/gallium/drivers/llvmpipe/lp_screen.c
> +++ b/src/gallium/drivers/llvmpipe/lp_screen.c
> @@ -315,6 +315,10 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
> case PIPE_CAP_SURFACE_REINTERPRET_BLOCKS:
> case PIPE_CAP_QUERY_BUFFER_OBJECT:
> case PIPE_CAP_QUERY_MEMORY_INFO:
> + case PIPE_CAP_PCI_GROUP:
> + case PIPE_CAP_PCI_BUS:
> + case PIPE_CAP_PCI_DEVICE:
> + case PIPE_CAP_PCI_FUNCTION:
> return 0;
> }
> /* should only get here on unhandled cases */
> diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> index 5be7a3d..b105c6a 100644
> --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> @@ -188,6 +188,10 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
> case PIPE_CAP_SURFACE_REINTERPRET_BLOCKS:
> case PIPE_CAP_QUERY_BUFFER_OBJECT:
> case PIPE_CAP_QUERY_MEMORY_INFO:
> + case PIPE_CAP_PCI_GROUP:
> + case PIPE_CAP_PCI_BUS:
> + case PIPE_CAP_PCI_DEVICE:
> + case PIPE_CAP_PCI_FUNCTION:
> return 0;
>
> case PIPE_CAP_VENDOR_ID:
> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> index 0bd5de9..28e0ed3 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> @@ -232,6 +232,10 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
> case PIPE_CAP_SURFACE_REINTERPRET_BLOCKS:
> case PIPE_CAP_QUERY_BUFFER_OBJECT:
> case PIPE_CAP_QUERY_MEMORY_INFO:
> + case PIPE_CAP_PCI_GROUP:
> + case PIPE_CAP_PCI_BUS:
> + case PIPE_CAP_PCI_DEVICE:
> + case PIPE_CAP_PCI_FUNCTION:
> return 0;
>
> case PIPE_CAP_VENDOR_ID:
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> index 37620ea..114d868 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> @@ -225,6 +225,10 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
> case PIPE_CAP_BUFFER_SAMPLER_VIEW_RGBA_ONLY:
> case PIPE_CAP_SURFACE_REINTERPRET_BLOCKS:
> case PIPE_CAP_QUERY_MEMORY_INFO:
> + case PIPE_CAP_PCI_GROUP:
> + case PIPE_CAP_PCI_BUS:
> + case PIPE_CAP_PCI_DEVICE:
> + case PIPE_CAP_PCI_FUNCTION:
> return 0;
>
> case PIPE_CAP_VENDOR_ID:
> diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
> index 7fad7ad..1c3bb64 100644
> --- a/src/gallium/drivers/r300/r300_screen.c
> +++ b/src/gallium/drivers/r300/r300_screen.c
> @@ -259,6 +259,14 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
> return r300screen->info.vram_size >> 20;
> case PIPE_CAP_UMA:
> return 0;
> + case PIPE_CAP_PCI_GROUP:
> + return r300screen->info.pci_domain;
> + case PIPE_CAP_PCI_BUS:
> + return r300screen->info.pci_bus;
> + case PIPE_CAP_PCI_DEVICE:
> + return r300screen->info.pci_dev;
> + case PIPE_CAP_PCI_FUNCTION:
> + return r300screen->info.pci_func;
> }
> return 0;
> }
> diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
> index 7d256db..7018088 100644
> --- a/src/gallium/drivers/r600/r600_pipe.c
> +++ b/src/gallium/drivers/r600/r600_pipe.c
> @@ -450,6 +450,14 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
> return 0;
> case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
> return rscreen->b.chip_class >= R700;
> + case PIPE_CAP_PCI_GROUP:
> + return rscreen->b.info.pci_domain;
> + case PIPE_CAP_PCI_BUS:
> + return rscreen->b.info.pci_bus;
> + case PIPE_CAP_PCI_DEVICE:
> + return rscreen->b.info.pci_dev;
> + case PIPE_CAP_PCI_FUNCTION:
> + return rscreen->b.info.pci_func;
> }
> return 0;
> }
> diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
> index 58e7f3a..8b50a49 100644
> --- a/src/gallium/drivers/radeonsi/si_pipe.c
> +++ b/src/gallium/drivers/radeonsi/si_pipe.c
> @@ -429,6 +429,14 @@ static int si_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
> return sscreen->b.info.vram_size >> 20;
> case PIPE_CAP_UMA:
> return 0;
> + case PIPE_CAP_PCI_GROUP:
> + return sscreen->b.info.pci_domain;
> + case PIPE_CAP_PCI_BUS:
> + return sscreen->b.info.pci_bus;
> + case PIPE_CAP_PCI_DEVICE:
> + return sscreen->b.info.pci_dev;
> + case PIPE_CAP_PCI_FUNCTION:
> + return sscreen->b.info.pci_func;
> }
> return 0;
> }
> diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
> index 097ffe6..bfd3598 100644
> --- a/src/gallium/drivers/softpipe/sp_screen.c
> +++ b/src/gallium/drivers/softpipe/sp_screen.c
> @@ -266,6 +266,10 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
> case PIPE_CAP_SURFACE_REINTERPRET_BLOCKS:
> case PIPE_CAP_QUERY_BUFFER_OBJECT:
> case PIPE_CAP_QUERY_MEMORY_INFO:
> + case PIPE_CAP_PCI_GROUP:
> + case PIPE_CAP_PCI_BUS:
> + case PIPE_CAP_PCI_DEVICE:
> + case PIPE_CAP_PCI_FUNCTION:
> return 0;
> }
> /* should only get here on unhandled cases */
> diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c
> index c9abd49..ffa7b74 100644
> --- a/src/gallium/drivers/svga/svga_screen.c
> +++ b/src/gallium/drivers/svga/svga_screen.c
> @@ -360,6 +360,10 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
> case PIPE_CAP_STRING_MARKER:
> case PIPE_CAP_SURFACE_REINTERPRET_BLOCKS:
> case PIPE_CAP_QUERY_MEMORY_INFO:
> + case PIPE_CAP_PCI_GROUP:
> + case PIPE_CAP_PCI_BUS:
> + case PIPE_CAP_PCI_DEVICE:
> + case PIPE_CAP_PCI_FUNCTION:
> return 0;
> case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT:
> return 64;
> diff --git a/src/gallium/drivers/vc4/vc4_screen.c b/src/gallium/drivers/vc4/vc4_screen.c
> index a4b3efc..92d910b 100644
> --- a/src/gallium/drivers/vc4/vc4_screen.c
> +++ b/src/gallium/drivers/vc4/vc4_screen.c
> @@ -203,6 +203,10 @@ vc4_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
> case PIPE_CAP_SURFACE_REINTERPRET_BLOCKS:
> case PIPE_CAP_QUERY_BUFFER_OBJECT:
> case PIPE_CAP_QUERY_MEMORY_INFO:
> + case PIPE_CAP_PCI_GROUP:
> + case PIPE_CAP_PCI_BUS:
> + case PIPE_CAP_PCI_DEVICE:
> + case PIPE_CAP_PCI_FUNCTION:
> return 0;
>
> /* Stream output. */
> diff --git a/src/gallium/drivers/virgl/virgl_screen.c b/src/gallium/drivers/virgl/virgl_screen.c
> index d3f4e25..8126bde 100644
> --- a/src/gallium/drivers/virgl/virgl_screen.c
> +++ b/src/gallium/drivers/virgl/virgl_screen.c
> @@ -235,6 +235,10 @@ virgl_get_param(struct pipe_screen *screen, enum pipe_cap param)
> case PIPE_CAP_COPY_BETWEEN_COMPRESSED_AND_PLAIN_FORMATS:
> case PIPE_CAP_STRING_MARKER:
> case PIPE_CAP_QUERY_MEMORY_INFO:
> + case PIPE_CAP_PCI_GROUP:
> + case PIPE_CAP_PCI_BUS:
> + case PIPE_CAP_PCI_DEVICE:
> + case PIPE_CAP_PCI_FUNCTION:
> return 0;
> case PIPE_CAP_VENDOR_ID:
> return 0x1af4;
> diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
> index c9149be..a490b3b 100644
> --- a/src/gallium/include/pipe/p_defines.h
> +++ b/src/gallium/include/pipe/p_defines.h
> @@ -669,6 +669,10 @@ enum pipe_cap
> PIPE_CAP_SURFACE_REINTERPRET_BLOCKS,
> PIPE_CAP_QUERY_BUFFER_OBJECT,
> PIPE_CAP_QUERY_MEMORY_INFO,
> + PIPE_CAP_PCI_GROUP,
> + PIPE_CAP_PCI_BUS,
> + PIPE_CAP_PCI_DEVICE,
> + PIPE_CAP_PCI_FUNCTION,
> };
>
> #define PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50 (1 << 0)
>
Reviewed-by: Brian Paul <brianp at vmware.com>
More information about the mesa-dev
mailing list