Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/{i915,xe}: deduplicate initial plane setup

Deduplicate more of the identical parts of i915 and xe initial plane
setup. This lets us reduce the core dependency on display internals.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patch.msgid.link/1a2abbceedb9e7d03f262c44cd54a24556ef6b61.1765812266.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>

+26 -50
+26
drivers/gpu/drm/i915/display/intel_initial_plane.c
··· 6 6 7 7 #include "intel_display_core.h" 8 8 #include "intel_display_types.h" 9 + #include "intel_fb.h" 10 + #include "intel_frontbuffer.h" 9 11 #include "intel_initial_plane.h" 12 + #include "intel_plane.h" 10 13 11 14 void intel_initial_plane_vblank_wait(struct intel_crtc *crtc) 12 15 { ··· 75 72 struct intel_display *display = to_intel_display(crtc); 76 73 struct intel_initial_plane_config *plane_config = &plane_configs[crtc->pipe]; 77 74 struct intel_plane *plane = to_intel_plane(crtc->base.primary); 75 + struct intel_plane_state *plane_state = to_intel_plane_state(plane->base.state); 78 76 struct drm_framebuffer *fb; 79 77 struct i915_vma *vma; 80 78 int ret; ··· 102 98 vma = other_plane_state->ggtt_vma; 103 99 } 104 100 101 + plane_state->uapi.rotation = plane_config->rotation; 102 + intel_fb_fill_view(to_intel_framebuffer(fb), 103 + plane_state->uapi.rotation, &plane_state->view); 104 + 105 105 ret = display->parent->initial_plane->setup(&crtc->base, plane_config, fb, vma); 106 106 if (ret) 107 107 goto nofb; 108 + 109 + plane_state->uapi.src_x = 0; 110 + plane_state->uapi.src_y = 0; 111 + plane_state->uapi.src_w = fb->width << 16; 112 + plane_state->uapi.src_h = fb->height << 16; 113 + 114 + plane_state->uapi.crtc_x = 0; 115 + plane_state->uapi.crtc_y = 0; 116 + plane_state->uapi.crtc_w = fb->width; 117 + plane_state->uapi.crtc_h = fb->height; 118 + 119 + plane_state->uapi.fb = fb; 120 + drm_framebuffer_get(fb); 121 + 122 + plane_state->uapi.crtc = &crtc->base; 123 + intel_plane_copy_uapi_to_hw_state(plane_state, plane_state, crtc); 124 + 125 + atomic_or(plane->frontbuffer_bit, &to_intel_frontbuffer(fb)->bits); 108 126 109 127 return; 110 128
-25
drivers/gpu/drm/i915/i915_initial_plane.c
··· 11 11 #include "display/intel_display_core.h" 12 12 #include "display/intel_display_types.h" 13 13 #include "display/intel_fb.h" 14 - #include "display/intel_frontbuffer.h" 15 - #include "display/intel_initial_plane.h" 16 - #include "display/intel_plane.h" 17 14 #include "gem/i915_gem_lmem.h" 18 15 #include "gem/i915_gem_region.h" 19 16 ··· 276 279 struct intel_plane_state *plane_state = 277 280 to_intel_plane_state(plane->base.state); 278 281 279 - plane_state->uapi.rotation = plane_config->rotation; 280 - intel_fb_fill_view(to_intel_framebuffer(fb), 281 - plane_state->uapi.rotation, &plane_state->view); 282 - 283 282 __i915_vma_pin(vma); 284 283 plane_state->ggtt_vma = i915_vma_get(vma); 285 284 if (intel_plane_uses_fence(plane_state) && ··· 284 291 285 292 plane_state->surf = i915_ggtt_offset(plane_state->ggtt_vma); 286 293 287 - plane_state->uapi.src_x = 0; 288 - plane_state->uapi.src_y = 0; 289 - plane_state->uapi.src_w = fb->width << 16; 290 - plane_state->uapi.src_h = fb->height << 16; 291 - 292 - plane_state->uapi.crtc_x = 0; 293 - plane_state->uapi.crtc_y = 0; 294 - plane_state->uapi.crtc_w = fb->width; 295 - plane_state->uapi.crtc_h = fb->height; 296 - 297 294 if (fb->modifier != DRM_FORMAT_MOD_LINEAR) 298 295 dev_priv->preserve_bios_swizzle = true; 299 - 300 - plane_state->uapi.fb = fb; 301 - drm_framebuffer_get(fb); 302 - 303 - plane_state->uapi.crtc = &crtc->base; 304 - intel_plane_copy_uapi_to_hw_state(plane_state, plane_state, crtc); 305 - 306 - atomic_or(plane->frontbuffer_bit, &to_intel_frontbuffer(fb)->bits); 307 296 308 297 return 0; 309 298 }
-25
drivers/gpu/drm/xe/display/xe_initial_plane.c
··· 20 20 #include "intel_display_types.h" 21 21 #include "intel_fb.h" 22 22 #include "intel_fb_pin.h" 23 - #include "intel_frontbuffer.h" 24 - #include "intel_initial_plane.h" 25 - #include "intel_plane.h" 26 23 #include "xe_bo.h" 27 24 #include "xe_vram_types.h" 28 25 #include "xe_wa.h" ··· 170 173 to_intel_plane_state(plane->base.state); 171 174 struct i915_vma *vma; 172 175 173 - plane_state->uapi.rotation = plane_config->rotation; 174 - intel_fb_fill_view(to_intel_framebuffer(fb), 175 - plane_state->uapi.rotation, &plane_state->view); 176 - 177 176 vma = intel_fb_pin_to_ggtt(fb, &plane_state->view.gtt, 178 177 0, 0, 0, false, &plane_state->flags); 179 178 if (IS_ERR(vma)) ··· 178 185 plane_state->ggtt_vma = vma; 179 186 180 187 plane_state->surf = i915_ggtt_offset(plane_state->ggtt_vma); 181 - 182 - plane_state->uapi.src_x = 0; 183 - plane_state->uapi.src_y = 0; 184 - plane_state->uapi.src_w = fb->width << 16; 185 - plane_state->uapi.src_h = fb->height << 16; 186 - 187 - plane_state->uapi.crtc_x = 0; 188 - plane_state->uapi.crtc_y = 0; 189 - plane_state->uapi.crtc_w = fb->width; 190 - plane_state->uapi.crtc_h = fb->height; 191 - 192 - plane_state->uapi.fb = fb; 193 - drm_framebuffer_get(fb); 194 - 195 - plane_state->uapi.crtc = &crtc->base; 196 - intel_plane_copy_uapi_to_hw_state(plane_state, plane_state, crtc); 197 - 198 - atomic_or(plane->frontbuffer_bit, &to_intel_frontbuffer(fb)->bits); 199 188 200 189 plane_config->vma = vma; 201 190