Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I help out with improving the state of the Mesa driver? #13

Open
astillich opened this issue May 11, 2021 · 12 comments
Open

Can I help out with improving the state of the Mesa driver? #13

astillich opened this issue May 11, 2021 · 12 comments

Comments

@astillich
Copy link

As the title says. What needs to be done and how could I help out on the development side? I have experience in C and GL, but find it hard to figure out where to start. Also: the compile-time dependency to the grate version of libdrm was removed, but I still need to have it around at runtime, correct?

@kusma
Copy link
Member

kusma commented May 12, 2021

Hey. The major blocker right now is s proper fragment shader IR. I've actually carved out some time at work to take a crack at getting something working, but it's probably not going to get us all the way there.

If you have experience in writing compiler backends or are interested in learning about it, I would love some help here.

After that's done, the next major thing is wiring up texturing. This kinda depends on compiler work first.

Once those things are in place, we should actually be pretty good, and from there it's mostly upstreaming the driver, and the endless cycle of testing and fixing bugs. We might also want to set up some CI runners if possible, and do some hardware enablement for later versions of the GPU, and other missing features.

@digetx
Copy link
Member

digetx commented May 12, 2021

@astillich Hello, please tell us which Tegra device do you have.

The https://github.com/grate-driver/grate should be a good place for the start, compile it and run the tests. If everything appear to work fine, then take a look at https://github.com/grate-driver/grate/wiki and start hacking the code to get familiar with the basics. Be prepared that this may be not that easy as it may sound if you haven't touched Tegra hardware before, hence it's normal if it will take some time and effort.

The #tegra IRC channel should be a good place for chatting. You could ask anything in this thread as well, whatever works best for you.

The dependency on a customized libdrm was indeed removed, but the Tegra/Grate DRM code itself was moved inside of the mesa / opentegra / libvdpau drivers. This eased the development process a lot and removed maintenance burden. It's enough to have any generic libdrm installed, i.e. libdrm which is shipped with the Linux distro you're using will be good.

@kusma currently working on refreshing the mesa driver, adding fragment code generation and textures support. He has https://gitlab.freedesktop.org/kusma/mesa. I assume that the latest work should appear here in the master branch once it will be ready.

I rebased the older code base on a more recent version of mesa https://github.com/grate-driver/mesa/tree/21.0.3 The code is a proof-a-concept which can draw glxgears, it's a good place for starting the mesa development. Pull the code, compile it and check that glxgears work.

Mesa has a good documentation https://gallium.readthedocs.io/en/latest/, you should take a look at it, look at the code of other gallium drivers. Download the GLES spec and start wiring up the code generation and etc. Eventually you'll may need to set up a working environment to get command stream traces from the proprietary driver, we could discuss it later on.

@kusma
Copy link
Member

kusma commented May 12, 2021

I assume that the latest work should appear here in the master branch once it will be ready.

Yeah, or in some other branch in that repo. I'll let the relevant people know ;)

I rebased the older code base on a more recent version of mesa

I actually also rebased on an even more recent version, but I haven't tested that beyond seeing that it still compiles. I suppose I can share that as well. (edit: here)

@astillich
Copy link
Author

astillich commented May 12, 2021

I have a Nexus 7 2012 which has a Tegra30 SoC. Actually, I have several and the reason I'm offering help is because I want to get HW accelerated rendering running on these devices which should support a custom Qt/QML application for my self-built home automation system. The tablets will be used as stationary control panels. Reading your answers it seems that it's quite some way to go. I have limited time, so I'd like to invest it into getting things working and not in upstreaming code to Mesa or getting other devices to work.

I will run a custom postmarketOS build on the devices, I have already built the 21.0.3 grate fork of Mesa as a package. I wondered if I'd also need to package the custom libdrm for this to work, that's why I asked about it. Then I ran out of time (vacation was over), and I haven't gotten around to testing the package on the device yet.

I actually skimmed some of the Mesa documentation, but I'm still lost on what exactly needs to be done and how the differnt components work together.

I do have some experience with compiler backends, but in a less formal way from some experiments with my own scripting languages where it was all put together as needed. I don't have any experience doing that in a GPU context. For clarification: we are talking about translating NIR (or TGSI?) produced by Mesa from GLSL ES to something which can be sent to the GPU using libdrm to get it to the device via the kernel driver?

