Allocate memory for frame buffer */
| 171 | |
| 172 | /* Allocate memory for frame buffer */ |
| 173 | static int |
| 174 | tegra_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 | |
| 199 | int |
| 200 | tegra_bo_create(struct drm_device *drm, size_t size, struct tegra_bo **res_bo) |
no test coverage detected