Skip to content

Commit

Permalink
drm/mgag200: Fix gamma lut not initialized for G200ER, G200EV, G200SE
Browse files Browse the repository at this point in the history
commit 11f9eb8 upstream.

When mgag200 switched from simple KMS to regular atomic helpers,
the initialization of the gamma settings was lost.
This leads to a black screen, if the bios/uefi doesn't use the same
pixel color depth.
This has been fixed with commit ad81e23 ("drm/mgag200: Fix gamma
lut not initialized.") for most G200, but G200ER, G200EV, G200SE use
their own version of crtc_helper_atomic_enable() and need to be fixed
too.

Fixes: 1baf912 ("drm/mgag200: Replace simple-KMS with regular atomic helpers")
Cc: <stable@vger.kernel.org> #v6.1+
Reported-by: Roger Sewell <roger.sewell@cantab.net>
Suggested-by: Roger Sewell <roger.sewell@cantab.net>
Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20231214163849.359691-1-jfalempe@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Jocelyn Falempe authored and gregkh committed Jan 10, 2024
1 parent 8cc22ba commit feef4dc
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 5 deletions.
5 changes: 5 additions & 0 deletions drivers/gpu/drm/mgag200/mgag200_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,11 @@ void mgag200_primary_plane_helper_atomic_disable(struct drm_plane *plane,
.destroy = drm_plane_cleanup, \
DRM_GEM_SHADOW_PLANE_FUNCS

void mgag200_crtc_set_gamma_linear(struct mga_device *mdev, const struct drm_format_info *format);
void mgag200_crtc_set_gamma(struct mga_device *mdev,
const struct drm_format_info *format,
struct drm_color_lut *lut);

enum drm_mode_status mgag200_crtc_helper_mode_valid(struct drm_crtc *crtc,
const struct drm_display_mode *mode);
int mgag200_crtc_helper_atomic_check(struct drm_crtc *crtc, struct drm_atomic_state *new_state);
Expand Down
5 changes: 5 additions & 0 deletions drivers/gpu/drm/mgag200/mgag200_g200er.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,11 @@ static void mgag200_g200er_crtc_helper_atomic_enable(struct drm_crtc *crtc,

mgag200_g200er_reset_tagfifo(mdev);

if (crtc_state->gamma_lut)
mgag200_crtc_set_gamma(mdev, format, crtc_state->gamma_lut->data);
else
mgag200_crtc_set_gamma_linear(mdev, format);

mgag200_enable_display(mdev);

if (funcs->enable_vidrst)
Expand Down
5 changes: 5 additions & 0 deletions drivers/gpu/drm/mgag200/mgag200_g200ev.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,11 @@ static void mgag200_g200ev_crtc_helper_atomic_enable(struct drm_crtc *crtc,

mgag200_g200ev_set_hiprilvl(mdev);

if (crtc_state->gamma_lut)
mgag200_crtc_set_gamma(mdev, format, crtc_state->gamma_lut->data);
else
mgag200_crtc_set_gamma_linear(mdev, format);

mgag200_enable_display(mdev);

if (funcs->enable_vidrst)
Expand Down
5 changes: 5 additions & 0 deletions drivers/gpu/drm/mgag200/mgag200_g200se.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,11 @@ static void mgag200_g200se_crtc_helper_atomic_enable(struct drm_crtc *crtc,

mgag200_g200se_set_hiprilvl(mdev, adjusted_mode, format);

if (crtc_state->gamma_lut)
mgag200_crtc_set_gamma(mdev, format, crtc_state->gamma_lut->data);
else
mgag200_crtc_set_gamma_linear(mdev, format);

mgag200_enable_display(mdev);

if (funcs->enable_vidrst)
Expand Down
10 changes: 5 additions & 5 deletions drivers/gpu/drm/mgag200/mgag200_mode.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
* This file contains setup code for the CRTC.
*/

static void mgag200_crtc_set_gamma_linear(struct mga_device *mdev,
const struct drm_format_info *format)
void mgag200_crtc_set_gamma_linear(struct mga_device *mdev,
const struct drm_format_info *format)
{
int i;

Expand Down Expand Up @@ -65,9 +65,9 @@ static void mgag200_crtc_set_gamma_linear(struct mga_device *mdev,
}
}

static void mgag200_crtc_set_gamma(struct mga_device *mdev,
const struct drm_format_info *format,
struct drm_color_lut *lut)
void mgag200_crtc_set_gamma(struct mga_device *mdev,
const struct drm_format_info *format,
struct drm_color_lut *lut)
{
int i;

Expand Down

0 comments on commit feef4dc

Please sign in to comment.