From 76039b38f0ef54ca61cbe72b899dfcf0f0c724e4 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sun, 22 Mar 2015 07:21:01 +0100 Subject: [PATCH] gallium: implement get_device_vendor() for existing drivers The only hackish ones are llvmpipe and softpipe, which currently return the same string as for get_vendor(), while ideally they should return the CPU vendor. Signed-off-by: Giuseppe Bilotta Reviewed-by: Tom Stellard --- .../drivers/freedreno/freedreno_screen.c | 8 +++++++ src/gallium/drivers/i915/i915_screen.c | 7 ++++++ src/gallium/drivers/ilo/ilo_screen.c | 7 ++++++ src/gallium/drivers/llvmpipe/lp_screen.c | 1 + src/gallium/drivers/noop/noop_pipe.c | 6 +++++ src/gallium/drivers/nouveau/nouveau_screen.c | 7 ++++++ src/gallium/drivers/r300/r300_screen.c | 6 +++++ src/gallium/drivers/radeon/r600_pipe_common.c | 6 +++++ src/gallium/drivers/rbug/rbug_screen.c | 10 +++++++++ src/gallium/drivers/softpipe/sp_screen.c | 1 + src/gallium/drivers/svga/svga_screen.c | 1 + src/gallium/drivers/trace/tr_screen.c | 22 +++++++++++++++++++ src/gallium/drivers/vc4/vc4_screen.c | 1 + 13 files changed, 83 insertions(+) diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c index cdcc0daf2fb..1e4708935ff 100644 --- a/src/gallium/drivers/freedreno/freedreno_screen.c +++ b/src/gallium/drivers/freedreno/freedreno_screen.c @@ -95,6 +95,13 @@ fd_screen_get_vendor(struct pipe_screen *pscreen) return "freedreno"; } +static const char * +fd_screen_get_device_vendor(struct pipe_screen *pscreen) +{ + return "Qualcomm"; +} + + static uint64_t fd_screen_get_timestamp(struct pipe_screen *pscreen) { @@ -531,6 +538,7 @@ fd_screen_create(struct fd_device *dev) pscreen->get_name = fd_screen_get_name; pscreen->get_vendor = fd_screen_get_vendor; + pscreen->get_device_vendor = fd_screen_get_device_vendor; pscreen->get_timestamp = fd_screen_get_timestamp; diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c index 50847e2b42a..7216160bb22 100644 --- a/src/gallium/drivers/i915/i915_screen.c +++ b/src/gallium/drivers/i915/i915_screen.c @@ -54,6 +54,12 @@ i915_get_vendor(struct pipe_screen *screen) return "Mesa Project"; } +static const char * +i915_get_device_vendor(struct pipe_screen *screen) +{ + return "Intel"; +} + static const char * i915_get_name(struct pipe_screen *screen) { @@ -548,6 +554,7 @@ i915_screen_create(struct i915_winsys *iws) is->base.get_name = i915_get_name; is->base.get_vendor = i915_get_vendor; + is->base.get_device_vendor = i915_get_device_vendor; is->base.get_param = i915_get_param; is->base.get_shader_param = i915_get_shader_param; is->base.get_paramf = i915_get_paramf; diff --git a/src/gallium/drivers/ilo/ilo_screen.c b/src/gallium/drivers/ilo/ilo_screen.c index bf0a84a44eb..80ea4c75241 100644 --- a/src/gallium/drivers/ilo/ilo_screen.c +++ b/src/gallium/drivers/ilo/ilo_screen.c @@ -514,6 +514,12 @@ ilo_get_vendor(struct pipe_screen *screen) return "LunarG, Inc."; } +static const char * +ilo_get_device_vendor(struct pipe_screen *screen) +{ + return "Intel"; +} + static const char * ilo_get_name(struct pipe_screen *screen) { @@ -844,6 +850,7 @@ ilo_screen_create(struct intel_winsys *ws) is->base.destroy = ilo_screen_destroy; is->base.get_name = ilo_get_name; is->base.get_vendor = ilo_get_vendor; + is->base.get_device_vendor = ilo_get_device_vendor; is->base.get_param = ilo_get_param; is->base.get_paramf = ilo_get_paramf; is->base.get_shader_param = ilo_get_shader_param; diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index 3387d3a047f..4b4572587e5 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -589,6 +589,7 @@ llvmpipe_create_screen(struct sw_winsys *winsys) screen->base.get_name = llvmpipe_get_name; screen->base.get_vendor = llvmpipe_get_vendor; + screen->base.get_device_vendor = llvmpipe_get_vendor; // TODO should be the CPU vendor screen->base.get_param = llvmpipe_get_param; screen->base.get_shader_param = llvmpipe_get_shader_param; screen->base.get_paramf = llvmpipe_get_paramf; diff --git a/src/gallium/drivers/noop/noop_pipe.c b/src/gallium/drivers/noop/noop_pipe.c index 8cb8c702c0e..6fb22773c69 100644 --- a/src/gallium/drivers/noop/noop_pipe.c +++ b/src/gallium/drivers/noop/noop_pipe.c @@ -305,6 +305,11 @@ static const char *noop_get_vendor(struct pipe_screen* pscreen) return "X.Org"; } +static const char *noop_get_device_vendor(struct pipe_screen* pscreen) +{ + return "NONE"; +} + static const char *noop_get_name(struct pipe_screen* pscreen) { return "NOOP"; @@ -376,6 +381,7 @@ struct pipe_screen *noop_screen_create(struct pipe_screen *oscreen) screen->destroy = noop_destroy_screen; screen->get_name = noop_get_name; screen->get_vendor = noop_get_vendor; + screen->get_device_vendor = noop_get_device_vendor; screen->get_param = noop_get_param; screen->get_shader_param = noop_get_shader_param; screen->get_paramf = noop_get_paramf; diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c b/src/gallium/drivers/nouveau/nouveau_screen.c index 517978d8858..b4f1413fd8b 100644 --- a/src/gallium/drivers/nouveau/nouveau_screen.c +++ b/src/gallium/drivers/nouveau/nouveau_screen.c @@ -43,6 +43,12 @@ nouveau_screen_get_vendor(struct pipe_screen *pscreen) return "nouveau"; } +static const char * +nouveau_screen_get_device_vendor(struct pipe_screen *pscreen) +{ + return "NVIDIA"; +} + static uint64_t nouveau_screen_get_timestamp(struct pipe_screen *pscreen) { @@ -182,6 +188,7 @@ nouveau_screen_init(struct nouveau_screen *screen, struct nouveau_device *dev) pscreen->get_name = nouveau_screen_get_name; pscreen->get_vendor = nouveau_screen_get_vendor; + pscreen->get_device_vendor = nouveau_screen_get_device_vendor; pscreen->get_timestamp = nouveau_screen_get_timestamp; diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 752d7e59fd5..a7b59d8bfbb 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -47,6 +47,11 @@ static const char* r300_get_vendor(struct pipe_screen* pscreen) return "X.Org R300 Project"; } +static const char* r300_get_device_vendor(struct pipe_screen* pscreen) +{ + return "ATI"; +} + static const char* chip_families[] = { "unknown", "ATI R300", @@ -695,6 +700,7 @@ struct pipe_screen* r300_screen_create(struct radeon_winsys *rws) r300screen->screen.destroy = r300_destroy_screen; r300screen->screen.get_name = r300_get_name; r300screen->screen.get_vendor = r300_get_vendor; + r300screen->screen.get_device_vendor = r300_get_device_vendor; r300screen->screen.get_param = r300_get_param; r300screen->screen.get_shader_param = r300_get_shader_param; r300screen->screen.get_paramf = r300_get_paramf; diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c index dabe53c60a7..0ef5fc24d99 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.c +++ b/src/gallium/drivers/radeon/r600_pipe_common.c @@ -332,6 +332,11 @@ static const char* r600_get_vendor(struct pipe_screen* pscreen) return "X.Org"; } +static const char* r600_get_device_vendor(struct pipe_screen* pscreen) +{ + return "AMD"; +} + static const char* r600_get_name(struct pipe_screen* pscreen) { struct r600_common_screen *rscreen = (struct r600_common_screen*)pscreen; @@ -825,6 +830,7 @@ bool r600_common_screen_init(struct r600_common_screen *rscreen, rscreen->b.get_name = r600_get_name; rscreen->b.get_vendor = r600_get_vendor; + rscreen->b.get_device_vendor = r600_get_device_vendor; rscreen->b.get_compute_param = r600_get_compute_param; rscreen->b.get_paramf = r600_get_paramf; rscreen->b.get_driver_query_info = r600_get_driver_query_info; diff --git a/src/gallium/drivers/rbug/rbug_screen.c b/src/gallium/drivers/rbug/rbug_screen.c index 731cc60047a..d5a3164e217 100644 --- a/src/gallium/drivers/rbug/rbug_screen.c +++ b/src/gallium/drivers/rbug/rbug_screen.c @@ -68,6 +68,15 @@ rbug_screen_get_vendor(struct pipe_screen *_screen) return screen->get_vendor(screen); } +static const char * +rbug_screen_get_device_vendor(struct pipe_screen *_screen) +{ + struct rbug_screen *rb_screen = rbug_screen(_screen); + struct pipe_screen *screen = rb_screen->screen; + + return screen->get_device_vendor(screen); +} + static int rbug_screen_get_param(struct pipe_screen *_screen, enum pipe_cap param) @@ -267,6 +276,7 @@ rbug_screen_create(struct pipe_screen *screen) rb_screen->base.destroy = rbug_screen_destroy; rb_screen->base.get_name = rbug_screen_get_name; rb_screen->base.get_vendor = rbug_screen_get_vendor; + rb_screen->base.get_device_vendor = rbug_screen_get_device_vendor; rb_screen->base.get_param = rbug_screen_get_param; rb_screen->base.get_shader_param = rbug_screen_get_shader_param; rb_screen->base.get_paramf = rbug_screen_get_paramf; diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index a269328aff8..d289e28a6f8 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -427,6 +427,7 @@ softpipe_create_screen(struct sw_winsys *winsys) screen->base.get_name = softpipe_get_name; screen->base.get_vendor = softpipe_get_vendor; + screen->base.get_device_vendor = softpipe_get_vendor; // TODO should be the CPU vendor screen->base.get_param = softpipe_get_param; screen->base.get_shader_param = softpipe_get_shader_param; screen->base.get_paramf = softpipe_get_paramf; diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c index 7b01d35a93a..ab26413064e 100644 --- a/src/gallium/drivers/svga/svga_screen.c +++ b/src/gallium/drivers/svga/svga_screen.c @@ -635,6 +635,7 @@ svga_screen_create(struct svga_winsys_screen *sws) screen->destroy = svga_destroy_screen; screen->get_name = svga_get_name; screen->get_vendor = svga_get_vendor; + screen->get_device_vendor = svga_get_vendor; // TODO actual device vendor screen->get_param = svga_get_param; screen->get_shader_param = svga_get_shader_param; screen->get_paramf = svga_get_paramf; diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c index 3a82cc4d56c..266626defa8 100644 --- a/src/gallium/drivers/trace/tr_screen.c +++ b/src/gallium/drivers/trace/tr_screen.c @@ -82,6 +82,27 @@ trace_screen_get_vendor(struct pipe_screen *_screen) } +static const char * +trace_screen_get_device_vendor(struct pipe_screen *_screen) +{ + struct trace_screen *tr_scr = trace_screen(_screen); + struct pipe_screen *screen = tr_scr->screen; + const char *result; + + trace_dump_call_begin("pipe_screen", "get_device_vendor"); + + trace_dump_arg(ptr, screen); + + result = screen->get_device_vendor(screen); + + trace_dump_ret(string, result); + + trace_dump_call_end(); + + return result; +} + + static int trace_screen_get_param(struct pipe_screen *_screen, enum pipe_cap param) @@ -470,6 +491,7 @@ trace_screen_create(struct pipe_screen *screen) tr_scr->base.destroy = trace_screen_destroy; tr_scr->base.get_name = trace_screen_get_name; tr_scr->base.get_vendor = trace_screen_get_vendor; + tr_scr->base.get_device_vendor = trace_screen_get_device_vendor; tr_scr->base.get_param = trace_screen_get_param; tr_scr->base.get_shader_param = trace_screen_get_shader_param; tr_scr->base.get_paramf = trace_screen_get_paramf; diff --git a/src/gallium/drivers/vc4/vc4_screen.c b/src/gallium/drivers/vc4/vc4_screen.c index 0be8ec2c980..03dd8654631 100644 --- a/src/gallium/drivers/vc4/vc4_screen.c +++ b/src/gallium/drivers/vc4/vc4_screen.c @@ -472,6 +472,7 @@ vc4_screen_create(int fd) pscreen->get_name = vc4_screen_get_name; pscreen->get_vendor = vc4_screen_get_vendor; + pscreen->get_device_vendor = vc4_screen_get_vendor; return pscreen; } -- 2.30.2