]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm/nouveau/kms/gv100-: implement csc + enable modern colour managment properties
authorBen Skeggs <bskeggs@redhat.com>
Tue, 11 Jun 2019 07:46:39 +0000 (17:46 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 23 Aug 2019 02:55:32 +0000 (12:55 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/dispnv50/base907c.c
drivers/gpu/drm/nouveau/dispnv50/head.c
drivers/gpu/drm/nouveau/dispnv50/wndw.h
drivers/gpu/drm/nouveau/dispnv50/wndwc37e.c
drivers/gpu/drm/nouveau/dispnv50/wndwc57e.c

index fd0c1d84730b071f009b40db6c69818c15d7c653..5f2de77e0f32e1bcce6a48a41c1546f4ba9b09a8 100644 (file)
@@ -101,7 +101,7 @@ csc_drm_to_base(u64 in)
        }
 }
 
-static void
+void
 base907c_csc(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
             const struct drm_color_ctm *ctm)
 {
index 46e7f4c51f10e8c79e6617fc6a7910673c51808a..0d1108eadcff4f20361c39fc37ece9a697eaffd9 100644 (file)
@@ -512,8 +512,7 @@ nv50_head_create(struct drm_device *dev, int index)
                                  &nv50_head_func, "head-%d", head->base.index);
        drm_crtc_helper_add(crtc, &nv50_head_help);
        drm_mode_crtc_set_gamma_size(crtc, 256);
-       if (disp->disp->object.oclass >= GF110_DISP &&
-           disp->disp->object.oclass < GV100_DISP)
+       if (disp->disp->object.oclass >= GF110_DISP)
                drm_crtc_enable_color_mgmt(crtc, 256, true, 256);
        else
                drm_crtc_enable_color_mgmt(crtc, 0, false, 256);
index 1e781d80c990a7669dafcd202d834d2f825c145b..59ff8f082542be7528e71b15318600a883272cab 100644 (file)
@@ -85,6 +85,9 @@ extern const struct drm_plane_funcs nv50_wndw;
 void base507c_ntfy_reset(struct nouveau_bo *, u32);
 int base507c_ntfy_wait_begun(struct nouveau_bo *, u32, struct nvif_device *);
 
+void base907c_csc(struct nv50_wndw *, struct nv50_wndw_atom *,
+                 const struct drm_color_ctm *);
+
 struct nv50_wimm_func {
        void (*point)(struct nv50_wndw *, struct nv50_wndw_atom *);
 
@@ -106,7 +109,6 @@ void wndwc37e_sema_set(struct nv50_wndw *, struct nv50_wndw_atom *);
 void wndwc37e_sema_clr(struct nv50_wndw *);
 void wndwc37e_ntfy_set(struct nv50_wndw *, struct nv50_wndw_atom *);
 void wndwc37e_ntfy_clr(struct nv50_wndw *);
-void wndwc37e_image_set(struct nv50_wndw *, struct nv50_wndw_atom *);
 void wndwc37e_image_clr(struct nv50_wndw *);
 void wndwc37e_update(struct nv50_wndw *, u32 *);
 
index 8a4f0e436be628508a61ffff5a1070ad36e10eca..0d270cd5ac4cce2d5579f425213d54454b6babaf 100644 (file)
 
 #include <nvif/clc37e.h>
 
+static void
+wndwc37e_csc_clr(struct nv50_wndw *wndw)
+{
+}
+
+static void
+wndwc37e_csc_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
+{
+       u32 *push, i;
+       if ((push = evo_wait(&wndw->wndw, 13))) {
+                evo_mthd(push, 0x02bc, 12);
+                for (i = 0; i < 12; i++)
+                         evo_data(push, asyw->csc.matrix[i]);
+                evo_kick(push, &wndw->wndw);
+       }
+}
+
 static void
 wndwc37e_ilut_clr(struct nv50_wndw *wndw)
 {
@@ -77,7 +94,7 @@ wndwc37e_image_clr(struct nv50_wndw *wndw)
        }
 }
 
