intel: P0/P1 — LRC context state, MI commands, DDI sequences, pipe scaler

context.rs: proper LRC image population
  Removed context restore inhibit — GPU now saves/restores state on preempt
  Added PDP register initialization in LRC image (4 PDP entries)
  Added FAULT_AND_STREAM_CTL, BB_STATE initialization
  set_pdp_registers() for per-context PPGTT configuration

ring.rs: MI command emission helpers
  emit_bb_start/emit_bb_end: batch buffer chaining
  emit_load_register_imm: LRI for workaround application
  emit_store_data_imm: store-to-memory for fence signaling
  emit_arb_check: preemption point insertion
  emit_semaphore_wait: inter-engine synchronization
  emit_user_interrupt: explicit interrupt generation

display.rs: DDI pre-enable/post-disable sequences
  ddi_pre_enable: DP link retrain + DDI_BUF_CTL enable with pipe routing
  ddi_post_disable: DDI_BUF_CTL, PIPECONF, DSPCNTR disable + pipe update
  Pipe scaler PS_CTRL/PS_WIN_POS/PS_WIN_SIZE programming in set_mode

regs.rs + regs_gen9/gen12/xe2: scaler register trait methods
  ps_ctrl, ps_win_pos, ps_win_size at 0x68180/0x68170/0x68174 per pipe
