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)
committerDave Airlie <airlied@redhat.com>
Wed, 11 Nov 2015 02:27:31 +0000 (12:27 +1000)
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>
Cc: stable@vger.kernel.org
Signed-off-by: Egbert Eich <eich@suse.de>
[pulled from SuSE tree by me - airlied]
Signed-off-by: Dave Airlie <airlied@redhat.com>
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 86205a28e56b79ceeb247949343f7117a08c393c..05f6522c045719f9e63e520d9a80eca0f4e0a6d8 100644 (file)
@@ -315,6 +315,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 f31db28a684b3e2cbfb042a9aebf11f0bd912105..a37e7ea4a00cc4cca2773a5da1622dec08472c67 100644 (file)
@@ -365,3 +365,10 @@ void ast_fbdev_set_suspend(struct drm_device *dev, int state)
 
        drm_fb_helper_set_suspend(&ast->fbdev->helper, 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 838217f8ce7dd681de66fa976f8d8bc93b98ece7..541a610667add983ed234bb9e7807ed90ffb75ce 100644 (file)
@@ -448,6 +448,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 b7ee2634e47cb420cb476c0f2a5906681b826601..69d19f3304a5ea67529393200979ae27ba796822 100644 (file)
@@ -547,6 +547,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);