How can I capture command streams? Can I do that on a rooted android device or do I need to get a Linux system with the old NV tegra support working on them?

I guess the best way to move on would be to look at the VS IR and inspecting Kusma's fork? Some concrete pointers along the lines of "do X now, so that we can do Y" would be very much appreciated.

@digetx
Copy link
Member

digetx commented May 14, 2021

I have a Nexus 7 2012 which has a Tegra30 SoC. Actually, I have several and the reason I'm offering help is because I want to get HW accelerated rendering running on these devices which should support a custom Qt/QML application for my self-built home automation system. The tablets will be used as stationary control panels. Reading your answers it seems that it's quite some way to go. I have limited time, so I'd like to invest it into getting things working and not in upstreaming code to Mesa or getting other devices to work.

Nexus 7 2012 has a great upstream support status, you're good with it.

I will run a custom postmarketOS build on the devices, I have already built the 21.0.3 grate fork of Mesa as a package. I wondered if I'd also need to package the custom libdrm for this to work, that's why I asked about it. Then I ran out of time (vacation was over), and I haven't gotten around to testing the package on the device yet.

Having extra motivation is always helpful, it's great that you have it.

Time is a universal problem. You may have noticed that grate drivers are progressing staidly, but not very fast.

I actually skimmed some of the Mesa documentation, but I'm still lost on what exactly needs to be done and how the differnt components work together.

Mesa is a very complex software, it's normal to feel lost in it, especially in the beginning. In general it's more productive to focus on easier things first and then move iteratively to a more difficult problems.

I do have some experience with compiler backends, but in a less formal way from some experiments with my own scripting languages where it was all put together as needed. I don't have any experience doing that in a GPU context. For clarification: we are talking about translating NIR (or TGSI?) produced by Mesa from GLSL ES to something which can be sent to the GPU using libdrm to get it to the device via the kernel driver?

Yes, we need to take Mesa's IR and state, translate it to the HW state and HW opcodes, and send it all to hardware via libdrm and kernel DRM driver.

For vertex programs TGSI should be more appropriate since it maps well to hardware. For the fragment NIR should be more suitable.

How can I capture command streams? Can I do that on a rooted android device or do I need to get a Linux system with the old NV tegra support working on them?

You will need to prepare rootfs with the old NV tegra driver and then LD_PRELOAD https://github.com/grate-driver/grate/tree/master/src/libwrap to capture streams.

I guess the best way to move on would be to look at the VS IR and inspecting Kusma's fork? Some concrete pointers along the lines of "do X now, so that we can do Y" would be very much appreciated.

  • Choose a simple problem that you want solve.
  • Enable debug prints of the mesa's grate gallium driver
  • Run your application.
  • See which code paths need to be implemented.
  • Add more debug messages and stubs if necessary.
  • Start to implement missing parts.
  • Move to next problem.

Kusma's fork is a good variant. You may start with the VS IR.

@astillich
Copy link
Author

astillich commented May 14, 2021

Thank you for the helpful answer. To get a better feeling of things, and to get some reference data, I decided to set up an old Linux distribution on one of the tablets and managed to install a build of Ubuntu 13.04 which contains the proprietary NV drivers. I wasn't sure how to get the rootfs from NV onto the android device without disabling the android bootloader (?), which I don't really want to do. Also, the rootfs is for an NV tablet which makes me suspicious if there would be problems with it.

Running es2_info confirms that I'm running on the proper driver (EGL_VENDOR = NVIDIA) and es2gears works fine. However, running es2tri fails with a fragment shader compile error, which I haven't investigated yet (there's no output about what's wrong). The tools were installed from the distro Mesa packages.

I tried to compile grate tools repository, which mostly worked, but it seems to have a dependency on the custom libdrm, as it cannot find drmSetClientCap which seems to come from it. So I guess to get that working, I need the custom libdrm and overwrite the distro version with it?

I'll have a closer look at Mesa stuff and the grate driver code in the coming days.

@digetx
Copy link
Member

digetx commented May 14, 2021

