From 0b00e3512440c1e56af756267c3e3cefb62c469c Mon Sep 17 00:00:00 2001 From: root Date: Sun, 2 Dec 2007 13:59:46 +1100 Subject: add ability to set crtc regs --- radeontool.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/radeontool.c b/radeontool.c index d0b10d3..0d16fb4 100644 --- a/radeontool.c +++ b/radeontool.c @@ -185,6 +185,18 @@ uint8_t get_vga_crtc_reg(int crtc, int reg) return retval; } +void set_vga_crtc_reg(int crtc, int reg, uint8_t val) +{ + int offset; + if (crtc==0) + offset = NV_PCIO0_OFFSET; + else + offset = NV_PCIO0_OFFSET + 0x2000; + + radeon_set8(offset+CRTC_INDEX, "CRTC", reg); + radeon_set8(offset+CRTC_DATA, "CRTC", val); +} + uint32_t get_tmds_index_reg(int index, int reg) { uint32_t idx_reg; @@ -348,6 +360,7 @@ void radeon_reg_match(const char *pattern) int i; unsigned long address; unsigned int value; + if (pattern[0] == '0' && pattern[1] == 'x') { address = strtol(&(pattern[2]), NULL, 16); value = radeon_get32(address, pattern); @@ -355,6 +368,13 @@ void radeon_reg_match(const char *pattern) return; } + if (pattern[0] == 'C' && pattern[2] == ':') { + uint8_t crtc = (pattern[1] == '0') ? 0 : 1; + address = strtol(&(pattern[3]), NULL, 16); + value = get_vga_crtc_reg(crtc, address); + printf("%s\tCRTC%d: 0x%02x (%d)\n", pattern, crtc, value, value); + return; + } for (i=0;i