diff mbox

[3/3] drm/vc4: Restrict active CTM to one CRTC

Message ID 1521237059-37117-4-git-send-email-stschake@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Stefan Schake March 16, 2018, 9:50 p.m. UTC
We only have one hardware block to do the CTM and need to reject
attempts to enable it for multiple CRTCs simultaneously.

Signed-off-by: Stefan Schake <stschake@gmail.com>
---
 drivers/gpu/drm/vc4/vc4_crtc.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

kernel test robot March 18, 2018, 6:55 a.m. UTC | #1
Hi Stefan,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on v4.16-rc4]
[also build test WARNING on next-20180316]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Stefan-Schake/drm-vc4-Atomic-color-management-support/20180318-120701
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=sh 

All warnings (new ones prefixed by >>):

        ^~~~~~~~~~~~~
   drivers/gpu/drm/vc4/vc4_crtc.c:362:5: error: 'SCALER_OLEDCOEF0_B_TO_B_MASK' undeclared (first use in this function); did you mean 'SCALER_OLEDCOEF0_B_TO_G_MASK'?
        SCALER_OLEDCOEF0_B_TO_B));
        ^
   arch/sh/include/asm/io.h:31:77: note: in definition of macro '__raw_writel'
    #define __raw_writel(v,a) (__chk_io_ptr(a), *(volatile u32 __force *)(a) = (v))
                                                                                ^
   arch/sh/include/asm/io.h:46:62: note: in expansion of macro 'ioswabl'
    #define writel_relaxed(v,c) ((void)__raw_writel((__force u32)ioswabl(v),c))
                                                                 ^~~~~~~
   arch/sh/include/asm/io.h:56:32: note: in expansion of macro 'writel_relaxed'
    #define writel(v,a)  ({ wmb(); writel_relaxed((v),(a)); })
                                   ^~~~~~~~~~~~~~
   drivers/gpu/drm/vc4/vc4_drv.h:301:32: note: in expansion of macro 'writel'
    #define HVS_WRITE(offset, val) writel(val, vc4->hvs->regs + offset)
                                   ^~~~~~
   drivers/gpu/drm/vc4/vc4_crtc.c:356:2: note: in expansion of macro 'HVS_WRITE'
     HVS_WRITE(SCALER_OLEDCOEF0,
     ^~~~~~~~~
   drivers/gpu/drm/vc4/vc4_regs.h:19:3: note: in expansion of macro 'WARN_ON'
      WARN_ON((fieldval & ~field##_MASK) != 0);  \
      ^~~~~~~
   drivers/gpu/drm/vc4/vc4_crtc.c:361:5: note: in expansion of macro 'VC4_SET_FIELD'
        VC4_SET_FIELD(vc4_crtc_s31_32_to_s0_9(ctm->matrix[8]),
        ^~~~~~~~~~~~~
   drivers/gpu/drm/vc4/vc4_crtc.c:365:12: error: 'SCALER_OLEDOFFS' undeclared (first use in this function); did you mean 'SCALER_OLEDCOEF0'?
     HVS_WRITE(SCALER_OLEDOFFS, VC4_SET_FIELD(vc4_crtc->channel + 1,
               ^
   arch/sh/include/asm/io.h:31:71: note: in definition of macro '__raw_writel'
    #define __raw_writel(v,a) (__chk_io_ptr(a), *(volatile u32 __force *)(a) = (v))
                                                                          ^
   arch/sh/include/asm/io.h:56:32: note: in expansion of macro 'writel_relaxed'
    #define writel(v,a)  ({ wmb(); writel_relaxed((v),(a)); })
                                   ^~~~~~~~~~~~~~
   drivers/gpu/drm/vc4/vc4_drv.h:301:32: note: in expansion of macro 'writel'
    #define HVS_WRITE(offset, val) writel(val, vc4->hvs->regs + offset)
                                   ^~~~~~
   drivers/gpu/drm/vc4/vc4_crtc.c:365:2: note: in expansion of macro 'HVS_WRITE'
     HVS_WRITE(SCALER_OLEDOFFS, VC4_SET_FIELD(vc4_crtc->channel + 1,
     ^~~~~~~~~
   drivers/gpu/drm/vc4/vc4_crtc.c:366:8: error: 'SCALER_OLEDOFFS_DISPFIFO_SHIFT' undeclared (first use in this function); did you mean 'SCALER_OLEDCOEF0_B_TO_B_SHIFT'?
           SCALER_OLEDOFFS_DISPFIFO));
           ^
   arch/sh/include/asm/io.h:31:77: note: in definition of macro '__raw_writel'
    #define __raw_writel(v,a) (__chk_io_ptr(a), *(volatile u32 __force *)(a) = (v))
                                                                                ^
   arch/sh/include/asm/io.h:46:62: note: in expansion of macro 'ioswabl'
    #define writel_relaxed(v,c) ((void)__raw_writel((__force u32)ioswabl(v),c))
                                                                 ^~~~~~~
   arch/sh/include/asm/io.h:56:32: note: in expansion of macro 'writel_relaxed'
    #define writel(v,a)  ({ wmb(); writel_relaxed((v),(a)); })
                                   ^~~~~~~~~~~~~~
   drivers/gpu/drm/vc4/vc4_drv.h:301:32: note: in expansion of macro 'writel'
    #define HVS_WRITE(offset, val) writel(val, vc4->hvs->regs + offset)
                                   ^~~~~~
   drivers/gpu/drm/vc4/vc4_crtc.c:365:2: note: in expansion of macro 'HVS_WRITE'
     HVS_WRITE(SCALER_OLEDOFFS, VC4_SET_FIELD(vc4_crtc->channel + 1,
     ^~~~~~~~~
   drivers/gpu/drm/vc4/vc4_crtc.c:365:29: note: in expansion of macro 'VC4_SET_FIELD'
     HVS_WRITE(SCALER_OLEDOFFS, VC4_SET_FIELD(vc4_crtc->channel + 1,
                                ^~~~~~~~~~~~~
   drivers/gpu/drm/vc4/vc4_crtc.c:366:8: error: 'SCALER_OLEDOFFS_DISPFIFO_MASK' undeclared (first use in this function); did you mean 'SCALER_OLEDOFFS_DISPFIFO_SHIFT'?
           SCALER_OLEDOFFS_DISPFIFO));
           ^
   arch/sh/include/asm/io.h:31:77: note: in definition of macro '__raw_writel'
    #define __raw_writel(v,a) (__chk_io_ptr(a), *(volatile u32 __force *)(a) = (v))
                                                                                ^
   arch/sh/include/asm/io.h:46:62: note: in expansion of macro 'ioswabl'
    #define writel_relaxed(v,c) ((void)__raw_writel((__force u32)ioswabl(v),c))
                                                                 ^~~~~~~
   arch/sh/include/asm/io.h:56:32: note: in expansion of macro 'writel_relaxed'
    #define writel(v,a)  ({ wmb(); writel_relaxed((v),(a)); })
                                   ^~~~~~~~~~~~~~
   drivers/gpu/drm/vc4/vc4_drv.h:301:32: note: in expansion of macro 'writel'
    #define HVS_WRITE(offset, val) writel(val, vc4->hvs->regs + offset)
                                   ^~~~~~
   drivers/gpu/drm/vc4/vc4_crtc.c:365:2: note: in expansion of macro 'HVS_WRITE'
     HVS_WRITE(SCALER_OLEDOFFS, VC4_SET_FIELD(vc4_crtc->channel + 1,
     ^~~~~~~~~
   drivers/gpu/drm/vc4/vc4_regs.h:19:3: note: in expansion of macro 'WARN_ON'
      WARN_ON((fieldval & ~field##_MASK) != 0);  \
      ^~~~~~~
   drivers/gpu/drm/vc4/vc4_crtc.c:365:29: note: in expansion of macro 'VC4_SET_FIELD'
     HVS_WRITE(SCALER_OLEDOFFS, VC4_SET_FIELD(vc4_crtc->channel + 1,
                                ^~~~~~~~~~~~~
   drivers/gpu/drm/vc4/vc4_crtc.c: In function 'vc4_crtc_atomic_check_ctm':
   drivers/gpu/drm/vc4/vc4_crtc.c:377:30: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
     struct drm_color_ctm *ctm = state->ctm->data;
                                 ^~~~~
   In file included from drivers/gpu/drm/vc4/vc4_crtc.c:43:0:
   drivers/gpu/drm/vc4/vc4_crtc.c: In function 'vc4_crtc_get_ctm_fifo':
   drivers/gpu/drm/vc4/vc4_crtc.c:683:32: error: 'SCALER_OLEDOFFS' undeclared (first use in this function); did you mean 'SCALER_GAMDATA'?
     return VC4_GET_FIELD(HVS_READ(SCALER_OLEDOFFS),
                                   ^
   drivers/gpu/drm/vc4/vc4_regs.h:23:39: note: in definition of macro 'VC4_GET_FIELD'
    #define VC4_GET_FIELD(word, field) (((word) & field##_MASK) >>  \
                                          ^~~~
   arch/sh/include/asm/io.h:41:39: note: in expansion of macro 'ioswabl'
    #define readl_relaxed(c) ({ u32 __v = ioswabl(__raw_readl(c)); __v; })
                                          ^~~~~~~
>> arch/sh/include/asm/io.h:41:47: note: in expansion of macro '__raw_readl'
    #define readl_relaxed(c) ({ u32 __v = ioswabl(__raw_readl(c)); __v; })
                                                  ^~~~~~~~~~~
>> arch/sh/include/asm/io.h:51:31: note: in expansion of macro 'readl_relaxed'
    #define readl(a)  ({ u32 r_ = readl_relaxed(a); rmb(); r_; })
                                  ^~~~~~~~~~~~~
>> drivers/gpu/drm/vc4/vc4_drv.h:300:26: note: in expansion of macro 'readl'
    #define HVS_READ(offset) readl(vc4->hvs->regs + offset)
                             ^~~~~
   drivers/gpu/drm/vc4/vc4_crtc.c:683:23: note: in expansion of macro 'HVS_READ'
     return VC4_GET_FIELD(HVS_READ(SCALER_OLEDOFFS),
                          ^~~~~~~~
   drivers/gpu/drm/vc4/vc4_crtc.c:684:9: error: 'SCALER_OLEDOFFS_DISPFIFO_MASK' undeclared (first use in this function); did you mean 'SCALER_PPF_IPHASE_MASK'?
            SCALER_OLEDOFFS_DISPFIFO);
            ^
   drivers/gpu/drm/vc4/vc4_regs.h:23:47: note: in definition of macro 'VC4_GET_FIELD'
    #define VC4_GET_FIELD(word, field) (((word) & field##_MASK) >>  \
                                                  ^~~~~
   drivers/gpu/drm/vc4/vc4_crtc.c:684:9: error: 'SCALER_OLEDOFFS_DISPFIFO_SHIFT' undeclared (first use in this function); did you mean 'SCALER_OLEDOFFS_DISPFIFO_MASK'?
            SCALER_OLEDOFFS_DISPFIFO);
            ^
   drivers/gpu/drm/vc4/vc4_regs.h:24:9: note: in definition of macro 'VC4_GET_FIELD'
            field##_SHIFT)
            ^~~~~
   In file included from include/linux/fb.h:17:0,
                    from include/drm/drm_crtc.h:31,
                    from include/drm/drm_atomic.h:31,
                    from drivers/gpu/drm/vc4/vc4_crtc.c:35:
   drivers/gpu/drm/vc4/vc4_crtc.c: In function 'vc4_crtc_atomic_flush':
   drivers/gpu/drm/vc4/vc4_crtc.c:778:14: error: 'SCALER_OLEDOFFS' undeclared (first use in this function); did you mean 'SCALER_GAMDATA'?
       HVS_WRITE(SCALER_OLEDOFFS,
                 ^
   arch/sh/include/asm/io.h:31:71: note: in definition of macro '__raw_writel'
    #define __raw_writel(v,a) (__chk_io_ptr(a), *(volatile u32 __force *)(a) = (v))
                                                                          ^
   arch/sh/include/asm/io.h:56:32: note: in expansion of macro 'writel_relaxed'
    #define writel(v,a)  ({ wmb(); writel_relaxed((v),(a)); })
                                   ^~~~~~~~~~~~~~
   drivers/gpu/drm/vc4/vc4_drv.h:301:32: note: in expansion of macro 'writel'
    #define HVS_WRITE(offset, val) writel(val, vc4->hvs->regs + offset)
                                   ^~~~~~
   drivers/gpu/drm/vc4/vc4_crtc.c:778:4: note: in expansion of macro 'HVS_WRITE'
       HVS_WRITE(SCALER_OLEDOFFS,
       ^~~~~~~~~
   drivers/gpu/drm/vc4/vc4_crtc.c:779:24: error: 'SCALER_OLEDOFFS_DISPFIFO_SHIFT' undeclared (first use in this function); did you mean 'SCALER_PPF_IPHASE_SHIFT'?
          VC4_SET_FIELD(0, SCALER_OLEDOFFS_DISPFIFO));
                           ^
   arch/sh/include/asm/io.h:31:77: note: in definition of macro '__raw_writel'
    #define __raw_writel(v,a) (__chk_io_ptr(a), *(volatile u32 __force *)(a) = (v))
                                                                                ^
   arch/sh/include/asm/io.h:46:62: note: in expansion of macro 'ioswabl'
    #define writel_relaxed(v,c) ((void)__raw_writel((__force u32)ioswabl(v),c))
                                                                 ^~~~~~~
   arch/sh/include/asm/io.h:56:32: note: in expansion of macro 'writel_relaxed'
    #define writel(v,a)  ({ wmb(); writel_relaxed((v),(a)); })
                                   ^~~~~~~~~~~~~~
   drivers/gpu/drm/vc4/vc4_drv.h:301:32: note: in expansion of macro 'writel'
    #define HVS_WRITE(offset, val) writel(val, vc4->hvs->regs + offset)
                                   ^~~~~~
   drivers/gpu/drm/vc4/vc4_crtc.c:778:4: note: in expansion of macro 'HVS_WRITE'
       HVS_WRITE(SCALER_OLEDOFFS,
       ^~~~~~~~~
   drivers/gpu/drm/vc4/vc4_crtc.c:779:7: note: in expansion of macro 'VC4_SET_FIELD'
          VC4_SET_FIELD(0, SCALER_OLEDOFFS_DISPFIFO));
          ^~~~~~~~~~~~~
   drivers/gpu/drm/vc4/vc4_crtc.c:779:24: error: 'SCALER_OLEDOFFS_DISPFIFO_MASK' undeclared (first use in this function); did you mean 'SCALER_OLEDOFFS_DISPFIFO_SHIFT'?
          VC4_SET_FIELD(0, SCALER_OLEDOFFS_DISPFIFO));
                           ^
   arch/sh/include/asm/io.h:31:77: note: in definition of macro '__raw_writel'
    #define __raw_writel(v,a) (__chk_io_ptr(a), *(volatile u32 __force *)(a) = (v))
                                                                                ^
   arch/sh/include/asm/io.h:46:62: note: in expansion of macro 'ioswabl'
    #define writel_relaxed(v,c) ((void)__raw_writel((__force u32)ioswabl(v),c))
                                                                 ^~~~~~~
   arch/sh/include/asm/io.h:56:32: note: in expansion of macro 'writel_relaxed'
    #define writel(v,a)  ({ wmb(); writel_relaxed((v),(a)); })
                                   ^~~~~~~~~~~~~~
   drivers/gpu/drm/vc4/vc4_drv.h:301:32: note: in expansion of macro 'writel'
    #define HVS_WRITE(offset, val) writel(val, vc4->hvs->regs + offset)
                                   ^~~~~~
   drivers/gpu/drm/vc4/vc4_crtc.c:778:4: note: in expansion of macro 'HVS_WRITE'
       HVS_WRITE(SCALER_OLEDOFFS,
       ^~~~~~~~~
   drivers/gpu/drm/vc4/vc4_regs.h:19:3: note: in expansion of macro 'WARN_ON'
      WARN_ON((fieldval & ~field##_MASK) != 0);  \
      ^~~~~~~
   drivers/gpu/drm/vc4/vc4_crtc.c:779:7: note: in expansion of macro 'VC4_SET_FIELD'
          VC4_SET_FIELD(0, SCALER_OLEDOFFS_DISPFIFO));
          ^~~~~~~~~~~~~
   drivers/gpu/drm/vc4/vc4_crtc.c: In function 'vc4_crtc_get_ctm_fifo':
   drivers/gpu/drm/vc4/vc4_crtc.c:685:1: warning: control reaches end of non-void function [-Wreturn-type]
    }
    ^
   cc1: some warnings being treated as errors

vim +/__raw_readl +41 arch/sh/include/asm/io.h

14866543 Paul Mundt 2008-10-04  38  
b7e68d68 Paul Mundt 2012-03-29  39  #define readb_relaxed(c)	({ u8  __v = ioswabb(__raw_readb(c)); __v; })
b7e68d68 Paul Mundt 2012-03-29  40  #define readw_relaxed(c)	({ u16 __v = ioswabw(__raw_readw(c)); __v; })
b7e68d68 Paul Mundt 2012-03-29 @41  #define readl_relaxed(c)	({ u32 __v = ioswabl(__raw_readl(c)); __v; })
b7e68d68 Paul Mundt 2012-03-29  42  #define readq_relaxed(c)	({ u64 __v = ioswabq(__raw_readq(c)); __v; })
b7e68d68 Paul Mundt 2012-03-29  43  
b7e68d68 Paul Mundt 2012-03-29  44  #define writeb_relaxed(v,c)	((void)__raw_writeb((__force  u8)ioswabb(v),c))
b7e68d68 Paul Mundt 2012-03-29  45  #define writew_relaxed(v,c)	((void)__raw_writew((__force u16)ioswabw(v),c))
b7e68d68 Paul Mundt 2012-03-29  46  #define writel_relaxed(v,c)	((void)__raw_writel((__force u32)ioswabl(v),c))
b7e68d68 Paul Mundt 2012-03-29  47  #define writeq_relaxed(v,c)	((void)__raw_writeq((__force u64)ioswabq(v),c))
37b7a978 Paul Mundt 2010-11-01  48  
37b7a978 Paul Mundt 2010-11-01  49  #define readb(a)		({ u8  r_ = readb_relaxed(a); rmb(); r_; })
37b7a978 Paul Mundt 2010-11-01  50  #define readw(a)		({ u16 r_ = readw_relaxed(a); rmb(); r_; })
37b7a978 Paul Mundt 2010-11-01 @51  #define readl(a)		({ u32 r_ = readl_relaxed(a); rmb(); r_; })
37b7a978 Paul Mundt 2010-11-01  52  #define readq(a)		({ u64 r_ = readq_relaxed(a); rmb(); r_; })
37b7a978 Paul Mundt 2010-11-01  53  

:::::: The code at line 41 was first introduced by commit
:::::: b7e68d6876dfbab087bc3859211a9efc74cbe30c sh: Support I/O space swapping where needed.

:::::: TO: Paul Mundt <lethal@linux-sh.org>
:::::: CC: Paul Mundt <lethal@linux-sh.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
index 5c83fd2..64ff293 100644
--- a/drivers/gpu/drm/vc4/vc4_crtc.c
+++ b/drivers/gpu/drm/vc4/vc4_crtc.c
@@ -678,10 +678,17 @@  static enum drm_mode_status vc4_crtc_mode_valid(struct drm_crtc *crtc,
 	return MODE_OK;
 }
 
+static int vc4_crtc_get_ctm_fifo(struct vc4_dev *vc4)
+{
+	return VC4_GET_FIELD(HVS_READ(SCALER_OLEDOFFS),
+			     SCALER_OLEDOFFS_DISPFIFO);
+}
+
 static int vc4_crtc_atomic_check(struct drm_crtc *crtc,
 				 struct drm_crtc_state *state)
 {
 	struct vc4_crtc_state *vc4_state = to_vc4_crtc_state(state);
+	struct drm_crtc_state *old_state = crtc->state;
 	struct drm_device *dev = crtc->dev;
 	struct vc4_dev *vc4 = to_vc4_dev(dev);
 	struct drm_plane *plane;
@@ -703,6 +710,10 @@  static int vc4_crtc_atomic_check(struct drm_crtc *crtc,
 		 */
 		if (vc4_crtc_atomic_check_ctm(state))
 			return -EINVAL;
+
+		/* We can only enable CTM for one fifo or CRTC at a time */
+		if (!old_state->ctm && vc4_crtc_get_ctm_fifo(vc4))
+			return -EINVAL;
 	}
 
 	drm_atomic_crtc_state_for_each_plane_state(plane, plane_state, state)