summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/nouveau/dispnv50/headc57d.c
diff options
context:
space:
mode:
authorIlia Mirkin <imirkin@alum.mit.edu>2019-09-06 07:13:59 +0300
committerBen Skeggs <bskeggs@redhat.com>2020-01-15 03:49:58 +0300
commit131992709dc4c6140cec3b352f820cb873f7dd50 (patch)
tree071b2b1facb94d5a9c3c1a40fd35682e6b0b4ad1 /drivers/gpu/drm/nouveau/dispnv50/headc57d.c
parent11a8630917b681ff2f5320938b8d76b354c89d34 (diff)
downloadlinux-131992709dc4c6140cec3b352f820cb873f7dd50.tar.xz
drm/nouveau/kms/gf119-: allow both 256- and 1024-sized LUTs to be used
The hardware supports either size. Also add checks to ensure that only these two sizes may be used for supplying a LUT. Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/dispnv50/headc57d.c')
-rw-r--r--drivers/gpu/drm/nouveau/dispnv50/headc57d.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/gpu/drm/nouveau/dispnv50/headc57d.c b/drivers/gpu/drm/nouveau/dispnv50/headc57d.c
index 32a7f9e85fb0..938d910a1b1e 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/headc57d.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/headc57d.c
@@ -151,17 +151,20 @@ headc57d_olut_load(struct drm_color_lut *in, int size, void __iomem *mem)
writew(readw(mem - 4), mem + 4);
}
-void
-headc57d_olut(struct nv50_head *head, struct nv50_head_atom *asyh)
+bool
+headc57d_olut(struct nv50_head *head, struct nv50_head_atom *asyh, int size)
{
+ if (size != 0 && size != 256 && size != 1024)
+ return false;
+
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;
+ return true;
}
static void
@@ -194,6 +197,7 @@ headc57d = {
.mode = headc57d_mode,
.olut = headc57d_olut,
.olut_identity = true,
+ .olut_size = 1024,
.olut_set = headc57d_olut_set,
.olut_clr = headc57d_olut_clr,
.curs_layout = head917d_curs_layout,