On Thu, Sep 18, 2025 at 11:40:56AM +0300, Jani Nikula wrote:
> Separate fbdev bo creation into a separate function
> intel_fbdev_fb_bo_create().
> 
> Signed-off-by: Jani Nikula <[email protected]>

Reviewed-by: Ville Syrjälä <[email protected]>

> ---
>  drivers/gpu/drm/xe/display/intel_fbdev_fb.c | 33 ++++++++++++++-------
>  1 file 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 8eaf1cc7fdf9..48225062211c 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);
>  
> -- 
> 2.47.3

-- 
Ville Syrjälä
Intel

Reply via email to