-void
+static void
 wndwc37e_image_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
 {
        u32 *push;
@@ -90,7 +107,9 @@ wndwc37e_image_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
        evo_mthd(push, 0x0224, 4);
        evo_data(push, asyw->image.h << 16 | asyw->image.w);
        evo_data(push, asyw->image.layout << 4 | asyw->image.blockh);
-       evo_data(push, asyw->image.colorspace << 8 | asyw->image.format);
+       evo_data(push, asyw->csc.valid << 17 |
+                      asyw->image.colorspace << 8 |
+                      asyw->image.format);
        evo_data(push, asyw->image.blocks[0] | (asyw->image.pitch[0] >> 6));
        evo_mthd(push, 0x0240, 1);
        evo_data(push, asyw->image.handle[0]);
@@ -234,6 +253,9 @@ wndwc37e = {
        .ilut = wndwc37e_ilut,
        .xlut_set = wndwc37e_ilut_set,
        .xlut_clr = wndwc37e_ilut_clr,
+       .csc = base907c_csc,
+       .csc_set = wndwc37e_csc_set,
+       .csc_clr = wndwc37e_csc_clr,
        .image_set = wndwc37e_image_set,
        .image_clr = wndwc37e_image_clr,
        .update = wndwc37e_update,
index ba89f1a5fcfaf7795b4ccbc3883bd6dcbc71f4fc..d5e4b006ae1eab8d94a6394f6d27ad8b9e2f4832 100644 (file)
 
 #include <nvif/clc37e.h>
 
+static void
+wndwc57e_image_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
+{
+       u32 *push;
+
+       if (!(push = evo_wait(&wndw->wndw, 17)))
+               return;
+
+       evo_mthd(push, 0x0308, 1);
+       evo_data(push, asyw->image.mode << 4 | asyw->image.interval);
+       evo_mthd(push, 0x0224, 4);
+       evo_data(push, asyw->image.h << 16 | asyw->image.w);
+       evo_data(push, asyw->image.layout << 4 | asyw->image.blockh);
+       evo_data(push, asyw->image.colorspace << 8 |
+                      asyw->image.format);
+       evo_data(push, asyw->image.blocks[0] | (asyw->image.pitch[0] >> 6));
+       evo_mthd(push, 0x0240, 1);
+       evo_data(push, asyw->image.handle[0]);
+       evo_mthd(push, 0x0260, 1);
+       evo_data(push, asyw->image.offset[0] >> 8);
+       evo_mthd(push, 0x0290, 1);
+       evo_data(push, (asyw->state.src_y >> 16) << 16 |
+                      (asyw->state.src_x >> 16));
+       evo_mthd(push, 0x0298, 1);
+       evo_data(push, (asyw->state.src_h >> 16) << 16 |
+                      (asyw->state.src_w >> 16));
+       evo_mthd(push, 0x02a4, 1);
+       evo_data(push, asyw->state.crtc_h << 16 |
+                      asyw->state.crtc_w);
+       evo_kick(push, &wndw->wndw);
+}
+
+static void
+wndwc57e_csc_clr(struct nv50_wndw *wndw)
+{
+       u32 *push;
+       if ((push = evo_wait(&wndw->wndw, 13))) {
+                evo_mthd(push, 0x0400, 12);
+                evo_data(push, 0x00010000);
+                evo_data(push, 0x00000000);
+                evo_data(push, 0x00000000);
+                evo_data(push, 0x00000000);
+                evo_data(push, 0x00000000);
+                evo_data(push, 0x00010000);
+                evo_data(push, 0x00000000);
+                evo_data(push, 0x00000000);
+                evo_data(push, 0x00000000);
+                evo_data(push, 0x00000000);
+                evo_data(push, 0x00010000);
+                evo_data(push, 0x00000000);
+                evo_kick(push, &wndw->wndw);
+       }
+}
+
+static void
+wndwc57e_csc_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
+{
+       u32 *push, i;
+       if ((push = evo_wait(&wndw->wndw, 13))) {
+                evo_mthd(push, 0x0400, 12);
+                for (i = 0; i < 12; i++)
+                         evo_data(push, asyw->csc.matrix[i]);
+                evo_kick(push, &wndw->wndw);
+       }
+}
+
 static void
 wndwc57e_ilut_clr(struct nv50_wndw *wndw)
 {
@@ -119,7 +185,10 @@ wndwc57e = {
        .ilut_identity = true,
        .xlut_set = wndwc57e_ilut_set,
        .xlut_clr = wndwc57e_ilut_clr,
-       .image_set = wndwc37e_image_set,
+       .csc = base907c_csc,
+       .csc_set = wndwc57e_csc_set,
+       .csc_clr = wndwc57e_csc_clr,
+       .image_set = wndwc57e_image_set,
        .image_clr = wndwc37e_image_clr,
        .update = wndwc37e_update,
 };