STRUCT DRM_GEM_VRAM_OBJECT(9)
π struct drm_gem_vram_object β GEM object backed by VRAM π
okay bestie so this is from the Kernel API Manual, and today's main character is struct drm_gem_vram_object β a GEM object whose whole thing is being backed by VRAM. no cap, she's iconic. β¨
πΈ SYNOPSIS πΈ
struct drm_gem_vram_object {
struct ttm_buffer_object bo;
struct iosys_map map;
unsigned int vmap_use_count;
struct ttm_placement placement;
struct ttm_place placements[2];
};
like, that's the whole struct. five members. she's lowkey efficient about it. π
π Members π
boβ the TTM buffer object. the actual backbone of the situation. π¦mapβ mapping information forbo. where the mapping tea lives.vmap_use_countβ the reference count on the virtual address. and listen, the way this works is: the address are un-mapped when the count reaches zero. so when it hits0, bestie's gone. periodt. πplacementβ TTM placement information. the supported placements areTTM_PL_VRAMandTTM_PL_SYSTEM, and yes those are the only two, don't come for me. π«Άplacementsβ TTM placement information. (yes, plural. yes, she has both. we love a thorough queen. π)
π Description π
so struct drm_gem_vram_object represents a GEM object that is backed by VRAM. literally that's her job description. she can be used for simple framebuffer devices with dedicated memory β very much "small but mighty" energy. and here's the cute part: the buffer object can be evicted to system memory if video memory becomes scarce. so when VRAM gets crowded, she justβ¦ moves to system memory. adaptable. main character energy fr fr. β¨
now the important bit, because this is where people mess up β GEM VRAM objects perform reference counting for pin and mapping operations. so a buffer object that has been pinned N times with drm_gem_vram_pin must be unpinned N times with drm_gem_vram_unpin. N times in, N times out. balanced. symmetric. the way it should be. π§
the same applies to pairs of drm_gem_vram_kmap and drm_gem_vram_kunmap, as well as pairs of drm_gem_vram_vmap and drm_gem_vram_vunmap.
β οΈ okay real talk for a sec: these are pairs, bestie. if you pin N times you unpin N times. if youkmapyoukunmap. if youvmapyouvunmap. skip the other half and you've got leaked references and a very sad driver. don't do that to yourself. π
π¦ SEE ALSO π¦
- Kernel file
./include/drm/drm_gem_vram_helper.h drm_gem_vram_of_bo(9)drm_gem_vram_of_gem(9)DRM_GEM_VRAM_PLANE_HELPER_FUNCS(9)DRM_GEM_VRAM_DRIVER(9)struct drm_vram_mm(9)drm_vram_mm_of_bdev(9)
like, go read those next. iykyk. ππ
okay that's the whole page!! π and for the receipts: this one lives under ./include/drm, dated October 2026, and the proper title is struct drm_gem_vram_object(9) β which is also literally the name we started with, so we've come full circle. slay. π«Άβ¨πΈ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms