return buf;
}
-static uint64_t
-get_aperture_size(int fd)
-{
- struct drm_i915_gem_get_aperture aperture = {};
- gen_ioctl(fd, DRM_IOCTL_I915_GEM_GET_APERTURE, &aperture);
- return aperture.aper_size;
-}
-
static int
iris_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
{
* flushing, etc. That's the big cliff apps will care about.
*/
const unsigned gpu_mappable_megabytes =
- (screen->aperture_bytes * 3 / 4) / (1024 * 1024);
+ (devinfo->aperture_bytes * 3 / 4) / (1024 * 1024);
const long system_memory_pages = sysconf(_SC_PHYS_PAGES);
const long system_page_size = sysconf(_SC_PAGE_SIZE);
screen->fd = iris_bufmgr_get_fd(screen->bufmgr);
- screen->aperture_bytes = get_aperture_size(fd);
-
if (getenv("INTEL_NO_HW") != NULL)
screen->no_hw = true;
}
+int
+gen_get_aperture_size(int fd, uint64_t *size)
+{
+ struct drm_i915_gem_get_aperture aperture = { 0 };
+
+ int ret = gen_ioctl(fd, DRM_IOCTL_I915_GEM_GET_APERTURE, &aperture);
+ if (ret == 0 && size)
+ *size = aperture.aper_size;
+
+ return ret;
+}
+
bool
gen_get_device_info_from_fd(int fd, struct gen_device_info *devinfo)
{
getparam_topology(devinfo, fd);
}
+ gen_get_aperture_size(fd, &devinfo->aperture_bytes);
+
return true;
}
*/
uint64_t timestamp_frequency;
+ uint64_t aperture_bytes;
+
/**
* ID to put into the .aub files.
*/
bool gen_get_device_info_from_fd(int fh, struct gen_device_info *devinfo);
bool gen_get_device_info_from_pci_id(int pci_id,
struct gen_device_info *devinfo);
+int gen_get_aperture_size(int fd, uint64_t *size);
#ifdef __cplusplus
}
anv_perf_warn(NULL, NULL,
"Failed to get I915_CONTEXT_PARAM_GTT_SIZE: %m");
- if (anv_gem_get_aperture(fd, &device->gtt_size) == -1) {
+ if (gen_get_aperture_size(fd, &device->gtt_size) == -1) {
return vk_errorfi(device->instance, NULL,
VK_ERROR_INITIALIZATION_FAILED,
"failed to get aperture size: %m");
return 0;
}
-int
-anv_gem_get_aperture(int fd, uint64_t *size)
-{
- struct drm_i915_gem_get_aperture aperture = { 0 };
-
- int ret = gen_ioctl(fd, DRM_IOCTL_I915_GEM_GET_APERTURE, &aperture);
- if (ret == -1)
- return -1;
-
- *size = aperture.aper_available_size;
-
- return 0;
-}
-
int
anv_gem_gpu_get_reset_stats(struct anv_device *device,
uint32_t *active, uint32_t *pending)
unreachable("Unused");
}
-int
-anv_gem_get_aperture(int fd, uint64_t *size)
-{
- unreachable("Unused");
-}
-
int
anv_gem_gpu_get_reset_stats(struct anv_device *device,
uint32_t *active, uint32_t *pending)
int anv_gem_get_param(int fd, uint32_t param);
int anv_gem_get_tiling(struct anv_device *device, uint32_t gem_handle);
bool anv_gem_get_bit6_swizzle(int fd, uint32_t tiling);
-int anv_gem_get_aperture(int fd, uint64_t *size);
int anv_gem_gpu_get_reset_stats(struct anv_device *device,
uint32_t *active, uint32_t *pending);
int anv_gem_handle_to_fd(struct anv_device *device, uint32_t gem_handle);
.queryDmaBufFormatModifierAttribs = intel_query_format_modifier_attribs,
};
-static uint64_t
-get_aperture_size(int fd)
-{
- struct drm_i915_gem_get_aperture aperture;
-
- if (drmIoctl(fd, DRM_IOCTL_I915_GEM_GET_APERTURE, &aperture) != 0)
- return 0;
-
- return aperture.aper_size;
-}
-
static int
brw_query_renderer_integer(__DRIscreen *dri_screen,
int param, unsigned int *value)
screen->max_gtt_map_object_size = gtt_size / 4;
}
- screen->aperture_threshold = get_aperture_size(screen->fd) * 3 / 4;
+ screen->aperture_threshold = devinfo->aperture_bytes * 3 / 4;
screen->hw_has_swizzling = intel_detect_swizzling(screen);
screen->hw_has_timestamp = intel_detect_timestamp(screen);