On 22/02/14 03:33, Stéphane Marchesin wrote: > On Fri, Feb 21, 2014 at 7:04 PM, Emil Velikov <emil.l.veli...@gmail.com>wrote: > >> Implementation is a verbatim copy from the classic driver. >> >> This introduces a driver dependency on libdrm-intel, as the winsys does not >> cache the aperture size of the device. >> > > 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. > > 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. > Agreed, keeping OS/platform specifics within the winsys is the way to do it.
Should I store the device aperture size within i915_winsys or is there a more suitable place for it ? The current implementation is essentially a vtable for the drm/sw callbacks. -Emil > > >> >> Cc: Stephane Marchesin <stephane.marche...@gmail.com> >> Signed-off-by: Emil Velikov <emil.l.veli...@gmail.com> >> --- >> >> NOTE: This _will_ fail on i915/sw due to the lack of fd on the >> particular winsys. >> >> Stephane, >> Perhaps we can take a look at i915/sw, its users and future. >> > > 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. > > Stéphane > > >> I can vision (but I'm not planing to pursue) some cleanups >> if the software winsys is retired. >> >> Cheers >> -Emil >> >> src/gallium/drivers/i915/Makefile.am | 3 ++- >> src/gallium/drivers/i915/SConscript | 2 ++ >> src/gallium/drivers/i915/i915_screen.c | 39 >> ++++++++++++++++++++++++++++++++++ >> 3 files changed, 43 insertions(+), 1 deletion(-) >> >> diff --git a/src/gallium/drivers/i915/Makefile.am >> b/src/gallium/drivers/i915/Makefile.am >> index a4a3e86..67936ca 100644 >> --- a/src/gallium/drivers/i915/Makefile.am >> +++ b/src/gallium/drivers/i915/Makefile.am >> @@ -24,7 +24,8 @@ include Makefile.sources >> include $(top_srcdir)/src/gallium/Automake.inc >> >> AM_CFLAGS = \ >> - $(GALLIUM_DRIVER_CFLAGS) >> + $(GALLIUM_DRIVER_CFLAGS) \ >> + $(INTEL_CFLAGS) >> >> noinst_LTLIBRARIES = libi915.la >> >> diff --git a/src/gallium/drivers/i915/SConscript >> b/src/gallium/drivers/i915/SConscript >> index 22de67d..a04517e 100644 >> --- a/src/gallium/drivers/i915/SConscript >> +++ b/src/gallium/drivers/i915/SConscript >> @@ -2,6 +2,8 @@ Import('*') >> >> env = env.Clone() >> >> +env.PkgUseModules('DRM_INTEL') >> + >> i915 = env.ConvenienceLibrary( >> target = 'i915', >> source = env.ParseSourceList('Makefile.sources', 'C_SOURCES') >> diff --git a/src/gallium/drivers/i915/i915_screen.c >> b/src/gallium/drivers/i915/i915_screen.c >> index 1f55a06..3970dae 100644 >> --- a/src/gallium/drivers/i915/i915_screen.c >> +++ b/src/gallium/drivers/i915/i915_screen.c >> @@ -26,6 +26,7 @@ >> >> **************************************************************************/ >> >> >> +#include <intel_bufmgr.h> >> #include "draw/draw_context.h" >> #include "util/u_format.h" >> #include "util/u_format_s3tc.h" >> @@ -40,6 +41,7 @@ >> #include "i915_resource.h" >> #include "i915_winsys.h" >> #include "i915_public.h" >> +#include <../winsys/i915/drm/i915_drm_winsys.h> >> >> >> /* >> @@ -281,6 +283,43 @@ i915_get_param(struct pipe_screen *screen, enum >> pipe_cap cap) >> case PIPE_CAP_MAX_GL_ES2_VERSION: >> return 20; >> >> + case PIPE_CAP_VENDOR_ID: >> + return 0x8086; >> + case PIPE_CAP_DEVICE_ID: >> + return is->iws->pci_id; >> + case PIPE_CAP_ACCELERATED: >> + return 1; >> + case PIPE_CAP_VIDEO_MEMORY: { >> + /* Once a batch uses more than 75% of the maximum mappable size, we >> + * assume that there's some fragmentation, and we start doing extra >> + * flushing, etc. That's the big cliff apps will care about. >> + */ >> + struct i915_drm_winsys *idws =(struct i915_drm_winsys *)is->iws; >> + size_t aper_size; >> + size_t mappable_size; >> + >> + drm_intel_get_aperture_sizes(idws->fd, &mappable_size, &aper_size); >> + >> + const unsigned gpu_mappable_megabytes = >> + (aper_size / (1024 * 1024)) * 3 / 4; >> + >> + const long system_memory_pages = sysconf(_SC_PHYS_PAGES); >> + const long system_page_size = sysconf(_SC_PAGE_SIZE); >> + >> + if (system_memory_pages <= 0 || system_page_size <= 0) >> + return 0; >> + >> + const uint64_t system_memory_bytes = (uint64_t) system_memory_pages >> + * (uint64_t) system_page_size; >> + >> + const unsigned system_memory_megabytes = >> + (unsigned) (system_memory_bytes / (1024 * 1024)); >> + >> + return MIN2(system_memory_megabytes, gpu_mappable_megabytes); >> + } >> + case PIPE_CAP_UMA: >> + return 1; >> + >> default: >> debug_printf("%s: Unknown cap %u.\n", __FUNCTION__, cap); >> return 0; >> -- >> 1.9.0 >> >> > _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev