From b709c3010e9a39b7ed4ed63a16148d4fa0055d3f Mon Sep 17 00:00:00 2001 From: Ezequiel Garcia Date: Sat, 5 Oct 2019 13:31:22 -0300 Subject: [PATCH] modetest: avoid erroring if there's no gamma legacy support Let's follow the Rule of Silence. And while here, document what's going on. Signed-off-by: Ezequiel Garcia Reviewed-by: Marijn Suijten --- tests/modetest/modetest.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c index 2f6f328d..3d24e0dc 100644 --- a/tests/modetest/modetest.c +++ b/tests/modetest/modetest.c @@ -1168,6 +1168,7 @@ static void set_gamma(struct device *dev, unsigned crtc_id, unsigned fourcc) add_property_optional(dev, crtc_id, "DEGAMMA_LUT", 0); add_property_optional(dev, crtc_id, "CTM", 0); if (!add_property_optional(dev, crtc_id, "GAMMA_LUT", blob_id)) { + /* If we can't add the GAMMA_LUT property, try the legacy API. */ uint16_t r[256], g[256], b[256]; for (i = 0; i < 256; i++) { @@ -1177,7 +1178,7 @@ static void set_gamma(struct device *dev, unsigned crtc_id, unsigned fourcc) } ret = drmModeCrtcSetGamma(dev->fd, crtc_id, 256, r, g, b); - if (ret) + if (ret && errno != ENOSYS) fprintf(stderr, "failed to set gamma: %s\n", strerror(errno)); } }