All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel.vetter@ffwll.ch>
To: DRI Development <dri-devel@lists.freedesktop.org>
Cc: "Daniel Vetter" <daniel.vetter@ffwll.ch>,
	"Peter Rosin" <peda@axenita.se>,
	"Daniel Vetter" <daniel.vetter@intel.com>,
	"Gustavo Padovan" <gustavo@padovan.org>,
	"Sean Paul" <seanpaul@chromium.org>,
	"David Airlie" <airlied@linux.ie>,
	stable@vger.kernel.org,
	"Deposite Pirate" <dpirate@metalpunks.info>,
	"Bill Fraser" <bill.fraser@gmail.com>,
	"Michel Dänzer" <michel@daenzer.net>
Subject: [PATCH] drm/fb-helper: Fix of-by-one in setcmap_pseudo_palette
Date: Fri, 12 Jan 2018 10:48:34 +0100	[thread overview]
Message-ID: <20180112094834.26310-1-daniel.vetter@ffwll.ch> (raw)

[Fair warning: This is pure conjecture right now.]

In

commit b8e2b0199cc377617dc238f5106352c06dcd3fa2
Author: Peter Rosin <peda@axentia.se>
Date:   Tue Jul 4 12:36:57 2017 +0200

    drm/fb-helper: factor out pseudo-palette

Peter extracted the pseudo palette computation, but seems to have done
an off-by-one. I spotted that +1, but then noticed that we've passed
start++ to (now gone) setcolreg function, so it seemed to all match
up. Except post vs. pre-increment ftw.

Result is that the palette is off-by-one, and the forground color
(slot 0) ends up black, rendering a fairly unreadable console.

What baffles me is that on some systems it still seems to work
somehow, which lead us all down a wild goose chase trying to add
load_lut calls back in in various places (which was also intentionally
removed, but really doesn't seem to be the real root cause).

Fixes: b8e2b0199cc3 ("drm/fb-helper: factor out pseudo-palette")
Cc: Peter Rosin <peda@axenita.se>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Gustavo Padovan <gustavo@padovan.org>
Cc: Sean Paul <seanpaul@chromium.org>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
Cc: <stable@vger.kernel.org> # v4.14+
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=198123
Reported-by: Deposite Pirate <dpirate@metalpunks.info>
Reported-by: Bill Fraser <bill.fraser@gmail.com>
Cc: Deposite Pirate <dpirate@metalpunks.info>
Cc: Bill Fraser <bill.fraser@gmail.com>
Cc: Michel Dänzer <michel@daenzer.net>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 drivers/gpu/drm/drm_fb_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 035784ddd133..1c3a200c4a10 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -1295,7 +1295,7 @@ static int setcmap_pseudo_palette(struct fb_cmap *cmap, struct fb_info *info)
 			mask <<= info->var.transp.offset;
 			value |= mask;
 		}
-		palette[cmap->start + i] = value;
+		palette[cmap->start] = value;
 	}
 
 	return 0;
-- 
2.15.1

             reply	other threads:[~2018-01-12  9:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-12  9:48 Daniel Vetter [this message]
2018-01-12 14:08 ` [PATCH] drm/fb-helper: Fix of-by-one in setcmap_pseudo_palette Sean Paul
2018-01-12 21:08   ` Daniel Vetter
2018-01-12 21:08     ` Daniel Vetter
2018-01-16 22:00     ` Sean Paul
2018-01-16 22:00       ` Sean Paul
2018-01-16 22:27       ` Daniel Vetter
2018-01-17  0:13         ` Sean Paul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180112094834.26310-1-daniel.vetter@ffwll.ch \
    --to=daniel.vetter@ffwll.ch \
    --cc=airlied@linux.ie \
    --cc=bill.fraser@gmail.com \
    --cc=daniel.vetter@intel.com \
    --cc=dpirate@metalpunks.info \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gustavo@padovan.org \
    --cc=michel@daenzer.net \
    --cc=peda@axenita.se \
    --cc=seanpaul@chromium.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.