diff options
author | Lionel Landwerlin <[email protected]> | 2016-09-22 14:58:11 +0300 |
---|---|---|
committer | Lionel Landwerlin <[email protected]> | 2016-09-23 10:11:59 +0300 |
commit | bc24590f0c579a2528fd94eb8d40dd4ce12eba29 (patch) | |
tree | 0ec5dbc71ec3aa551586005282200b184251d51f /src/intel/vulkan | |
parent | e60928f4c4bd4484821d83f2b16a910ea9f5f9d9 (diff) |
intel/i965: make gen_device_info mutable
Make gen_device_info a mutable structure so we can update the fields that
can be refined by querying the kernel (like subslices and EU numbers).
This patch does not make any functional change, it just makes
gen_get_device_info() fill a structure rather than returning a const
pointer.
Signed-off-by: Lionel Landwerlin <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/intel/vulkan')
-rw-r--r-- | src/intel/vulkan/anv_device.c | 59 | ||||
-rw-r--r-- | src/intel/vulkan/anv_formats.c | 16 | ||||
-rw-r--r-- | src/intel/vulkan/anv_private.h | 2 |
3 files changed, 38 insertions, 39 deletions
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index fecb8505b89..6edbb1c8c1b 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -77,19 +77,18 @@ anv_physical_device_init(struct anv_physical_device *device, } device->name = gen_get_device_name(device->chipset_id); - device->info = gen_get_device_info(device->chipset_id); - if (!device->info) { + if (!gen_get_device_info(device->chipset_id, &device->info)) { result = vk_error(VK_ERROR_INCOMPATIBLE_DRIVER); goto fail; } - if (device->info->is_haswell) { + if (device->info.is_haswell) { fprintf(stderr, "WARNING: Haswell Vulkan support is incomplete\n"); - } else if (device->info->gen == 7 && !device->info->is_baytrail) { + } else if (device->info.gen == 7 && !device->info.is_baytrail) { fprintf(stderr, "WARNING: Ivy Bridge Vulkan support is incomplete\n"); - } else if (device->info->gen == 7 && device->info->is_baytrail) { + } else if (device->info.gen == 7 && device->info.is_baytrail) { fprintf(stderr, "WARNING: Bay Trail Vulkan support is incomplete\n"); - } else if (device->info->gen >= 8) { + } else if (device->info.gen >= 8) { /* Broadwell, Cherryview, Skylake, Broxton, Kabylake is as fully * supported as anything */ } else { @@ -99,7 +98,7 @@ anv_physical_device_init(struct anv_physical_device *device, } device->cmd_parser_version = -1; - if (device->info->gen == 7) { + if (device->info.gen == 7) { device->cmd_parser_version = anv_gem_get_param(fd, I915_PARAM_CMD_PARSER_VERSION); if (device->cmd_parser_version == -1) { @@ -127,7 +126,7 @@ anv_physical_device_init(struct anv_physical_device *device, goto fail; } - if (!device->info->has_llc && + if (!device->info.has_llc && anv_gem_get_param(fd, I915_PARAM_MMAP_VERSION) < 1) { result = vk_errorf(VK_ERROR_INITIALIZATION_FAILED, "kernel missing wc mmap"); @@ -136,14 +135,14 @@ anv_physical_device_init(struct anv_physical_device *device, bool swizzled = anv_gem_get_bit6_swizzle(fd, I915_TILING_X); - device->max_vs_threads = device->info->max_vs_threads; - device->max_hs_threads = device->info->max_hs_threads; - device->max_ds_threads = device->info->max_ds_threads; - device->max_gs_threads = device->info->max_gs_threads; - device->max_wm_threads = device->info->max_wm_threads; + device->max_vs_threads = device->info.max_vs_threads; + device->max_hs_threads = device->info.max_hs_threads; + device->max_ds_threads = device->info.max_ds_threads; + device->max_gs_threads = device->info.max_gs_threads; + device->max_wm_threads = device->info.max_wm_threads; /* GENs prior to 8 do not support EU/Subslice info */ - if (device->info->gen >= 8) { + if (device->info.gen >= 8) { device->subslice_total = anv_gem_get_param(fd, I915_PARAM_SUBSLICE_TOTAL); device->eu_total = anv_gem_get_param(fd, I915_PARAM_EU_TOTAL); @@ -155,27 +154,27 @@ anv_physical_device_init(struct anv_physical_device *device, fprintf(stderr, "WARNING: Kernel 4.1 required to properly" " query GPU properties.\n"); } - } else if (device->info->gen == 7) { - device->subslice_total = 1 << (device->info->gt - 1); + } else if (device->info.gen == 7) { + device->subslice_total = 1 << (device->info.gt - 1); } - if (device->info->is_cherryview && + if (device->info.is_cherryview && device->subslice_total > 0 && device->eu_total > 0) { /* Logical CS threads = EUs per subslice * 7 threads per EU */ device->max_cs_threads = device->eu_total / device->subslice_total * 7; /* Fuse configurations may give more threads than expected, never less. */ - if (device->max_cs_threads < device->info->max_cs_threads) - device->max_cs_threads = device->info->max_cs_threads; + if (device->max_cs_threads < device->info.max_cs_threads) + device->max_cs_threads = device->info.max_cs_threads; } else { - device->max_cs_threads = device->info->max_cs_threads; + device->max_cs_threads = device->info.max_cs_threads; } close(fd); brw_process_intel_debug_variable(); - device->compiler = brw_compiler_create(NULL, device->info); + device->compiler = brw_compiler_create(NULL, &device->info); if (device->compiler == NULL) { result = vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); goto fail; @@ -188,7 +187,7 @@ anv_physical_device_init(struct anv_physical_device *device, goto fail; /* XXX: Actually detect bit6 swizzling */ - isl_device_init(&device->isl_dev, device->info, swizzled); + isl_device_init(&device->isl_dev, &device->info, swizzled); return VK_SUCCESS; @@ -237,7 +236,7 @@ static const VkExtensionProperties device_extensions[] = { }; static void * -default_alloc_func(void *pUserData, size_t size, size_t align, +default_alloc_func(void *pUserData, size_t size, size_t align, VkSystemAllocationScope allocationScope) { return malloc(size); @@ -428,9 +427,9 @@ void anv_GetPhysicalDeviceFeatures( .alphaToOne = true, .multiViewport = true, .samplerAnisotropy = false, /* FINISHME */ - .textureCompressionETC2 = pdevice->info->gen >= 8 || - pdevice->info->is_baytrail, - .textureCompressionASTC_LDR = pdevice->info->gen >= 9, /* FINISHME CHV */ + .textureCompressionETC2 = pdevice->info.gen >= 8 || + pdevice->info.is_baytrail, + .textureCompressionASTC_LDR = pdevice->info.gen >= 9, /* FINISHME CHV */ .textureCompressionBC = true, .occlusionQueryPrecise = true, .pipelineStatisticsQuery = false, @@ -473,7 +472,7 @@ void anv_GetPhysicalDeviceProperties( VkPhysicalDeviceProperties* pProperties) { ANV_FROM_HANDLE(anv_physical_device, pdevice, physicalDevice); - const struct gen_device_info *devinfo = pdevice->info; + const struct gen_device_info *devinfo = &pdevice->info; const float time_stamp_base = devinfo->gen >= 9 ? 83.333 : 80.0; @@ -645,7 +644,7 @@ void anv_GetPhysicalDeviceMemoryProperties( */ heap_size = 3 * physical_device->aperture_size / 4; - if (physical_device->info->has_llc) { + if (physical_device->info.has_llc) { /* Big core GPUs share LLC with the CPU and thus one memory type can be * both cached and coherent at the same time. */ @@ -861,7 +860,7 @@ VkResult anv_CreateDevice( return vk_error(VK_ERROR_EXTENSION_NOT_PRESENT); } - anv_set_dispatch_devinfo(physical_device->info); + anv_set_dispatch_devinfo(&physical_device->info); device = anv_alloc2(&physical_device->instance->alloc, pAllocator, sizeof(*device), 8, @@ -891,7 +890,7 @@ VkResult anv_CreateDevice( goto fail_fd; } - device->info = *physical_device->info; + device->info = physical_device->info; device->isl_dev = physical_device->isl_dev; /* On Broadwell and later, we can use batch chaining to more efficiently diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c index ff59f479fd0..7341d725cd0 100644 --- a/src/intel/vulkan/anv_formats.c +++ b/src/intel/vulkan/anv_formats.c @@ -365,8 +365,8 @@ anv_physical_device_get_format_properties(struct anv_physical_device *physical_d VkFormat format, VkFormatProperties *out_properties) { - int gen = physical_device->info->gen * 10; - if (physical_device->info->is_haswell) + int gen = physical_device->info.gen * 10; + if (physical_device->info.is_haswell) gen += 5; VkFormatFeatureFlags linear = 0, tiled = 0, buffer = 0; @@ -374,25 +374,25 @@ anv_physical_device_get_format_properties(struct anv_physical_device *physical_d /* Nothing to do here */ } else if (vk_format_is_depth_or_stencil(format)) { tiled |= VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT; - if (physical_device->info->gen >= 8) + if (physical_device->info.gen >= 8) tiled |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT; tiled |= VK_FORMAT_FEATURE_BLIT_SRC_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT; } else { struct anv_format linear_fmt, tiled_fmt; - linear_fmt = anv_get_format(physical_device->info, format, + linear_fmt = anv_get_format(&physical_device->info, format, VK_IMAGE_ASPECT_COLOR_BIT, VK_IMAGE_TILING_LINEAR); - tiled_fmt = anv_get_format(physical_device->info, format, + tiled_fmt = anv_get_format(&physical_device->info, format, VK_IMAGE_ASPECT_COLOR_BIT, VK_IMAGE_TILING_OPTIMAL); - linear = get_image_format_properties(physical_device->info, + linear = get_image_format_properties(&physical_device->info, linear_fmt.isl_format, linear_fmt); - tiled = get_image_format_properties(physical_device->info, + tiled = get_image_format_properties(&physical_device->info, linear_fmt.isl_format, tiled_fmt); - buffer = get_buffer_format_properties(physical_device->info, + buffer = get_buffer_format_properties(&physical_device->info, linear_fmt.isl_format); /* XXX: We handle 3-channel formats by switching them out for RGBX or diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index f578a9d9a85..839f813d0d7 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -564,7 +564,7 @@ struct anv_physical_device { uint32_t chipset_id; char path[20]; const char * name; - const struct gen_device_info * info; + struct gen_device_info info; uint64_t aperture_size; struct brw_compiler * compiler; struct isl_device isl_dev; |