[Mesa-dev] [PATCH 3/4] gallium: implement get_device_vendor() for existing drivers

Giuseppe Bilotta giuseppe.bilotta at gmail.com
Sat Mar 21 23:21:01 PDT 2015


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 <giuseppe.bilotta at gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard at amd.com>
---
 src/gallium/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 cdcc0da..1e47089 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 50847e2..7216160 100644
--- a/src/gallium/drivers/i915/i915_screen.c
+++ b/src/gallium/drivers/i915/i915_screen.c
@@ -55,6 +55,12 @@ i915_get_vendor(struct pipe_screen *screen)
 }
 
 static const char *
+i915_get_device_vendor(struct pipe_screen *screen)
+{
+   return "Intel";
+}
+
+static const char *
 i915_get_name(struct pipe_screen *screen)
 {
    static char buffer[128];
@@ -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 bf0a84a..80ea4c7 100644
--- a/src/gallium/drivers/ilo/ilo_screen.c
+++ b/src/gallium/drivers/ilo/ilo_screen.c
@@ -515,6 +515,12 @@ ilo_get_vendor(struct pipe_screen *screen)
 }
 
 static const char *
+ilo_get_device_vendor(struct pipe_screen *screen)
+{
+   return "Intel";
+}
+
+static const char *
 ilo_get_name(struct pipe_screen *screen)
 {
    struct ilo_screen *is = ilo_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 3387d3a..4b45725 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 8cb8c70..6fb2277 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 517978d..b4f1413 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 752d7e5..a7b59d8 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 dabe53c..0ef5fc2 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 731cc60..d5a3164 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 a269328..d289e28 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 7b01d35..ab26413 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 3a82cc4..266626d 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 0be8ec2..03dd865 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.1.2.766.gaa23a90



More information about the mesa-dev mailing list