{"id":1010,"date":"2021-02-09T11:47:09","date_gmt":"2021-02-09T08:47:09","guid":{"rendered":"https:\/\/blog.andresgomez.org\/?p=1010"},"modified":"2021-02-09T11:47:09","modified_gmt":"2021-02-09T08:47:09","slug":"replaying-3d-traces-with-piglit","status":"publish","type":"post","link":"https:\/\/blog.andresgomez.org\/es\/2021\/02\/09\/replaying-3d-traces-with-piglit\/","title":{"rendered":"Replaying 3D traces with piglit"},"content":{"rendered":"\n<hr class=\"wp-block-separator is-style-dots\"\/>\n\n\n\n<p>If you don&#8217;t know what is <em>traces based rendering regression testing<\/em>, read the <a href=\"#appendix\" data-type=\"internal\" data-id=\"#appendix\">appendix<\/a> before continuing.<\/p>\n\n\n\n<hr class=\"wp-block-separator is-style-dots\"\/>\n\n\n\n<p>The <a rel=\"noreferrer noopener\" href=\"https:\/\/www.mesa3d.org\/\" data-type=\"URL\" data-id=\"https:\/\/www.mesa3d.org\/\" target=\"_blank\">Mesa<\/a> community has witnessed an explosion of the <em>Continuous Integration<\/em> interest in the last two years.<\/p>\n\n\n\n<p>In addition to checking the proper building of the project, integrating the testing of its functional correctness has become a priority. The user space graphics drivers exhibit a wide variety of types of tests and test suites. One kind of those tests are the traces based rendering regression testing.<\/p>\n\n\n\n<p>The public effort to add this kind of tests into Mesa&#8217;s CI started with <a rel=\"noreferrer noopener\" href=\"https:\/\/lists.freedesktop.org\/archives\/mesa-dev\/2019-September\/223581.html\" data-type=\"URL\" data-id=\"https:\/\/lists.freedesktop.org\/archives\/mesa-dev\/2019-September\/223581.html\" target=\"_blank\">this mail<\/a> from <a rel=\"noreferrer noopener\" href=\"https:\/\/afrantzis.com\/\" data-type=\"URL\" data-id=\"https:\/\/afrantzis.com\/\" target=\"_blank\">Alexandros Frantzis<\/a>.<\/p>\n\n\n\n<p>At some point, we had support for replaying OpenGL, Vulkan and D3D11 traces using <a rel=\"noreferrer noopener\" href=\"https:\/\/apitrace.github.io\/\" data-type=\"URL\" data-id=\"https:\/\/apitrace.github.io\/\" target=\"_blank\">apitrace<\/a>, <a rel=\"noreferrer noopener\" href=\"https:\/\/renderdoc.org\/\" data-type=\"URL\" data-id=\"https:\/\/renderdoc.org\/\" target=\"_blank\">RenderDoc<\/a> and <a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/LunarG\/gfxreconstruct\" data-type=\"URL\" data-id=\"https:\/\/github.com\/LunarG\/gfxreconstruct\" target=\"_blank\">GFXReconstruct<\/a> with the in-tree tool <em>tracie<\/em>. However, it was a very custom solution made to the needs of Mesa so I proposed to move this codebase and integrate it into the <a rel=\"noreferrer noopener\" href=\"https:\/\/gitlab.freedesktop.org\/mesa\/piglit\" data-type=\"URL\" data-id=\"https:\/\/gitlab.freedesktop.org\/mesa\/piglit\" target=\"_blank\">piglit<\/a> test suite. It was a natural step forward.<\/p>\n\n\n\n<p>This is how <a href=\"https:\/\/gitlab.freedesktop.org\/mesa\/piglit\/-\/blob\/6566714d2a68efab97f03fb648162976fbf7c89c\/\/replayer\" data-type=\"URL\" data-id=\"https:\/\/gitlab.freedesktop.org\/mesa\/piglit\/-\/blob\/6566714d2a68efab97f03fb648162976fbf7c89c\/\/replayer\" target=\"_blank\" rel=\"noreferrer noopener\">replayer<\/a> was born into piglit.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">replayer<\/h2>\n\n\n\n<p>The first step to test a trace is, actually, obtaining a trace. I won&#8217;t go into the details about how to create one from scratch. The process is well documented on each of the tools listed above. However, the Mesa community has been collecting publicly distributable traces for a while and placing them in <a rel=\"noreferrer noopener\" href=\"https:\/\/gitlab.freedesktop.org\/gfx-ci\/tracie\/traces-db\" data-type=\"URL\" data-id=\"https:\/\/gitlab.freedesktop.org\/gfx-ci\/tracie\/traces-db\" target=\"_blank\">traces-db<\/a> whose CI is copying them to Freedesktop.org&#8217;s <a rel=\"noreferrer noopener\" href=\"https:\/\/minio-packet.freedesktop.org\/mesa-tracie-public\/\" data-type=\"URL\" data-id=\"https:\/\/minio-packet.freedesktop.org\/mesa-tracie-public\/\" target=\"_blank\">MinIO instance<\/a>.<\/p>\n\n\n\n<p>To make things simple, once we have built and installed piglit, if we would like to test an apitrace created OpenGL trace, we can download from there with:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ replayer.py download \\\n \t --download-url https:\/\/minio-packet.freedesktop.org\/mesa-tracie-public\/ \\\n \t --db-path .\/traces-db \\\n \t --force-download \\\n \t glxgears\/glxgears-2.trace<\/code><\/pre>\n\n\n\n<p>The parameters are self explanatory. The downloaded trace will now exist at <code>.\/traces-db\/glxgears\/glxgears-2.trace<\/code>.<\/p>\n\n\n\n<p>The next step will be to dump an image from the trace. Since it is a <code>.trace<\/code> file we will need to have apitrace installed in the system. If we do not specify the call(s) from which to dump the image(s), we will just get the last frame of the trace:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ replayer.py dump .\/traces-db\/glxgears\/glxgears-2.trace<\/code><\/pre>\n\n\n\n<p>The dumped PNG image will be at <code>.\/results\/glxgears-2.trace-0000001413.png<\/code>. Notice, the number suffix is the snapshot id from the trace.<\/p>\n\n\n\n<p>Dumping from a trace may result in a range of different possible images. One example is when the trace makes use of uninitialized values, leading to undefined behaviors.<\/p>\n\n\n\n<p>However, since the original aim was performing <strong>pre-merge<\/strong> rendering regression testing in Mesa&#8217;s CI, the idea is that replaying any of the provided traces would be quick and the dumped image will be consistent. In other words, if we would dump several times the same frame of a trace with the same GFX stack, the image will always be the same.<\/p>\n\n\n\n<p>With this precondition, we can test whether 2 different images are the same just by doing a hash of its content. replayer can obtain the hash for the generated dumped image:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ replayer.py checksum .\/results\/glxgears-2.trace-0000001413.png \nf8eba0fec6e3e0af9cb09844bc73bdc8<\/code><\/pre>\n\n\n\n<p>Now, if we would build a different commit of Mesa, we could check the generated image at this new point against the previously generated <strong>reference image<\/strong>. If everything goes well, we will see something like:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ replayer.py compare trace \\\n \t --download-url https:\/\/minio-packet.freedesktop.org\/mesa-tracie-public\/ \\\n \t --device-name gl-vmware-llvmpipe \\\n \t --db-path .\/traces-db \\\n \t --keep-image \\\n \t glxgears\/glxgears-2.trace f8eba0fec6e3e0af9cb09844bc73bdc8\n&#91;dump_trace_images] Info: Dumping trace .\/traces-db\/glxgears\/glxgears-2.trace...\n&#91;dump_trace_images] Running: apitrace dump --calls=frame .\/traces-db\/glxgears\/glxgears-2.trace\n\/\/ process.name = \"\/usr\/bin\/glxgears\"\n1384 glXSwapBuffers(dpy = 0x56060e921f80, drawable = 31457282)\n\n1413 glXSwapBuffers(dpy = 0x56060e921f80, drawable = 31457282)\n\nerror: drawable failed to resize: expected 1515x843, got 300x300\n&#91;dump_trace_images] Running: eglretrace --headless --snapshot=1413 --snapshot-prefix=.\/results\/trace\/gl-vmware-llvmpipe\/glxgears\/glxgears-2.trace- .\/blog-traces-db\/glxgears\/glxgears-2.trace\nWrote .\/results\/trace\/gl-vmware-llvmpipe\/glxgears\/glxgears-2.trace-0000001413.png\n\nOK\n&#91;check_image]\n    actual: f8eba0fec6e3e0af9cb09844bc73bdc8\n  expected: f8eba0fec6e3e0af9cb09844bc73bdc8\n&#91;check_image] Images match for:\n  glxgears\/glxgears-2.trace\n\nPIGLIT: {\"images\": &#91;{\"image_desc\": \"glxgears\/glxgears-2.trace\", \"image_ref\": \"f8eba0fec6e3e0af9cb09844bc73bdc8.png\", \"image_render\": \".\/results\/trace\/gl-vmware-llvmpipe\/glxgears\/glxgears-2.trace-0000001413-f8eba0fec6e3e0af9cb09844bc73bdc8.png\"}], \"result\": \"pass\"}<\/code><\/pre>\n\n\n\n<p><em>replayer<\/em>&#8216;s <em>compare<\/em> subcommand is the one spitting a piglit formatted test expectations output.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Putting everything together<\/h3>\n\n\n\n<p id=\"replayer-compare-yaml-example\">We can make the whole process way simpler by passing the replayer a YAML tests list file. For example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ cat testing-traces.yml\ntraces-db:\n  download-url: https:\/\/minio-packet.freedesktop.org\/mesa-tracie-public\/\n\ntraces:\n  - path: gputest\/triangle.trace\n    expectations:\n      - device: gl-vmware-llvmpipe\n        checksum: c8848dec77ee0c55292417f54c0a1a49\n  - path: glxgears\/glxgears-2.trace\n    expectations:\n      - device: gl-vmware-llvmpipe\n        checksum: f53ac20e17da91c0359c31f2fa3f401e\n$ replayer.py compare yaml \\\n \t --device-name gl-vmware-llvmpipe \\\n \t --yaml-file testing-traces.yml \n&#91;check_image] Downloading file gputest\/triangle.trace took 5s.\n&#91;dump_trace_images] Info: Dumping trace .\/replayer-db\/gputest\/triangle.trace...\n&#91;dump_trace_images] Running: apitrace dump --calls=frame .\/replayer-db\/gputest\/triangle.trace\n\/\/ process.name = \"\/home\/anholt\/GpuTest_Linux_x64_0.7.0\/GpuTest\"\n397 glXSwapBuffers(dpy = 0x7f0ad0005a90, drawable = 56623106)\n\n510 glXSwapBuffers(dpy = 0x7f0ad0005a90, drawable = 56623106)\n\n\n\/home\/anholt\/GpuTest_Linux_x64_0.7.0\/GpuTest\n&#91;dump_trace_images] Running: eglretrace --headless --snapshot=510 --snapshot-prefix=.\/results\/trace\/gl-vmware-llvmpipe\/gputest\/triangle.trace- .\/replayer-db\/gputest\/triangle.trace\nWrote .\/results\/trace\/gl-vmware-llvmpipe\/gputest\/triangle.trace-0000000510.png\n\nOK\n&#91;check_image]\n    actual: c8848dec77ee0c55292417f54c0a1a49\n  expected: c8848dec77ee0c55292417f54c0a1a49\n&#91;check_image] Images match for:\n  gputest\/triangle.trace\n\n&#91;check_image] Downloading file glxgears\/glxgears-2.trace took 5s.\n&#91;dump_trace_images] Info: Dumping trace .\/replayer-db\/glxgears\/glxgears-2.trace...\n&#91;dump_trace_images] Running: apitrace dump --calls=frame .\/replayer-db\/glxgears\/glxgears-2.trace\n\/\/ process.name = \"\/usr\/bin\/glxgears\"\n1384 glXSwapBuffers(dpy = 0x56060e921f80, drawable = 31457282)\n\n1413 glXSwapBuffers(dpy = 0x56060e921f80, drawable = 31457282)\n\n\n\/usr\/bin\/glxgears\nerror: drawable failed to resize: expected 1515x843, got 300x300\n&#91;dump_trace_images] Running: eglretrace --headless --snapshot=1413 --snapshot-prefix=.\/results\/trace\/gl-vmware-llvmpipe\/glxgears\/glxgears-2.trace- .\/replayer-db\/glxgears\/glxgears-2.trace\nWrote .\/results\/trace\/gl-vmware-llvmpipe\/glxgears\/glxgears-2.trace-0000001413.png\n\nOK\n&#91;check_image]\n    actual: f8eba0fec6e3e0af9cb09844bc73bdc8\n  expected: f8eba0fec6e3e0af9cb09844bc73bdc8\n&#91;check_image] Images match for:\n  glxgears\/glxgears-2.trace<\/code><\/pre>\n\n\n\n<p><em>replayer<\/em> features also the <em>query<\/em> subcommand, which is just a helper to read the YAML files with the tests configuration.<\/p>\n\n\n\n<p>Testing the other kind of supported 3D traces doesn&#8217;t change much from what&#8217;s shown here. Just make sure to have the needed tools installed: RenderDoc, GFXReconstruct, the <a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/LunarG\/VulkanTools\/blob\/98f7c5f4268cdccb43ad03b8a55492286cac8b91\/layersvt\/screenshot_layer.md\" data-type=\"URL\" data-id=\"https:\/\/github.com\/LunarG\/VulkanTools\/blob\/98f7c5f4268cdccb43ad03b8a55492286cac8b91\/layersvt\/screenshot_layer.md\" target=\"_blank\">VK_LAYER_LUNARG_screenshot<\/a> layer, <a rel=\"noreferrer noopener\" href=\"http:\/\/98f7c5f4268cdccb43ad03b8a55492286cac8b91\" data-type=\"URL\" target=\"_blank\" data-id=\"98f7c5f4268cdccb43ad03b8a55492286cac8b91\">Wine<\/a> and <a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/doitsujin\/dxvk\" data-type=\"URL\" target=\"_blank\" data-id=\"https:\/\/github.com\/doitsujin\/dxvk\">DXVK<\/a>. A good reference for building, installing and configuring these tools are Mesa&#8217;s <a rel=\"noreferrer noopener\" href=\"https:\/\/gitlab.freedesktop.org\/mesa\/mesa\/-\/blob\/eff837c7c2de627545dd9197d09f6ff337e68456\/.gitlab-ci\/container\/x86_test-gl.sh\" data-type=\"URL\" target=\"_blank\" data-id=\"https:\/\/gitlab.freedesktop.org\/mesa\/mesa\/-\/blob\/eff837c7c2de627545dd9197d09f6ff337e68456\/.gitlab-ci\/container\/x86_test-gl.sh\">GL<\/a> and <a rel=\"noreferrer noopener\" href=\"https:\/\/gitlab.freedesktop.org\/mesa\/mesa\/-\/blob\/eff837c7c2de627545dd9197d09f6ff337e68456\/.gitlab-ci\/container\/x86_test-vk.sh\" data-type=\"URL\" target=\"_blank\">VK<\/a> test containers building scripts.<\/p>\n\n\n\n<p><em>replayer<\/em> also accepts several configurations to tweak how to behave and where to find the actual tracing tools needed for replaying the different types of traces. Make sure to check the <em>replay<\/em> section in piglit&#8217;s <a rel=\"noreferrer noopener\" href=\"https:\/\/gitlab.freedesktop.org\/mesa\/piglit\/-\/blob\/6566714d2a68efab97f03fb648162976fbf7c89c\/piglit.conf.example#L196\" data-type=\"URL\" data-id=\"https:\/\/gitlab.freedesktop.org\/mesa\/piglit\/-\/blob\/6566714d2a68efab97f03fb648162976fbf7c89c\/piglit.conf.example#L196\" target=\"_blank\">configuration example file<\/a>.<\/p>\n\n\n\n<p><em>replayer<\/em>&#8216;s <a href=\"https:\/\/gitlab.freedesktop.org\/mesa\/piglit\/-\/blob\/6566714d2a68efab97f03fb648162976fbf7c89c\/replayer\/README.md\" data-type=\"URL\" data-id=\"https:\/\/gitlab.freedesktop.org\/mesa\/piglit\/-\/blob\/6566714d2a68efab97f03fb648162976fbf7c89c\/replayer\/README.md\" target=\"_blank\" rel=\"noreferrer noopener\">README.md<\/a> file is also a good read for further information.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">piglit<\/h2>\n\n\n\n<p><em>replayer<\/em> is a test runner in a similar fashion to <em>shader_runner<\/em> or <em>glslparsertest<\/em>. We are now missing how does it integrate so we can do <em>piglit runs<\/em> which will produce piglit formatted results.<\/p>\n\n\n\n<p>This is done through the <a href=\"https:\/\/gitlab.freedesktop.org\/mesa\/piglit\/-\/blob\/6566714d2a68efab97f03fb648162976fbf7c89c\/tests\/replay.py\" data-type=\"URL\" data-id=\"https:\/\/gitlab.freedesktop.org\/mesa\/piglit\/-\/blob\/6566714d2a68efab97f03fb648162976fbf7c89c\/tests\/replay.py\" target=\"_blank\" rel=\"noreferrer noopener\">replay<\/a> test profile.<\/p>\n\n\n\n<p>This profile needs a couple configuration values. Easiest is just to set the <code>PIGLIT_REPLAY_DESCRIPTION_FILE<\/code> and <code>PIGLIT_REPLAY_DEVICE_NAME<\/code> env variables. They are self explanatory, but make sure to check the <a rel=\"noreferrer noopener\" href=\"https:\/\/gitlab.freedesktop.org\/mesa\/piglit\/-\/blob\/6566714d2a68efab97f03fb648162976fbf7c89c\/tests\/replay.py#L32\" data-type=\"URL\" target=\"_blank\">documentation<\/a> for this and other configuration options for this profile.<\/p>\n\n\n\n<p>The following example features a similar run to <a href=\"#replayer-compare-yaml-example\" data-type=\"internal\" data-id=\"#replayer-compare-yaml-example\">the one done above<\/a> invoking directly replayer but with piglit integration, providing formatted results:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ PIGLIT_REPLAY_DESCRIPTION_FILE=testing-traces.yml PIGLIT_REPLAY_DEVICE_NAME=gl-vmware-llvmpipe piglit run replay -n replay-example replay-results\n&#91;2\/2] pass: 2   \nThank you for running Piglit!\nResults have been written to replay-results<\/code><\/pre>\n\n\n\n<p>We can create some summary based on the results:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># piglit summary console replay-results\/\ntrace\/gl-vmware-llvmpipe\/glxgears\/glxgears-2.trace: pass\ntrace\/gl-vmware-llvmpipe\/gputest\/triangle.trace: pass\nsummary:\n       name: replay-example\n       ----  --------------\n       pass:              2\n       fail:              0\n      crash:              0\n       skip:              0\n    timeout:              0\n       warn:              0\n incomplete:              0\n dmesg-warn:              0\n dmesg-fail:              0\n    changes:              0\n      fixes:              0\nregressions:              0\n      total:              2\n       time:       00:00:00<\/code><\/pre>\n\n\n\n<p>Creating an HTML summary may be also interesting, specially when finding failures!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Wishlist<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>Through different backends, <em>replayer<\/em> supports running <a rel=\"noreferrer noopener\" href=\"https:\/\/gitlab.freedesktop.org\/mesa\/piglit\/-\/blob\/6566714d2a68efab97f03fb648162976fbf7c89c\/framework\/replay\/backends\/apitrace.py\" data-type=\"URL\" data-id=\"https:\/\/gitlab.freedesktop.org\/mesa\/piglit\/-\/blob\/6566714d2a68efab97f03fb648162976fbf7c89c\/framework\/replay\/backends\/apitrace.py\" target=\"_blank\">apitrace<\/a>, <a rel=\"noreferrer noopener\" href=\"https:\/\/gitlab.freedesktop.org\/mesa\/piglit\/-\/blob\/6566714d2a68efab97f03fb648162976fbf7c89c\/framework\/replay\/backends\/renderdoc.py\" data-type=\"URL\" data-id=\"https:\/\/gitlab.freedesktop.org\/mesa\/piglit\/-\/blob\/6566714d2a68efab97f03fb648162976fbf7c89c\/framework\/replay\/backends\/renderdoc.py\" target=\"_blank\">RenderDoc<\/a> and <a rel=\"noreferrer noopener\" href=\"https:\/\/gitlab.freedesktop.org\/mesa\/piglit\/-\/blob\/6566714d2a68efab97f03fb648162976fbf7c89c\/framework\/replay\/backends\/gfxreconstruct.py\" data-type=\"URL\" data-id=\"https:\/\/gitlab.freedesktop.org\/mesa\/piglit\/-\/blob\/6566714d2a68efab97f03fb648162976fbf7c89c\/framework\/replay\/backends\/gfxreconstruct.py\" target=\"_blank\">GFXReconstruct<\/a> traces. We may want to support other tracing tools in the future. The <a rel=\"noreferrer noopener\" href=\"https:\/\/gitlab.freedesktop.org\/mesa\/piglit\/-\/blob\/6566714d2a68efab97f03fb648162976fbf7c89c\/functionaltests\/framework\/replay\/programs\/backends\/testtrace.py\" data-type=\"URL\" data-id=\"https:\/\/gitlab.freedesktop.org\/mesa\/piglit\/-\/blob\/6566714d2a68efab97f03fb648162976fbf7c89c\/functionaltests\/framework\/replay\/programs\/backends\/testtrace.py\" target=\"_blank\">dummy backend<\/a> used for functional testing is a good starting point when writing a new backend.<\/li><li>The solution chosen for checking whether we detect a rendering regression is dependent on having consistent results, as said before. It&#8217;d be great if we could add a secondary testing method whenever the expected rendered image is variable. From the top of my head, using exclusion masks could be a quick single-run solution when we know which specific areas in a rendered scenario are the ones fluctuating. For more complex variations, a multi-run based solution seems to be the best option. EzBench has a <a rel=\"noreferrer noopener\" href=\"https:\/\/gitlab.freedesktop.org\/gfx-ci\/ezbench\/-\/blob\/b51644bf65962aba58d6f46b9da582c5aa661148\/python-modules\/ezbench\/imgcmp.py\" data-type=\"URL\" data-id=\"https:\/\/gitlab.freedesktop.org\/gfx-ci\/ezbench\/-\/blob\/b51644bf65962aba58d6f46b9da582c5aa661148\/python-modules\/ezbench\/imgcmp.py\" target=\"_blank\">great<\/a> statistical <a rel=\"noreferrer noopener\" href=\"https:\/\/gitlab.freedesktop.org\/gfx-ci\/ezbench\/-\/blob\/b51644bf65962aba58d6f46b9da582c5aa661148\/python-modules\/ezbench\/report.py#L736\" data-type=\"URL\" data-id=\"https:\/\/gitlab.freedesktop.org\/gfx-ci\/ezbench\/-\/blob\/b51644bf65962aba58d6f46b9da582c5aa661148\/python-modules\/ezbench\/report.py#L736\" target=\"_blank\">approach<\/a> for this!<\/li><li>The current syntax of the YAML test list files implies running the <em>compare<\/em> subcommand with the default behavior of checking against the last frame of the tested trace. This means figuring out which call number is the one of the last frame first. It would be great to support providing the call numbers directly in the YAML files to be able to test more than just the last frame and, additionally, cut down the time taken to run the test.<\/li><li>The HTML generated summary allows us to see the reference and generated image during a test run side to side when it fails. It&#8217;d be great to have also some easy way of checking its differences. Using <a rel=\"noreferrer noopener\" href=\"http:\/\/rembrandtjs.com\/\" data-type=\"URL\" data-id=\"http:\/\/rembrandtjs.com\/\" target=\"_blank\">Rembrandt.js<\/a> could be a possible solution.<\/li><\/ul>\n\n\n\n<hr class=\"wp-block-separator is-style-dots\"\/>\n\n\n\n<p>Thanks a lot to the whole Mesa community for helping with the creation of this tool. Alexandros Frantzis, <a href=\"https:\/\/kshadeslayer.wordpress.com\/\" data-type=\"URL\" data-id=\"https:\/\/kshadeslayer.wordpress.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">Rohan Garg<\/a> and <a href=\"https:\/\/kshadeslayer.wordpress.com\/\" data-type=\"URL\" data-id=\"https:\/\/kshadeslayer.wordpress.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">Tomeu Vizoso<\/a> did a lot of the initial development for the in-tree <em>tracie<\/em> tool while Dylan Baker was very patient while reviewing my patches for the piglit integration.<\/p>\n\n\n\n<p>Finally, thanks to <a rel=\"noreferrer noopener\" href=\"https:\/\/www.igalia.com\" data-type=\"URL\" data-id=\"https:\/\/www.igalia.com\" target=\"_blank\">Igalia<\/a> for allowing me to work in this.<\/p>\n\n\n\n<hr class=\"wp-block-separator is-style-default\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"appendix\">Appendix<\/h2>\n\n\n\n<p>In 3D computer graphics we say <em>\u00abtraces\u00bb<\/em>, for short, to name the files generated by 3D APIs capturing tools which store not only the calls to the specific 3D API but also the internal state of the 3D program during the capturing process: shaders, textures, buffers, etc.<\/p>\n\n\n\n<p>Being able to \u00abrecord\u00bb the execution of a 3D program is very useful. Usually, it will allow us to replay the execution without the need of the original program from which we generated the trace, it will also allow in-depth analysis for debugging and performance optimization, it&#8217;s a very good solution for sharing with other developers, and, in some cases, will allow us to check how the replay will happen with different GPUs.<\/p>\n\n\n\n<p>In this post, however, I focus in a specific usage: <strong>rendering regression testing<\/strong>.<\/p>\n\n\n\n<p>When doing a regression test what we would do is compare a specific metric obtained by replaying the trace with a specific version of the GFX software stack against the same metric obtained from a different version of the GFX stack. If the value of the metric changes we have found a regression (or an improvement!).<\/p>\n\n\n\n<p>To make things simpler, we would like to check changes happening just in one of the many elements of the software stack. The most relevant component is the <em>user space driver<\/em>. In particular, I care about the Mesa drivers and the GNU\/Linux stack.<\/p>\n\n\n\n<p>Mainly, there are two kinds of regression testing we can do with a trace: <em>performance<\/em> or <em>rendering regression testing<\/em>. When doing a performance one, the checked metric(s) usually are in terms of speed or memory usage. In the case of the rendering ones what we would do is comparing the rendered output at one (or many) point during the trace replay. This output, a bitmap image, is the metric that we will compare in between two different points of the Mesa driver. If the images differ, we may have found a regression; artifacts, improper colors, etc, or an enhancement, if the reference image is the one featuring any of these problems.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you don&#8217;t know what is traces based rendering regression testing, read the appendix before continuing. The Mesa community has witnessed an explosion of the Continuous Integration interest in the last two years. In addition to checking the proper building &hellip; <a href=\"https:\/\/blog.andresgomez.org\/es\/2021\/02\/09\/replaying-3d-traces-with-piglit\/\">Sigue leyendo <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27,4,6,26,7,9,23,12],"tags":[33,29,31,34,32],"class_list":["post-1010","post","type-post","status-publish","format-standard","hentry","category-3d","category-english","category-free-software","category-freedesktop","category-general","category-igaliacom","category-multimedia","category-planetigaliacom","tag-ci","tag-mesa","tag-opengl","tag-testing","tag-vulkan"],"_links":{"self":[{"href":"https:\/\/blog.andresgomez.org\/es\/wp-json\/wp\/v2\/posts\/1010"}],"collection":[{"href":"https:\/\/blog.andresgomez.org\/es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.andresgomez.org\/es\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.andresgomez.org\/es\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.andresgomez.org\/es\/wp-json\/wp\/v2\/comments?post=1010"}],"version-history":[{"count":8,"href":"https:\/\/blog.andresgomez.org\/es\/wp-json\/wp\/v2\/posts\/1010\/revisions"}],"predecessor-version":[{"id":1021,"href":"https:\/\/blog.andresgomez.org\/es\/wp-json\/wp\/v2\/posts\/1010\/revisions\/1021"}],"wp:attachment":[{"href":"https:\/\/blog.andresgomez.org\/es\/wp-json\/wp\/v2\/media?parent=1010"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.andresgomez.org\/es\/wp-json\/wp\/v2\/categories?post=1010"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.andresgomez.org\/es\/wp-json\/wp\/v2\/tags?post=1010"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}