drm/ast: Initialized data needed to map fbdev memory
authorEgbert Eich <eich@suse.de>
Wed, 11 Jun 2014 12:59:55 +0000 (14:59 +0200)
committerDanny Wood <danwood76@gmail.com>
Tue, 29 Jan 2019 13:11:52 +0000 (13:11 +0000)
commit 28fb4cb7fa6f63dc2fbdb5f2564dcbead8e3eee0 upstream.

Due to a missing initialization there was no way to map fbdev memory.
Thus for example using the Xserver with the fbdev driver failed.
This fix adds initialization for fix.smem_start and fix.smem_len
in the fb_info structure, which fixes this problem.

Requested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Egbert Eich <eich@suse.de>
[pulled from SuSE tree by me - airlied]
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/ast/ast_drv.h
drivers/gpu/drm/ast/ast_fb.c
drivers/gpu/drm/ast/ast_main.c
drivers/gpu/drm/ast/ast_mode.c

index b6b7d70f2832064bfdda4b4228b71ad8fdeb6851..5cfc1765af74859374b0dac747efe010bedf5799 100644 (file)
@@ -296,6 +296,7 @@ int ast_framebuffer_init(struct drm_device *dev,
 int ast_fbdev_init(struct drm_device *dev);
 void ast_fbdev_fini(struct drm_device *dev);
 void ast_fbdev_set_suspend(struct drm_device *dev, int state);
+void ast_fbdev_set_base(struct ast_private *ast, unsigned long gpu_addr);
 
 struct ast_bo {
        struct ttm_buffer_object bo;
index fbc0823cfa18b9dbd35588d07d3c9322c58bc18d..a298d8f72225cc695d368e4173e209d20ff95f4e 100644 (file)
@@ -366,3 +366,10 @@ void ast_fbdev_set_suspend(struct drm_device *dev, int state)
 
        fb_set_suspend(ast->fbdev->helper.fbdev, state);
 }
+
+void ast_fbdev_set_base(struct ast_private *ast, unsigned long gpu_addr)
+{
+       ast->fbdev->helper.fbdev->fix.smem_start =
+               ast->fbdev->helper.fbdev->apertures->ranges[0].base + gpu_addr;
+       ast->fbdev->helper.fbdev->fix.smem_len = ast->vram_size - gpu_addr;
+}
index 96f874a508e26f68f895572e607eea2c57d09f24..313ccaf25f49f045c4a561ce405f8364fe2e22fe 100644 (file)
@@ -359,6 +359,7 @@ int ast_driver_load(struct drm_device *dev, unsigned long flags)
        dev->mode_config.min_height = 0;
        dev->mode_config.preferred_depth = 24;
        dev->mode_config.prefer_shadow = 1;
+       dev->mode_config.fb_base = pci_resource_start(ast->dev->pdev, 0);
 
        if (ast->chip == AST2100 ||
            ast->chip == AST2200 ||
index e8f6418b6dec9984f33eb9e9350d53255d3ff2ef..f3a54ad77e3f59043c7c22daafc36af87a34b4e9 100644 (file)
@@ -509,6 +509,8 @@ static int ast_crtc_do_set_base(struct drm_crtc *crtc,
                ret = ttm_bo_kmap(&bo->bo, 0, bo->bo.num_pages, &bo->kmap);
                if (ret)
                        DRM_ERROR("failed to kmap fbcon\n");
+               else
+                       ast_fbdev_set_base(ast, gpu_addr);
        }
        ast_bo_unreserve(bo);