Thank you for the helpful answer. To get a better feeling of things, and to get some reference data, I decided to set up an old Linux distribution on one of the tablets and managed to install a build of Ubuntu 13.04 which contains the proprietary NV drivers. I wasn't sure how to get the rootfs from NV onto the android device without disabling the android bootloader (?), which I don't really want to do. Also, the rootfs is for an NV tablet which makes me suspicious if there would be problems with it.

Having rootfs over NFS is very useful for such cases, you won't need to write anything to device and could switch to another rootfs instantly.

You could write rootfs to /data partition. You could also write it to a subdirectory, but then you'll need to chroot there. I used https://gist.github.com/digetx/698af095d432d597d0835ab9f7b95f55 for chrooting.

Running es2_info confirms that I'm running on the proper driver (EGL_VENDOR = NVIDIA) and es2gears works fine. However, running es2tri fails with a fragment shader compile error, which I haven't investigated yet (there's no output about what's wrong). The tools were installed from the distro Mesa packages.

I don't know what's wrong with es2tri. You could also run the GL tests of grate.

I tried to compile grate tools repository, which mostly worked, but it seems to have a dependency on the custom libdrm, as it cannot find drmSetClientCap which seems to come from it. So I guess to get that working, I need the custom libdrm and overwrite the distro version with it?

I'll have a closer look at Mesa stuff and the grate driver code in the coming days.

The very old libdrm doesn't have drmSetClientCap(), I pushed fix for that.

@astillich
Copy link
Author

Thanks for the info about mounting rootfs via NFS, I think it will come in handy when I have a cross compile setup. Right now, compiling on the device is enough for me.

I'll hack es2tri to output shader errors, I'd like to know why it fails with the NV drivers, might be useful info and it's not a lot of effort.

The grate tools now compile with the fix. I think I'll continue tomorrow.

@astillich
Copy link
Author

I managed to capture the command stream of some of the ES2 examples in grate, so that's working for me now. A newer version os es2_tri runs fine, so I won't bother with it anymore. Time to get comfortable with mesa and the IL stuff.

@digetx
Copy link
Member

digetx commented May 16, 2021

Great, you could also install https://github.com/grate-driver/envytools and then recompile libwrap in order to get a meaningful output from the traces.

digetx pushed a commit that referenced this issue May 15, 2022
need to iterate over the descriptors in the binding to invalidate the whole
thing here

