[Mesa-dev] [PATCH] gallium/vc4: PIPE_CAP_VIDEO_MEMORY return the amount of system ram

Emil Velikov emil.l.velikov at gmail.com
Fri Aug 15 13:23:06 PDT 2014


Cc: Eric Anholt <eric at anholt.net>
Suggested-by: Eric Anholt <eric at anholt.net>
Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---

Hi Eric,

I fear I was bit too trigger happy with the series :\ Are you sure that 
you want to to the softpipe route here ? I would assume that adding some
heuristics would be a lot better.

-Emil

 src/gallium/drivers/vc4/vc4_screen.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/vc4/vc4_screen.c b/src/gallium/drivers/vc4/vc4_screen.c
index da68f72..852ff87 100644
--- a/src/gallium/drivers/vc4/vc4_screen.c
+++ b/src/gallium/drivers/vc4/vc4_screen.c
@@ -24,6 +24,7 @@
 
 #include <stdio.h>
 
+#include "os/os_misc.h"
 #include "pipe/p_defines.h"
 #include "pipe/p_screen.h"
 #include "pipe/p_state.h"
@@ -207,9 +208,14 @@ vc4_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
                 return 0xFFFFFFFF;
         case PIPE_CAP_ACCELERATED:
                 return 1;
-        case PIPE_CAP_VIDEO_MEMORY:
-                fprintf(stderr, "FINISHME: The value returned is incorrect\n");
-                return 10;
+        case PIPE_CAP_VIDEO_MEMORY: {
+                uint64_t system_memory;
+
+                if (!os_get_total_physical_memory(&system_memory))
+                        return 0;
+
+                return (int)(system_memory >> 20);
+        }
         case PIPE_CAP_UMA:
                 return 1;
 
-- 
2.0.2



More information about the mesa-dev mailing list