intel/gem: Return length from intel_i915_query_alloc
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Caio Oliveira <caio.oliveira@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13866>
This commit is contained in:
@@ -265,7 +265,7 @@ iris_create_engines_context(struct iris_context *ice, int priority)
|
||||
int fd = iris_bufmgr_get_fd(screen->bufmgr);
|
||||
|
||||
struct drm_i915_query_engine_info *engines_info =
|
||||
intel_i915_query_alloc(fd, DRM_I915_QUERY_ENGINE_INFO);
|
||||
intel_i915_query_alloc(fd, DRM_I915_QUERY_ENGINE_INFO, NULL);
|
||||
|
||||
if (!engines_info)
|
||||
return -1;
|
||||
|
@@ -2272,7 +2272,7 @@ static bool
|
||||
iris_bufmgr_query_meminfo(struct iris_bufmgr *bufmgr)
|
||||
{
|
||||
struct drm_i915_query_memory_regions *meminfo =
|
||||
intel_i915_query_alloc(bufmgr->fd, DRM_I915_QUERY_MEMORY_REGIONS);
|
||||
intel_i915_query_alloc(bufmgr->fd, DRM_I915_QUERY_MEMORY_REGIONS, NULL);
|
||||
if (meminfo == NULL)
|
||||
return false;
|
||||
|
||||
|
@@ -135,8 +135,11 @@ intel_i915_query(int fd, uint64_t query_id, void *buffer,
|
||||
* The caller is responsible for freeing the returned pointer.
|
||||
*/
|
||||
static inline void *
|
||||
intel_i915_query_alloc(int fd, uint64_t query_id)
|
||||
intel_i915_query_alloc(int fd, uint64_t query_id, int32_t *query_length)
|
||||
{
|
||||
if (query_length)
|
||||
*query_length = 0;
|
||||
|
||||
int32_t length = 0;
|
||||
int ret = intel_i915_query(fd, query_id, NULL, &length);
|
||||
if (ret < 0)
|
||||
@@ -154,6 +157,9 @@ intel_i915_query_alloc(int fd, uint64_t query_id)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (query_length)
|
||||
*query_length = length;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
@@ -1528,7 +1528,7 @@ static bool
|
||||
query_topology(struct intel_device_info *devinfo, int fd)
|
||||
{
|
||||
struct drm_i915_query_topology_info *topo_info =
|
||||
intel_i915_query_alloc(fd, DRM_I915_QUERY_TOPOLOGY_INFO);
|
||||
intel_i915_query_alloc(fd, DRM_I915_QUERY_TOPOLOGY_INFO, NULL);
|
||||
if (topo_info == NULL)
|
||||
return false;
|
||||
|
||||
|
@@ -353,7 +353,7 @@ anv_gather_meminfo(struct anv_physical_device *device, int fd, bool update)
|
||||
sizeof(struct drm_i915_memory_region_info)];
|
||||
|
||||
struct drm_i915_query_memory_regions *mem_regions =
|
||||
intel_i915_query_alloc(fd, DRM_I915_QUERY_MEMORY_REGIONS);
|
||||
intel_i915_query_alloc(fd, DRM_I915_QUERY_MEMORY_REGIONS, NULL);
|
||||
if (mem_regions == NULL) {
|
||||
if (device->info.has_local_mem) {
|
||||
return vk_errorf(device, VK_ERROR_INCOMPATIBLE_DRIVER,
|
||||
|
@@ -424,5 +424,5 @@ anv_gem_reg_read(int fd, uint32_t offset, uint64_t *result)
|
||||
struct drm_i915_query_engine_info *
|
||||
anv_gem_get_engine_info(int fd)
|
||||
{
|
||||
return intel_i915_query_alloc(fd, DRM_I915_QUERY_ENGINE_INFO);
|
||||
return intel_i915_query_alloc(fd, DRM_I915_QUERY_ENGINE_INFO, NULL);
|
||||
}
|
||||
|
Reference in New Issue
Block a user