current state of GEM vs. TTM?
As far as I know, there are two competing graphics memory managers on linux: GEM vs. TTM.
Around 2008, a great controversy flared in different forums about the merits of respective ones. Judging from the posts, people were more GEMish.
We are in 2013 now and I just wonder about the results of the controversy. Which one the radeon drivers are using now?
Judging from my linux source tree, both are included and both are possible with radeon:
1) We have radeon_gem.c in the folder drivers/gpu/drm/radeon. We also have radeon_ttm.c in the same folder.
2) We have a huge ttm folder under gpu/drm, compared with only two tiny gem-related files: gpu/drm/drm_gem.c and gpu/drm/drm_gem_cma_helper.c
3) As far as headers go, there is a huge TTM folder under /include/drm, but the only GEM-related header file there is /include/drm/drm_gem_cma_helper.h. Some gem related header info is also included in drmP.h
My two questions are:
1) Can we say that the linux 3.8.6 source tree includes all the source code of TTM and GEM, and hence both are possible with radeon? If so, how do we choose between them? By some compiler options?
2) It seems that GEM is tiny compared with DRM. Is this correct?
AFAIK both radeon and nouveau essentially use a GEM API wrapped around the TTM memory manager. The actual GEM implementation was OK for IGP products using system memory for graphics, but TTM provided better support for discrete graphics with dedicated high speed video memory.
Something like that, anyways
That was my understanding as well. Basically using a GEM wrapper on top of TTM.
Does this mean that radeon first calls GEM, which then calls TTM, and it is TTM code which does the real job?
Why such a complicated arrangement?
It's not that complex. GEM has two parts:
Originally Posted by sourcecodereader
1. the API
2. the backend memory manager implementation
In radeon (and nouveau and just about all the other kms drivers), we use the GEM API, but use TTM as the backend memory manager since the GEM backend does not adequately handle things like vram. You still need a backend regardless of what API you expose to userspace.
I think GEM is limited to UMA (unified memory architecture). So, when --and only when-- it needs to deal with VRAM, it calls TTM. Hence it uses only a subset of TTM.
A question is: If a video card has VRAM, does it still need to access system memory to read/write data? For example, when its VRAM is full, will it start to use system memory? Or, do the graphics cards that have VRAM never use system memory?
A clearer way to express this question is: Do graphics cards which has VRAM act UMA'ish (hence still need the UMA related part of GEM, in addition to VRAM related part of TTM)?