Lines Matching defs:data

236    void *data = _mesa_hash_table_u64_search(vk_object_to_data, obj);
238 return data;
241 static void map_object(uint64_t obj, void *data)
245 _mesa_hash_table_u64_insert(vk_object_to_data, obj, data);
329 struct instance_data *data = rzalloc(NULL, struct instance_data);
330 data->instance = instance;
331 data->control_client = -1;
332 map_object(HKEY(data->instance), data);
333 return data;
336 static void destroy_instance_data(struct instance_data *data)
338 if (data->params.output_file)
339 fclose(data->params.output_file);
340 if (data->params.control >= 0)
341 os_socket_close(data->params.control);
342 unmap_object(HKEY(data->instance));
343 ralloc_free(data);
372 struct device_data *data = rzalloc(NULL, struct device_data);
373 data->instance = instance;
374 data->device = device;
375 map_object(HKEY(data->device), data);
376 return data;
384 struct queue_data *data = rzalloc(device_data, struct queue_data);
385 data->device = device_data;
386 data->queue = queue;
387 data->flags = family_props->queueFlags;
388 data->timestamp_mask = (1ull << family_props->timestampValidBits) - 1;
389 data->family_index = family_index;
390 list_inithead(&data->running_command_buffer);
391 map_object(HKEY(data->queue), data);
400 &data->queries_fence));
402 if (data->flags & VK_QUEUE_GRAPHICS_BIT)
403 device_data->graphic_queue = data;
405 return data;
408 static void destroy_queue(struct queue_data *data)
410 struct device_data *device_data = data->device;
411 device_data->vtable.DestroyFence(device_data->device, data->queries_fence, NULL);
412 unmap_object(HKEY(data->queue));
413 ralloc_free(data);
416 static void device_map_queues(struct device_data *data,
420 data->n_queues += pCreateInfo->pQueueCreateInfos[i].queueCount;
421 data->queues = ralloc_array(data, struct queue_data *, data->n_queues);
423 struct instance_data *instance_data = data->instance;
425 instance_data->pd_vtable.GetPhysicalDeviceQueueFamilyProperties(data->physical_device,
430 instance_data->pd_vtable.GetPhysicalDeviceQueueFamilyProperties(data->physical_device,
438 data->vtable.GetDeviceQueue(data->device,
442 VK_CHECK(data->set_device_loader_data(data->device, queue));
444 data->queues[queue_index++] =
446 pCreateInfo->pQueueCreateInfos[i].queueFamilyIndex, data);
453 static void device_unmap_queues(struct device_data *data)
455 for (uint32_t i = 0; i < data->n_queues; i++)
456 destroy_queue(data->queues[i]);
459 static void destroy_device_data(struct device_data *data)
461 unmap_object(HKEY(data->device));
462 ralloc_free(data);
473 struct command_buffer_data *data = rzalloc(NULL, struct command_buffer_data);
474 data->device = device_data;
475 data->cmd_buffer = cmd_buffer;
476 data->level = level;
477 data->pipeline_query_pool = pipeline_query_pool;
478 data->timestamp_query_pool = timestamp_query_pool;
479 data->query_index = query_index;
480 list_inithead(&data->link);
481 map_object(HKEY(data->cmd_buffer), data);
482 return data;
485 static void destroy_command_buffer_data(struct command_buffer_data *data)
487 unmap_object(HKEY(data->cmd_buffer));
488 list_delinit(&data->link);
489 ralloc_free(data);
497 struct swapchain_data *data = rzalloc(NULL, struct swapchain_data);
498 data->device = device_data;
499 data->swapchain = swapchain;
500 data->window_size = ImVec2(instance_data->params.width, instance_data->params.height);
501 list_inithead(&data->draws);
502 map_object(HKEY(data->swapchain), data);
503 return data;
506 static void destroy_swapchain_data(struct swapchain_data *data)
508 unmap_object(HKEY(data->swapchain));
509 ralloc_free(data);
512 struct overlay_draw *get_overlay_draw(struct swapchain_data *data)
514 struct device_data *device_data = data->device;
515 struct overlay_draw *draw = list_is_empty(&data->draws) ?
516 NULL : list_first_entry(&data->draws, struct overlay_draw, link);
525 list_addtail(&draw->link, &data->draws);
529 draw = rzalloc(data, struct overlay_draw);
533 cmd_buffer_info.commandPool = data->command_pool;
555 list_addtail(&draw->link, &data->draws);
762 * socket, there's a good chance that there's still more data to be
772 static void snapshot_swapchain_frame(struct swapchain_data *data)
774 struct device_data *device_data = data->device;
776 uint32_t f_idx = data->n_frames % ARRAY_SIZE(data->frames_stats);
784 if (data->last_present_time) {
785 data->frame_stats.stats[OVERLAY_PARAM_ENABLED_frame_timing] =
786 now - data->last_present_time;
789 memset(&data->frames_stats[f_idx], 0, sizeof(data->frames_stats[f_idx]));
791 data->frames_stats[f_idx].stats[s] += device_data->frame_stats.stats[s] + data->frame_stats.stats[s];
792 data->accumulated_stats.stats[s] += device_data->frame_stats.stats[s] + data->frame_stats.stats[s];
798 * this data to cause noise to the stats that we want to capture from now
802 * flush of the data, but no stats will be written to the output file. This
809 if (data->last_fps_update) {
810 double elapsed = (double)(now - data->last_fps_update); /* us */
813 data->fps = 1000000.0f * data->n_frames_since_update / elapsed;
839 "%s%.2f", s == 0 ? "" : ", ", data->fps);
843 data->accumulated_stats.stats[s]);
850 memset(&data->accumulated_stats, 0, sizeof(data->accumulated_stats));
851 data->n_frames_since_update = 0;
852 data->last_fps_update = now;
858 data->last_fps_update = now;
862 memset(&data->frame_stats, 0, sizeof(device_data->frame_stats));
864 data->last_present_time = now;
865 data->n_frames++;
866 data->n_frames_since_update++;
871 struct swapchain_data *data = (struct swapchain_data *) _data;
872 if ((ARRAY_SIZE(data->frames_stats) - _idx) > data->n_frames)
874 int idx = ARRAY_SIZE(data->frames_stats) +
875 data->n_frames < ARRAY_SIZE(data->frames_stats) ?
876 _idx - data->n_frames :
877 _idx + data->n_frames;
878 idx %= ARRAY_SIZE(data->frames_stats);
880 return data->frames_stats[idx].stats[data->stat_selector] / data->time_dividor;
885 struct swapchain_data *data = (struct swapchain_data *) _data;
886 if ((ARRAY_SIZE(data->frames_stats) - _idx) > data->n_frames)
888 int idx = ARRAY_SIZE(data->frames_stats) +
889 data->n_frames < ARRAY_SIZE(data->frames_stats) ?
890 _idx - data->n_frames :
891 _idx + data->n_frames;
892 idx %= ARRAY_SIZE(data->frames_stats);
893 return data->frames_stats[idx].stats[data->stat_selector];
896 static void position_layer(struct swapchain_data *data)
899 struct device_data *device_data = data->device;
904 ImGui::SetNextWindowSize(data->window_size, ImGuiCond_Always);
910 ImGui::SetNextWindowPos(ImVec2(data->width - data->window_size.x - margin, margin),
914 ImGui::SetNextWindowPos(ImVec2(margin, data->height - data->window_size.y - margin),
918 ImGui::SetNextWindowPos(ImVec2(data->width - data->window_size.x - margin,
919 data->height - data->window_size.y - margin),
925 static void compute_swapchain_display(struct swapchain_data *data)
927 struct device_data *device_data = data->device;
930 ImGui::SetCurrentContext(data->imgui_context);
932 position_layer(data);
938 const char *format_name = vk_Format_to_str(data->format);
943 ImGui::Text("Frames: %" PRIu64, data->n_frames);
945 ImGui::Text("FPS: %.2f" , data->fps);
949 data->stats_min.stats[s] = UINT64_MAX;
950 data->stats_max.stats[s] = 0;
952 for (uint32_t f = 0; f < MIN2(data->n_frames, ARRAY_SIZE(data->frames_stats)); f++) {
954 data->stats_min.stats[s] = MIN2(data->frames_stats[f].stats[s],
955 data->stats_min.stats[s]);
956 data->stats_max.stats[s] = MAX2(data->frames_stats[f].stats[s],
957 data->stats_max.stats[s]);
961 assert(data->stats_min.stats[s] != UINT64_MAX);
974 data->stat_selector = (enum overlay_param_enabled) s;
975 data->time_dividor = 1000.0f;
977 data->time_dividor = 1000000.0f;
983 double min_time = data->stats_min.stats[s] / data->time_dividor;
984 double max_time = data->stats_max.stats[s] / data->time_dividor;
985 ImGui::PlotHistogram(hash, get_time_stat, data,
986 ARRAY_SIZE(data->frames_stats), 0,
990 get_time_stat(data, ARRAY_SIZE(data->frames_stats) - 1),
993 ImGui::PlotHistogram(hash, get_stat, data,
994 ARRAY_SIZE(data->frames_stats), 0,
996 data->stats_min.stats[s],
997 data->stats_max.stats[s],
1000 get_stat(data, ARRAY_SIZE(data->frames_stats) - 1),
1001 data->stats_min.stats[s], data->stats_max.stats[s]);
1004 data->window_size = ImVec2(data->window_size.x, ImGui::GetCursorPosY() + 10.0f);
1010 static uint32_t vk_memory_type(struct device_data *data,
1015 data->instance->pd_vtable.GetPhysicalDeviceMemoryProperties(data->physical_device, &prop);
1022 static void ensure_swapchain_fonts(struct swapchain_data *data,
1025 if (data->font_uploaded)
1028 data->font_uploaded = true;
1030 struct device_data *device_data = data->device;
1044 NULL, &data->upload_font_buffer));
1047 data->upload_font_buffer,
1058 &data->upload_font_buffer_mem));
1060 data->upload_font_buffer,
1061 data->upload_font_buffer_mem, 0));
1066 data->upload_font_buffer_mem,
1071 range[0].memory = data->upload_font_buffer_mem;
1075 data->upload_font_buffer_mem);
1085 copy_barrier[0].image = data->font_image;
1102 data->upload_font_buffer,
1103 data->font_image,
1115 use_barrier[0].image = data->font_image;
1128 io.Fonts->TexID = (ImTextureID)(intptr_t)data->font_image;
1131 static void CreateOrResizeBuffer(struct device_data *data,
1138 data->vtable.DestroyBuffer(data->device, *buffer, NULL);
1140 data->vtable.FreeMemory(data->device, *buffer_memory, NULL);
1147 VK_CHECK(data->vtable.CreateBuffer(data->device, &buffer_info, NULL, buffer));
1150 data->vtable.GetBufferMemoryRequirements(data->device, *buffer, &req);
1155 vk_memory_type(data, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, req.memoryTypeBits);
1156 VK_CHECK(data->vtable.AllocateMemory(data->device, &alloc_info, NULL, buffer_memory));
1158 VK_CHECK(data->vtable.BindBufferMemory(data->device, *buffer, *buffer_memory, 0));
1162 static struct overlay_draw *render_swapchain_display(struct swapchain_data *data,
1172 struct device_data *device_data = data->device;
1173 struct overlay_draw *draw = get_overlay_draw(data);
1179 render_pass_info.renderPass = data->render_pass;
1180 render_pass_info.framebuffer = data->framebuffers[image_index];
1181 render_pass_info.renderArea.extent.width = data->width;
1182 render_pass_info.renderArea.extent.height = data->height;
1189 ensure_swapchain_fonts(data, draw->command_buffer);
1201 imb.image = data->images[image_index];
1238 /* Upload vertex & index data */
1265 device_data->vtable.CmdBindPipeline(draw->command_buffer, VK_PIPELINE_BIND_POINT_GRAPHICS, data->pipeline);
1266 VkDescriptorSet desc_set[1] = { data->descriptor_set };
1268 data->pipeline_layout, 0, 1, desc_set, 0, NULL);
1299 device_data->vtable.CmdPushConstants(draw->command_buffer, data->pipeline_layout,
1302 device_data->vtable.CmdPushConstants(draw->command_buffer, data->pipeline_layout,
1346 imb.image = data->images[image_index];
1425 static void setup_swapchain_data_pipeline(struct swapchain_data *data)
1427 struct device_data *device_data = data->device;
1457 NULL, &data->font_sampler));
1470 NULL, &data->descriptor_pool));
1473 VkSampler sampler[1] = { data->font_sampler };
1485 NULL, &data->descriptor_layout));
1490 alloc_info.descriptorPool = data->descriptor_pool;
1492 alloc_info.pSetLayouts = &data->descriptor_layout;
1495 &data->descriptor_set));
1507 layout_info.pSetLayouts = &data->descriptor_layout;
1512 NULL, &data->pipeline_layout));
1607 info.layout = data->pipeline_layout;
1608 info.renderPass = data->render_pass;
1612 NULL, &data->pipeline));
1638 NULL, &data->font_image));
1641 data->font_image, &font_image_req);
1649 NULL, &data->font_mem));
1651 data->font_image,
1652 data->font_mem, 0));
1657 view_info.image = data->font_image;
1664 NULL, &data->font_image_view));
1668 desc_image[0].sampler = data->font_sampler;
1669 desc_image[0].imageView = data->font_image_view;
1673 write_desc[0].dstSet = data->descriptor_set;
1680 static void setup_swapchain_data(struct swapchain_data *data,
1683 data->width = pCreateInfo->imageExtent.width;
1684 data->height = pCreateInfo->imageExtent.height;
1685 data->format = pCreateInfo->imageFormat;
1687 data->imgui_context = ImGui::CreateContext();
1688 ImGui::SetCurrentContext(data->imgui_context);
1691 ImGui::GetIO().DisplaySize = ImVec2((float)data->width, (float)data->height);
1693 struct device_data *device_data = data->device;
1729 NULL, &data->render_pass));
1731 setup_swapchain_data_pipeline(data);
1734 data->swapchain,
1735 &data->n_images,
1738 data->images = ralloc_array(data, VkImage, data->n_images);
1739 data->image_views = ralloc_array(data, VkImageView, data->n_images);
1740 data->framebuffers = ralloc_array(data, VkFramebuffer, data->n_images);
1743 data->swapchain,
1744 &data->n_images,
1745 data->images));
1757 for (uint32_t i = 0; i < data->n_images; i++) {
1758 view_info.image = data->images[i];
1761 &data->image_views[i]));
1768 fb_info.renderPass = data->render_pass;
1771 fb_info.width = data->width;
1772 fb_info.height = data->height;
1774 for (uint32_t i = 0; i < data->n_images; i++) {
1775 attachment[0] = data->image_views[i];
1777 NULL, &data->framebuffers[i]));
1787 NULL, &data->command_pool));
1790 static void shutdown_swapchain_data(struct swapchain_data *data)
1792 struct device_data *device_data = data->device;
1794 list_for_each_entry_safe(struct overlay_draw, draw, &data->draws, link) {
1804 for (uint32_t i = 0; i < data->n_images; i++) {
1805 device_data->vtable.DestroyImageView(device_data->device, data->image_views[i], NULL);
1806 device_data->vtable.DestroyFramebuffer(device_data->device, data->framebuffers[i], NULL);
1809 device_data->vtable.DestroyRenderPass(device_data->device, data->render_pass, NULL);
1811 device_data->vtable.DestroyCommandPool(device_data->device, data->command_pool, NULL);
1813 device_data->vtable.DestroyPipeline(device_data->device, data->pipeline, NULL);
1814 device_data->vtable.DestroyPipelineLayout(device_data->device, data->pipeline_layout, NULL);
1817 data->descriptor_pool, NULL);
1819 data->descriptor_layout, NULL);
1821 device_data->vtable.DestroySampler(device_data->device, data->font_sampler, NULL);
1822 device_data->vtable.DestroyImageView(device_data->device, data->font_image_view, NULL);
1823 device_data->vtable.DestroyImage(device_data->device, data->font_image, NULL);
1824 device_data->vtable.FreeMemory(device_data->device, data->font_mem, NULL);
1826 device_data->vtable.DestroyBuffer(device_data->device, data->upload_font_buffer, NULL);
1827 device_data->vtable.FreeMemory(device_data->device, data->upload_font_buffer_mem, NULL);
1829 ImGui::DestroyContext(data->imgui_context);
2447 "This could lead to invalid data.\n");
2487 "This could lead to invalid data.\n");
2607 * capturing fps data right away.