drm/{i915, xe}/fbdev: add intel_fbdev_fb_bo_destroy()

i915 and xe do different things on the failure path; i915 calls
drm_gem_object_put() while xe calls xe_bo_unpin_map_no_vm(). Add a
helper to enable further refactoring.

v2: Call drm_gem_object_put() on intel_fbdev_fb_bo_destroy()

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://lore.kernel.org/r/22bc3c3158f5a22ab258ada8684766fdf75fefec.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:57 +03:00
parent ec4dae5e9b
commit a170c6ca8b
3 changed files with 13 additions and 2 deletions

View File

@ -46,6 +46,11 @@ struct drm_gem_object *intel_fbdev_fb_bo_create(struct drm_device *drm, int size
return &obj->base;
}
void intel_fbdev_fb_bo_destroy(struct drm_gem_object *obj)
{
drm_gem_object_put(obj);
}
struct intel_framebuffer *intel_fbdev_fb_alloc(struct drm_device *drm,
struct drm_mode_fb_cmd2 *mode_cmd)
{
@ -68,7 +73,7 @@ struct intel_framebuffer *intel_fbdev_fb_alloc(struct drm_device *drm,
mode_cmd->modifier[0]),
mode_cmd);
if (IS_ERR(fb)) {
drm_gem_object_put(obj);
intel_fbdev_fb_bo_destroy(obj);
goto err;
}

View File

@ -14,6 +14,7 @@ struct i915_vma;
struct intel_display;
struct drm_gem_object *intel_fbdev_fb_bo_create(struct drm_device *drm, int size);
void intel_fbdev_fb_bo_destroy(struct drm_gem_object *obj);
struct intel_framebuffer *intel_fbdev_fb_alloc(struct drm_device *drm,
struct drm_mode_fb_cmd2 *mode_cmd);
int intel_fbdev_fb_fill_info(struct intel_display *display, struct fb_info *info,

View File

@ -49,6 +49,11 @@ struct drm_gem_object *intel_fbdev_fb_bo_create(struct drm_device *drm, int size
return &obj->ttm.base;
}
void intel_fbdev_fb_bo_destroy(struct drm_gem_object *obj)
{
xe_bo_unpin_map_no_vm(gem_to_xe_bo(obj));
}
struct intel_framebuffer *intel_fbdev_fb_alloc(struct drm_device *drm,
struct drm_mode_fb_cmd2 *mode_cmd)
{
@ -71,7 +76,7 @@ struct intel_framebuffer *intel_fbdev_fb_alloc(struct drm_device *drm,
mode_cmd->modifier[0]),
mode_cmd);
if (IS_ERR(fb)) {
xe_bo_unpin_map_no_vm(gem_to_xe_bo(obj));
intel_fbdev_fb_bo_destroy(obj);
goto err;
}