drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series
Subsystems (3)
Dave Airlie
maintainerPATCH 1/1 drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series
From: Dave Airlie <[email protected]>
This is the initial driver for the Aspeed Technologies chips found in servers. This driver supports the AST 2000, 2100, 2200, 2150 and 2300. It doesn't support the AST11xx due to lack of hw to test it on, and them requiring different codepaths.
This driver is intended to be used with xf86-video-modesetting in userspace.
This driver has a slightly different design than other KMS drivers, but future server chips will probably share similiar setup. As these GPUs commonly have low video RAM, it doesn't make sense to put the kms console in VRAM always. This driver places the kms console into system RAM, and does dirty updates to a copy in video RAM. When userspace sets a new scanout buffer, it forcefully evicts the video RAM console, and X can create a framebuffer that can use all of of video RAM.
This driver uses TTM but in a very simple fashion to control the eviction to system RAM of the console, and multiple servers.
--- drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/ast/Kconfig | 14 + drivers/gpu/drm/ast/Makefile | 9 + drivers/gpu/drm/ast/ast_drv.c | 139 +++++ drivers/gpu/drm/ast/ast_drv.h | 352 ++++++++++++ drivers/gpu/drm/ast/ast_fb.c | 331 +++++++++++ drivers/gpu/drm/ast/ast_main.c | 522 +++++++++++++++++ drivers/gpu/drm/ast/ast_mode.c | 1160 ++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/ast/ast_tables.h | 265 +++++++++ drivers/gpu/drm/ast/ast_ttm.c | 453 +++++++++++++++ 11 files changed, 3248 insertions(+), 0 deletions(-) create mode 100644 drivers/gpu/drm/ast/Kconfig create mode 100644 drivers/gpu/drm/ast/Makefile create mode 100644 drivers/gpu/drm/ast/ast_drv.c create mode 100644 drivers/gpu/drm/ast/ast_drv.h create mode 100644 drivers/gpu/drm/ast/ast_fb.c create mode 100644 drivers/gpu/drm/ast/ast_main.c create mode 100644 drivers/gpu/drm/ast/ast_mode.c create mode 100644 drivers/gpu/drm/ast/ast_tables.h create mode 100644 drivers/gpu/drm/ast/ast_ttm.c
drivers/gpu/drm/Kconfig +2 -0
@@ -165,3 +165,5 @@ source "drivers/gpu/drm/vmwgfx/Kconfig" source "drivers/gpu/drm/gma500/Kconfig" +source "drivers/gpu/drm/ast/Kconfig" +
drivers/gpu/drm/Makefile +1 -0
@@ -37,4 +37,5 @@ obj-$(CONFIG_DRM_VIA) +=via/ obj-$(CONFIG_DRM_NOUVEAU) +=nouveau/ obj-$(CONFIG_DRM_EXYNOS) +=exynos/ obj-$(CONFIG_DRM_GMA500) += gma500/ +obj-$(CONFIG_DRM_AST) += ast/ obj-y += i2c/
drivers/gpu/drm/ast/Kconfig new file +14 -0
@@ -0,0 +1,14 @@ +config DRM_AST + tristate "AST server chips" + depends on DRM && PCI && X86 && EXPERIMENTAL + select DRM_TTM + select FB_CFB_COPYAREA + select FB_CFB_FILLRECT + select FB_CFB_IMAGEBLIT + select SYS_CFB_COPYAREA + select SYS_CFB_FILLRECT + select SYS_CFB_IMAGEBLIT + select DRM_KMS_HELPER + help + Say yes for experimental AST driver +
drivers/gpu/drm/ast/Makefile new file +9 -0
@@ -0,0 +1,9 @@ +# +# Makefile for the drm device driver. This driver provides support for the +# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. + +ccflags-y := -Iinclude/drm + +ast-y := ast_drv.o ast_main.o ast_mode.o ast_fb.o ast_ttm.o + +obj-$(CONFIG_DRM_AST) := ast.o
drivers/gpu/drm/ast/ast_drv.c new file +139 -0
139 lines not on this page · raw message
drivers/gpu/drm/ast/ast_drv.h new file +352 -0
352 lines not on this page · raw message
drivers/gpu/drm/ast/ast_fb.c new file +331 -0
331 lines not on this page · raw message
drivers/gpu/drm/ast/ast_main.c new file +522 -0
522 lines not on this page · raw message
drivers/gpu/drm/ast/ast_mode.c new file +1160 -0
1,160 lines not on this page · raw message
drivers/gpu/drm/ast/ast_tables.h new file +265 -0
265 lines not on this page · raw message
drivers/gpu/drm/ast/ast_ttm.c new file +453 -0
197 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.
Quoted 4 lines
This driver has a slightly different design than other KMS drivers, but future server chips will probably share similiar setup. As these GPUs commonly have low video RAM, it doesn't make sense to put the kms console in VRAM always. This driver places the kms console into system RAM, and does dirty
What happens to mmap of the framebuffer in this case ?
Quoted 3 lines
updates to a copy in video RAM. When userspace sets a new scanout buffer, it forcefully evicts the video RAM console, and X can create a framebuffer that can use all of of video RAM.
If the framebuffer memory points either at the real display or a TTM backing object depending upon where the framebuffer in question is currently living then you'd get
- working mmap (at the expected speed)
- the ability to page out the console buffer rather than burn 8MB or more of main memory with fixed mappings (and precious vmalloc space on 32bit at that) with GEM at least.
It seems to me you'd just need to flip the framebuffer base and also for the mmap to evict the object so that it faults back at the new mappinging. The rest is a copy in and out.
Either way I don't quite understand why the sysram is not GEM backed so that you can just unpin it when not displaying the framebuffer and let the kernel page it out ?
Alan
Dave Airlie
maintainerQuoted 6 lines · Alan Cox
Quoted 4 lines
This driver has a slightly different design than other KMS drivers, but future server chips will probably share similiar setup. As these GPUs commonly have low video RAM, it doesn't make sense to put the kms console in VRAM always. This driver places the kms console into system RAM, and does dirty
What happens to mmap of the framebuffer in this case ?
the framebuffer only gets mmaped from the copy in main RAM, the mmap never ends up in the in-VRAM object. I'll have to add defio support to make this work properly now that I think about it a bit more, but defio isn't a major amount of work.
Quoted 5 lines
Quoted 4 lines
updates to a copy in video RAM. When userspace sets a new scanout buffer, it forcefully evicts the video RAM console, and X can create a framebuffer that can use all of of video RAM.
Quoted 8 lines
If the framebuffer memory points either at the real display or a TTM backing object depending upon where the framebuffer in question is currently living then you'd get
- working mmap (at the expected speed)
- the ability to page out the console buffer rather than burn 8MB or more of main memory with fixed mappings (and precious vmalloc space on 32bit at that) with GEM at least.
I'm not 100% sure what you are getting at here, currently we can't move fbdev objects once exposed to userspace or to fbcon, thanks to some wonderful API design way back, the mmaps on the fbdev device are direct to the VRAM physical pages. Can't tear them down and move them into system RAM pages at all easily.
Quoted 8 lines
It seems to me you'd just need to flip the framebuffer base and also for the mmap to evict the object so that it faults back at the new mappinging. The rest is a copy in and out.
Quoted 1 line
Either way I don't quite understand why the sysram is not GEM backed so
that you can just unpin it when not displaying the framebuffer and let the kernel page it out ?
Because I'm not 100% sure nothing will get written to it, and if something gets written
to it I'd rather not have to complicate the oops printing to have to page in memory
from disk, when it might be the disk that caused the oops.
Dave.
Quoted 3 lines
ends up in the in-VRAM object. I'll have to add defio support to make this work properly now that I think about it a bit more, but defio isn't a major amount of work.
Ok
Quoted 4 lines
fbdev objects once exposed to userspace or to fbcon, thanks to some wonderful API design way back, the mmaps on the fbdev device are direct to the VRAM physical pages. Can't tear them down and move them into system RAM pages at all easily.
Thats not strictly true. They can move mapping if the locking is right and the helpers handle it because you can invalidate the pages in the userspace mappings and they will get faulted back with the new ones.
Quoted 1 line
Because I'm not 100% sure nothing will get written to it, and if
Fair point.
Quoted 4 lines
something gets written
to it I'd rather not have to complicate the oops printing to have to page in memory
from disk, when it might be the disk that caused the oops.
If the box was horked that way then you are going to fail to migrate the graphical frame buffer out in order to go into text mode to print the oops. Probably safest any oops hits the current visible object ?
Alan
Quoted 9 lines · Alan Cox
Quoted 5 lines
fbdev objects once exposed to userspace or to fbcon, thanks to some wonderful API design way back, the mmaps on the fbdev device are direct to the VRAM physical pages. Can't tear them down and move them into system RAM pages at all easily.
Thats not strictly true. They can move mapping if the locking is right and the helpers handle it because you can invalidate the pages in the userspace mappings and they will get faulted back with the new ones.
fbdev userspace mappings is the easy part, TTM has supported that for years. The problem is fbcon, which can access the framebuffer from basically any context for printk.
Quoted 4 lines
Quoted 1 line
Because I'm not 100% sure nothing will get written to it, and if
Fair point.
Quoted 8 lines
Quoted 4 lines
something gets written
to it I'd rather not have to complicate the oops printing to have to page in memory
from disk, when it might be the disk that caused the oops.If the box was horked that way then you are going to fail to migrate the graphical frame buffer out in order to go into text mode to print the oops. Probably safest any oops hits the current visible object ?
It's not always that simple either, e.g. this wouldn't work when scanning out a tiled buffer on Radeon HDs.
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Debian, X and DRI developer _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel