Hi David, Sorry for not getting back to you sooner, I've been swamped with work this week. On Wed, Jun 29, 2022 at 03:27:44PM +0800, David Gow wrote: > These look pretty good overall to me, but there is one big issue > (which is actually with the previous series -- oops!), and a few small > stylistic thoughts. > > For the big issue: these tests don't work on big-endian systems. The > 'swab' bit in this series reminded me to check, and sure enough, all > of the tests fail (including the rgb332 ones). > > I tested it on PowerPC with: > ./tools/testing/kunit/kunit.py run > --kunitconfig=drivers/gpu/drm/tests --arch=powerpc > --cross_compile=powerpc64-linux-gnu- > > So that's something which needs to be fixed. Oops, yes, definitely something that I need to fix! I'll include an extra patch at the beginning of v2 fixing this bug. > The smaller stylistic thoughts basically all revolve around the > complexity of convert_xrgb8888_cases: there are arrays of structs with > arrays of unions of structs (with function pointers in them). This > isn't a problem: it's actually a lot more readable than that > description implies, but there are other ways it could be tackled > (which have their own tradeoffs, of course). > > One possibility would be to split up the test into a separate test per > destination format. They could reuse the convert_xrgb8888_cases array, > and just each access a different result. You could make things even > clearer (IMO) by replacing the results[] array with a separate, named, > member (since you don't need to iterate over them any more), and > remove the need to have the function pointer and swab union/members by > just hardcoding those in the separate test functions. It'd also make > the results a bit clearer, as each destination format would get its > own separate set of results. > > Of course, that's just an idea: I don't actually have a problem with > the existing design either (other than the endianness issue, of > course). I like from your approach that the output of the tests would be easier to understand. At the moment, if a test fails, there is not enough context to know which target format failed. I'll explore this approach and see how it looks like. Thanks, Jose > Cheers, > -- David