=================================================================
==546534==ERROR: AddressSanitizer: heap-use-after-free on address 0x61a0000ae6c0 at pc 0x7fe20e26fd9d bp 0x7ffd92be6bc0 sp 0x7ffd92be6bb8
READ of size 8 at 0x61a0000ae6c0 thread T0
    #0 0x7fe20e26fd9c in zink_descriptor_set_refs_clear ../src/gallium/drivers/zink/zink_descriptors.c:950
    #1 0x7fe20e401304 in zink_destroy_surface ../src/gallium/drivers/zink/zink_surface.c:340
    #2 0x7fe20e21311b in zink_surface_reference ../src/gallium/drivers/zink/zink_surface.h:106
    #3 0x7fe20e21a5b9 in zink_sampler_view_destroy ../src/gallium/drivers/zink/zink_context.c:835
    #4 0x7fe20c41d35f in tc_sampler_view_destroy ../src/gallium/auxiliary/util/u_threaded_context.c:1848
    #5 0x7fe20e210ff7 in pipe_sampler_view_reference ../src/gallium/auxiliary/util/u_inlines.h:216
    #6 0x7fe20e22d592 in zink_set_sampler_views ../src/gallium/drivers/zink/zink_context.c:1532
    #7 0x7fe20c41a3d8 in tc_call_set_sampler_views ../src/gallium/auxiliary/util/u_threaded_context.c:1393
    #8 0x7fe20c411706 in tc_batch_execute ../src/gallium/auxiliary/util/u_threaded_context.c:211
    #9 0x7fe20c4124ba in _tc_sync ../src/gallium/auxiliary/util/u_threaded_context.c:362
    #10 0x7fe20c42b728 in tc_destroy ../src/gallium/auxiliary/util/u_threaded_context.c:4250
    #11 0x7fe20b65176a in st_destroy_context_priv ../src/mesa/state_tracker/st_context.c:387
    #12 0x7fe20b65669f in st_destroy_context ../src/mesa/state_tracker/st_context.c:1009
    #13 0x7fe20b7055ab in st_context_destroy ../src/mesa/state_tracker/st_manager.c:944
    #14 0x7fe20a9c75bd in dri_destroy_context ../src/gallium/frontends/dri/dri_context.c:256
    #15 0x7fe20a9d4bef in driDestroyContext ../src/gallium/frontends/dri/dri_util.c:534
    #16 0x7fe22361f25c in drisw_destroy_context ../src/glx/drisw_glx.c:429
    #17 0x7fe223625d95 in glXDestroyContext ../src/glx/glxcmds.c:523
    #18 0x7fe22636aaeb in glXDestroyContext /home/zmike/src/libglvnd-v1.3.2/src/GLX/libglx.c:332
    #19 0x7fe2269d9e7d in glXDestroyContext /home/zmike/src/libglvnd-v1.3.2/src/GL/g_libglglxwrapper.c:384
    #20 0x41b88a in tcu::lnx::x11::glx::GlxRenderContext::~GlxRenderContext() /home/zmike/src/VK-GL-CTS/framework/platform/lnx/X11/tcuLnxX11GlxPlatform.cpp:734
    #21 0x41b8e9 in tcu::lnx::x11::glx::GlxRenderContext::~GlxRenderContext() /home/zmike/src/VK-GL-CTS/framework/platform/lnx/X11/tcuLnxX11GlxPlatform.cpp:735
    #22 0x2323aa7 in deqp::gles31::Context::destroyRenderContext() /home/zmike/src/VK-GL-CTS/modules/gles31/tes31Context.cpp:77
    #23 0x2323969 in deqp::gles31::Context::~Context() /home/zmike/src/VK-GL-CTS/modules/gles31/tes31Context.cpp:55
    #24 0x232278e in deqp::gles31::TestPackage::deinit() /home/zmike/src/VK-GL-CTS/modules/gles31/tes31TestPackage.cpp:102
    #25 0x2c866c2 in tcu::DefaultHierarchyInflater::leaveTestPackage(tcu::TestPackage*) /home/zmike/src/VK-GL-CTS/framework/common/tcuTestHierarchyIterator.cpp:75
    #26 0x2c87058 in tcu::TestHierarchyIterator::next() /home/zmike/src/VK-GL-CTS/framework/common/tcuTestHierarchyIterator.cpp:252
    #27 0x2c365da in tcu::TestSessionExecutor::iterate() /home/zmike/src/VK-GL-CTS/framework/common/tcuTestSessionExecutor.cpp:122
    #28 0x2c00b0c in tcu::App::iterate() /home/zmike/src/VK-GL-CTS/framework/common/tcuApp.cpp:221
    #29 0x4141b7 in main /home/zmike/src/VK-GL-CTS/framework/platform/tcuMain.cpp:58
    #30 0x7fe2263e155f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
    #31 0x7fe2263e160b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
    #32 0x413fa4 in _start (/home/zmike/src/VK-GL-CTS/build/external/openglcts/modules/glcts+0x413fa4)

0x61a0000ae6c0 is located 64 bytes inside of 1328-byte region [0x61a0000ae680,0x61a0000aebb0)
freed by thread T0 here:
    #0 0x7fe226cb6627 in free (/usr/lib64/libasan.so.6+0xae627)
    #1 0x7fe20aab1751 in unsafe_free ../src/util/ralloc.c:302
    #2 0x7fe20aab16c8 in unsafe_free ../src/util/ralloc.c:295
    #3 0x7fe20aab13c3 in ralloc_free ../src/util/ralloc.c:265
    #4 0x7fe20e269234 in descriptor_pool_free ../src/gallium/drivers/zink/zink_descriptors.c:286
    #5 0x7fe20e26937d in descriptor_pool_delete ../src/gallium/drivers/zink/zink_descriptors.c:296
    #6 0x7fe20e26ff53 in zink_descriptor_pool_reference ../src/gallium/drivers/zink/zink_descriptors.c:967
    #7 0x7fe20e270db2 in zink_descriptor_program_deinit ../src/gallium/drivers/zink/zink_descriptors.c:1071
    #8 0x7fe20e3b6536 in zink_destroy_gfx_program ../src/gallium/drivers/zink/zink_program.c:695
    #9 0x7fe20e1eaaf9 in zink_gfx_program_reference ../src/gallium/drivers/zink/zink_program.h:242
    #10 0x7fe20e20d386 in zink_shader_free ../src/gallium/drivers/zink/zink_compiler.c:2099
    #11 0x7fe20e3b9f0b in zink_delete_shader_state ../src/gallium/drivers/zink/zink_program.c:1074
    #12 0x7fe20c3e29ad in util_shader_reference ../src/gallium/auxiliary/util/u_live_shader_cache.c:188
    #13 0x7fe20e3ba11e in zink_delete_cached_shader_state ../src/gallium/drivers/zink/zink_program.c:1093
    #14 0x7fe20c41709e in tc_call_delete_fs_state ../src/gallium/auxiliary/util/u_threaded_context.c:998
    #15 0x7fe20c411706 in tc_batch_execute ../src/gallium/auxiliary/util/u_threaded_context.c:211
    #16 0x7fe20c4124ba in _tc_sync ../src/gallium/auxiliary/util/u_threaded_context.c:362
    #17 0x7fe20c423683 in tc_flush ../src/gallium/auxiliary/util/u_threaded_context.c:3003
    #18 0x7fe20b62d996 in st_flush ../src/mesa/state_tracker/st_cb_flush.c:60
    #19 0x7fe20b62dbe3 in st_glFlush ../src/mesa/state_tracker/st_cb_flush.c:94
    #20 0x7fe20ae4bded in _mesa_make_current ../src/mesa/main/context.c:1493
    #21 0x7fe20ae49702 in _mesa_free_context_data ../src/mesa/main/context.c:1187
    #22 0x7fe20b65668b in st_destroy_context ../src/mesa/state_tracker/st_context.c:1005
    #23 0x7fe20b7055ab in st_context_destroy ../src/mesa/state_tracker/st_manager.c:944
    #24 0x7fe20a9c75bd in dri_destroy_context ../src/gallium/frontends/dri/dri_context.c:256
    #25 0x7fe20a9d4bef in driDestroyContext ../src/gallium/frontends/dri/dri_util.c:534
    #26 0x7fe22361f25c in drisw_destroy_context ../src/glx/drisw_glx.c:429
    #27 0x7fe223625d95 in glXDestroyContext ../src/glx/glxcmds.c:523
    #28 0x7fe22636aaeb in glXDestroyContext /home/zmike/src/libglvnd-v1.3.2/src/GLX/libglx.c:332
    #29 0x7fe2269d9e7d in glXDestroyContext /home/zmike/src/libglvnd-v1.3.2/src/GL/g_libglglxwrapper.c:384

