<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Feb 21, 2014 at 7:04 PM, Emil Velikov <span dir="ltr"><<a href="mailto:emil.l.velikov@gmail.com" target="_blank">emil.l.velikov@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Implementation is a verbatim copy from the classic driver.<br>
<br>
This introduces a driver dependency on libdrm-intel, as the winsys does not<br>
cache the aperture size of the device.<br></blockquote><div><br></div><div>Usually if you have to add calls into libdrm, you add them to the winsys, and then add a new entry point to the winsys which you call... If you want I can do it.</div>
<div><br></div><div>I've been ensuring that the only place calling into libdrm was the winsys so far. Whether or not we remove the sw winsys, I think it's a healthy thing to do.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
Cc: Stephane Marchesin <<a href="mailto:stephane.marchesin@gmail.com">stephane.marchesin@gmail.com</a>><br>
Signed-off-by: Emil Velikov <<a href="mailto:emil.l.velikov@gmail.com">emil.l.velikov@gmail.com</a>><br>
---<br>
<br>
NOTE: This _will_ fail on i915/sw due to the lack of fd on the<br>
particular winsys.<br>
<br>
Stephane,<br>
Perhaps we can take a look at i915/sw, its users and future.<br></blockquote><div><br></div><div>I'm not sure if there are any i915/sw users; I certainly don't test/use the sw winsys. I just keep it around in case someone does. If someone wants to speak up, now is the time. </div>
<div><br></div><div>Stéphane</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
I can vision (but I'm not planing to pursue) some cleanups<br>
if the software winsys is retired.<br>
<br>
Cheers<br>
-Emil<br>
<br>
src/gallium/drivers/i915/Makefile.am | 3 ++-<br>
src/gallium/drivers/i915/SConscript | 2 ++<br>
src/gallium/drivers/i915/i915_screen.c | 39 ++++++++++++++++++++++++++++++++++<br>
3 files changed, 43 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/src/gallium/drivers/i915/Makefile.am b/src/gallium/drivers/i915/Makefile.am<br>
index a4a3e86..67936ca 100644<br>
--- a/src/gallium/drivers/i915/Makefile.am<br>
+++ b/src/gallium/drivers/i915/Makefile.am<br>
@@ -24,7 +24,8 @@ include Makefile.sources<br>
include $(top_srcdir)/src/gallium/Automake.inc<br>
<br>
AM_CFLAGS = \<br>
- $(GALLIUM_DRIVER_CFLAGS)<br>
+ $(GALLIUM_DRIVER_CFLAGS) \<br>
+ $(INTEL_CFLAGS)<br>
<br>
noinst_LTLIBRARIES = <a href="http://libi915.la" target="_blank">libi915.la</a><br>
<br>
diff --git a/src/gallium/drivers/i915/SConscript b/src/gallium/drivers/i915/SConscript<br>
index 22de67d..a04517e 100644<br>
--- a/src/gallium/drivers/i915/SConscript<br>
+++ b/src/gallium/drivers/i915/SConscript<br>
@@ -2,6 +2,8 @@ Import('*')<br>
<br>
env = env.Clone()<br>
<br>
+env.PkgUseModules('DRM_INTEL')<br>
+<br>
i915 = env.ConvenienceLibrary(<br>
target = 'i915',<br>
source = env.ParseSourceList('Makefile.sources', 'C_SOURCES')<br>
diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c<br>
index 1f55a06..3970dae 100644<br>
--- a/src/gallium/drivers/i915/i915_screen.c<br>
+++ b/src/gallium/drivers/i915/i915_screen.c<br>
@@ -26,6 +26,7 @@<br>
**************************************************************************/<br>
<br>
<br>
+#include <intel_bufmgr.h><br>
#include "draw/draw_context.h"<br>
#include "util/u_format.h"<br>
#include "util/u_format_s3tc.h"<br>
@@ -40,6 +41,7 @@<br>
#include "i915_resource.h"<br>
#include "i915_winsys.h"<br>
#include "i915_public.h"<br>
+#include <../winsys/i915/drm/i915_drm_winsys.h><br>
<br>
<br>
/*<br>
@@ -281,6 +283,43 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)<br>
case PIPE_CAP_MAX_GL_ES2_VERSION:<br>
return 20;<br>
<br>
+ case PIPE_CAP_VENDOR_ID:<br>
+ return 0x8086;<br>
+ case PIPE_CAP_DEVICE_ID:<br>
+ return is->iws->pci_id;<br>
+ case PIPE_CAP_ACCELERATED:<br>
+ return 1;<br>
+ case PIPE_CAP_VIDEO_MEMORY: {<br>
+ /* Once a batch uses more than 75% of the maximum mappable size, we<br>
+ * assume that there's some fragmentation, and we start doing extra<br>
+ * flushing, etc. That's the big cliff apps will care about.<br>
+ */<br>
+ struct i915_drm_winsys *idws =(struct i915_drm_winsys *)is->iws;<br>
+ size_t aper_size;<br>
+ size_t mappable_size;<br>
+<br>
+ drm_intel_get_aperture_sizes(idws->fd, &mappable_size, &aper_size);<br>
+<br>
+ const unsigned gpu_mappable_megabytes =<br>
+ (aper_size / (1024 * 1024)) * 3 / 4;<br>
+<br>
+ const long system_memory_pages = sysconf(_SC_PHYS_PAGES);<br>
+ const long system_page_size = sysconf(_SC_PAGE_SIZE);<br>
+<br>
+ if (system_memory_pages <= 0 || system_page_size <= 0)<br>
+ return 0;<br>
+<br>
+ const uint64_t system_memory_bytes = (uint64_t) system_memory_pages<br>
+ * (uint64_t) system_page_size;<br>
+<br>
+ const unsigned system_memory_megabytes =<br>
+ (unsigned) (system_memory_bytes / (1024 * 1024));<br>
+<br>
+ return MIN2(system_memory_megabytes, gpu_mappable_megabytes);<br>
+ }<br>
+ case PIPE_CAP_UMA:<br>
+ return 1;<br>
+<br>
default:<br>
debug_printf("%s: Unknown cap %u.\n", __FUNCTION__, cap);<br>
return 0;<br>
<span class=""><font color="#888888">--<br>
1.9.0<br>
<br>
</font></span></blockquote></div><br></div></div>