ilo: fold drm_intel_get_aperture_sizes() within probe_winsys()
authorEmil Velikov <emil.l.velikov@gmail.com>
Tue, 19 Aug 2014 09:02:35 +0000 (10:02 +0100)
committerChia-I Wu <olvaffe@gmail.com>
Tue, 19 Aug 2014 09:45:00 +0000 (17:45 +0800)
... and store the value in intel_winsys_info/ilo_dev_info.

Suggested-by: Chia-I Wu <olvaffe@gmail.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
olv: check for errors and report raw values

src/gallium/drivers/ilo/ilo_common.h
src/gallium/drivers/ilo/ilo_screen.c
src/gallium/winsys/intel/drm/intel_drm_winsys.c
src/gallium/winsys/intel/intel_winsys.h

index dd31f749bbfc4de27e70ce9eeed8c5544166a0fd..e4f28b38122980c8a3e28d0eea6ffa121c9abb8d 100644 (file)
@@ -68,6 +68,8 @@ enum ilo_debug {
 struct ilo_dev_info {
    /* these mirror intel_winsys_info */
    int devid;
+   size_t aperture_total;
+   size_t aperture_mappable;
    int max_batch_size;
    bool has_llc;
    bool has_address_swizzling;
index ad59d6dfb944be163e02e2d5a121cd917bcde100..72d66acf13162d1a70e1312e476107a4db415507 100644 (file)
@@ -448,8 +448,7 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param)
        * assume that there's some fragmentation, and we start doing extra
        * flushing, etc.  That's the big cliff apps will care about.
        */
-      const int gpu_mappable_megabytes =
-         intel_winsys_get_aperture_size(is->winsys) * 3 / 4;
+      const uint64_t gpu_mappable_megabytes = is->dev.aperture_total * 3 / 4;
       uint64_t system_memory;
 
       if (!os_get_total_physical_memory(&system_memory))
@@ -638,6 +637,8 @@ static bool
 init_dev(struct ilo_dev_info *dev, const struct intel_winsys_info *info)
 {
    dev->devid = info->devid;
+   dev->aperture_total = info->aperture_total;
+   dev->aperture_mappable = info->aperture_mappable;
    dev->max_batch_size = info->max_batch_size;
    dev->has_llc = info->has_llc;
    dev->has_address_swizzling = info->has_address_swizzling;
index b394e5fe7561ab2ccf66782d5d2aac2e96aa484b..f94a1cb9f338cd8e72424b14ee8f0a1d729f01ea 100644 (file)
@@ -139,6 +139,12 @@ probe_winsys(struct intel_winsys *winsys)
 
    info->devid = drm_intel_bufmgr_gem_get_devid(winsys->bufmgr);
 
+   if (drm_intel_get_aperture_sizes(winsys->fd,
+         &info->aperture_mappable, &info->aperture_total)) {
+      debug_error("failed to query aperture sizes");
+      return false;
+   }
+
    info->max_batch_size = BATCH_SZ;
 
    get_param(winsys, I915_PARAM_HAS_LLC, &val);
@@ -223,16 +229,6 @@ intel_winsys_get_info(const struct intel_winsys *winsys)
    return &winsys->info;
 }
 
-int
-intel_winsys_get_aperture_size(const struct intel_winsys *winsys)
-{
-   size_t aper_size, mappable_size;
-
-   drm_intel_get_aperture_sizes(winsys->fd, &mappable_size, &aper_size);
-
-   return aper_size >> 20;
-}
-
 struct intel_context *
 intel_winsys_create_context(struct intel_winsys *winsys)
 {
index 4bf9a16ee93f907e9cc21242f4666f940450158f..679f24817b875df1b13b94a70148f0901845cabb 100644 (file)
@@ -69,6 +69,10 @@ struct intel_bo;
 struct intel_winsys_info {
    int devid;
 
+   /* the sizes of the aperture in bytes */
+   size_t aperture_total;
+   size_t aperture_mappable;
+
    int max_batch_size;
    bool has_llc;
    bool has_address_swizzling;
@@ -91,9 +95,6 @@ intel_winsys_destroy(struct intel_winsys *winsys);
 const struct intel_winsys_info *
 intel_winsys_get_info(const struct intel_winsys *winsys);
 
-int
-intel_winsys_get_aperture_size(const struct intel_winsys *winsys);
-
 /**
  * Create a logical context for use with the render ring.
  */