summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJani Nikula <jani.nikula@intel.com>2025-09-18 11:40:56 +0300
committerJani Nikula <jani.nikula@intel.com>2025-09-19 09:32:36 +0300
commitec4dae5e9b2cbdadcc9e22c0472f8a2749674355 (patch)
treedcb47425d01b58ad820458fe4c1324a1c36586b9
parent7326099d71243ba31ef486931279d9573482292b (diff)
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>
-rw-r--r--drivers/gpu/drm/xe/display/intel_fbdev_fb.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/drivers/gpu/drm/xe/display/intel_fbdev_fb.c b/drivers/gpu/drm/xe/display/intel_fbdev_fb.c
index 9c9fb34b3407..3ae9d41cb62c 100644
--- a/drivers/gpu/drm/xe/display/intel_fbdev_fb.c
+++ b/drivers/gpu/drm/xe/display/intel_fbdev_fb.c
@@ -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);