MCPcopy Create free account
hub / github.com/F-Stack/f-stack / tegra_bo_alloc

Function tegra_bo_alloc

freebsd/arm/nvidia/drm2/tegra_bo.c:173–197  ·  view source on GitHub ↗

Allocate memory for frame buffer */

Source from the content-addressed store, hash-verified

171
172/* Allocate memory for frame buffer */
173static int
174tegra_bo_alloc(struct drm_device *drm, struct tegra_bo *bo)
175{
176 size_t size;
177 int rv;
178
179 size = bo->gem_obj.size;
180
181 bo->npages = atop(size);
182 bo->m = malloc(sizeof(vm_page_t *) * bo->npages, DRM_MEM_DRIVER,
183 M_WAITOK | M_ZERO);
184
185 rv = tegra_bo_alloc_contig(bo->npages, PAGE_SIZE,
186 VM_MEMATTR_WRITE_COMBINING, &(bo->m));
187 if (rv != 0) {
188 DRM_WARNING("Cannot allocate memory for gem object.\n");
189 return (rv);
190 }
191 rv = tegra_bo_init_pager(bo);
192 if (rv != 0) {
193 DRM_WARNING("Cannot initialize gem object pager.\n");
194 return (rv);
195 }
196 return (0);
197}
198
199int
200tegra_bo_create(struct drm_device *drm, size_t size, struct tegra_bo **res_bo)

Callers 1

tegra_bo_createFunction · 0.85

Calls 3

mallocFunction · 0.85
tegra_bo_alloc_contigFunction · 0.85
tegra_bo_init_pagerFunction · 0.85

Tested by

no test coverage detected