linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Zielinski <grim@undead.cc>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: "Ville Syrjälä" <syrjala@sci.fi>,
	"Linux Frame Buffer Device Development"
	<linux-fbdev-devel@lists.sourceforge.net>
Subject: Re: [PATCH] atyfb (2.6): Add RGB565 support
Date: Thu, 13 May 2004 21:11:47 -0400	[thread overview]
Message-ID: <40A41CD3.2010908@undead.cc> (raw)
In-Reply-To: <Pine.GSO.4.58.0405131121210.9790@waterleaf.sonytel.be>

[-- Attachment #1: Type: text/plain, Size: 1201 bytes --]

Geert Uytterhoeven wrote:

>	Hi Ville,
>
>On Wed, 12 May 2004, Ville [iso-8859-1] Syrjälä wrote:
>  
>
>>On Wed, May 12, 2004 at 11:11:21AM +0200, Geert Uytterhoeven wrote:
>>    
>>
>>>On Wed, 12 May 2004, Ville [iso-8859-1] Syrjälä wrote:
>>>      
>>>
>>>>This patch adds RGB565 support to atyfb.
>>>>        
>>>>
>>>Nice! Have you tried fbtest on it?
>>>
>>>I once tried to implement it myself, but it didn't work reliably.
>>>      
>>>
>>I just tried fbtest and most tests look ok. The penguin images are wrong
>>(green instead of white stuff aroung the penguin) and the test009 looks
>>wrong too. Are you sure fbtest is doing the right thing with rgb565
>>directcolor visuals? DirectFB or mplayer don't have any problems.
>>    
>>
>
>It's always possible there's a bug in fbtest w.r.t. 565 handling, but I didn't
>see it.
>  
>

It's a bug in fbtest's directcolor routines.   Directcolor sets the clut 
using using the min of the RGB sizes so 565 becomes 555.  The problem is 
that tests 4, 8 and 9 use the buffer as 565 (VISUAL_GENERIC & 
VISUAL_TRUECOLOR) and the directcolor routines don't reset the clut to 
it's full range.  Fix attached.

John


[-- Attachment #2: fbtest_565_fix --]
[-- Type: text/plain, Size: 2903 bytes --]

diff -urNX dontdiff2 fbtest.old/clut.c fbtest/clut.c
--- fbtest.old/clut.c	2002-10-06 16:14:20.000000000 -0400
+++ fbtest/clut.c	2004-05-13 21:12:53.000000000 -0400
@@ -114,6 +114,29 @@
 
 
     /*
+     *  Create table with maximum dynamic range
+     */
+
+void clut_create_maximum(rgba_t *clut, u32 rlen, u32 glen, u32 blen, u32 alen)
+{
+    u32 i;
+    u32 len = max(max(rlen, glen), max(blen, alen));
+
+    Debug("clut_create_maximum: RGBA %dx%dx%dx%d\n", rlen, glen, blen, alen);
+    for (i = 0; i < len; i++) {
+	if (i < rlen)
+	    clut->r = EXPAND_TO_16BIT(i, rlen-1);
+	if (i < glen)
+    	    clut->g = EXPAND_TO_16BIT(i, glen-1);
+	if (i < blen)
+	    clut->b = EXPAND_TO_16BIT(i, blen-1);
+	if (i < alen)
+	    clut->a = (alen-1) ? EXPAND_TO_16BIT(i, alen-1) : 0xffff;
+	clut++;
+    }
+}
+
+    /*
      *  Create a linear ramp
      */
 
@@ -158,7 +181,7 @@
 	clut_create_rgbcube(clut, 4, 4, 4);
     } else if (idx_len >= 32) {
 	clut_create_rgbcube(clut, 3, 3, 3);
-	/* FIXME: still 3 entries left */
+	/* FIXME: still 5 entries left */
     } else if (idx_len >= 16) {
 	memcpy(clut, clut_console, sizeof(clut_console));
     } else if (idx_len >= 8) {
diff -urNX dontdiff2 fbtest.old/include/clut.h fbtest/include/clut.h
--- fbtest.old/include/clut.h	2001-05-01 10:39:20.000000000 -0400
+++ fbtest/include/clut.h	2004-05-13 20:36:03.000000000 -0400
@@ -16,6 +16,7 @@
 extern const rgba_t clut_windows[4];
 
 extern void clut_create_rgbcube(rgba_t *clut, u32 rlen, u32 glen, u32 blen);
+extern void clut_create_maximum(rgba_t *clut, u32 rlen, u32 glen, u32 blen, u32 alen);
 extern void clut_create_linear(rgba_t *clut, u32 len);
 extern void clut_init_nice(void);
 
diff -urNX dontdiff2 fbtest.old/pnmtohex/Makefile fbtest/pnmtohex/Makefile
--- fbtest.old/pnmtohex/Makefile	2003-01-20 07:58:47.000000000 -0500
+++ fbtest/pnmtohex/Makefile	2004-05-13 19:00:43.000000000 -0400
@@ -3,7 +3,7 @@
 
 HOST_TARGET = pnmtohex
 
-LIBS += -lnetpnm -lnetpbm -lnetpgm -lnetppm
+LIBS += -lnetpbm
 
 include $(TOPDIR)/Rules.make
 
diff -urNX dontdiff2 fbtest.old/visops/directcolor.c fbtest/visops/directcolor.c
--- fbtest.old/visops/directcolor.c	2003-03-18 11:53:44.000000000 -0500
+++ fbtest/visops/directcolor.c	2004-05-13 21:11:37.000000000 -0400
@@ -94,7 +94,18 @@
 
 
     /*
-     *  Truecolor/Grayscale
+     *  Truecolor/Generic
+     */
+
+static void directcolor_set_maximum(void)
+{
+    clut_create_maximum(clut, red_len, green_len, blue_len, alpha_len);
+    directcolor_update_cmap();
+}
+
+
+    /*
+     *  Grayscale
      */
 
 static void directcolor_set_linear(void)
@@ -119,11 +130,14 @@
 	case VISUAL_DIRECTCOLOR:
 	    break;
 
-	case VISUAL_GENERIC:
 	case VISUAL_GRAYSCALE:
-	case VISUAL_TRUECOLOR:
 	    directcolor_set_linear();
 	    break;
+	
+	case VISUAL_GENERIC:
+	case VISUAL_TRUECOLOR:
+	    directcolor_set_maximum();
+	    break;
 
 	default:
 	    return 0;

  parent reply	other threads:[~2004-05-14  1:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-11 21:36 [PATCH] atyfb (2.6): Add RGB565 support Ville Syrjälä
2004-05-12  9:11 ` Geert Uytterhoeven
2004-05-12 18:57   ` Ville Syrjälä
2004-05-13  9:22     ` Geert Uytterhoeven
2004-05-13 19:19       ` Ville Syrjälä
2004-05-14  1:11       ` John Zielinski [this message]
2004-05-14  4:53         ` Ville Syrjälä

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=40A41CD3.2010908@undead.cc \
    --to=grim@undead.cc \
    --cc=geert@linux-m68k.org \
    --cc=linux-fbdev-devel@lists.sourceforge.net \
    --cc=syrjala@sci.fi \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).