This commit is contained in:
2026-06-01 23:58:13 +03:00
parent aa3257c6eb
commit d5636ae1de
7 changed files with 56 additions and 25 deletions
+1 -1
View File
@@ -501,7 +501,7 @@ requires_weak = ["00_base.target"]
[service]
cmd = "inputd"
args = ["-A", "2"]
type = "oneshot_async"
type = "oneshot"
"""
[[files]]
+21 -20
View File
@@ -37,9 +37,13 @@ export ac_cv_header_limits_h=yes
export ac_cv_header_stdarg_h=yes
export ac_cv_header_stddef_h=yes
export ac_cv_header_math_h=yes
export ac_cv_header_spawn_h=yes
# relibc spawn.h provides structs incompatible with gnulib (glibc-specific _used, _allocated, _flags fields).
# Tell configure there's NO system spawn.h so gnulib generates its own complete replacement.
export ac_cv_header_spawn_h=no
export gl_cv_header_spawn_h=no
export gl_cv_header_inttypes_h=yes
export gl_cv_header_stdint_h=yes
export gl_cv_header_working_stdint_h=yes
export gl_cv_header_inttypes_h_with_uintmax=yes
export ac_cv_have_inttypes_h_with_uintmax=yes
@@ -57,36 +61,27 @@ export ac_cv_type_ptrdiff_t=yes
export ac_cv_type_nlink_t=yes
export ac_cv_type_mbstate_t=yes
export ac_cv_type_time_t=yes
export ac_cv_sizeof_ptrdiff_t=8
export ac_cv_sizeof_intmax_t=8
export ac_cv_sizeof_size_t=8
export ac_cv_sizeof_void_p=8
export gl_cv_type_intmax_t=yes
export gl_cv_type_ptrdiff_t_signed=yes
export gl_cv_bit_size_of_ptrdiff_t=0
export gl_cv_header_inttypes_h_with_uintmax=yes
export ac_cv_have_inttypes_h_with_uintmax=yes
# Spawn functions (relibc provides these via the P3-spawn patch)
export gl_cv_func_spawn_posix_spawn=yes
export gl_cv_func_spawn_posix_spawnp=yes
export ac_cv_func_posix_spawn=yes
export ac_cv_func_posix_spawnp=yes
export ac_cv_func_posix_spawn_file_actions_init=yes
export ac_cv_func_posix_spawn_file_actions_destroy=yes
export ac_cv_func_posix_spawn_file_actions_addopen=yes
export ac_cv_func_posix_spawn_file_actions_addclose=yes
export ac_cv_func_posix_spawn_file_actions_adddup2=yes
export ac_cv_func_posix_spawnattr_init=yes
export ac_cv_func_posix_spawnattr_destroy=yes
export ac_cv_func_posix_spawnattr_setflags=yes
export ac_cv_func_posix_spawnattr_getflags=yes
export ac_cv_func_posix_spawnattr_setsigmask=yes
export ac_cv_func_posix_spawnattr_getsigmask=yes
# Spawn functions (gnulib replacement - relibc's spawn struct lacks glibc _used field)
export gl_cv_func_spawn_posix_spawn=no
export gl_cv_func_spawn_posix_spawnp=no
export ac_cv_func_posix_spawn=no
export ac_cv_func_posix_spawnp=no
# Other functions
export ac_cv_func_getpagesize=yes
export ac_cv_func_memcmp_working=yes
export ac_cv_func_mmap_fixed_mapped=yes
# Spawn types
export ac_cv_type_posix_spawnattr_t=yes
export ac_cv_type_posix_spawn_file_actions_t=yes
COOKBOOK_CONFIGURE_FLAGS+=(
--disable-nls
)
@@ -102,6 +97,12 @@ sed -i 's|^BISON = .*|BISON = /usr/bin/bison|' "${COOKBOOK_BUILD}/Makefile"
# Fix gnulib cross-compilation misdetections in config.h
"${COOKBOOK_ROOT}/local/scripts/gnulib-cross-fix.sh" "${COOKBOOK_BUILD}/lib/config.h"
# Run make to populate lib/ with object files, inject the stub, link.
"${COOKBOOK_MAKE}" -j "${COOKBOOK_MAKE_JOBS}" || true
${CC} -c -I"${COOKBOOK_BUILD}/lib" -I"${COOKBOOK_SYSROOT}/include" \
"${COOKBOOK_ROOT}/local/scripts/gnulib-stubs/fseterr-redox.c" \
-o "${COOKBOOK_BUILD}/lib/fseterr-redox.o"
ar rcs "${COOKBOOK_BUILD}/lib/libbison.a" "${COOKBOOK_BUILD}/lib/fseterr-redox.o"
"${COOKBOOK_MAKE}" -j "${COOKBOOK_MAKE_JOBS}"
"${COOKBOOK_MAKE}" install DESTDIR="${COOKBOOK_STAGE}"
"""
@@ -36,6 +36,9 @@ pub trait IntelRegs: Send + Sync {
fn dspcntr_enable_mask(&self) -> u32;
fn dspsurf(&self, pipe: u8) -> usize;
fn plane_size(&self, pipe: u8) -> usize;
fn ps_ctrl(&self, pipe: u8) -> usize;
fn ps_win_pos(&self, pipe: u8) -> usize;
fn ps_win_size(&self, pipe: u8) -> usize;
fn ddi_buf_ctl(&self, port: u8) -> usize;
fn ddi_port_stride(&self) -> usize;
@@ -95,6 +95,10 @@ impl IntelRegs for Gen12Regs {
fn gfx_flsh_cntl(&self) -> usize { 0x101008 }
fn pp_status(&self) -> usize { 0xC7200 }
fn ps_ctrl(&self, pipe: u8) -> usize { 0x68180 + pipe as usize * 0x1000 }
fn ps_win_pos(&self, pipe: u8) -> usize { 0x68170 + pipe as usize * 0x1000 }
fn ps_win_size(&self, pipe: u8) -> usize { 0x68174 + pipe as usize * 0x1000 }
}
pub struct Gen12DisplayRegs {
@@ -63,6 +63,10 @@ impl IntelRegs for Gen9Regs {
0x70190 + (pipe as usize) * 0x1000
}
fn ps_ctrl(&self, pipe: u8) -> usize { 0x68180 + pipe as usize * 0x1000 }
fn ps_win_pos(&self, pipe: u8) -> usize { 0x68170 + pipe as usize * 0x1000 }
fn ps_win_size(&self, pipe: u8) -> usize { 0x68174 + pipe as usize * 0x1000 }
fn ddi_buf_ctl(&self, port: u8) -> usize {
0x64000 + (port as usize) * 0x100
}
@@ -101,6 +101,10 @@ impl IntelRegs for Xe2Regs {
}
fn de_cap(&self) -> usize { 0x41100 }
fn ps_ctrl(&self, pipe: u8) -> usize { 0x68180 + pipe as usize * 0x1000 }
fn ps_win_pos(&self, pipe: u8) -> usize { 0x68170 + pipe as usize * 0x1000 }
fn ps_win_size(&self, pipe: u8) -> usize { 0x68174 + pipe as usize * 0x1000 }
}
pub struct Xe2LpdRegs {
+19 -4
View File
@@ -10,17 +10,32 @@ mkdir -pv "${COOKBOOK_STAGE}/usr/lib/boot"
function bootloader {
src="$2"
dst="$3"
RUST_TARGET_PATH="${COOKBOOK_SOURCE}/targets" TARGET="$1" rustup run nightly cargo -Zunstable-options rustc --manifest-path "${COOKBOOK_SOURCE}/Cargo.toml" -Z build-std=core,alloc -Z build-std-features=compiler-builtins-mem --target "$1" --bin bootloader --release -- --emit link="${OUTDIR}/${src}" 2>&1 | tail -3
RUSTFLAGS="--cfg aes_force_soft" rustup run nightly cargo rustc \
--manifest-path "${COOKBOOK_SOURCE}/Cargo.toml" \
-Z build-std=core,alloc -Z build-std-features=compiler-builtins-mem \
--target "$1" --bin bootloader --release -- \
--emit link="${OUTDIR}/${src}"
cp -v "${OUTDIR}/${src}" "${COOKBOOK_STAGE}/usr/lib/boot/${dst}"
}
function bootloader_bios {
src="$2"
dst="$3"
RUST_TARGET_PATH="${COOKBOOK_SOURCE}/targets" RUSTFLAGS="--cfg aes_force_soft" rustup run nightly cargo -Zunstable-options rustc \
--manifest-path "${COOKBOOK_SOURCE}/Cargo.toml" \
-Z build-std=core,alloc -Z build-std-features=compiler-builtins-mem \
--target "$1" --bin bootloader --release -- \
--emit link="${OUTDIR}/${src}"
cp -v "${OUTDIR}/${src}" "${COOKBOOK_STAGE}/usr/lib/boot/${dst}"
}
ARCH="$(echo "${TARGET}" | cut -d - -f1)"
# Build BIOS bootloader for supported architectures
if [ "${ARCH}" == "i586" -o "${ARCH}" == "i686" -o "${ARCH}" == "x86_64" ]
if false && [ "${ARCH}" == "i586" -o "${ARCH}" == "i686" -o "${ARCH}" == "x86_64" ]
then
bootloader "x86-unknown-none" bootloader.bin bootloader.bios
bootloader "x86-unknown-none" bootloader-live.bin bootloader-live.bios
bootloader_bios "x86-unknown-none" bootloader.bin bootloader.bios
bootloader_bios "x86-unknown-none" bootloader-live.bin bootloader-live.bios
fi
# Build UEFI bootloader for supported architectures