Lines Matching +full:mem +full:- +full:base

1 // SPDX-License-Identifier: MIT
23 struct drm_i915_private *i915 = to_i915(this->base.dev); in intel_reuse_initial_plane_obj()
26 for_each_intel_crtc(&i915->drm, crtc) { in intel_reuse_initial_plane_obj()
28 to_intel_plane(crtc->base.primary); in intel_reuse_initial_plane_obj()
30 to_intel_plane_state(plane->base.state); in intel_reuse_initial_plane_obj()
32 to_intel_crtc_state(crtc->base.state); in intel_reuse_initial_plane_obj()
34 if (!crtc_state->uapi.active) in intel_reuse_initial_plane_obj()
37 if (!plane_state->ggtt_vma) in intel_reuse_initial_plane_obj()
40 if (plane_configs[this->pipe].base == plane_configs[crtc->pipe].base) { in intel_reuse_initial_plane_obj()
41 *fb = plane_state->hw.fb; in intel_reuse_initial_plane_obj()
42 *vma = plane_state->ggtt_vma; in intel_reuse_initial_plane_obj()
54 gen8_pte_t __iomem *gte = to_gt(i915)->ggtt->gsm; in initial_plane_phys_lmem()
55 struct intel_memory_region *mem; in initial_plane_phys_lmem() local
58 u32 base; in initial_plane_phys_lmem() local
60 base = round_down(plane_config->base, I915_GTT_MIN_ALIGNMENT); in initial_plane_phys_lmem()
62 gte += base / I915_GTT_PAGE_SIZE; in initial_plane_phys_lmem()
66 drm_err(&i915->drm, in initial_plane_phys_lmem()
74 mem = i915->mm.regions[INTEL_REGION_LMEM_0]; in initial_plane_phys_lmem()
76 mem = i915->mm.stolen_region; in initial_plane_phys_lmem()
77 if (!mem) { in initial_plane_phys_lmem()
78 drm_dbg_kms(&i915->drm, in initial_plane_phys_lmem()
87 if (dma_addr < mem->region.start || dma_addr > mem->region.end) { in initial_plane_phys_lmem()
88 drm_err(&i915->drm, in initial_plane_phys_lmem()
89 "Initial plane programming using invalid range, dma_addr=%pa (%s [%pa-%pa])\n", in initial_plane_phys_lmem()
90 &dma_addr, mem->region.name, &mem->region.start, &mem->region.end); in initial_plane_phys_lmem()
94 drm_dbg(&i915->drm, in initial_plane_phys_lmem()
98 plane_config->phys_base = dma_addr - mem->region.start; in initial_plane_phys_lmem()
99 plane_config->mem = mem; in initial_plane_phys_lmem()
108 struct intel_memory_region *mem; in initial_plane_phys_smem() local
109 u32 base; in initial_plane_phys_smem() local
111 base = round_down(plane_config->base, I915_GTT_MIN_ALIGNMENT); in initial_plane_phys_smem()
113 mem = i915->mm.stolen_region; in initial_plane_phys_smem()
114 if (!mem) { in initial_plane_phys_smem()
115 drm_dbg_kms(&i915->drm, in initial_plane_phys_smem()
121 plane_config->phys_base = base; in initial_plane_phys_smem()
122 plane_config->mem = mem; in initial_plane_phys_smem()
141 struct intel_memory_region *mem; in initial_plane_vma() local
146 u32 base, size; in initial_plane_vma() local
149 if (plane_config->size == 0) in initial_plane_vma()
155 phys_base = plane_config->phys_base; in initial_plane_vma()
156 mem = plane_config->mem; in initial_plane_vma()
158 base = round_down(plane_config->base, I915_GTT_MIN_ALIGNMENT); in initial_plane_vma()
159 size = round_up(plane_config->base + plane_config->size, in initial_plane_vma()
160 mem->min_page_size); in initial_plane_vma()
161 size -= base; in initial_plane_vma()
169 mem == i915->mm.stolen_region && in initial_plane_vma()
170 size * 2 > i915->dsm.usable_size) { in initial_plane_vma()
171 drm_dbg_kms(&i915->drm, "Initial FB size exceeds half of stolen, discarding\n"); in initial_plane_vma()
175 obj = i915_gem_object_create_region_at(mem, phys_base, size, in initial_plane_vma()
179 drm_dbg_kms(&i915->drm, "Failed to preallocate initial FB in %s\n", in initial_plane_vma()
180 mem->region.name); in initial_plane_vma()
192 switch (plane_config->tiling) { in initial_plane_vma()
197 obj->tiling_and_stride = in initial_plane_vma()
198 plane_config->fb->base.pitches[0] | in initial_plane_vma()
199 plane_config->tiling; in initial_plane_vma()
202 MISSING_CASE(plane_config->tiling); in initial_plane_vma()
211 base = 0; in initial_plane_vma()
213 if (base != plane_config->base) { in initial_plane_vma()
214 struct i915_ggtt *ggtt = to_gt(i915)->ggtt; in initial_plane_vma()
222 ret = i915_gem_gtt_reserve(&ggtt->vm, NULL, &orig_mm, in initial_plane_vma()
223 size, plane_config->base, in initial_plane_vma()
229 vma = i915_vma_instance(obj, &to_gt(i915)->ggtt->vm, NULL); in initial_plane_vma()
234 pinctl = PIN_GLOBAL | PIN_OFFSET_FIXED | base; in initial_plane_vma()
244 base = plane_config->base; in initial_plane_vma()
257 drm_dbg_kms(&i915->drm, in initial_plane_vma()
259 i915_ggtt_offset(vma), plane_config->base); in initial_plane_vma()
274 struct drm_device *dev = crtc->base.dev; in intel_alloc_initial_plane_obj()
277 struct drm_framebuffer *fb = &plane_config->fb->base; in intel_alloc_initial_plane_obj()
280 switch (fb->modifier) { in intel_alloc_initial_plane_obj()
287 drm_dbg(&dev_priv->drm, in intel_alloc_initial_plane_obj()
289 fb->modifier); in intel_alloc_initial_plane_obj()
297 mode_cmd.pixel_format = fb->format->format; in intel_alloc_initial_plane_obj()
298 mode_cmd.width = fb->width; in intel_alloc_initial_plane_obj()
299 mode_cmd.height = fb->height; in intel_alloc_initial_plane_obj()
300 mode_cmd.pitches[0] = fb->pitches[0]; in intel_alloc_initial_plane_obj()
301 mode_cmd.modifier[0] = fb->modifier; in intel_alloc_initial_plane_obj()
305 vma->obj, &mode_cmd)) { in intel_alloc_initial_plane_obj()
306 drm_dbg_kms(&dev_priv->drm, "intel fb init failed\n"); in intel_alloc_initial_plane_obj()
310 plane_config->vma = vma; in intel_alloc_initial_plane_obj()
322 struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); in intel_find_initial_plane_obj()
324 &plane_configs[crtc->pipe]; in intel_find_initial_plane_obj()
326 to_intel_plane(crtc->base.primary); in intel_find_initial_plane_obj()
328 to_intel_plane_state(plane->base.state); in intel_find_initial_plane_obj()
335 * Make sure things work if the surface base is not page aligned. in intel_find_initial_plane_obj()
337 if (!plane_config->fb) in intel_find_initial_plane_obj()
341 fb = &plane_config->fb->base; in intel_find_initial_plane_obj()
342 vma = plane_config->vma; in intel_find_initial_plane_obj()
365 plane_state->uapi.rotation = plane_config->rotation; in intel_find_initial_plane_obj()
367 plane_state->uapi.rotation, &plane_state->view); in intel_find_initial_plane_obj()
370 plane_state->ggtt_vma = i915_vma_get(vma); in intel_find_initial_plane_obj()
372 i915_vma_pin_fence(vma) == 0 && vma->fence) in intel_find_initial_plane_obj()
373 plane_state->flags |= PLANE_HAS_FENCE; in intel_find_initial_plane_obj()
375 plane_state->uapi.src_x = 0; in intel_find_initial_plane_obj()
376 plane_state->uapi.src_y = 0; in intel_find_initial_plane_obj()
377 plane_state->uapi.src_w = fb->width << 16; in intel_find_initial_plane_obj()
378 plane_state->uapi.src_h = fb->height << 16; in intel_find_initial_plane_obj()
380 plane_state->uapi.crtc_x = 0; in intel_find_initial_plane_obj()
381 plane_state->uapi.crtc_y = 0; in intel_find_initial_plane_obj()
382 plane_state->uapi.crtc_w = fb->width; in intel_find_initial_plane_obj()
383 plane_state->uapi.crtc_h = fb->height; in intel_find_initial_plane_obj()
385 if (plane_config->tiling) in intel_find_initial_plane_obj()
386 dev_priv->preserve_bios_swizzle = true; in intel_find_initial_plane_obj()
388 plane_state->uapi.fb = fb; in intel_find_initial_plane_obj()
391 plane_state->uapi.crtc = &crtc->base; in intel_find_initial_plane_obj()
394 atomic_or(plane->frontbuffer_bit, &to_intel_frontbuffer(fb)->bits); in intel_find_initial_plane_obj()
399 if (plane_config->fb) { in plane_config_fini()
400 struct drm_framebuffer *fb = &plane_config->fb->base; in plane_config_fini()
409 if (plane_config->vma) in plane_config_fini()
410 i915_vma_put(plane_config->vma); in plane_config_fini()
418 for_each_intel_crtc(&i915->drm, crtc) { in intel_initial_plane_config()
420 &plane_configs[crtc->pipe]; in intel_initial_plane_config()
422 if (!to_intel_crtc_state(crtc->base.state)->uapi.active) in intel_initial_plane_config()
432 i915->display.funcs.display->get_initial_plane_config(crtc, plane_config); in intel_initial_plane_config()
440 if (i915->display.funcs.display->fixup_initial_plane_config(crtc, plane_config)) in intel_initial_plane_config()