previously allocated by thread T0 here:
    #0 0x7fe226cb691f in __interceptor_malloc (/usr/lib64/libasan.so.6+0xae91f)
    #1 0x7fe20aab0c81 in ralloc_size ../src/util/ralloc.c:120
    #2 0x7fe20aab0e33 in rzalloc_size ../src/util/ralloc.c:153
    #3 0x7fe20aab12c8 in rzalloc_array_size ../src/util/ralloc.c:233
    #4 0x7fe20e26c76d in allocate_desc_set ../src/gallium/drivers/zink/zink_descriptors.c:657
    #5 0x7fe20e26e9cb in zink_descriptor_set_get ../src/gallium/drivers/zink/zink_descriptors.c:840
    #6 0x7fe20e2747aa in zink_descriptors_update ../src/gallium/drivers/zink/zink_descriptors.c:1424
    #7 0x7fe20e36fc48 in void zink_draw<(zink_multidraw)1, (zink_dynamic_state)2, true, false>(pipe_context*, pipe_draw_info const*, unsigned int, pipe_draw_indirect_info const*, pipe_draw_start_count_bias const*, unsigned int, pipe_vertex_state*, unsigned int) ../src/gallium/drivers/zink/zink_draw.cpp:788
    #8 0x7fe20e29166d in zink_draw_vbo<(zink_multidraw)1, (zink_dynamic_state)2, true> ../src/gallium/drivers/zink/zink_draw.cpp:907
    #9 0x7fe20c424982 in tc_call_draw_single ../src/gallium/auxiliary/util/u_threaded_context.c:3155
    #10 0x7fe20c411706 in tc_batch_execute ../src/gallium/auxiliary/util/u_threaded_context.c:211
    #11 0x7fe20c4124ba in _tc_sync ../src/gallium/auxiliary/util/u_threaded_context.c:362
    #12 0x7fe20c41f7a9 in tc_texture_map ../src/gallium/auxiliary/util/u_threaded_context.c:2279
    #13 0x7fe20b630757 in pipe_texture_map_3d ../src/gallium/auxiliary/util/u_inlines.h:572
    #14 0x7fe20b6341f6 in st_ReadPixels ../src/mesa/state_tracker/st_cb_readpixels.c:546
    #15 0x7fe20b42fea7 in read_pixels ../src/mesa/main/readpix.c:1178
    #16 0x7fe20b42fea7 in _mesa_ReadnPixelsARB ../src/mesa/main/readpix.c:1195
    #17 0x7fe20b42ffc0 in _mesa_ReadPixels ../src/mesa/main/readpix.c:1210
    #18 0x2a6d094 in glu::readPixels(glu::RenderContext const&, int, int, tcu::PixelBufferAccess const&) /home/zmike/src/VK-GL-CTS/framework/opengl/gluPixelTransfer.cpp:61
    #19 0x29eaa06 in deqp::gls::ShaderExecUtil::FragmentOutExecutor::execute(int, void const* const*, void* const*) /home/zmike/src/VK-GL-CTS/modules/glshared/glsShaderExecUtil.cpp:677
    #20 0x25a600b in iterate /home/zmike/src/VK-GL-CTS/modules/gles31/functional/es31fOpaqueTypeIndexingTests.cpp:585
    #21 0x2322b53 in deqp::gles31::TestCaseWrapper<deqp::gles31::TestPackage>::iterate(tcu::TestCase*) /home/zmike/src/VK-GL-CTS/modules/gles31/tes31TestCaseWrapper.hpp:86
    #22 0x2c376fd in tcu::TestSessionExecutor::iterateTestCase(tcu::TestCase*) /home/zmike/src/VK-GL-CTS/framework/common/tcuTestSessionExecutor.cpp:302
    #23 0x2c366e3 in tcu::TestSessionExecutor::iterate() /home/zmike/src/VK-GL-CTS/framework/common/tcuTestSessionExecutor.cpp:139
    #24 0x2c00b0c in tcu::App::iterate() /home/zmike/src/VK-GL-CTS/framework/common/tcuApp.cpp:221
    #25 0x4141b7 in main /home/zmike/src/VK-GL-CTS/framework/platform/tcuMain.cpp:58
    #26 0x7fe2263e155f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)

cc: mesa-stable

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15173>
(cherry picked from commit 698ae34)
digetx pushed a commit that referenced this issue May 15, 2022
Test case 'dEQP-GLES31.functional.shaders.builtin_functions.common.modf.vec2_mediump_tess_control'..
=================================================================
==539161==ERROR: AddressSanitizer: unknown-crash on address 0x60400008cfef at pc 0x7fffdb47b2d6 bp 0x7fffffffa490 sp 0x7fffffffa488
READ of size 4 at 0x60400008cfef thread T0
    #0 0x7fffdb47b2d5 in XXH_read32 ../src/util/xxhash.h:531
    #1 0x7fffdb47bfbf in XXH_readLE32 ../src/util/xxhash.h:608
    #2 0x7fffdb47bfbf in XXH_readLE32_align ../src/util/xxhash.h:620
    #3 0x7fffdb47bfbf in XXH32_endian_align ../src/util/xxhash.h:797
    #4 0x7fffdb47bfbf in XXH32 ../src/util/xxhash.h:831
    #5 0x7fffdb480b49 in _mesa_hash_data ../src/util/hash_table.c:631
    #6 0x7fffded8c10a in shader_module_hash ../src/gallium/drivers/zink/zink_program.c:82
    #7 0x7fffded8cad8 in get_shader_module_for_stage ../src/gallium/drivers/zink/zink_program.c:144
    #8 0x7fffded8cf64 in update_gfx_shader_modules ../src/gallium/drivers/zink/zink_program.c:182
    #9 0x7fffded8dcc2 in zink_update_gfx_program ../src/gallium/drivers/zink/zink_program.c:257
    #10 0x7fffdec63463 in update_gfx_program ../src/gallium/drivers/zink/zink_draw.cpp:223
    #11 0x7fffded7aab9 in update_gfx_pipeline<true> ../src/gallium/drivers/zink/zink_draw.cpp:445
    #12 0x7fffded4a88b in void zink_draw<(zink_multidraw)1, (zink_dynamic_state)2, true, false>(pipe_context*, pipe_draw_info const*, unsigned int, pipe_draw_indirect_info const*, pipe_draw_start_count_bias const*, unsigned int, pipe_vertex_state*, unsigned int) ../src/gallium/drivers/zink/zink_draw.cpp:777
    #13 0x7fffdec6c5b2 in zink_draw_vbo<(zink_multidraw)1, (zink_dynamic_state)2, true> ../src/gallium/drivers/zink/zink_draw.cpp:907
    #14 0x7fffdcdff982 in tc_call_draw_single ../src/gallium/auxiliary/util/u_threaded_context.c:3155
    #15 0x7fffdcdec706 in tc_batch_execute ../src/gallium/auxiliary/util/u_threaded_context.c:211
    #16 0x7fffdcded4ba in _tc_sync ../src/gallium/auxiliary/util/u_threaded_context.c:362
    #17 0x7fffdcdfa492 in tc_buffer_map ../src/gallium/auxiliary/util/u_threaded_context.c:2251
    #18 0x7fffdb7f2439 in pipe_buffer_map_range ../src/gallium/auxiliary/util/u_inlines.h:393
    #19 0x7fffdb7f56c2 in _mesa_bufferobj_map_range ../src/mesa/main/bufferobj.c:488
    #20 0x7fffdb803300 in map_buffer_range ../src/mesa/main/bufferobj.c:3734
    #21 0x7fffdb8036e7 in _mesa_MapBufferRange ../src/mesa/main/bufferobj.c:3817
    #22 0x29ecb02 in deqp::gls::ShaderExecUtil::BufferIoExecutor::readOutputBuffer(void* const*, int) /home/zmike/src/VK-GL-CTS/modules/glshared/glsShaderExecUtil.cpp:1069
    #23 0x29ee499 in deqp::gls::ShaderExecUtil::TessControlExecutor::execute(int, void const* const*, void* const*) /home/zmike/src/VK-GL-CTS/modules/glshared/glsShaderExecUtil.cpp:1390
    #24 0x246264c in deqp::gles31::Functional::CommonFunctionCase::iterate() /home/zmike/src/VK-GL-CTS/modules/gles31/functional/es31fShaderCommonFunctionTests.cpp:400
    #25 0x2322b53 in deqp::gles31::TestCaseWrapper<deqp::gles31::TestPackage>::iterate(tcu::TestCase*) /home/zmike/src/VK-GL-CTS/modules/gles31/tes31TestCaseWrapper.hpp:86
    #26 0x2c376fd in tcu::TestSessionExecutor::iterateTestCase(tcu::TestCase*) /home/zmike/src/VK-GL-CTS/framework/common/tcuTestSessionExecutor.cpp:302
    #27 0x2c366e3 in tcu::TestSessionExecutor::iterate() /home/zmike/src/VK-GL-CTS/framework/common/tcuTestSessionExecutor.cpp:139
    #28 0x2c00b0c in tcu::App::iterate() /home/zmike/src/VK-GL-CTS/framework/common/tcuApp.cpp:221
    #29 0x4141b7 in main /home/zmike/src/VK-GL-CTS/framework/platform/tcuMain.cpp:58
    #30 0x7ffff6dbc55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
    #31 0x7ffff6dbc60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
    #32 0x413fa4 in _start (/home/zmike/src/VK-GL-CTS/build/external/openglcts/modules/glcts+0x413fa4)

