iris: Only fetch intel_device_info once per bufmgr
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Signed-off-by: José Roberto de Souza <jose.souza@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19650>
This commit is contained in:

committed by
Marge Bot

parent
aff85114fd
commit
1e78dd9eda
@@ -2535,8 +2535,9 @@ iris_bufmgr_create_screen_id(struct iris_bufmgr *bufmgr)
|
||||
* \param fd File descriptor of the opened DRM device.
|
||||
*/
|
||||
struct iris_bufmgr *
|
||||
iris_bufmgr_get_for_fd(struct intel_device_info *devinfo, int fd, bool bo_reuse)
|
||||
iris_bufmgr_get_for_fd(int fd, bool bo_reuse)
|
||||
{
|
||||
struct intel_device_info devinfo;
|
||||
struct stat st;
|
||||
|
||||
if (fstat(fd, &st))
|
||||
@@ -2557,7 +2558,13 @@ iris_bufmgr_get_for_fd(struct intel_device_info *devinfo, int fd, bool bo_reuse)
|
||||
}
|
||||
}
|
||||
|
||||
bufmgr = iris_bufmgr_create(devinfo, fd, bo_reuse);
|
||||
if (!intel_get_device_info_from_fd(fd, &devinfo))
|
||||
return NULL;
|
||||
|
||||
if (devinfo.ver < 8 || devinfo.platform == INTEL_PLATFORM_CHV)
|
||||
return NULL;
|
||||
|
||||
bufmgr = iris_bufmgr_create(&devinfo, fd, bo_reuse);
|
||||
if (bufmgr)
|
||||
list_addtail(&bufmgr->link, &global_bufmgr_list);
|
||||
|
||||
|
@@ -485,8 +485,7 @@ bool iris_bo_busy(struct iris_bo *bo);
|
||||
*/
|
||||
int iris_bo_madvise(struct iris_bo *bo, int madv);
|
||||
|
||||
struct iris_bufmgr *iris_bufmgr_get_for_fd(struct intel_device_info *devinfo,
|
||||
int fd, bool bo_reuse);
|
||||
struct iris_bufmgr *iris_bufmgr_get_for_fd(int fd, bool bo_reuse);
|
||||
int iris_bufmgr_get_fd(struct iris_bufmgr *bufmgr);
|
||||
|
||||
struct iris_bo *iris_bo_gem_create_from_name(struct iris_bufmgr *bufmgr,
|
||||
|
@@ -781,30 +781,6 @@ iris_screen_create(int fd, const struct pipe_screen_config *config)
|
||||
if (!screen)
|
||||
return NULL;
|
||||
|
||||
struct intel_device_info devinfo;
|
||||
if (!intel_get_device_info_from_fd(fd, &devinfo))
|
||||
return NULL;
|
||||
|
||||
p_atomic_set(&screen->refcount, 1);
|
||||
|
||||
if (devinfo.ver < 8 || devinfo.platform == INTEL_PLATFORM_CHV)
|
||||
return NULL;
|
||||
|
||||
/* Here are the i915 features we need for Iris (in chronological order) :
|
||||
* - I915_PARAM_HAS_EXEC_NO_RELOC (3.10)
|
||||
* - I915_PARAM_HAS_EXEC_HANDLE_LUT (3.10)
|
||||
* - I915_PARAM_HAS_EXEC_BATCH_FIRST (4.13)
|
||||
* - I915_PARAM_HAS_EXEC_FENCE_ARRAY (4.14)
|
||||
* - I915_PARAM_HAS_CONTEXT_ISOLATION (4.16)
|
||||
*
|
||||
* Checking the last feature availability will include all previous ones.
|
||||
*/
|
||||
if (!devinfo.has_context_isolation) {
|
||||
debug_error("Kernel is too old (4.16+ required) or unusable for Iris.\n"
|
||||
"Check your dmesg logs for loading failures.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
driParseConfigFiles(config->options, config->options_info, 0, "iris",
|
||||
NULL, NULL, NULL, 0, NULL, 0);
|
||||
|
||||
@@ -820,11 +796,28 @@ iris_screen_create(int fd, const struct pipe_screen_config *config)
|
||||
|
||||
brw_process_intel_debug_variable();
|
||||
|
||||
screen->bufmgr = iris_bufmgr_get_for_fd(&devinfo, fd, bo_reuse);
|
||||
screen->bufmgr = iris_bufmgr_get_for_fd(fd, bo_reuse);
|
||||
if (!screen->bufmgr)
|
||||
return NULL;
|
||||
|
||||
screen->devinfo = iris_bufmgr_get_device_info(screen->bufmgr);
|
||||
p_atomic_set(&screen->refcount, 1);
|
||||
|
||||
/* Here are the i915 features we need for Iris (in chronological order) :
|
||||
* - I915_PARAM_HAS_EXEC_NO_RELOC (3.10)
|
||||
* - I915_PARAM_HAS_EXEC_HANDLE_LUT (3.10)
|
||||
* - I915_PARAM_HAS_EXEC_BATCH_FIRST (4.13)
|
||||
* - I915_PARAM_HAS_EXEC_FENCE_ARRAY (4.14)
|
||||
* - I915_PARAM_HAS_CONTEXT_ISOLATION (4.16)
|
||||
*
|
||||
* Checking the last feature availability will include all previous ones.
|
||||
*/
|
||||
if (!screen->devinfo->has_context_isolation) {
|
||||
debug_error("Kernel is too old (4.16+ required) or unusable for Iris.\n"
|
||||
"Check your dmesg logs for loading failures.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
screen->fd = iris_bufmgr_get_fd(screen->bufmgr);
|
||||
screen->winsys_fd = os_dupfd_cloexec(fd);
|
||||
|
||||
|
Reference in New Issue
Block a user