]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/{i915, xe}/fbdev: add intel_fbdev_fb_bo_destroy()
authorJani Nikula <jani.nikula@intel.com>
Thu, 18 Sep 2025 08:40:57 +0000 (11:40 +0300)
committerJani Nikula <jani.nikula@intel.com>
Fri, 19 Sep 2025 06:32:36 +0000 (09:32 +0300)
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>
drivers/gpu/drm/i915/display/intel_fbdev_fb.c
drivers/gpu/drm/i915/display/intel_fbdev_fb.h
drivers/gpu/drm/xe/display/intel_fbdev_fb.c

index bfd05fd3434854cfe43c7c020d24177f22b9ca79..a7dab8cd3aa26d448f8223856a15822b6165a53e 100644 (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;
        }
 
index 6a4ba40d5831f001ade7bb1f819b6a18caba932f..8b6214b0ad0e41d8edecec5a429171f401a4a807 100644 (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,
index 3ae9d41cb62cb6fbe739d80bea83ffdd3858696d..e1043617c3ae6ea2b1b0cf2496cdd0ae2ac3aaa6 100644 (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;
        }