From patchwork Thu Jun 20 00:11:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilia Mirkin X-Patchwork-Id: 11005583 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E9208924 for ; Thu, 20 Jun 2019 00:11:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C8482288E4 for ; Thu, 20 Jun 2019 00:11:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B8095288F3; Thu, 20 Jun 2019 00:11:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8F503288E4 for ; Thu, 20 Jun 2019 00:11:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1257D6E408; Thu, 20 Jun 2019 00:11:29 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qt1-x842.google.com (mail-qt1-x842.google.com [IPv6:2607:f8b0:4864:20::842]) by gabe.freedesktop.org (Postfix) with ESMTPS id EE4E86E408; Thu, 20 Jun 2019 00:11:27 +0000 (UTC) Received: by mail-qt1-x842.google.com with SMTP id p15so1297041qtl.3; Wed, 19 Jun 2019 17:11:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=N8C4pQ1LabYE9bnldKQgZtg1+OvSGSTL/iPVs+tKuBI=; b=l6QXueXwAu2Sv+vvstsYxKQ23Prh6n6yDW4OyasXA7z0S2oCMoynEfAzj5Buxu5oot GAZl/uRqh2KZ87voVoD31Mfmco2s5PAn6JYh0iNmY+cMW60f0Kp/7GEDwpakcakhu+ug /e1REfYsIQjYO/9URWKzhFVB1bCwFMJNZxOkE9nnP8RBrD2NwWiX/g06gboIkoedoaeO P2NCgVVuvtS+6cE2Jf0BlVfQDsRCGxWFHLPYEDDylh9gc3VYSFCYXwRIiUnBLMTnyMbN sYpYI6BDRA6wF2kTdCVW+AN6MBd4Qz5JDw13Mvsuv1JjdbwVtj3ZHVL+3zcoLW6lyuIp jESg== X-Gm-Message-State: APjAAAVo/u854NTybSwVoyWGC00yWlQaFlwp8mjv80p8i7DulOtm/vp9 0oY/RW7EjHRitvfGqUUMXa4OAY8UC/Y= X-Google-Smtp-Source: APXvYqxf7TK9IvSHpKkwjLLF+xc+Oq0v7tVkoPCbxOsu67tSquR6u42kO+R5Wb0o52sbD5Y5bi81dw== X-Received: by 2002:a0c:c16c:: with SMTP id i41mr35483551qvh.33.1560989486742; Wed, 19 Jun 2019 17:11:26 -0700 (PDT) Received: from athos.hellosponsor.com (pool-173-68-20-215.nycmny.fios.verizon.net. [173.68.20.215]) by smtp.gmail.com with ESMTPSA id v75sm3066823qka.38.2019.06.19.17.11.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 17:11:26 -0700 (PDT) From: Ilia Mirkin To: nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org, bskeggs@redhat.com Subject: [PATCH] drm/nouveau/kms/gf119-: allow both 256- and 1024-sized LUTs to be used Date: Wed, 19 Jun 2019 20:11:23 -0400 Message-Id: <20190620001123.10962-1-imirkin@alum.mit.edu> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=N8C4pQ1LabYE9bnldKQgZtg1+OvSGSTL/iPVs+tKuBI=; b=Gi7iPMgr7bLmJjb8rknbQH+qtEJ/zFM9bUUI37GLAKk4KpOMFxT53Sg2LadEZEj7Qk 1dhVjc9TIvZnONLS2faFUv30LOTlCA/ytjoLS72FtqGho6+Sx/5QK/gEruVwMdkC1z1E KMkSitUvnYJyli2JSk9t5hgCD46HQBOPZdFC2Xm1811p2bl8cnZihUO7z5NhbFYJQwvh UUYwA98jZSyH9LqRYtkJ38WUOv/KNx3hCw5zX3hJSQF2Xmiik6+fmfSYMtSVWteJNPk6 DlulD2CFA4k1ONG/i72i1lnpXxXmnop8Uyttn9ca1eXAHbQtL1pdSXqHVd6po8zE4Fog i5mQ== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The hardware supports either size. Also add checks to ensure that only these two sizes may be used for supplying a LUT. Finally, experimental evidence suggests you can't mix sizes for degamma and gamma. Disallow this as well. Signed-off-by: Ilia Mirkin --- Note that all the gv100+ changes are purely speculative. Tested on a GK208 with 8- and 10-bpc formats (but still 8bpc output). This is on top of the patches which I've sent in the past. You'll end up with some conflicts, I suspect, but I can't rebase easily on your changes since they're not in a linux tree. drivers/gpu/drm/nouveau/dispnv50/base907c.c | 4 ++-- drivers/gpu/drm/nouveau/dispnv50/corec57d.c | 2 +- drivers/gpu/drm/nouveau/dispnv50/head.c | 26 +++++++++++++++++---- drivers/gpu/drm/nouveau/dispnv50/head.h | 10 +++++--- drivers/gpu/drm/nouveau/dispnv50/head507d.c | 10 +++++++- drivers/gpu/drm/nouveau/dispnv50/head827d.c | 2 ++ drivers/gpu/drm/nouveau/dispnv50/head907d.c | 12 ++++++++-- drivers/gpu/drm/nouveau/dispnv50/head917d.c | 2 ++ drivers/gpu/drm/nouveau/dispnv50/headc37d.c | 6 +++-- drivers/gpu/drm/nouveau/dispnv50/headc57d.c | 9 +++---- drivers/gpu/drm/nouveau/dispnv50/lut.c | 2 +- drivers/gpu/drm/nouveau/dispnv50/wndw.c | 2 +- drivers/gpu/drm/nouveau/dispnv50/wndw.h | 2 +- drivers/gpu/drm/nouveau/dispnv50/wndwc37e.c | 4 ++-- drivers/gpu/drm/nouveau/dispnv50/wndwc57e.c | 3 +-- 15 files changed, 70 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/nouveau/dispnv50/base907c.c b/drivers/gpu/drm/nouveau/dispnv50/base907c.c index fd0c1d84730b..76db448205d2 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/base907c.c +++ b/drivers/gpu/drm/nouveau/dispnv50/base907c.c @@ -76,9 +76,9 @@ base907c_xlut_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw) } static void -base907c_ilut(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw) +base907c_ilut(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw, int size) { - asyw->xlut.i.mode = 7; + asyw->xlut.i.mode = size == 1024 ? 4 : 7; asyw->xlut.i.enable = 2; asyw->xlut.i.load = head907d_olut_load; } diff --git a/drivers/gpu/drm/nouveau/dispnv50/corec57d.c b/drivers/gpu/drm/nouveau/dispnv50/corec57d.c index b606d68cda10..700df4762b6d 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/corec57d.c +++ b/drivers/gpu/drm/nouveau/dispnv50/corec57d.c @@ -36,7 +36,7 @@ corec57d_init(struct nv50_core *core) evo_data(push, 0x0000000f); evo_data(push, 0x00000000); evo_mthd(push, 0x1010 + (i * 0x080), 1); - evo_data(push, 0x00117fff); + evo_data(push, 0x00127fff); } evo_mthd(push, 0x0200, 1); evo_data(push, 0x00000001); diff --git a/drivers/gpu/drm/nouveau/dispnv50/head.c b/drivers/gpu/drm/nouveau/dispnv50/head.c index 8cac8b724b70..407c91bd09b9 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/head.c +++ b/drivers/gpu/drm/nouveau/dispnv50/head.c @@ -193,7 +193,23 @@ nv50_head_atomic_check_lut(struct nv50_head *head, struct nv50_head_atom *asyh) { struct nv50_disp *disp = nv50_disp(head->base.base.dev); + struct drm_property_blob *ilut = asyh->state.degamma_lut; struct drm_property_blob *olut = asyh->state.gamma_lut; + int ilut_size = ilut ? drm_color_lut_size(ilut) : 0; + int olut_size = olut ? drm_color_lut_size(olut) : 0; + + if (!head->func->lut_chk(ilut_size)) { + DRM_DEBUG_KMS("Invalid DEGAMMA_LUT size: %d\n", ilut_size); + return -EINVAL; + } + if (!head->func->lut_chk(olut_size)) { + DRM_DEBUG_KMS("Invalid GAMMA_LUT size: %d\n", olut_size); + return -EINVAL; + } + if (ilut && olut && ilut_size != olut_size) { + DRM_DEBUG_KMS("DEGAMMA_LUT size (%d) must match GAMMA_LUT size (%d)\n", + ilut_size, olut_size); + } /* Determine whether core output LUT should be enabled. */ if (olut) { @@ -217,7 +233,7 @@ nv50_head_atomic_check_lut(struct nv50_head *head, asyh->olut.handle = disp->core->chan.vram.handle; asyh->olut.buffer = !asyh->olut.buffer; - head->func->olut(head, asyh); + head->func->olut(head, asyh, olut_size); return 0; } @@ -491,12 +507,14 @@ nv50_head_create(struct drm_device *dev, int index) drm_crtc_init_with_planes(dev, crtc, &wndw->plane, &curs->plane, &nv50_head_func, "head-%d", head->base.index); drm_crtc_helper_add(crtc, &nv50_head_help); - drm_mode_crtc_set_gamma_size(crtc, 256); + drm_mode_crtc_set_gamma_size(crtc, head->func->lut_size); if (disp->disp->object.oclass >= GF110_DISP && disp->disp->object.oclass < GV100_DISP) - drm_crtc_enable_color_mgmt(crtc, 256, true, 256); + drm_crtc_enable_color_mgmt(crtc, head->func->lut_size, true, + head->func->lut_size); else - drm_crtc_enable_color_mgmt(crtc, 0, false, 256); + drm_crtc_enable_color_mgmt(crtc, 0, false, + head->func->lut_size); if (head->func->olut_set) { ret = nv50_lut_init(disp, &drm->client.mmu, &head->olut); diff --git a/drivers/gpu/drm/nouveau/dispnv50/head.h b/drivers/gpu/drm/nouveau/dispnv50/head.h index d1c002f534d4..cefe589136f6 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/head.h +++ b/drivers/gpu/drm/nouveau/dispnv50/head.h @@ -20,10 +20,12 @@ void nv50_head_flush_clr(struct nv50_head *, struct nv50_head_atom *, bool y); struct nv50_head_func { void (*view)(struct nv50_head *, struct nv50_head_atom *); void (*mode)(struct nv50_head *, struct nv50_head_atom *); - void (*olut)(struct nv50_head *, struct nv50_head_atom *); + void (*olut)(struct nv50_head *, struct nv50_head_atom *, int); bool olut_identity; void (*olut_set)(struct nv50_head *, struct nv50_head_atom *); void (*olut_clr)(struct nv50_head *); + int lut_size; + bool (*lut_chk)(int size); void (*core_calc)(struct nv50_head *, struct nv50_head_atom *); void (*core_set)(struct nv50_head *, struct nv50_head_atom *); void (*core_clr)(struct nv50_head *); @@ -43,7 +45,8 @@ struct nv50_head_func { extern const struct nv50_head_func head507d; void head507d_view(struct nv50_head *, struct nv50_head_atom *); void head507d_mode(struct nv50_head *, struct nv50_head_atom *); -void head507d_olut(struct nv50_head *, struct nv50_head_atom *); +void head507d_olut(struct nv50_head *, struct nv50_head_atom *, int); +bool head507d_lut_chk(int); void head507d_core_calc(struct nv50_head *, struct nv50_head_atom *); void head507d_core_clr(struct nv50_head *); int head507d_curs_layout(struct nv50_head *, struct nv50_wndw_atom *, @@ -60,9 +63,10 @@ extern const struct nv50_head_func head827d; extern const struct nv50_head_func head907d; void head907d_view(struct nv50_head *, struct nv50_head_atom *); void head907d_mode(struct nv50_head *, struct nv50_head_atom *); -void head907d_olut(struct nv50_head *, struct nv50_head_atom *); +void head907d_olut(struct nv50_head *, struct nv50_head_atom *, int); void head907d_olut_set(struct nv50_head *, struct nv50_head_atom *); void head907d_olut_clr(struct nv50_head *); +bool head907d_lut_chk(int); void head907d_core_set(struct nv50_head *, struct nv50_head_atom *); void head907d_core_clr(struct nv50_head *); void head907d_curs_set(struct nv50_head *, struct nv50_head_atom *); diff --git a/drivers/gpu/drm/nouveau/dispnv50/head507d.c b/drivers/gpu/drm/nouveau/dispnv50/head507d.c index 7561be5ca707..59f06cebfce6 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/head507d.c +++ b/drivers/gpu/drm/nouveau/dispnv50/head507d.c @@ -272,7 +272,7 @@ head507d_olut_load(struct drm_color_lut *in, int size, void __iomem *mem) } void -head507d_olut(struct nv50_head *head, struct nv50_head_atom *asyh) +head507d_olut(struct nv50_head *head, struct nv50_head_atom *asyh, int size) { if (asyh->base.cpp == 1) asyh->olut.mode = 0; @@ -282,6 +282,12 @@ head507d_olut(struct nv50_head *head, struct nv50_head_atom *asyh) asyh->olut.load = head507d_olut_load; } +bool +head507d_lut_chk(int size) +{ + return size == 0 || size == 256; +} + void head507d_mode(struct nv50_head *head, struct nv50_head_atom *asyh) { @@ -330,6 +336,8 @@ head507d = { .olut = head507d_olut, .olut_set = head507d_olut_set, .olut_clr = head507d_olut_clr, + .lut_size = 256, + .lut_chk = head507d_lut_chk, .core_calc = head507d_core_calc, .core_set = head507d_core_set, .core_clr = head507d_core_clr, diff --git a/drivers/gpu/drm/nouveau/dispnv50/head827d.c b/drivers/gpu/drm/nouveau/dispnv50/head827d.c index af5e7bd5978b..d69e8671b743 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/head827d.c +++ b/drivers/gpu/drm/nouveau/dispnv50/head827d.c @@ -110,6 +110,8 @@ head827d = { .olut = head507d_olut, .olut_set = head827d_olut_set, .olut_clr = head827d_olut_clr, + .lut_size = 256, + .lut_chk = head507d_lut_chk, .core_calc = head507d_core_calc, .core_set = head827d_core_set, .core_clr = head507d_core_clr, diff --git a/drivers/gpu/drm/nouveau/dispnv50/head907d.c b/drivers/gpu/drm/nouveau/dispnv50/head907d.c index c2d09dd97b1f..c523d3c3feb5 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/head907d.c +++ b/drivers/gpu/drm/nouveau/dispnv50/head907d.c @@ -231,12 +231,18 @@ head907d_olut_load(struct drm_color_lut *in, int size, void __iomem *mem) } void -head907d_olut(struct nv50_head *head, struct nv50_head_atom *asyh) +head907d_olut(struct nv50_head *head, struct nv50_head_atom *asyh, int size) { - asyh->olut.mode = 7; + asyh->olut.mode = size == 1024 ? 4 : 7; asyh->olut.load = head907d_olut_load; } +bool +head907d_lut_chk(int size) +{ + return size == 0 || size == 256 || size == 1024; +} + void head907d_mode(struct nv50_head *head, struct nv50_head_atom *asyh) { @@ -287,6 +293,8 @@ head907d = { .olut = head907d_olut, .olut_set = head907d_olut_set, .olut_clr = head907d_olut_clr, + .lut_size = 1024, + .lut_chk = head907d_lut_chk, .core_calc = head507d_core_calc, .core_set = head907d_core_set, .core_clr = head907d_core_clr, diff --git a/drivers/gpu/drm/nouveau/dispnv50/head917d.c b/drivers/gpu/drm/nouveau/dispnv50/head917d.c index 303df8459ca8..7e79fab52104 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/head917d.c +++ b/drivers/gpu/drm/nouveau/dispnv50/head917d.c @@ -85,6 +85,8 @@ head917d = { .olut = head907d_olut, .olut_set = head907d_olut_set, .olut_clr = head907d_olut_clr, + .lut_size = 1024, + .lut_chk = head907d_lut_chk, .core_calc = head507d_core_calc, .core_set = head907d_core_set, .core_clr = head907d_core_clr, diff --git a/drivers/gpu/drm/nouveau/dispnv50/headc37d.c b/drivers/gpu/drm/nouveau/dispnv50/headc37d.c index ef6a99d95a9c..96ef740c6a96 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/headc37d.c +++ b/drivers/gpu/drm/nouveau/dispnv50/headc37d.c @@ -149,10 +149,10 @@ headc37d_olut_set(struct nv50_head *head, struct nv50_head_atom *asyh) } static void -headc37d_olut(struct nv50_head *head, struct nv50_head_atom *asyh) +headc37d_olut(struct nv50_head *head, struct nv50_head_atom *asyh, int size) { asyh->olut.mode = 2; - asyh->olut.size = 0; + asyh->olut.size = size == 1024 ? 2 : 0; asyh->olut.range = 0; asyh->olut.output_mode = 1; asyh->olut.load = head907d_olut_load; @@ -203,6 +203,8 @@ headc37d = { .olut = headc37d_olut, .olut_set = headc37d_olut_set, .olut_clr = headc37d_olut_clr, + .lut_size = 1024, + .lut_chk = head907d_lut_chk, .curs_layout = head917d_curs_layout, .curs_format = headc37d_curs_format, .curs_set = headc37d_curs_set, diff --git a/drivers/gpu/drm/nouveau/dispnv50/headc57d.c b/drivers/gpu/drm/nouveau/dispnv50/headc57d.c index 32a7f9e85fb0..0d91ba8000cc 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/headc57d.c +++ b/drivers/gpu/drm/nouveau/dispnv50/headc57d.c @@ -152,13 +152,12 @@ headc57d_olut_load(struct drm_color_lut *in, int size, void __iomem *mem) } void -headc57d_olut(struct nv50_head *head, struct nv50_head_atom *asyh) +headc57d_olut(struct nv50_head *head, struct nv50_head_atom *asyh, int size) { asyh->olut.mode = 2; /* DIRECT10 */ asyh->olut.size = 4 /* VSS header. */ + 1024 + 1 /* Entries. */; asyh->olut.output_mode = 1; /* INTERPOLATE_ENABLE. */ - if (asyh->state.gamma_lut && - asyh->state.gamma_lut->length / sizeof(struct drm_color_lut) == 256) + if (size == 256) asyh->olut.load = headc57d_olut_load_8; else asyh->olut.load = headc57d_olut_load; @@ -183,7 +182,7 @@ headc57d_mode(struct nv50_head *head, struct nv50_head_atom *asyh) evo_data(push, m->clock * 1000); /*XXX: HEAD_USAGE_BOUNDS, doesn't belong here. */ evo_mthd(push, 0x2030 + (head->base.index * 0x400), 1); - evo_data(push, 0x00001014); + evo_data(push, 0x00001024); evo_kick(push, core); } } @@ -196,6 +195,8 @@ headc57d = { .olut_identity = true, .olut_set = headc57d_olut_set, .olut_clr = headc57d_olut_clr, + .lut_size = 1024, + .lut_chk = head907d_lut_chk, .curs_layout = head917d_curs_layout, .curs_format = headc37d_curs_format, .curs_set = headc37d_curs_set, diff --git a/drivers/gpu/drm/nouveau/dispnv50/lut.c b/drivers/gpu/drm/nouveau/dispnv50/lut.c index 994def4fd51a..4e95ca5604ab 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/lut.c +++ b/drivers/gpu/drm/nouveau/dispnv50/lut.c @@ -49,7 +49,7 @@ nv50_lut_load(struct nv50_lut *lut, int buffer, struct drm_property_blob *blob, kvfree(in); } } else { - load(in, blob->length / sizeof(*in), mem); + load(in, drm_color_lut_size(blob), mem); } return addr; diff --git a/drivers/gpu/drm/nouveau/dispnv50/wndw.c b/drivers/gpu/drm/nouveau/dispnv50/wndw.c index cb94bc9f820f..1ecce1750a77 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/wndw.c +++ b/drivers/gpu/drm/nouveau/dispnv50/wndw.c @@ -332,7 +332,7 @@ nv50_wndw_atomic_check_lut(struct nv50_wndw *wndw, /* Recalculate LUT state. */ memset(&asyw->xlut, 0x00, sizeof(asyw->xlut)); if ((asyw->ilut = wndw->func->ilut ? ilut : NULL)) { - wndw->func->ilut(wndw, asyw); + wndw->func->ilut(wndw, asyw, drm_color_lut_size(ilut)); asyw->xlut.handle = wndw->wndw.vram.handle; asyw->xlut.i.buffer = !asyw->xlut.i.buffer; asyw->set.xlut = true; diff --git a/drivers/gpu/drm/nouveau/dispnv50/wndw.h b/drivers/gpu/drm/nouveau/dispnv50/wndw.h index 1e781d80c990..0a4cf6903b67 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/wndw.h +++ b/drivers/gpu/drm/nouveau/dispnv50/wndw.h @@ -64,7 +64,7 @@ struct nv50_wndw_func { void (*ntfy_clr)(struct nv50_wndw *); int (*ntfy_wait_begun)(struct nouveau_bo *, u32 offset, struct nvif_device *); - void (*ilut)(struct nv50_wndw *, struct nv50_wndw_atom *); + void (*ilut)(struct nv50_wndw *, struct nv50_wndw_atom *, int); void (*csc)(struct nv50_wndw *, struct nv50_wndw_atom *, const struct drm_color_ctm *); void (*csc_set)(struct nv50_wndw *, struct nv50_wndw_atom *); diff --git a/drivers/gpu/drm/nouveau/dispnv50/wndwc37e.c b/drivers/gpu/drm/nouveau/dispnv50/wndwc37e.c index 826d1d760d3a..776cda7e5377 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/wndwc37e.c +++ b/drivers/gpu/drm/nouveau/dispnv50/wndwc37e.c @@ -55,10 +55,10 @@ wndwc37e_ilut_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw) } static void -wndwc37e_ilut(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw) +wndwc37e_ilut(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw, int size) { asyw->xlut.i.mode = 2; - asyw->xlut.i.size = 0; + asyw->xlut.i.size = size == 1024 ? 2 : 0; asyw->xlut.i.range = 0; asyw->xlut.i.output_mode = 1; asyw->xlut.i.load = head907d_olut_load; diff --git a/drivers/gpu/drm/nouveau/dispnv50/wndwc57e.c b/drivers/gpu/drm/nouveau/dispnv50/wndwc57e.c index ba89f1a5fcfa..45348dbe9e59 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/wndwc57e.c +++ b/drivers/gpu/drm/nouveau/dispnv50/wndwc57e.c @@ -91,9 +91,8 @@ wndwc57e_ilut_load(struct drm_color_lut *in, int size, void __iomem *mem) } static void -wndwc57e_ilut(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw) +wndwc57e_ilut(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw, int size) { - u16 size = asyw->ilut->length / sizeof(struct drm_color_lut); if (size == 256) { asyw->xlut.i.mode = 1; /* DIRECT8. */ } else {