From 64b09cef49f9cd7e7eb9871d8fe36ed5b315149a Mon Sep 17 00:00:00 2001 From: Marijn Suijten Date: Sat, 9 Sep 2023 10:26:33 +0200 Subject: [PATCH] modetest: document why no blob is created for linear gamma LUT As found and discussed in [MR 58] a blob is not created in the else arm because adding the GAMMA_LUT property with a NULL/0 blob_id causes it to be reset to a default linear / pass-thru gamma table. The values in the gamma_lut table might still be consumed in the legacy API path below though, so it has to be initialized to a linear table. [MR 58]: https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/58#note_466972 Signed-off-by: Marijn Suijten --- tests/modetest/modetest.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c index 3d24e0dc..8bc3d5a5 100644 --- a/tests/modetest/modetest.c +++ b/tests/modetest/modetest.c @@ -1158,6 +1158,11 @@ static void set_gamma(struct device *dev, unsigned crtc_id, unsigned fourcc) util_smpte_c8_gamma(256, gamma_lut); drmModeCreatePropertyBlob(dev->fd, gamma_lut, sizeof(gamma_lut), &blob_id); } else { + /* + * Initialize gamma_lut to a linear table for the legacy API below. + * The modern property API resets to a linear/pass-thru table if blob_id + * is 0, hence no PropertyBlob is created here. + */ for (i = 0; i < 256; i++) { gamma_lut[i].red = gamma_lut[i].green =