Skip to content
This repository was archived by the owner on Jan 27, 2026. It is now read-only.

Commit e912c80

Browse files
committed
Enable pipe crc regional
Add pipe crc regional size/position registers settting to enable crc regional. Signed-off-by: Jialin <lin.a.jia@intel.com>
1 parent 4c59d86 commit e912c80

3 files changed

Lines changed: 64 additions & 0 deletions

File tree

drivers/gpu/drm/i915/display/intel_pipe_crc.c

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,48 @@ display_crc_ctl_parse_source(const char *buf, enum intel_pipe_crc_source *s)
434434
return 0;
435435
}
436436

437+
static int intel_crtc_change_crc_region(struct drm_i915_private *dev_priv,
438+
struct intel_crtc *crtc,
439+
enum pipe pipe,
440+
enum intel_pipe_crc_source *source, u32 *val)
441+
{
442+
struct display_region *region;/* = &dev_priv->regions[dev_priv->next_region++];*/
443+
struct drm_checksum_region *region_data =
444+
(struct drm_checksum_region *)crtc->config->hw.region_blob->data;
445+
u32 reg_val = 0;
446+
447+
region->x = region_data->x_start;
448+
region->y = region_data->y_start;
449+
region->width = region_data->x_end - region_data->x_start;
450+
region->height = region_data->y_end - region_data->y_start;
451+
#if 0
452+
intel_de_write(dev_priv, PIPE_CRC_CTL(pipe), val);
453+
intel_de_posting_read(dev_priv, PIPE_CRC_CTL(pipe));
454+
#endif
455+
reg_val = intel_de_read(dev_priv, PIPE_CRC_REGIONAL_SIZE(pipe));
456+
reg_val &= ~PIPE_CRC_REGIONAL_SIZE_Y_MASK;
457+
reg_val |= (region->height << PIPE_CRC_REGIONAL_SIZE_Y_SHIFT) & PIPE_CRC_REGIONAL_SIZE_Y_MASK;
458+
reg_val &= ~PIPE_CRC_REGIONAL_SIZE_X_MASK;
459+
reg_val |= (region->width << PIPE_CRC_REGIONAL_SIZE_X_SHIFT) & PIPE_CRC_REGIONAL_SIZE_X_MASK;
460+
intel_de_write(dev_priv, PIPE_CRC_REGIONAL_SIZE(pipe), reg_val);
461+
intel_de_posting_read(dev_priv, PIPE_CRC_REGIONAL_SIZE(pipe));
462+
463+
reg_val = intel_de_read(dev_priv, PIPE_CRC_REGIONAL_POS(pipe));
464+
reg_val &= ~PIPE_CRC_REGIONAL_POS_Y_MASK;
465+
reg_val |= (region->y << PIPE_CRC_REGIONAL_POS_Y_SHIFT) & PIPE_CRC_REGIONAL_POS_Y_MASK;
466+
reg_val &= ~PIPE_CRC_REGIONAL_POS_X_MASK;
467+
reg_val |= (region->x << PIPE_CRC_REGIONAL_POS_X_SHIFT) & PIPE_CRC_REGIONAL_POS_X_MASK;
468+
intel_de_write(dev_priv, PIPE_CRC_REGIONAL_POS(pipe), reg_val);
469+
intel_de_posting_read(dev_priv, PIPE_CRC_REGIONAL_POS(pipe));
470+
#if 0
471+
if (dev_priv->next_region == dev_priv->region_cnt) {
472+
dev_priv->next_region = 0;
473+
}
474+
#endif
475+
return 0;
476+
}
477+
478+
437479
void intel_crtc_crc_init(struct intel_crtc *crtc)
438480
{
439481
struct intel_pipe_crc *pipe_crc = &crtc->pipe_crc;
@@ -608,6 +650,8 @@ int intel_crtc_set_crc_source(struct drm_crtc *_crtc, const char *source_name)
608650
goto out;
609651

610652
pipe_crc->source = source;
653+
654+
intel_crtc_change_crc_region(dev_priv, crtc, pipe, &source, &val);
611655
intel_de_write(dev_priv, PIPE_CRC_CTL(pipe), val);
612656
intel_de_posting_read(dev_priv, PIPE_CRC_CTL(pipe));
613657

drivers/gpu/drm/i915/display/intel_pipe_crc.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ struct drm_i915_private;
1313
struct intel_crtc;
1414

1515
#ifdef CONFIG_DEBUG_FS
16+
struct display_region {
17+
uint16_t x, y;
18+
uint16_t width, height;
19+
//uint64_t fbbuf; /* gpa, size = width * height * BPP */
20+
}__packed;
21+
1622
void intel_crtc_crc_init(struct intel_crtc *crtc);
1723
int intel_crtc_set_crc_source(struct drm_crtc *crtc, const char *source_name);
1824
int intel_crtc_verify_crc_source(struct drm_crtc *crtc,

drivers/gpu/drm/i915/i915_reg.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1844,6 +1844,18 @@
18441844
*/
18451845

18461846
/* Pipe A CRC regs */
1847+
#define _PIPE_CRC_REGIONAL_SIZE_A 0x60048
1848+
#define PIPE_CRC_REGIONAL_SIZE_Y_SHIFT 0
1849+
#define PIPE_CRC_REGIONAL_SIZE_Y_MASK 0x00003FFF
1850+
#define PIPE_CRC_REGIONAL_SIZE_X_SHIFT 16
1851+
#define PIPE_CRC_REGIONAL_SIZE_X_MASK 0x3FFF0000
1852+
1853+
#define _PIPE_CRC_REGIONAL_POS_A 0x6004C
1854+
#define PIPE_CRC_REGIONAL_POS_Y_SHIFT 0
1855+
#define PIPE_CRC_REGIONAL_POS_Y_MASK 0x00003FFF
1856+
#define PIPE_CRC_REGIONAL_POS_X_SHIFT 16
1857+
#define PIPE_CRC_REGIONAL_POS_X_MASK 0x1FFF0000
1858+
18471859
#define _PIPE_CRC_CTL_A 0x60050
18481860
#define PIPE_CRC_ENABLE REG_BIT(31)
18491861
/* skl+ source selection */
@@ -1911,6 +1923,8 @@
19111923
#define _PIPE_CRC_RES_4_B_IVB 0x61070
19121924
#define _PIPE_CRC_RES_5_B_IVB 0x61074
19131925

1926+
#define PIPE_CRC_REGIONAL_SIZE(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_REGIONAL_SIZE_A)
1927+
#define PIPE_CRC_REGIONAL_POS(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_REGIONAL_POS_A)
19141928
#define PIPE_CRC_CTL(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_CTL_A)
19151929
#define PIPE_CRC_RES_1_IVB(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_1_A_IVB)
19161930
#define PIPE_CRC_RES_2_IVB(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_2_A_IVB)

0 commit comments

Comments
 (0)