From: Egbert Eich <eich@suse.com>
To: dri-devel@lists.freedesktop.org
Cc: Egbert Eich <eich@suse.de>, Egbert Eich <eich@suse.com>,
Mathieu Larouche <mathieu.larouche@matrox.com>,
Dave Airlie <airlied@redhat.com>,
Christopher Harvey <charvey@matrox.com>
Subject: [PATCH 14/16] drm/mgag200: Fix LUT programming for 16bpp
Date: Wed, 17 Jul 2013 15:07:27 +0200 [thread overview]
Message-ID: <1374066449-21714-15-git-send-email-eich@suse.com> (raw)
In-Reply-To: <1374066449-21714-1-git-send-email-eich@suse.com>
Since there are only 32 (64) distinct color values for each color
in 16bpp Matrox hardware expects those in a 'dense' manner, ie in
the first 32 (64) entries of the respective color.
Signed-off-by: Egbert Eich <eich@suse.de>
---
drivers/gpu/drm/mgag200/mgag200_mode.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c
index c8983f9..503a414 100644
--- a/drivers/gpu/drm/mgag200/mgag200_mode.c
+++ b/drivers/gpu/drm/mgag200/mgag200_mode.c
@@ -29,6 +29,7 @@ static void mga_crtc_load_lut(struct drm_crtc *crtc)
struct mga_crtc *mga_crtc = to_mga_crtc(crtc);
struct drm_device *dev = crtc->dev;
struct mga_device *mdev = dev->dev_private;
+ struct drm_framebuffer *fb = crtc->fb;
int i;
if (!crtc->enabled)
@@ -36,6 +37,28 @@ static void mga_crtc_load_lut(struct drm_crtc *crtc)
WREG8(DAC_INDEX + MGA1064_INDEX, 0);
+ if (fb && fb->bits_per_pixel == 16) {
+ int inc = (fb->depth == 15) ? 8 : 4;
+ u8 r, b;
+ for (i = 0; i < MGAG200_LUT_SIZE; i += inc) {
+ if (fb->depth == 16) {
+ if (i > (MGAG200_LUT_SIZE >> 1)) {
+ r = b = 0;
+ } else {
+ r = mga_crtc->lut_r[i << 1];
+ b = mga_crtc->lut_b[i << 1];
+ }
+ } else {
+ r = mga_crtc->lut_r[i];
+ b = mga_crtc->lut_b[i];
+ }
+ /* VGA registers */
+ WREG8(DAC_INDEX + MGA1064_COL_PAL, r);
+ WREG8(DAC_INDEX + MGA1064_COL_PAL, mga_crtc->lut_g[i]);
+ WREG8(DAC_INDEX + MGA1064_COL_PAL, b);
+ }
+ return;
+ }
for (i = 0; i < MGAG200_LUT_SIZE; i++) {
/* VGA registers */
WREG8(DAC_INDEX + MGA1064_COL_PAL, mga_crtc->lut_r[i]);
--
1.8.1.4
next prev parent reply other threads:[~2013-07-17 13:07 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-17 13:07 [PATCH 00/16] drm/mgag200: Fixes and enhancements for the MGAG200 KMS driver Egbert Eich
2013-07-17 13:07 ` [PATCH 01/16] drm/mgag200: Fix memleaks in error path in mgag200_fb_create() Egbert Eich
2013-07-17 13:07 ` [PATCH 02/16] drm/mgag200: Fix memleak in error path in mgag200_bo_create() Egbert Eich
2013-07-17 13:07 ` [PATCH 03/16] drm/mgag200: Free container instead of member in mga_user_framebuffer_destroy() Egbert Eich
2013-07-17 13:07 ` [PATCH 04/16] drm/mgag200: Don't unreference when handle creation failed Egbert Eich
2013-07-17 13:28 ` Chris Wilson
2013-07-17 15:55 ` Egbert Eich
2013-07-17 13:07 ` [PATCH 05/16] drm/mgag200: Copy fb name string before using it in mgag200_fb_create() Egbert Eich
2013-07-17 13:07 ` [PATCH 06/16] drm/mgag200: Fix logic in mgag200_bo_pin() Egbert Eich
2013-07-23 5:38 ` Dave Airlie
2013-07-23 6:44 ` [PATCH 06/16 v2] drm/mgag200: Fix logic in mgag200_bo_pin() (v2) Egbert Eich
2013-07-17 13:07 ` [PATCH 07/16] drm/mgag200: Make local function mgag200_gem_init_object() static Egbert Eich
2013-07-17 13:07 ` [PATCH 08/16] drm/mgag200: Simplify function mgag200_bo_unpin() Egbert Eich
2013-07-17 13:07 ` [PATCH 09/16] drm/mgag200: Add an crtc_disable callback to the crtc helper funcs Egbert Eich
2013-07-17 13:07 ` [PATCH 10/16] drm/mgag200: Invalidate page tables when pinning a BO Egbert Eich
2013-07-17 15:40 ` [PATCH V2] " Egbert Eich
2013-07-17 13:07 ` [PATCH 11/16] drm/mgag200: Initialize data needed to map fbdev memory Egbert Eich
2013-07-23 5:43 ` Dave Airlie
2013-07-17 13:07 ` [PATCH 12/16] drm/mgag200: Add sysfs support for connectors Egbert Eich
2013-07-17 13:07 ` [PATCH 13/16] drm/mgag200: Fix framebuffer pitch calculation Egbert Eich
2013-07-17 13:07 ` Egbert Eich [this message]
2013-07-17 13:07 ` [PATCH 15/16] drm/mgag200: Reject modes when h-parameters are no multiple of 8 Egbert Eich
2013-07-23 5:46 ` Dave Airlie
2013-07-23 15:30 ` Adam Jackson
2013-07-23 18:07 ` Daniel Vetter
2013-07-17 13:07 ` [PATCH 16/16] drm/mgag200: Add doublescan and interlace support Egbert Eich
2013-07-23 7:14 ` [PATCH 00/16] drm/mgag200: Fixes and enhancements for the MGAG200 KMS driver Dave Airlie
2013-07-23 8:09 ` Egbert Eich
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=1374066449-21714-15-git-send-email-eich@suse.com \
--to=eich@suse.com \
--cc=airlied@redhat.com \
--cc=charvey@matrox.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=eich@suse.de \
--cc=mathieu.larouche@matrox.com \
/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.