diff --git a/drivers/graphics/ihdgd/src/device/mod.rs b/drivers/graphics/ihdgd/src/device/mod.rs index 7c751573f4..45f4075167 100644 --- a/drivers/graphics/ihdgd/src/device/mod.rs +++ b/drivers/graphics/ihdgd/src/device/mod.rs @@ -392,7 +392,8 @@ impl Device { DeviceKind::Alchemist => { // Many registers are identical to tigerlake dplls = Dpll::tigerlake(>tmm)?; - pipes = Pipe::tigerlake(>tmm)?; + pipes = Pipe::alchemist(>tmm)?; + // FIXME transcoders are probably different too transcoders = Transcoder::tigerlake(>tmm)?; // Power wells are distinct ddis = Ddi::alchemist(>tmm)?; diff --git a/drivers/graphics/ihdgd/src/device/pipe.rs b/drivers/graphics/ihdgd/src/device/pipe.rs index ffad8f4e32..afa120d7a3 100644 --- a/drivers/graphics/ihdgd/src/device/pipe.rs +++ b/drivers/graphics/ihdgd/src/device/pipe.rs @@ -307,4 +307,61 @@ impl Pipe { } Ok(pipes) } + + pub fn alchemist(gttmm: &MmioRegion) -> Result> { + let mut pipes = Vec::with_capacity(4); + for (i, name) in ["A", "B", "C", "D"].iter().enumerate() { + let mut planes = Vec::new(); + //TODO: cursor plane + for (j, name) in ["1", "2", "3", "4", "5"].iter().enumerate() { + planes.push(Plane { + name, + index: j, + // IHD-OS-ACM-Vol 2c-3.23 PLANE_BUF_CFG + buf_cfg: unsafe { gttmm.mmio(0x7057C + i * 0x1000 + j * 0x100)? }, + // IHD-OS-ACM-Vol 2c-3.23 PLANE_COLOR_CTL + color_ctl: Some(unsafe { gttmm.mmio(0x704CC + i * 0x1000 + j * 0x100)? }), + color_ctl_gamma_disable: 1 << 13, + // IHD-OS-ACM-Vol 2c-3.23 PLANE_CTL + ctl: unsafe { gttmm.mmio(0x70480 + i * 0x1000 + j * 0x100)? }, + ctl_source_rgb_8888: 0b01000 << 23, + ctl_source_mask: 0b11111 << 23, + // IHD-OS-ACM-Vol 2c-3.23 PLANE_OFFSET + offset: unsafe { gttmm.mmio(0x704A4 + i * 0x1000 + j * 0x100)? }, + // IHD-OS-ACM-Vol 2c-3.23 PLANE_POS + pos: unsafe { gttmm.mmio(0x7048C + i * 0x1000 + j * 0x100)? }, + // IHD-OS-ACM-Vol 2c-3.23 PLANE_SIZE + size: unsafe { gttmm.mmio(0x70490 + i * 0x1000 + j * 0x100)? }, + // IHD-OS-ACM-Vol 2c-3.23 PLANE_STRIDE + stride: unsafe { gttmm.mmio(0x70488 + i * 0x1000 + j * 0x100)? }, + // IHD-OS-ACM-Vol 2c-3.23 PLANE_SURF + surf: unsafe { gttmm.mmio(0x7049C + i * 0x1000 + j * 0x100)? }, + // IHD-OS-ACM-Vol 2c-3.23 PLANE_WM + wm: [ + unsafe { gttmm.mmio(0x70540 + i * 0x1000 + j * 0x100)? }, + unsafe { gttmm.mmio(0x70544 + i * 0x1000 + j * 0x100)? }, + unsafe { gttmm.mmio(0x70548 + i * 0x1000 + j * 0x100)? }, + unsafe { gttmm.mmio(0x7054C + i * 0x1000 + j * 0x100)? }, + unsafe { gttmm.mmio(0x70550 + i * 0x1000 + j * 0x100)? }, + unsafe { gttmm.mmio(0x70554 + i * 0x1000 + j * 0x100)? }, + unsafe { gttmm.mmio(0x70558 + i * 0x1000 + j * 0x100)? }, + unsafe { gttmm.mmio(0x7055C + i * 0x1000 + j * 0x100)? }, + ], + wm_trans: unsafe { gttmm.mmio(0x70568 + i * 0x1000 + j * 0x100)? }, + }); + } + pipes.push(Pipe { + name, + index: i, + planes, + // IHD-OS-ACM-Vol 2c-3.23 PIPE_BOTTOM_COLOR + bottom_color: unsafe { gttmm.mmio(0x70034 + i * 0x1000)? }, + // IHD-OS-ACM-Vol 2c-3.23 PIPE_MISC + misc: unsafe { gttmm.mmio(0x70030 + i * 0x1000)? }, + // IHD-OS-ACM-Vol 2c-3.23 PIPE_SRCSZ + srcsz: unsafe { gttmm.mmio(0x6001C + i * 0x1000)? }, + }) + } + Ok(pipes) + } }