[Mesa-dev] [PATCH v2 09/11] intel: tools: add aubinator viewer

Lionel Landwerlin lionel.g.landwerlin at intel.com
Wed Aug 8 08:46:48 UTC 2018


On 08/08/18 00:42, Rafael Antognolli wrote:
> On Tue, Aug 07, 2018 at 06:35:20PM +0100, Lionel Landwerlin wrote:
>> A graphical user interface version of aubinator.
>> Allows you to :
>>
>>     - simultaneously look at multiple points in the aub file (using all
>>       the goodness of the existing decoding in aubinator)
>>
>>     - edit an aub file
>>
>> Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
>> ---
>>   src/intel/tools/aubinator_viewer.cpp         | 1118 ++++++++++++++++++
>>   src/intel/tools/aubinator_viewer.h           |   71 ++
>>   src/intel/tools/aubinator_viewer_decoder.cpp |  860 ++++++++++++++
>>   src/intel/tools/imgui/imgui_memory_editor.h  |  704 +++++++++++
>>   src/intel/tools/meson.build                  |   12 +
>>   5 files changed, 2765 insertions(+)
>>   create mode 100644 src/intel/tools/aubinator_viewer.cpp
>>   create mode 100644 src/intel/tools/aubinator_viewer.h
>>   create mode 100644 src/intel/tools/aubinator_viewer_decoder.cpp
>>   create mode 100644 src/intel/tools/imgui/imgui_memory_editor.h
>>
> [...]
>
>> +int main(int argc, char *argv[])
>> +{
>> +   int c, i;
>> +   bool help = false;
>> +   const struct option aubinator_opts[] = {
>> +      { "help",          no_argument,       (int *) &help,                 true },
>> +      { "xml",           required_argument, NULL,                          'x' },
>> +      { NULL,            0,                 NULL,                          0 }
>> +   };
>> +
>> +   memset(&context, 0, sizeof(context));
>> +
>> +   i = 0;
>> +   while ((c = getopt_long(argc, argv, "x:s:", aubinator_opts, &i)) != -1) {
>> +      switch (c) {
>> +      case 'x':
>> +         context.xml_path = strdup(optarg);
>> +         break;
>> +      default:
>> +         break;
>> +      }
>> +   }
>> +
>> +   if (optind < argc)
>> +      context.input_file = argv[optind];
>> +
>> +   if (help || !context.input_file) {
>> +      print_help(argv[0], stderr);
>> +      exit(0);
>> +   }
>> +
>> +   context.file = aub_file_open(context.input_file);
>> +
>> +   gtk_init(NULL, NULL);
>> +
>> +   context.gtk_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
>> +   gtk_window_set_title(GTK_WINDOW(context.gtk_window), "GPUTop");
> Ah, I guess this is why I'm seeing "GPUTop" at the title bar :P

Lol... Shamelessly stolen :)

>
>> +   g_signal_connect(context.gtk_window, "delete-event", G_CALLBACK(gtk_main_quit), NULL);
>> +   gtk_window_resize(GTK_WINDOW(context.gtk_window), 1280, 720);
>> +
>> +   GtkWidget* gl_area = gtk_gl_area_new();
>> +   g_signal_connect(gl_area, "render", G_CALLBACK(repaint_area), NULL);
>> +   gtk_container_add(GTK_CONTAINER(context.gtk_window), gl_area);
>> +
>> +   gtk_widget_show_all(context.gtk_window);
>> +
>> +   ImGui::CreateContext();
>> +   ImGui_ImplGtk3_Init(gl_area, true);
>> +   ImGui_ImplOpenGL3_Init("#version 130");
>> +
>> +   init_ui();
>> +
>> +   gtk_main();
>> +
>> +   ImGui_ImplOpenGL3_Shutdown();
>> +   ImGui_ImplGtk3_Shutdown();
>> +   ImGui::DestroyContext();
>> +
>> +   free(context.xml_path);
>> +
>> +   return EXIT_SUCCESS;
>> +}
> I'm not sure what's going on here, but now when I close the window by
> clicking on the "x" at the top right I see this message:
>
> aubinator_viewer: ../../src/libepoxy/src/dispatch_common.c:863: epoxy_get_proc_address: Assertion `0 && "Couldn't find current GLX or EGL context.\n"' failed.
>
> That's the only issue I've seen so far, and since it's only when closing
> the window, I guess we can fix that later.
>
Oh yeah, missed that.
I found the fix : just need to call the create/destroy functions in a 
realize/unrealize vfunc of the GLArea.
Otherwise the underlying GL context might be destroy before we call 
those functions.

Fixed locally!

-
Lionel


More information about the mesa-dev mailing list