aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2013-10-21 11:26:38 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2013-10-21 12:34:08 -0400
commit52f843f6ccbd73497c8e9acd9299ebf216d738be (patch)
tree5a67df63cca2c09eda192a41fa81f04744fb1a17
parent4b79ebf7b2967e6e905e6e12e113a6ce9a86d045 (diff)
drm/i915: Wire up gen2 CRC support
Really simple, and we don't even have working frame numbers. v2: Actually enable it ... v3: Review from Ville: - Unconditionally enable the border in the CRC checksum for consistency with gen3+. - Handle the "none" source to be able to disable the CRC machinery again. Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r--drivers/gpu/drm/i915/i915_debugfs.c23
-rw-r--r--drivers/gpu/drm/i915/i915_reg.h1
2 files changed, 22 insertions, 2 deletions
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index e3f09801b64d..9a4f168c9e39 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -1947,6 +1947,23 @@ static int display_crc_ctl_open(struct inode *inode, struct file *file)
1947 return single_open(file, display_crc_ctl_show, dev); 1947 return single_open(file, display_crc_ctl_show, dev);
1948} 1948}
1949 1949
1950static int i8xx_pipe_crc_ctl_reg(enum intel_pipe_crc_source source,
1951 uint32_t *val)
1952{
1953 switch (source) {
1954 case INTEL_PIPE_CRC_SOURCE_PIPE:
1955 *val = PIPE_CRC_ENABLE | PIPE_CRC_INCLUDE_BORDER_I8XX;
1956 break;
1957 case INTEL_PIPE_CRC_SOURCE_NONE:
1958 *val = 0;
1959 break;
1960 default:
1961 return -EINVAL;
1962 }
1963
1964 return 0;
1965}
1966
1950static int i9xx_pipe_crc_ctl_reg(struct drm_device *dev, 1967static int i9xx_pipe_crc_ctl_reg(struct drm_device *dev,
1951 enum intel_pipe_crc_source source, 1968 enum intel_pipe_crc_source source,
1952 uint32_t *val) 1969 uint32_t *val)
@@ -2039,7 +2056,7 @@ static int pipe_crc_set_source(struct drm_device *dev, enum pipe pipe,
2039 u32 val; 2056 u32 val;
2040 int ret; 2057 int ret;
2041 2058
2042 if (!(INTEL_INFO(dev)->gen >= 3 && !IS_VALLEYVIEW(dev))) 2059 if (IS_VALLEYVIEW(dev))
2043 return -ENODEV; 2060 return -ENODEV;
2044 2061
2045 if (pipe_crc->source == source) 2062 if (pipe_crc->source == source)
@@ -2049,7 +2066,9 @@ static int pipe_crc_set_source(struct drm_device *dev, enum pipe pipe,
2049 if (pipe_crc->source && source) 2066 if (pipe_crc->source && source)
2050 return -EINVAL; 2067 return -EINVAL;
2051 2068
2052 if (INTEL_INFO(dev)->gen < 5) 2069 if (IS_GEN2(dev))
2070 ret = i8xx_pipe_crc_ctl_reg(source, &val);
2071 else if (INTEL_INFO(dev)->gen < 5)
2053 ret = i9xx_pipe_crc_ctl_reg(dev, source, &val); 2072 ret = i9xx_pipe_crc_ctl_reg(dev, source, &val);
2054 else if (IS_GEN5(dev) || IS_GEN6(dev)) 2073 else if (IS_GEN5(dev) || IS_GEN6(dev))
2055 ret = ilk_pipe_crc_ctl_reg(source, &val); 2074 ret = ilk_pipe_crc_ctl_reg(source, &val);
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index d0e61f0c34ce..d1fb06a6a3f0 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -1873,6 +1873,7 @@
1873#define PIPE_CRC_SOURCE_DP_B_G4X (6 << 28) 1873#define PIPE_CRC_SOURCE_DP_B_G4X (6 << 28)
1874#define PIPE_CRC_SOURCE_DP_C_G4X (7 << 28) 1874#define PIPE_CRC_SOURCE_DP_C_G4X (7 << 28)
1875/* gen2 doesn't have source selection bits */ 1875/* gen2 doesn't have source selection bits */
1876#define PIPE_CRC_INCLUDE_BORDER_I8XX (1 << 30)
1876 1877
1877#define _PIPE_CRC_RES_1_A_IVB 0x60064 1878#define _PIPE_CRC_RES_1_A_IVB 0x60064
1878#define _PIPE_CRC_RES_2_A_IVB 0x60068 1879#define _PIPE_CRC_RES_2_A_IVB 0x60068