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}: start deduplicating intel_find_initial_plane_obj() between i915 and xe

Move some easy common parts to display. Initially, the
intel_find_initial_plane_obj() error path seems silly, but it'll be more
helpful this way for later changes.

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

+36 -52
+26 -1
drivers/gpu/drm/i915/display/intel_initial_plane.c
··· 19 19 struct intel_initial_plane_config plane_configs[]) 20 20 { 21 21 struct intel_display *display = to_intel_display(crtc); 22 + struct intel_initial_plane_config *plane_config = &plane_configs[crtc->pipe]; 23 + struct intel_plane *plane = to_intel_plane(crtc->base.primary); 24 + int ret; 22 25 23 - display->parent->initial_plane->find_obj(&crtc->base, plane_configs); 26 + /* 27 + * TODO: 28 + * Disable planes if get_initial_plane_config() failed. 29 + * Make sure things work if the surface base is not page aligned. 30 + */ 31 + if (!plane_config->fb) 32 + return; 33 + 34 + ret = display->parent->initial_plane->find_obj(&crtc->base, plane_configs); 35 + if (ret) 36 + goto nofb; 37 + 38 + return; 39 + 40 + nofb: 41 + /* 42 + * We've failed to reconstruct the BIOS FB. Current display state 43 + * indicates that the primary plane is visible, but has a NULL FB, 44 + * which will lead to problems later if we don't fix it up. The 45 + * simplest solution is to just disable the primary plane now and 46 + * pretend the BIOS never had it enabled. 47 + */ 48 + intel_plane_disable_noatomic(crtc, plane); 24 49 } 25 50 26 51 static void plane_config_fini(struct intel_display *display,
+5 -29
drivers/gpu/drm/i915/i915_initial_plane.c
··· 311 311 return false; 312 312 } 313 313 314 - static void 314 + static int 315 315 i915_find_initial_plane_obj(struct drm_crtc *_crtc, 316 316 struct intel_initial_plane_config plane_configs[]) 317 317 { ··· 326 326 struct drm_framebuffer *fb; 327 327 struct i915_vma *vma; 328 328 329 - /* 330 - * TODO: 331 - * Disable planes if get_initial_plane_config() failed. 332 - * Make sure things work if the surface base is not page aligned. 333 - */ 334 - if (!plane_config->fb) 335 - return; 336 - 337 329 if (intel_alloc_initial_plane_obj(crtc, plane_config)) { 338 330 fb = &plane_config->fb->base; 339 331 vma = plane_config->vma; 340 - goto valid_fb; 332 + } else if (!intel_reuse_initial_plane_obj(crtc, plane_configs, &fb, &vma)) { 333 + return -EINVAL; 341 334 } 342 335 343 - /* 344 - * Failed to alloc the obj, check to see if we should share 345 - * an fb with another CRTC instead 346 - */ 347 - if (intel_reuse_initial_plane_obj(crtc, plane_configs, &fb, &vma)) 348 - goto valid_fb; 349 - 350 - /* 351 - * We've failed to reconstruct the BIOS FB. Current display state 352 - * indicates that the primary plane is visible, but has a NULL FB, 353 - * which will lead to problems later if we don't fix it up. The 354 - * simplest solution is to just disable the primary plane now and 355 - * pretend the BIOS never had it enabled. 356 - */ 357 - intel_plane_disable_noatomic(crtc, plane); 358 - 359 - return; 360 - 361 - valid_fb: 362 336 plane_state->uapi.rotation = plane_config->rotation; 363 337 intel_fb_fill_view(to_intel_framebuffer(fb), 364 338 plane_state->uapi.rotation, &plane_state->view); ··· 365 391 intel_plane_copy_uapi_to_hw_state(plane_state, plane_state, crtc); 366 392 367 393 atomic_or(plane->frontbuffer_bit, &to_intel_frontbuffer(fb)->bits); 394 + 395 + return 0; 368 396 } 369 397 370 398 static void i915_plane_config_fini(struct intel_initial_plane_config *plane_config)
+4 -21
drivers/gpu/drm/xe/display/xe_initial_plane.c
··· 203 203 return false; 204 204 } 205 205 206 - static void 206 + static int 207 207 xe_find_initial_plane_obj(struct drm_crtc *_crtc, 208 208 struct intel_initial_plane_config plane_configs[]) 209 209 { ··· 217 217 struct drm_framebuffer *fb; 218 218 struct i915_vma *vma; 219 219 220 - /* 221 - * TODO: 222 - * Disable planes if get_initial_plane_config() failed. 223 - * Make sure things work if the surface base is not page aligned. 224 - */ 225 - if (!plane_config->fb) 226 - return; 227 - 228 220 if (intel_alloc_initial_plane_obj(crtc, plane_config)) 229 221 fb = &plane_config->fb->base; 230 222 else if (!intel_reuse_initial_plane_obj(crtc, plane_configs, &fb)) 231 - goto nofb; 223 + return -EINVAL; 232 224 233 225 plane_state->uapi.rotation = plane_config->rotation; 234 226 intel_fb_fill_view(to_intel_framebuffer(fb), ··· 229 237 vma = intel_fb_pin_to_ggtt(fb, &plane_state->view.gtt, 230 238 0, 0, 0, false, &plane_state->flags); 231 239 if (IS_ERR(vma)) 232 - goto nofb; 240 + return PTR_ERR(vma); 233 241 234 242 plane_state->ggtt_vma = vma; 235 243 ··· 254 262 atomic_or(plane->frontbuffer_bit, &to_intel_frontbuffer(fb)->bits); 255 263 256 264 plane_config->vma = vma; 257 - return; 258 265 259 - nofb: 260 - /* 261 - * We've failed to reconstruct the BIOS FB. Current display state 262 - * indicates that the primary plane is visible, but has a NULL FB, 263 - * which will lead to problems later if we don't fix it up. The 264 - * simplest solution is to just disable the primary plane now and 265 - * pretend the BIOS never had it enabled. 266 - */ 267 - intel_plane_disable_noatomic(crtc, plane); 266 + return 0; 268 267 } 269 268 270 269 static void xe_plane_config_fini(struct intel_initial_plane_config *plane_config)
+1 -1
include/drm/intel/display_parent_interface.h
··· 29 29 30 30 struct intel_display_initial_plane_interface { 31 31 void (*vblank_wait)(struct drm_crtc *crtc); 32 - void (*find_obj)(struct drm_crtc *crtc, struct intel_initial_plane_config *plane_configs); 32 + int (*find_obj)(struct drm_crtc *crtc, struct intel_initial_plane_config *plane_configs); 33 33 void (*config_fini)(struct intel_initial_plane_config *plane_configs); 34 34 }; 35 35