[Openchrome-devel] HW cursor not working with KMS on K8M890CE
Ondrej Zary
linux at rainbow-software.org
Tue Oct 15 01:38:09 PDT 2013
Hello,
KMS is working on K8M890CE (Asus P3-AE5 system, M2V-TVM board) except for the
HW cursor. The problem is that KMS code seems to use wrong registers at least
on this chipset:
via_show_cursor():
if (iga->index) {
VIA_WRITE(HI_FBOFFSET, iga->cursor_kmap.bo->offset);
VIA_WRITE(HI_CONTROL, 0xB6000005);
} else {
VIA_WRITE(PRIM_HI_FBOFFSET, iga->cursor_kmap.bo->offset);
VIA_WRITE(PRIM_HI_CTRL, 0x36000005);
}
iga->index is 0 so PRIM_HI_ regs are used.
But UMS xf86-video-openchrome uses the other register set:
iga1_crtc_show_cursor():
switch(pVia->Chipset) {
case VIA_CX700:
case VIA_P4M890:
case VIA_P4M900:
case VIA_VX800:
case VIA_VX855:
case VIA_VX900:
VIASETREG(PRIM_HI_FBOFFSET, iga->cursor_bo->offset);
VIASETREG(PRIM_HI_CTRL, 0x36000005);
break;
default:
/* Mono Cursor Display Path [bit31]: Primary */
VIASETREG(HI_FBOFFSET, iga->cursor_bo->offset);
VIASETREG(HI_CONTROL, 0x76000005);
break;
}
Also the values written to control registers are different - KMS uses
0xB6000005 to enable cursor while UMS uses 0x76000005.
The following hack makes HW cursor work on K8M890CE:
diff --git a/drivers/gpu/drm/via/via_crtc.c b/drivers/gpu/drm/via/via_crtc.c
index f7c8a7e..0bb27fb 100644
--- a/drivers/gpu/drm/via/via_crtc.c
+++ b/drivers/gpu/drm/via/via_crtc.c
@@ -52,13 +52,8 @@ via_hide_cursor(struct drm_crtc *crtc)
struct drm_via_private *dev_priv = crtc->dev->dev_private;
uint32_t temp;
- if (iga->index) {
temp = VIA_READ(HI_CONTROL);
VIA_WRITE(HI_CONTROL, temp & 0xFFFFFFFA);
- } else {
- temp = VIA_READ(PRIM_HI_CTRL);
- VIA_WRITE(PRIM_HI_CTRL, temp & 0xFFFFFFFA);
- }
}
static void
@@ -71,13 +66,8 @@ via_show_cursor(struct drm_crtc *crtc)
return;
/* Program the offset and turn on Hardware icon Cursor */
- if (iga->index) {
VIA_WRITE(HI_FBOFFSET, iga->cursor_kmap.bo->offset);
- VIA_WRITE(HI_CONTROL, 0xB6000005);
- } else {
- VIA_WRITE(PRIM_HI_FBOFFSET, iga->cursor_kmap.bo->offset);
- VIA_WRITE(PRIM_HI_CTRL, 0x36000005);
- }
+ VIA_WRITE(HI_CONTROL, 0x76000005);
}
static int
@@ -153,13 +143,8 @@ via_crtc_cursor_move(struct drm_crtc *crtc, int x, int y)
ypos = 0;
}
- if (iga->index) {
VIA_WRITE(HI_POSSTART, ((xpos << 16) | (ypos & 0x07ff)));
VIA_WRITE(HI_CENTEROFFSET, ((xoff << 16) | (yoff & 0x07ff)));
- } else {
- VIA_WRITE(PRIM_HI_POSSTART, ((xpos << 16) | (ypos & 0x07ff)));
- VIA_WRITE(PRIM_HI_CENTEROFFSET, ((xoff << 16) | (yoff & 0x07ff)));
- }
return 0;
}
--
Ondrej Zary
More information about the Openchrome-devel
mailing list