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>
This commit is contained in:
Jani Nikula
2025-12-15 17:28:26 +02:00
parent 64ee50c6f0
commit dcff3266cf
3 changed files with 26 additions and 50 deletions

View File

@@ -6,7 +6,10 @@
#include "intel_display_core.h"
#include "intel_display_types.h"
#include "intel_fb.h"
#include "intel_frontbuffer.h"
#include "intel_initial_plane.h"
#include "intel_plane.h"
void intel_initial_plane_vblank_wait(struct intel_crtc *crtc)
{
@@ -72,6 +75,7 @@ intel_find_initial_plane_obj(struct intel_crtc *crtc,
struct intel_display *display = to_intel_display(crtc);
struct intel_initial_plane_config *plane_config = &plane_configs[crtc->pipe];
struct intel_plane *plane = to_intel_plane(crtc->base.primary);
struct intel_plane_state *plane_state = to_intel_plane_state(plane->base.state);
struct drm_framebuffer *fb;
struct i915_vma *vma;
int ret;
@@ -98,10 +102,32 @@ intel_find_initial_plane_obj(struct intel_crtc *crtc,
vma = other_plane_state->ggtt_vma;
}
plane_state->uapi.rotation = plane_config->rotation;
intel_fb_fill_view(to_intel_framebuffer(fb),
plane_state->uapi.rotation, &plane_state->view);
ret = display->parent->initial_plane->setup(&crtc->base, plane_config, fb, vma);
if (ret)
goto nofb;
plane_state->uapi.src_x = 0;
plane_state->uapi.src_y = 0;
plane_state->uapi.src_w = fb->width << 16;
plane_state->uapi.src_h = fb->height << 16;
plane_state->uapi.crtc_x = 0;
plane_state->uapi.crtc_y = 0;
plane_state->uapi.crtc_w = fb->width;
plane_state->uapi.crtc_h = fb->height;
plane_state->uapi.fb = fb;
drm_framebuffer_get(fb);
plane_state->uapi.crtc = &crtc->base;
intel_plane_copy_uapi_to_hw_state(plane_state, plane_state, crtc);
atomic_or(plane->frontbuffer_bit, &to_intel_frontbuffer(fb)->bits);
return;
nofb:

View File

@@ -11,9 +11,6 @@
#include "display/intel_display_core.h"
#include "display/intel_display_types.h"
#include "display/intel_fb.h"
#include "display/intel_frontbuffer.h"
#include "display/intel_initial_plane.h"
#include "display/intel_plane.h"
#include "gem/i915_gem_lmem.h"
#include "gem/i915_gem_region.h"
@@ -279,10 +276,6 @@ i915_initial_plane_setup(struct drm_crtc *_crtc,
struct intel_plane_state *plane_state =
to_intel_plane_state(plane->base.state);
plane_state->uapi.rotation = plane_config->rotation;
intel_fb_fill_view(to_intel_framebuffer(fb),
plane_state->uapi.rotation, &plane_state->view);
__i915_vma_pin(vma);
plane_state->ggtt_vma = i915_vma_get(vma);
if (intel_plane_uses_fence(plane_state) &&
@@ -291,27 +284,9 @@ i915_initial_plane_setup(struct drm_crtc *_crtc,
plane_state->surf = i915_ggtt_offset(plane_state->ggtt_vma);
plane_state->uapi.src_x = 0;
plane_state->uapi.src_y = 0;
plane_state->uapi.src_w = fb->width << 16;
plane_state->uapi.src_h = fb->height << 16;
plane_state->uapi.crtc_x = 0;
plane_state->uapi.crtc_y = 0;
plane_state->uapi.crtc_w = fb->width;
plane_state->uapi.crtc_h = fb->height;
if (fb->modifier != DRM_FORMAT_MOD_LINEAR)
dev_priv->preserve_bios_swizzle = true;
plane_state->uapi.fb = fb;
drm_framebuffer_get(fb);
plane_state->uapi.crtc = &crtc->base;
intel_plane_copy_uapi_to_hw_state(plane_state, plane_state, crtc);
atomic_or(plane->frontbuffer_bit, &to_intel_frontbuffer(fb)->bits);
return 0;
}

View File

@@ -20,9 +20,6 @@
#include "intel_display_types.h"
#include "intel_fb.h"
#include "intel_fb_pin.h"
#include "intel_frontbuffer.h"
#include "intel_initial_plane.h"
#include "intel_plane.h"
#include "xe_bo.h"
#include "xe_vram_types.h"
#include "xe_wa.h"
@@ -173,10 +170,6 @@ xe_initial_plane_setup(struct drm_crtc *_crtc,
to_intel_plane_state(plane->base.state);
struct i915_vma *vma;
plane_state->uapi.rotation = plane_config->rotation;
intel_fb_fill_view(to_intel_framebuffer(fb),
plane_state->uapi.rotation, &plane_state->view);
vma = intel_fb_pin_to_ggtt(fb, &plane_state->view.gtt,
0, 0, 0, false, &plane_state->flags);
if (IS_ERR(vma))
@@ -186,24 +179,6 @@ xe_initial_plane_setup(struct drm_crtc *_crtc,
plane_state->surf = i915_ggtt_offset(plane_state->ggtt_vma);
plane_state->uapi.src_x = 0;
plane_state->uapi.src_y = 0;
plane_state->uapi.src_w = fb->width << 16;
plane_state->uapi.src_h = fb->height << 16;
plane_state->uapi.crtc_x = 0;
plane_state->uapi.crtc_y = 0;
plane_state->uapi.crtc_w = fb->width;
plane_state->uapi.crtc_h = fb->height;
plane_state->uapi.fb = fb;
drm_framebuffer_get(fb);
plane_state->uapi.crtc = &crtc->base;
intel_plane_copy_uapi_to_hw_state(plane_state, plane_state, crtc);
atomic_or(plane->frontbuffer_bit, &to_intel_frontbuffer(fb)->bits);
plane_config->vma = vma;
return 0;