summaryrefslogtreecommitdiff
path: root/tests/modetest/modetest.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/modetest/modetest.c')
-rw-r--r--tests/modetest/modetest.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c
index 9504fbd8..9b1aa537 100644
--- a/tests/modetest/modetest.c
+++ b/tests/modetest/modetest.c
@@ -1149,13 +1149,16 @@ static bool add_property_optional(struct device *dev, uint32_t obj_id,
static void set_gamma(struct device *dev, unsigned crtc_id, unsigned fourcc)
{
unsigned blob_id = 0;
+ const struct util_format_info *info;
/* TODO: support 1024-sized LUTs, when the use-case arises */
struct drm_color_lut gamma_lut[256];
int i, ret;
- if (fourcc == DRM_FORMAT_C8) {
- /* TODO: Add C8 support for more patterns */
- util_smpte_fill_lut(256, gamma_lut);
+ info = util_format_info_find(fourcc);
+ if (info->ncolors) {
+ memset(gamma_lut, 0, sizeof(gamma_lut));
+ /* TODO: Add index support for more patterns */
+ util_smpte_fill_lut(info->ncolors, gamma_lut);
drmModeCreatePropertyBlob(dev->fd, gamma_lut, sizeof(gamma_lut), &blob_id);
} else {
/*