drm/xe/fbdev: abstract bo creation

Separate fbdev bo creation into a separate function
intel_fbdev_fb_bo_create().

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://lore.kernel.org/r/74dfb9f3e6e05a93d54a8ab534e4384145b52571.1758184771.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
This commit is contained in:
Jani Nikula
2025-09-18 11:40:56 +03:00
parent 7326099d71
commit ec4dae5e9b

View File

@@ -15,16 +15,11 @@
#include <generated/xe_wa_oob.h>
struct intel_framebuffer *intel_fbdev_fb_alloc(struct drm_device *drm,
struct drm_mode_fb_cmd2 *mode_cmd)
struct drm_gem_object *intel_fbdev_fb_bo_create(struct drm_device *drm, int size)
{
struct drm_framebuffer *fb;
struct xe_device *xe = to_xe_device(drm);
struct xe_bo *obj;
int size;
size = mode_cmd->pitches[0] * mode_cmd->height;
size = PAGE_ALIGN(size);
obj = ERR_PTR(-ENODEV);
if (!IS_DGFX(xe) && !XE_GT_WA(xe_root_mmio_gt(xe), 22019338487_display)) {
@@ -48,21 +43,39 @@ struct intel_framebuffer *intel_fbdev_fb_alloc(struct drm_device *drm,
if (IS_ERR(obj)) {
drm_err(&xe->drm, "failed to allocate framebuffer (%pe)\n", obj);
fb = ERR_PTR(-ENOMEM);
return ERR_PTR(-ENOMEM);
}
return &obj->ttm.base;
}
struct intel_framebuffer *intel_fbdev_fb_alloc(struct drm_device *drm,
struct drm_mode_fb_cmd2 *mode_cmd)
{
struct drm_framebuffer *fb;
struct drm_gem_object *obj;
int size;
size = mode_cmd->pitches[0] * mode_cmd->height;
size = PAGE_ALIGN(size);
obj = intel_fbdev_fb_bo_create(drm, size);
if (IS_ERR(obj)) {
fb = ERR_CAST(obj);
goto err;
}
fb = intel_framebuffer_create(&obj->ttm.base,
fb = intel_framebuffer_create(obj,
drm_get_format_info(drm,
mode_cmd->pixel_format,
mode_cmd->modifier[0]),
mode_cmd);
if (IS_ERR(fb)) {
xe_bo_unpin_map_no_vm(obj);
xe_bo_unpin_map_no_vm(gem_to_xe_bo(obj));
goto err;
}
drm_gem_object_put(&obj->ttm.base);
drm_gem_object_put(obj);
return to_intel_framebuffer(fb);