0x60400008cff1 is located 0 bytes to the right of 33-byte region [0x60400008cfd0,0x60400008cff1)
allocated by thread T0 here:
    #0 0x7ffff769191f in __interceptor_malloc (/usr/lib64/libasan.so.6+0xae91f)
    #1 0x7fffded8c608 in get_shader_module_for_stage ../src/gallium/drivers/zink/zink_program.c:115
    #2 0x7fffded8cf64 in update_gfx_shader_modules ../src/gallium/drivers/zink/zink_program.c:182
    #3 0x7fffded8dcc2 in zink_update_gfx_program ../src/gallium/drivers/zink/zink_program.c:257
    #4 0x7fffdec63463 in update_gfx_program ../src/gallium/drivers/zink/zink_draw.cpp:223
    #5 0x7fffded7aab9 in update_gfx_pipeline<true> ../src/gallium/drivers/zink/zink_draw.cpp:445
    #6 0x7fffded4a88b in void zink_draw<(zink_multidraw)1, (zink_dynamic_state)2, true, false>(pipe_context*, pipe_draw_info const*, unsigned int, pipe_draw_indirect_info const*, pipe_draw_start_count_bias const*, unsigned int, pipe_vertex_state*, unsigned int) ../src/gallium/drivers/zink/zink_draw.cpp:777
    #7 0x7fffdec6c5b2 in zink_draw_vbo<(zink_multidraw)1, (zink_dynamic_state)2, true> ../src/gallium/drivers/zink/zink_draw.cpp:907
    #8 0x7fffdcdff982 in tc_call_draw_single ../src/gallium/auxiliary/util/u_threaded_context.c:3155
    #9 0x7fffdcdec706 in tc_batch_execute ../src/gallium/auxiliary/util/u_threaded_context.c:211
    #10 0x7fffdcded4ba in _tc_sync ../src/gallium/auxiliary/util/u_threaded_context.c:362
    #11 0x7fffdcdfa492 in tc_buffer_map ../src/gallium/auxiliary/util/u_threaded_context.c:2251
    #12 0x7fffdb7f2439 in pipe_buffer_map_range ../src/gallium/auxiliary/util/u_inlines.h:393
    #13 0x7fffdb7f56c2 in _mesa_bufferobj_map_range ../src/mesa/main/bufferobj.c:488
    #14 0x7fffdb803300 in map_buffer_range ../src/mesa/main/bufferobj.c:3734
    #15 0x7fffdb8036e7 in _mesa_MapBufferRange ../src/mesa/main/bufferobj.c:3817
    #16 0x29ecb02 in deqp::gls::ShaderExecUtil::BufferIoExecutor::readOutputBuffer(void* const*, int) /home/zmike/src/VK-GL-CTS/modules/glshared/glsShaderExecUtil.cpp:1069
    #17 0x29ee499 in deqp::gls::ShaderExecUtil::TessControlExecutor::execute(int, void const* const*, void* const*) /home/zmike/src/VK-GL-CTS/modules/glshared/glsShaderExecUtil.cpp:1390
    #18 0x246264c in deqp::gles31::Functional::CommonFunctionCase::iterate() /home/zmike/src/VK-GL-CTS/modules/gles31/functional/es31fShaderCommonFunctionTests.cpp:400
    #19 0x2322b53 in deqp::gles31::TestCaseWrapper<deqp::gles31::TestPackage>::iterate(tcu::TestCase*) /home/zmike/src/VK-GL-CTS/modules/gles31/tes31TestCaseWrapper.hpp:86
    #20 0x2c376fd in tcu::TestSessionExecutor::iterateTestCase(tcu::TestCase*) /home/zmike/src/VK-GL-CTS/framework/common/tcuTestSessionExecutor.cpp:302
    #21 0x2c366e3 in tcu::TestSessionExecutor::iterate() /home/zmike/src/VK-GL-CTS/framework/common/tcuTestSessionExecutor.cpp:139
    #22 0x2c00b0c in tcu::App::iterate() /home/zmike/src/VK-GL-CTS/framework/common/tcuApp.cpp:221
    #23 0x4141b7 in main /home/zmike/src/VK-GL-CTS/framework/platform/tcuMain.cpp:58
    #24 0x7ffff6dbc55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)

cc: mesa-stable

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15173>
(cherry picked from commit 62b8daa)

Conflicts:
	src/gallium/drivers/zink/zink_program.c
@tamburro92
Copy link

Hi,
I started to look at code in gallium driver, but before start I want to know what features are missing that need to implement at this moment.
Hope I can bring some contributes...

@digetx
Copy link
Member

digetx commented Oct 27, 2023

You may start with rebasing driver onto the recent Mesa version. It should compile without errors and glxgears should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants