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 | |
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')
-rw-r--r-- | src/intel/common/gen_device_info.c | 11 | ||||
-rw-r--r-- | src/intel/common/gen_device_info.h | 2 | ||||
-rw-r--r-- | src/intel/isl/tests/isl_surf_get_image_offset_test.c | 18 | ||||
-rw-r--r-- | src/intel/tools/disasm.c | 4 | ||||
-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 |
7 files changed, 59 insertions, 53 deletions
diff --git a/src/intel/common/gen_device_info.c b/src/intel/common/gen_device_info.c index 7f1af19f98c..615605c18ba 100644 --- a/src/intel/common/gen_device_info.c +++ b/src/intel/common/gen_device_info.c @@ -487,21 +487,20 @@ static const struct gen_device_info gen_device_info_kbl_gt4 = { .num_slices = 3, }; -const struct gen_device_info * -gen_get_device_info(int devid) +const bool +gen_get_device_info(int devid, struct gen_device_info *devinfo) { - const struct gen_device_info *devinfo; switch (devid) { #undef CHIPSET #define CHIPSET(id, family, name) \ - case id: devinfo = &gen_device_info_##family; break; + case id: *devinfo = gen_device_info_##family; break; #include "pci_ids/i965_pci_ids.h" default: fprintf(stderr, "i965_dri.so does not support the 0x%x PCI ID.\n", devid); - return NULL; + return false; } - return devinfo; + return true; } const char * diff --git a/src/intel/common/gen_device_info.h b/src/intel/common/gen_device_info.h index 6b639d397a0..8b68a011ea4 100644 --- a/src/intel/common/gen_device_info.h +++ b/src/intel/common/gen_device_info.h @@ -143,5 +143,5 @@ struct gen_device_info /** @} */ }; -const struct gen_device_info *gen_get_device_info(int devid); +const bool gen_get_device_info(int devid, struct gen_device_info *devinfo); const char *gen_get_device_name(int devid); diff --git a/src/intel/isl/tests/isl_surf_get_image_offset_test.c b/src/intel/isl/tests/isl_surf_get_image_offset_test.c index 5ce326f7cd0..1b3dc58b002 100644 --- a/src/intel/isl/tests/isl_surf_get_image_offset_test.c +++ b/src/intel/isl/tests/isl_surf_get_image_offset_test.c @@ -124,9 +124,11 @@ test_bdw_2d_r8g8b8a8_unorm_512x512_array01_samples01_noaux_tiley0(void) { bool ok; + struct gen_device_info devinfo; + t_assert(gen_get_device_info(BDW_GT2_DEVID, &devinfo)); + struct isl_device dev; - isl_device_init(&dev, gen_get_device_info(BDW_GT2_DEVID), - /*bit6_swizzle*/ false); + isl_device_init(&dev, &devinfo, /*bit6_swizzle*/ false); struct isl_surf surf; ok = isl_surf_init(&dev, &surf, @@ -170,9 +172,11 @@ test_bdw_2d_r8g8b8a8_unorm_1024x1024_array06_samples01_noaux_tiley0(void) { bool ok; + struct gen_device_info devinfo; + t_assert(gen_get_device_info(BDW_GT2_DEVID, &devinfo)); + struct isl_device dev; - isl_device_init(&dev, gen_get_device_info(BDW_GT2_DEVID), - /*bit6_swizzle*/ false); + isl_device_init(&dev, &devinfo, /*bit6_swizzle*/ false); struct isl_surf surf; ok = isl_surf_init(&dev, &surf, @@ -229,9 +233,11 @@ test_bdw_3d_r8g8b8a8_unorm_256x256x256_levels09_tiley0(void) { bool ok; + struct gen_device_info devinfo; + t_assert(gen_get_device_info(BDW_GT2_DEVID, &devinfo)); + struct isl_device dev; - isl_device_init(&dev, gen_get_device_info(BDW_GT2_DEVID), - /*bit6_swizzle*/ false); + isl_device_init(&dev, &devinfo, /*bit6_swizzle*/ false); struct isl_surf surf; ok = isl_surf_init(&dev, &surf, diff --git a/src/intel/tools/disasm.c b/src/intel/tools/disasm.c index 2b51424742d..e52761586d0 100644 --- a/src/intel/tools/disasm.c +++ b/src/intel/tools/disasm.c @@ -101,7 +101,9 @@ gen_disasm_create(int pciid) if (gd == NULL) return NULL; - gd->devinfo = *gen_get_device_info(pciid); + if (!gen_get_device_info(pciid, &gd->devinfo)) + return NULL; + brw_init_compaction_tables(&gd->devinfo); return gd; 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; |