Skip to content

Draft: turnip: Switch to common ycbcr lowering

Valentine Burley requested to merge Valentine/mesa:tu/ycbcr into main

What does this MR do and why?

It currently doesn't work at all, it trips over an assert (layout && layout->ref_cnt >= 1) in the first test I threw at it:

Test case 'dEQP-VK.ycbcr.format.g8b8g8r8_422_unorm.vertex_linear'..
[New Thread 0x7feffff100 (LWP 13922)]
Unref layout at index 0, ref_cnt = 1
deqp-vk: ../src/vulkan/runtime/vk_descriptor_set_layout.h:89: void vk_descriptor_set_layout_unref(vk_device*, vk_descriptor_set_layout*): Assertion `layout && layout->ref_cnt >= 1' failed.

Thread 1 "deqp-vk" received signal SIGABRT, Aborted.
__pthread_kill_implementation (threadid=549621478496, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
44      ./nptl/pthread_kill.c: No such file or directory.
(gdb) bt
#0  __pthread_kill_implementation (threadid=549621478496, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
#1  0x0000007ff7870a64 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
#2  0x0000007ff782a76c in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x0000007ff78174bc in __GI_abort () at ./stdlib/abort.c:79
#4  0x0000007ff78241e4 in __assert_fail_base (fmt=0x7ff793f2c8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x7ff6f1e180 "layout && layout->ref_cnt >= 1",
    file=file@entry=0x7ff6f1e148 "../src/vulkan/runtime/vk_descriptor_set_layout.h", line=line@entry=89,
    function=function@entry=0x7ff6f1e1a0 "void vk_descriptor_set_layout_unref(vk_device*, vk_descriptor_set_layout*)") at ./assert/assert.c:92
#5  0x0000007ff782424c in __GI___assert_fail (assertion=0x7ff6f1e180 "layout && layout->ref_cnt >= 1", file=0x7ff6f1e148 "../src/vulkan/runtime/vk_descriptor_set_layout.h", line=89,
    function=0x7ff6f1e1a0 "void vk_descriptor_set_layout_unref(vk_device*, vk_descriptor_set_layout*)") at ./assert/assert.c:101
#6  0x0000007ff6ae2ac8 in vk_descriptor_set_layout_unref (device=0x3003e691e0, layout=0x3004153b90) at ../src/vulkan/runtime/vk_descriptor_set_layout.h:89
#7  0x0000007ff6ae2b08 in vk_descriptor_set_layout_unref (device=0x3003e691e0, layout=0x3004153b90) at ../src/vulkan/runtime/vk_descriptor_set_layout.h:91
#8  0x0000007ff6ae47ec in tu_DestroyPipelineLayout (_device=0x3003e691e0, _pipelineLayout=0x300415a690, pAllocator=0x0) at ../src/freedreno/vulkan/tu_descriptor_set.cc:557
#9  0x0000003001857a18 in vkt::shaderexecutor::(anonymous namespace)::FragmentOutExecutor::execute(int, void const* const*, void* const*, vk::Handle<(vk::HandleType)15>) ()
#10 0x000000300183df54 in vkt::ycbcr::(anonymous namespace)::testFormat(vkt::Context&, vkt::ycbcr::(anonymous namespace)::TestParameters) ()
#11 0x000000300183b9b4 in vkt::FunctionInstance1<vkt::ycbcr::(anonymous namespace)::TestParameters>::iterate() ()
#12 0x0000003000276da8 in vkt::TestCaseExecutor::iterate(tcu::TestCase*) ()
#13 0x0000003002a7e8a8 in tcu::TestSessionExecutor::iterateTestCase(tcu::TestCase*) ()
#14 0x0000003002a7ea28 in tcu::TestSessionExecutor::iterate() ()
#15 0x0000003002a4d4f8 in tcu::App::iterate() ()
#16 0x00000030002519a8 in main ()

Turnip was already using the common ref counting and the common destroy entrypoint, so I tried to switch it over to utilize the common ycbcr lowering in the runtime. It would use vk_ycbcr_conversion_state and vk_ycbcr_conversion instead of handrolling it in turnip. It also tried to use a nir pass for tex lowering.

I'm not sure when I'll be able to get back to it, so I wanted to open this MR and maybe get a drive-by comment pointing me in the right direction :)

Merge request reports