drm/ast: Add option to initialize palette on driver load
Subsystems (3)
PATCH 1/1 drm/ast: Add option to initialize palette on driver load
Non-x86, such as OpenPOWER and ARM machines, do not execute the ASPEED-provided option ROM on system start. As a result, the VGA palette registers remain uninitialized, leading to odd colors and generally hard to read output on the VGA port.
Add a new module option, ast_resetpalette, to enable loading a linear greyscale palette into the VGA RAMDAC. This option is intended for use by the first Linux kernel to load after initial power on, such as the skiroot kernel on OpenPOWER systems.
--- drivers/gpu/drm/ast/ast_drv.c | 4 ++++ drivers/gpu/drm/ast/ast_drv.h | 14 ++++++++++++++ drivers/gpu/drm/ast/ast_main.c | 8 ++++++++ drivers/gpu/drm/ast/ast_mode.c | 14 -------------- 4 files changed, 26 insertions(+), 14 deletions(-)
drivers/gpu/drm/ast/ast_drv.c +4 -0
@@ -1,5 +1,6 @@/* * Copyright 2012 Red Hat Inc. +* Copyright 2018 Raptor Engineering, LLC. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the
@@ -34,9 +35,12 @@#include "ast_drv.h" int ast_modeset =-1 ; +int ast_resetpalette =-1 ;MODULE_PARM_DESC (modeset,"Disable/Enable modesetting" ); +MODULE_PARM_DESC (resetpalette,"Disable/Enable palette reset on load" );module_param_named (modeset, ast_modeset, int,0400 ); +module_param_named (resetpalette, ast_resetpalette, int,0400 );#define PCI_VENDOR_ASPEED 0x1a03
drivers/gpu/drm/ast/ast_drv.h +14 -0
@@ -383,6 +383,20 @@ static inline int ast_bo_reserve(struct ast_bo *bo, bool no_wait)return 0 ; } +static inline void ast_load_palette_index (struct ast_private *ast, +u8 index,u8 red,u8 green, +u8 blue) +{ +ast_io_write8 (ast,AST_IO_DAC_INDEX_WRITE , index); +ast_io_read8 (ast,AST_IO_SEQ_PORT ); +ast_io_write8 (ast,AST_IO_DAC_DATA , red); +ast_io_read8 (ast,AST_IO_SEQ_PORT ); +ast_io_write8 (ast,AST_IO_DAC_DATA , green); +ast_io_read8 (ast,AST_IO_SEQ_PORT ); +ast_io_write8 (ast,AST_IO_DAC_DATA , blue); +ast_io_read8 (ast,AST_IO_SEQ_PORT ); +} +static inline void ast_bo_unreserve (struct ast_bo *bo) {ttm_bo_unreserve (&bo->bo);
drivers/gpu/drm/ast/ast_main.c +8 -0
@@ -1,5 +1,6 @@/* * Copyright 2012 Red Hat Inc. +* Copyright 2018 Raptor Engineering, LLC. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the
@@ -32,6 +33,8 @@#include <drm/drm_fb_helper.h> #include <drm/drm_crtc_helper.h> +extern int ast_resetpalette; +void ast_set_index_reg_mask (struct ast_private *ast,uint32_t base,uint8_t index,uint8_t mask,uint8_t val)
@@ -483,6 +486,7 @@ int ast_driver_load(struct drm_device *dev, unsigned long flags)struct ast_private *ast;bool need_post;int ret =0 ; +int index =0 ; ast =kzalloc (sizeof (struct ast_private ),GFP_KERNEL );if (!ast)
@@ -516,6 +520,10 @@ int ast_driver_load(struct drm_device *dev, unsigned long flags) } } +if (ast_resetpalette ==1 ) +for (index =0x00 ; index <0x100 ; index++) +ast_load_palette_index (ast, index, index, index, index); +ast_detect_chip (dev, &need_post);if (need_post)
drivers/gpu/drm/ast/ast_mode.c +0 -14
@@ -46,20 +46,6 @@ static int ast_cursor_set(struct drm_crtc *crtc,static int ast_cursor_move (struct drm_crtc *crtc,int x,int y); -static inline void ast_load_palette_index (struct ast_private *ast, -u8 index,u8 red,u8 green, -u8 blue) -{ -ast_io_write8 (ast,AST_IO_DAC_INDEX_WRITE , index); -ast_io_read8 (ast,AST_IO_SEQ_PORT ); -ast_io_write8 (ast,AST_IO_DAC_DATA , red); -ast_io_read8 (ast,AST_IO_SEQ_PORT ); -ast_io_write8 (ast,AST_IO_DAC_DATA , green); -ast_io_read8 (ast,AST_IO_SEQ_PORT ); -ast_io_write8 (ast,AST_IO_DAC_DATA , blue); -ast_io_read8 (ast,AST_IO_SEQ_PORT ); -} -static void ast_crtc_load_lut (struct drm_crtc *crtc) {struct ast_private *ast = crtc->dev->dev_private;
Signature · 6 lines
2.15.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 10 lines · Timothy Pearson
Non-x86, such as OpenPOWER and ARM machines, do not execute the ASPEED-provided option ROM on system start. As a result, the VGA palette registers remain uninitialized, leading to odd colors and generally hard to read output on the VGA port.
Add a new module option,
ast_resetpalette, to enable loading a linear greyscale palette into the VGA RAMDAC. This option is intended for use by the first Linux kernel to load after initial power on, such as the skiroot kernel on OpenPOWER systems.
Latest kernels already do that with a combination of
commit 24b8ef699e8221d2b7f813adaab13eec053e1507 (tag: drm-for-v4.16)
Author: Daniel Vetter <[email protected]> Date: Thu Jan 18 16:40:16 2018 +0100
drm/ast: Load lut in crtc_commit
and
commit cf48e2921ee95011a164dc31e8725022bd008666
Author: Daniel Vetter <[email protected]> Date: Wed Mar 30 11:51:16 2016 +0200
drm: Initialize a linear gamma table by default
either way this definitely shouldn't be a driver option, it's just a driver bug :-)
-Daniel
Quoted 129 lines
Signed-off-by Timothy Pearson <[email protected]>--- drivers/gpu/drm/ast/ast_drv.c | 4 ++++ drivers/gpu/drm/ast/ast_drv.h | 14 ++++++++++++++ drivers/gpu/drm/ast/ast_main.c | 8 ++++++++ drivers/gpu/drm/ast/ast_mode.c | 14 -------------- 4 files changed, 26 insertions(+), 14 deletions(-)drivers/gpu/drm/ast/ast_drv.c +4
-0@@ -1,5 +1,6 @@/* * Copyright 2012 Red Hat Inc. +* Copyright 2018 Raptor Engineering, LLC. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the @@ -34,9 +35,12 @@#include "ast_drv.h" int ast_modeset =-1 ; +int ast_resetpalette =-1 ;MODULE_PARM_DESC (modeset,"Disable/Enable modesetting" ); +MODULE_PARM_DESC (resetpalette,"Disable/Enable palette reset on load" );module_param_named (modeset, ast_modeset, int,0400 ); +module_param_named (resetpalette, ast_resetpalette, int,0400 );#define PCI_VENDOR_ASPEED 0x1a03drivers/gpu/drm/ast/ast_drv.h +14
-0@@ -383,6 +383,20 @@ static inline int ast_bo_reserve(struct ast_bo *bo, bool no_wait)return 0 ; } +static inline void ast_load_palette_index (struct ast_private *ast, +u8 index,u8 red,u8 green, +u8 blue) +{ +ast_io_write8 (ast,AST_IO_DAC_INDEX_WRITE , index); +ast_io_read8 (ast,AST_IO_SEQ_PORT ); +ast_io_write8 (ast,AST_IO_DAC_DATA , red); +ast_io_read8 (ast,AST_IO_SEQ_PORT ); +ast_io_write8 (ast,AST_IO_DAC_DATA , green); +ast_io_read8 (ast,AST_IO_SEQ_PORT ); +ast_io_write8 (ast,AST_IO_DAC_DATA , blue); +ast_io_read8 (ast,AST_IO_SEQ_PORT ); +} +static inline void ast_bo_unreserve (struct ast_bo *bo) {ttm_bo_unreserve (&bo->bo);drivers/gpu/drm/ast/ast_main.c +8
-0@@ -1,5 +1,6 @@/* * Copyright 2012 Red Hat Inc. +* Copyright 2018 Raptor Engineering, LLC. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the @@ -32,6 +33,8 @@#include <drm/drm_fb_helper.h> #include <drm/drm_crtc_helper.h> +extern int ast_resetpalette; +void ast_set_index_reg_mask (struct ast_private *ast,uint32_t base,uint8_t index,uint8_t mask,uint8_t val)@@ -483,6 +486,7 @@ int ast_driver_load(struct drm_device *dev, unsigned long flags)struct ast_private *ast;bool need_post;int ret =0 ; +int index =0 ; ast =kzalloc (sizeof (struct ast_private ),GFP_KERNEL );if (!ast)@@ -516,6 +520,10 @@ int ast_driver_load(struct drm_device *dev, unsigned long flags) } } +if (ast_resetpalette ==1 ) +for (index =0x00 ; index <0x100 ; index++) +ast_load_palette_index (ast, index, index, index, index); +ast_detect_chip (dev, &need_post);if (need_post)drivers/gpu/drm/ast/ast_mode.c +0
-14@@ -46,20 +46,6 @@ static int ast_cursor_set(struct drm_crtc *crtc,static int ast_cursor_move (struct drm_crtc *crtc,int x,int y); -static inline void ast_load_palette_index (struct ast_private *ast, -u8 index,u8 red,u8 green, -u8 blue) -{ -ast_io_write8 (ast,AST_IO_DAC_INDEX_WRITE , index); -ast_io_read8 (ast,AST_IO_SEQ_PORT ); -ast_io_write8 (ast,AST_IO_DAC_DATA , red); -ast_io_read8 (ast,AST_IO_SEQ_PORT ); -ast_io_write8 (ast,AST_IO_DAC_DATA , green); -ast_io_read8 (ast,AST_IO_SEQ_PORT ); -ast_io_write8 (ast,AST_IO_DAC_DATA , blue); -ast_io_read8 (ast,AST_IO_SEQ_PORT ); -} -static void ast_crtc_load_lut (struct drm_crtc *crtc) {struct ast_private *ast = crtc->dev->dev_private;Signature · 6 lines
2.15.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel