On Wed, Mar 09, 2005 at 04:01:04PM +0100, Denis Oliver Kropp wrote:
> Quoting Ville Syrj�l�:
> > On Wed, Mar 09, 2005 at 12:09:10AM +0100, Denis Oliver Kropp wrote:
> > > Quoting Ville Syrj�l�:
> > > > Older chips want the scaler/texture source color key in RGB24 format. I 
> > > > thought I'd just slap on a DFBColor to accompany the current source 
> > > > color 
> > > > key value passed around. That way the impact to other drivers would 
> > > > remain 
> > > > minimal.
> > > 
> > > That's a good idea. Having the color key twice within the state
> > > shouldn't have any impact.
> > 
> > Exactly. Just the pixel value isn't enough and storing just the DFBColor 
> > would be a bad idea because it would probably add palette lookups to many 
> > places. So keeping both around should work.
> 
> It would also be inconvenient for many drivers to convert the DFBColor
> to the pixel value, though they could use dfb_color_to_pixel().

Right. Alternatively I could convert the pixel value to RGB24 in the 
mach64 driver and set the mask to ignore the lower bits. I should probably 
set the mask that way in any case since the user might expand the color 
key by filling the lower bits with zero whereas the hardware will expand 
the values dynamically.

> > > > This solution would also need a small change to the fbdev format 
> > > > selection 
> > > > logic because currently it overrides the user's choice of RGB32 with 
> > > > ARGB 
> > > > because atyfb always says that transp.length = 8.
> > > 
> > > Ok, should we make an extra check for ARGB/RGB32 or simply check if the
> > > number of R/G/B bits is the same?
> > 
> > There's already this test to allow AiRGB so I think extending it for 
> > RGB32 would do the trick.
> > 
> >           format = dfb_fbdev_get_pixelformat( &var );
> > ...
> >           if (format != config->format) {
> >                 if (DFB_BYTES_PER_PIXEL(format) == 1 ||
> >                     (format == DSPF_ARGB && config->format == DSPF_AiRGB))
> >                      format = config->format;
> >           }
> 
> Ah, I remember ;)
> 
> > I think we should also allow the user to choose ARGB and AiRGB when fbdev 
> > tells us it uses RGB32. And of course the same stuff applies to 
> > ARGB1555/RGB15.
> 
> Yes, but we should have a helper function instead of adding these terms to
> the 'if' above, though it's hard to make the fbdev backend code look worse ;)

:)

> A generic version would check if the MSB of each RGB channel matches,
> but I don't think there's an acceptable implementation for this.

Something like this?

if (DFB_BYTES_PER_PIXEL(format) == 1 ||
    (dfb_color_to_pixel(config->format, 0x80,0x80,0x80) ^
     dfb_color_to_pixel(format, 0x80,0x80,0x80)) == 0)
   format = config->format;

Are there problems with this implementation?

-- 
Ville Syrj�l�
[EMAIL PROTECTED]
http://www.sci.fi/~syrjala/

_______________________________________________
directfb-dev mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev

Reply via email to