[Mesa-dev] [PATCH v2 1/1] radeonsi: Use libdrm to get chipset name
Marek Olšák
maraeo at gmail.com
Wed Jun 7 00:07:06 UTC 2017
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Marek
On Wed, Jun 7, 2017 at 12:21 AM, Samuel Li <Samuel.Li at amd.com> wrote:
> v2: Add a func pointer to radeon_winsys to support radeon later.
>
> Change-Id: I614ea71424f9e5c97e4ae68654315d28c89eaa5f
> Signed-off-by: Samuel Li <Samuel.Li at amd.com>
> ---
> src/gallium/drivers/radeon/r600_pipe_common.c | 11 ++++++++++-
> src/gallium/drivers/radeon/radeon_winsys.h | 2 ++
> src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c | 8 ++++++++
> 3 files changed, 20 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
> index 2c0cadb..48d136a 100644
> --- a/src/gallium/drivers/radeon/r600_pipe_common.c
> +++ b/src/gallium/drivers/radeon/r600_pipe_common.c
> @@ -790,6 +790,15 @@ static const char* r600_get_device_vendor(struct pipe_screen* pscreen)
>
> static const char* r600_get_chip_name(struct r600_common_screen *rscreen)
> {
> + const char *mname;
> +
> + if (rscreen->ws->get_chip_name) {
> + mname = rscreen->ws->get_chip_name(rscreen->ws);
> + if (mname != NULL)
> + return mname;
> + }
> +
> + /* fall back to family names*/
> switch (rscreen->info.family) {
> case CHIP_R600: return "AMD R600";
> case CHIP_RV610: return "AMD RV610";
> @@ -1321,6 +1330,7 @@ bool r600_common_screen_init(struct r600_common_screen *rscreen,
> struct utsname uname_data;
>
> ws->query_info(ws, &rscreen->info);
> + rscreen->ws = ws;
>
> if (uname(&uname_data) == 0)
> snprintf(kernel_version, sizeof(kernel_version),
> @@ -1362,7 +1372,6 @@ bool r600_common_screen_init(struct r600_common_screen *rscreen,
> r600_init_screen_texture_functions(rscreen);
> r600_init_screen_query_functions(rscreen);
>
> - rscreen->ws = ws;
> rscreen->family = rscreen->info.family;
> rscreen->chip_class = rscreen->info.chip_class;
> rscreen->debug_flags = debug_get_flags_option("R600_DEBUG", common_debug_options, 0);
> diff --git a/src/gallium/drivers/radeon/radeon_winsys.h b/src/gallium/drivers/radeon/radeon_winsys.h
> index 524bb46..e19fde6 100644
> --- a/src/gallium/drivers/radeon/radeon_winsys.h
> +++ b/src/gallium/drivers/radeon/radeon_winsys.h
> @@ -637,6 +637,8 @@ struct radeon_winsys {
>
> bool (*read_registers)(struct radeon_winsys *ws, unsigned reg_offset,
> unsigned num_registers, uint32_t *out);
> +
> + const char* (*get_chip_name)(struct radeon_winsys *ws);
> };
>
> static inline bool radeon_emitted(struct radeon_winsys_cs *cs, unsigned num_dw)
> diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
> index c8bd60e..b2307fe 100644
> --- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
> +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
> @@ -221,6 +221,13 @@ static bool amdgpu_winsys_unref(struct radeon_winsys *rws)
> return destroy;
> }
>
> +static const char* amdgpu_get_chip_name(struct radeon_winsys *ws)
> +{
> + amdgpu_device_handle dev = ((struct amdgpu_winsys *)ws)->dev;
> + return amdgpu_get_marketing_name(dev);
> +}
> +
> +
> PUBLIC struct radeon_winsys *
> amdgpu_winsys_create(int fd, radeon_screen_create_t screen_create)
> {
> @@ -296,6 +303,7 @@ amdgpu_winsys_create(int fd, radeon_screen_create_t screen_create)
> ws->base.cs_request_feature = amdgpu_cs_request_feature;
> ws->base.query_value = amdgpu_query_value;
> ws->base.read_registers = amdgpu_read_registers;
> + ws->base.get_chip_name = amdgpu_get_chip_name;
>
> amdgpu_bo_init_functions(ws);
> amdgpu_cs_init_functions(ws);
> --
> 2.7.4
>
> _______________________________________________
> 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