drm/{i915, xe}: deduplicate intel_alloc_initial_plane_obj() FB modifier checks

Move the modifier checks into common code to deduplicate.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patch.msgid.link/3c62ad48595aa2306219b1d6a215cf7680a67da2.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:25 +02:00
parent adf7968e52
commit 64ee50c6f0
3 changed files with 14 additions and 26 deletions

View File

@ -1,6 +1,7 @@
// SPDX-License-Identifier: MIT
/* Copyright © 2025 Intel Corporation */
#include <drm/drm_print.h>
#include <drm/intel/display_parent_interface.h>
#include "intel_display_core.h"
@ -47,6 +48,19 @@ intel_alloc_initial_plane_obj(struct intel_crtc *crtc,
struct intel_initial_plane_config *plane_config)
{
struct intel_display *display = to_intel_display(crtc);
struct intel_framebuffer *fb = plane_config->fb;
switch (fb->base.modifier) {
case DRM_FORMAT_MOD_LINEAR:
case I915_FORMAT_MOD_X_TILED:
case I915_FORMAT_MOD_Y_TILED:
case I915_FORMAT_MOD_4_TILED:
break;
default:
drm_dbg_kms(display->drm, "Unsupported modifier for initial FB: 0x%llx\n",
fb->base.modifier);
return NULL;
}
return display->parent->initial_plane->alloc_obj(&crtc->base, plane_config);
}

View File

@ -240,19 +240,6 @@ i915_alloc_initial_plane_obj(struct drm_crtc *_crtc,
struct drm_framebuffer *fb = &plane_config->fb->base;
struct i915_vma *vma;
switch (fb->modifier) {
case DRM_FORMAT_MOD_LINEAR:
case I915_FORMAT_MOD_X_TILED:
case I915_FORMAT_MOD_Y_TILED:
case I915_FORMAT_MOD_4_TILED:
break;
default:
drm_dbg(display->drm,
"Unsupported modifier for initial FB: 0x%llx\n",
fb->modifier);
return NULL;
}
vma = initial_plane_vma(display, plane_config);
if (!vma)
return NULL;

View File

@ -134,19 +134,6 @@ xe_alloc_initial_plane_obj(struct drm_crtc *_crtc,
struct drm_framebuffer *fb = &plane_config->fb->base;
struct xe_bo *bo;
switch (fb->modifier) {
case DRM_FORMAT_MOD_LINEAR:
case I915_FORMAT_MOD_X_TILED:
case I915_FORMAT_MOD_Y_TILED:
case I915_FORMAT_MOD_4_TILED:
break;
default:
drm_dbg_kms(&xe->drm,
"Unsupported modifier for initial FB: 0x%llx\n",
fb->modifier);
return NULL;
}
mode_cmd.pixel_format = fb->format->format;
mode_cmd.width = fb->width;
mode_cmd.height = fb->height;