Skip to contentSkip to conversation

mgag200: initial g200se driver

PATCH In review Dave Airlie 4 participants 4 messages Apr 26, 2012

Subsystems (3)
lore
Share & tools
lore

Dave Airlie

author maintainer
#0 lore raw

PATCH 1/1 mgag200: initial g200se driver

From: Dave Airlie <[email protected]>

This is a driver for the G200 server engines chips, it doesn't driver any of the Matrix G series desktop cards.

It will bind to G200 SE A,B, G200EV, G200WB, G200EH and G200ER cards.

Its based on previous work done my Matthew Garrett but remodelled to follow the same style and flow as the AST server driver. It also works along the same lines as the AST server driver wrt memory management.

There is no userspace driver planned, xf86-video-modesetting should be used. It also appears these GPUs have no ARGB hw cursors.

---
 drivers/gpu/drm/Kconfig                |    1 +
 drivers/gpu/drm/Makefile               |    1 +
 drivers/gpu/drm/mgag200/Kconfig        |    8 +
 drivers/gpu/drm/mgag200/Makefile       |    5 +
 drivers/gpu/drm/mgag200/mgag200_drv.c  |  115 +++
 drivers/gpu/drm/mgag200/mgag200_drv.h  |  274 ++++++
 drivers/gpu/drm/mgag200/mgag200_fb.c   |  293 +++++++
 drivers/gpu/drm/mgag200/mgag200_i2c.c  |  129 +++
 drivers/gpu/drm/mgag200/mgag200_main.c |  388 +++++++++
 drivers/gpu/drm/mgag200/mgag200_mode.c | 1494 ++++++++++++++++++++++++++++++++
 drivers/gpu/drm/mgag200/mgag200_reg.h  |  659 ++++++++++++++
 drivers/gpu/drm/mgag200/mgag200_ttm.c  |  452 ++++++++++
 12 files changed, 3819 insertions(+), 0 deletions(-)
 create mode 100644 drivers/gpu/drm/mgag200/Kconfig
 create mode 100644 drivers/gpu/drm/mgag200/Makefile
 create mode 100644 drivers/gpu/drm/mgag200/mgag200_drv.c
 create mode 100644 drivers/gpu/drm/mgag200/mgag200_drv.h
 create mode 100644 drivers/gpu/drm/mgag200/mgag200_fb.c
 create mode 100644 drivers/gpu/drm/mgag200/mgag200_i2c.c
 create mode 100644 drivers/gpu/drm/mgag200/mgag200_main.c
 create mode 100644 drivers/gpu/drm/mgag200/mgag200_mode.c
 create mode 100644 drivers/gpu/drm/mgag200/mgag200_reg.h
 create mode 100644 drivers/gpu/drm/mgag200/mgag200_ttm.c
drivers/gpu/drm/Kconfig +1 -0
index 514049f..47b1d3a 100644
@@ -167,3 +167,4 @@ source "drivers/gpu/drm/gma500/Kconfig"
 
 source "drivers/gpu/drm/ast/Kconfig"
 
+source "drivers/gpu/drm/mgag200/Kconfig"
drivers/gpu/drm/Makefile +1 -0
index bd76195..0d91e1a 100644
@@ -30,6 +30,7 @@ obj-$(CONFIG_DRM_RADEON)+= radeon/
 obj-$(CONFIG_DRM_MGA)	+= mga/
 obj-$(CONFIG_DRM_I810)	+= i810/
 obj-$(CONFIG_DRM_I915)  += i915/
+obj-$(CONFIG_DRM_MGAG200) += mgag200/
 obj-$(CONFIG_DRM_SIS)   += sis/
 obj-$(CONFIG_DRM_SAVAGE)+= savage/
 obj-$(CONFIG_DRM_VMWGFX)+= vmwgfx/
drivers/gpu/drm/mgag200/Kconfig new file +8 -0
new file mode 100644
index 0000000..9bc979f
@@ -0,0 +1,8 @@
+config DRM_MGAG200
+	tristate "Kernel modesetting driver for MGA G200 server engines"
+	depends on DRM && PCI
+	select FB_SYS_FILLRECT
+	select FB_SYS_COPYAREA
+	select FB_SYS_IMAGEBLIT
+	select DRM_KMS_HELPER
+
drivers/gpu/drm/mgag200/Makefile new file +5 -0
new file mode 100644
index 0000000..7db592e
@@ -0,0 +1,5 @@
+ccflags-y := -Iinclude/drm
+mgag200-y   := mgag200_main.o mgag200_mode.o \
+	mgag200_drv.o mgag200_fb.o mgag200_i2c.o mgag200_ttm.o
+
+obj-$(CONFIG_DRM_MGAG200) += mgag200.o
drivers/gpu/drm/mgag200/mgag200_drv.c new file +115 -0

