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 intel_initial_plane_config() between i915 and xe

Move the parent interface at one step lower level, allowing
deduplication.

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

+62 -84
+47 -1
drivers/gpu/drm/i915/display/intel_initial_plane.c
··· 14 14 display->parent->initial_plane->vblank_wait(&crtc->base); 15 15 } 16 16 17 + static void 18 + intel_find_initial_plane_obj(struct intel_crtc *crtc, 19 + struct intel_initial_plane_config plane_configs[]) 20 + { 21 + struct intel_display *display = to_intel_display(crtc); 22 + 23 + display->parent->initial_plane->find_obj(&crtc->base, plane_configs); 24 + } 25 + 26 + static void plane_config_fini(struct intel_display *display, 27 + struct intel_initial_plane_config *plane_config) 28 + { 29 + display->parent->initial_plane->config_fini(plane_config); 30 + } 31 + 17 32 void intel_initial_plane_config(struct intel_display *display) 18 33 { 19 - display->parent->initial_plane->config(display->drm); 34 + struct intel_initial_plane_config plane_configs[I915_MAX_PIPES] = {}; 35 + struct intel_crtc *crtc; 36 + 37 + for_each_intel_crtc(display->drm, crtc) { 38 + const struct intel_crtc_state *crtc_state = 39 + to_intel_crtc_state(crtc->base.state); 40 + struct intel_initial_plane_config *plane_config = 41 + &plane_configs[crtc->pipe]; 42 + 43 + if (!crtc_state->hw.active) 44 + continue; 45 + 46 + /* 47 + * Note that reserving the BIOS fb up front prevents us 48 + * from stuffing other stolen allocations like the ring 49 + * on top. This prevents some ugliness at boot time, and 50 + * can even allow for smooth boot transitions if the BIOS 51 + * fb is large enough for the active pipe configuration. 52 + */ 53 + display->funcs.display->get_initial_plane_config(crtc, plane_config); 54 + 55 + /* 56 + * If the fb is shared between multiple heads, we'll 57 + * just get the first one. 58 + */ 59 + intel_find_initial_plane_obj(crtc, plane_configs); 60 + 61 + if (display->funcs.display->fixup_initial_plane_config(crtc, plane_config)) 62 + intel_initial_plane_vblank_wait(crtc); 63 + 64 + plane_config_fini(display, plane_config); 65 + } 20 66 }
+6 -41
drivers/gpu/drm/i915/i915_initial_plane.c
··· 312 312 } 313 313 314 314 static void 315 - intel_find_initial_plane_obj(struct intel_crtc *crtc, 316 - struct intel_initial_plane_config plane_configs[]) 315 + i915_find_initial_plane_obj(struct drm_crtc *_crtc, 316 + struct intel_initial_plane_config plane_configs[]) 317 317 { 318 + struct intel_crtc *crtc = to_intel_crtc(_crtc); 318 319 struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 319 320 struct intel_initial_plane_config *plane_config = 320 321 &plane_configs[crtc->pipe]; ··· 393 392 atomic_or(plane->frontbuffer_bit, &to_intel_frontbuffer(fb)->bits); 394 393 } 395 394 396 - static void plane_config_fini(struct intel_initial_plane_config *plane_config) 395 + static void i915_plane_config_fini(struct intel_initial_plane_config *plane_config) 397 396 { 398 397 if (plane_config->fb) { 399 398 struct drm_framebuffer *fb = &plane_config->fb->base; ··· 409 408 i915_vma_put(plane_config->vma); 410 409 } 411 410 412 - static void i915_initial_plane_config(struct drm_device *drm) 413 - { 414 - struct intel_display *display = to_intel_display(drm); 415 - struct intel_initial_plane_config plane_configs[I915_MAX_PIPES] = {}; 416 - struct intel_crtc *crtc; 417 - 418 - for_each_intel_crtc(display->drm, crtc) { 419 - const struct intel_crtc_state *crtc_state = 420 - to_intel_crtc_state(crtc->base.state); 421 - struct intel_initial_plane_config *plane_config = 422 - &plane_configs[crtc->pipe]; 423 - 424 - if (!crtc_state->hw.active) 425 - continue; 426 - 427 - /* 428 - * Note that reserving the BIOS fb up front prevents us 429 - * from stuffing other stolen allocations like the ring 430 - * on top. This prevents some ugliness at boot time, and 431 - * can even allow for smooth boot transitions if the BIOS 432 - * fb is large enough for the active pipe configuration. 433 - */ 434 - display->funcs.display->get_initial_plane_config(crtc, plane_config); 435 - 436 - /* 437 - * If the fb is shared between multiple heads, we'll 438 - * just get the first one. 439 - */ 440 - intel_find_initial_plane_obj(crtc, plane_configs); 441 - 442 - if (display->funcs.display->fixup_initial_plane_config(crtc, plane_config)) 443 - i915_initial_plane_vblank_wait(&crtc->base); 444 - 445 - plane_config_fini(plane_config); 446 - } 447 - } 448 - 449 411 const struct intel_display_initial_plane_interface i915_display_initial_plane_interface = { 450 412 .vblank_wait = i915_initial_plane_vblank_wait, 451 - .config = i915_initial_plane_config, 413 + .find_obj = i915_find_initial_plane_obj, 414 + .config_fini = i915_plane_config_fini, 452 415 };
+6 -41
drivers/gpu/drm/xe/display/xe_initial_plane.c
··· 204 204 } 205 205 206 206 static void 207 - intel_find_initial_plane_obj(struct intel_crtc *crtc, 208 - struct intel_initial_plane_config plane_configs[]) 207 + xe_find_initial_plane_obj(struct drm_crtc *_crtc, 208 + struct intel_initial_plane_config plane_configs[]) 209 209 { 210 + struct intel_crtc *crtc = to_intel_crtc(_crtc); 210 211 struct intel_initial_plane_config *plane_config = 211 212 &plane_configs[crtc->pipe]; 212 213 struct intel_plane *plane = ··· 275 274 intel_plane_disable_noatomic(crtc, plane); 276 275 } 277 276 278 - static void plane_config_fini(struct intel_initial_plane_config *plane_config) 277 + static void xe_plane_config_fini(struct intel_initial_plane_config *plane_config) 279 278 { 280 279 if (plane_config->fb) { 281 280 struct drm_framebuffer *fb = &plane_config->fb->base; ··· 288 287 } 289 288 } 290 289 291 - static void xe_initial_plane_config(struct drm_device *drm) 292 - { 293 - struct intel_display *display = to_intel_display(drm); 294 - struct intel_initial_plane_config plane_configs[I915_MAX_PIPES] = {}; 295 - struct intel_crtc *crtc; 296 - 297 - for_each_intel_crtc(display->drm, crtc) { 298 - const struct intel_crtc_state *crtc_state = 299 - to_intel_crtc_state(crtc->base.state); 300 - struct intel_initial_plane_config *plane_config = 301 - &plane_configs[crtc->pipe]; 302 - 303 - if (!crtc_state->hw.active) 304 - continue; 305 - 306 - /* 307 - * Note that reserving the BIOS fb up front prevents us 308 - * from stuffing other stolen allocations like the ring 309 - * on top. This prevents some ugliness at boot time, and 310 - * can even allow for smooth boot transitions if the BIOS 311 - * fb is large enough for the active pipe configuration. 312 - */ 313 - display->funcs.display->get_initial_plane_config(crtc, plane_config); 314 - 315 - /* 316 - * If the fb is shared between multiple heads, we'll 317 - * just get the first one. 318 - */ 319 - intel_find_initial_plane_obj(crtc, plane_configs); 320 - 321 - if (display->funcs.display->fixup_initial_plane_config(crtc, plane_config)) 322 - xe_initial_plane_vblank_wait(&crtc->base); 323 - 324 - plane_config_fini(plane_config); 325 - } 326 - } 327 - 328 290 const struct intel_display_initial_plane_interface xe_display_initial_plane_interface = { 329 291 .vblank_wait = xe_initial_plane_vblank_wait, 330 - .config = xe_initial_plane_config, 292 + .find_obj = xe_find_initial_plane_obj, 293 + .config_fini = xe_plane_config_fini, 331 294 };
+3 -1
include/drm/intel/display_parent_interface.h
··· 11 11 struct drm_device; 12 12 struct drm_scanout_buffer; 13 13 struct intel_hdcp_gsc_context; 14 + struct intel_initial_plane_config; 14 15 struct intel_panic; 15 16 struct intel_stolen_node; 16 17 struct ref_tracker; ··· 29 28 30 29 struct intel_display_initial_plane_interface { 31 30 void (*vblank_wait)(struct drm_crtc *crtc); 32 - void (*config)(struct drm_device *drm); 31 + void (*find_obj)(struct drm_crtc *crtc, struct intel_initial_plane_config *plane_configs); 32 + void (*config_fini)(struct intel_initial_plane_config *plane_configs); 33 33 }; 34 34 35 35 struct intel_display_irq_interface {