115 lines not on this page · raw message

drivers/gpu/drm/mgag200/mgag200_drv.h new file +274 -0

274 lines not on this page · raw message

drivers/gpu/drm/mgag200/mgag200_fb.c new file +293 -0

293 lines not on this page · raw message

drivers/gpu/drm/mgag200/mgag200_i2c.c new file +129 -0

129 lines not on this page · raw message

drivers/gpu/drm/mgag200/mgag200_main.c new file +388 -0

388 lines not on this page · raw message

drivers/gpu/drm/mgag200/mgag200_mode.c new file +1494 -0

1,494 lines not on this page · raw message

drivers/gpu/drm/mgag200/mgag200_reg.h new file +659 -0

283 lines not on this page · raw message

drivers/gpu/drm/mgag200/mgag200_ttm.c new file +452 -0

452 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.7.7.6

Part of the diff is not shown here. View the raw message.

#1 lore raw
Quoted 6 lines · Dave Airlie

+/*
+ * Our emulated hardware has two sets of memory. One is video RAM and can
+ * simply be used as a linear framebuffer - the other provides mmio access
+ * to the display registers. The latter can also be accessed via IO port
+ * access, but we map the range and use mmio to program them instead
+ */

I suspect this comment came from somewhere near the emulated cirrus card in qemu? G200's definitely not emulated hardware.

Quoted 8 lines

+/*
+ * The meat of this driver. The core passes us a mode and we have to program
+ * it. The modesetting here is the bare minimum required to satisfy the qemu
+ * emulation of this hardware, and running this against a real device is
+ * likely to result in an inadequately programmed mode. We've already had
+ * the opportunity to modify the mode, so whatever we receive here should
+ * be something that can be correctly programmed and displayed
+ */

Yep, drm/cirrus all over the place here.

drivers/gpu/drm/mgag200/mgag200_mode.c line 1152

Quoted 6 lines
drivers/gpu/drm/mgag200/mgag200_mode.c new file +6 -0
+/*
+ * This is called after a mode is programmed. It should reverse anything done
+ * by the prepare function
+ */
+static void mga_crtc_commit(struct drm_crtc *crtc)
+{

This appears to be missing the analog of the "Reset tagfifo" commit from the X driver for G200ER:

http://cgit.freedesktop.org/xorg/driver/xf86-video-mga/commit/?id=01ca2186ea028b2549de509b51726aa08519fce0

Which, admittedly, is in an odd place in the X driver.

- ajax

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw
In reply to Dave Airlie
Quoted 4 lines · Dave Airlie

From: Dave Airlie <[email protected]>

This is a driver for the G200 server engines chips, it doesn't driver any of the Matrix G series desktop cards.

BTW I have a pile of modesetting and card initialization code written for all mga chips from 2064W up to G550, except these G200 server variants.

It's mostly in userspace but I wrote some wrappers for kernel APIs, so most of the code looks like kernel code (not drm/kms code though).

It was a night/weekend project for me at some point, and my plan was to make a kms driver out of it, but I ran out of steam before I got that far. I suppose I should try to get off my ass and do something useful with that code.

Signature · 3 lines
Ville Syrjälä
[email protected]
http://www.sci.fi/~syrjala/
#3 lore raw
In reply to Dave Airlie

drivers/gpu/drm/mgag200/mgag200_mode.c line 2

Quoted 8 lines · Dave Airlie
drivers/gpu/drm/mgag200/mgag200_mode.c new file +2 -0
new file mode 100644
index 0000000..a74f946
@@ -0,0 +1,1494 @@
+/*
+ * Copyright 2000,2001 Sven Luther.

Here...

drivers/gpu/drm/mgag200/mgag200_mode.c line 14

Quoted 12 lines
drivers/gpu/drm/mgag200/mgag200_mode.c new file +12 -0
+ * Copyright 2010 Matt Turner.
+ * Copyright 2011 Red Hat <[email protected]>
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License version 2. See the file COPYING in the main
+ * directory of this archive for more details.
+ *
+ * Authors: Matthew Garrett
+ *                     Matt Turner
+ *                     Sven Luther
+ *                     Thomas Witzel
+ *                     Alan Hourihane

and here, the copyrights and authorship for Sven Luther, Thomas Witzel, and Alan Hourihane can be dropped. When I wrote glint_crtc.c, I copied PM3DAC_CalculateClock from xf86-video-glint. With no remnants of this function left, none of the code was written by them.