dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matt Roper <matthew.d.roper@intel.com>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: wei.c.li@intel.com, intel-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org, harish.krupo.kps@intel.com
Subject: Re: [PATCH v2 2/3] drm: Add CRTC background color property (v2)
Date: Wed, 14 Nov 2018 09:29:52 -0800	[thread overview]
Message-ID: <20181114172952.GC8652@mdroper-desk.amr.corp.intel.com> (raw)
In-Reply-To: <20181114172036.GR9144@intel.com>

On Wed, Nov 14, 2018 at 07:20:36PM +0200, Ville Syrjälä wrote:
> On Tue, Nov 13, 2018 at 03:21:48PM -0800, Matt Roper wrote:
...
> >  
> > +/*
> > + * Put RGBA values into a standard 64-bit representation that can be used
> > + * for ioctl parameters, inter-driver commmunication, etc.  If the component
> > + * values being provided contain less than 16 bits of precision, they'll
> > + * be shifted into the most significant bits.
> > + */
> > +static inline __u64
> > +drm_rgba(__u8 bpc, __u16 red, __u16 green, __u16 blue, __u16 alpha)
> > +{
> > +	int msb_shift = 16 - bpc;
> > +
> > +	return (__u64)alpha << msb_shift << 48 |
> > +	       (__u64)red   << msb_shift << 32 |
> > +	       (__u64)green << msb_shift << 16 |
> > +	       (__u64)blue  << msb_shift;
> 
> So the value is now ARGB but everything still says RGBA?

Well, the general idea was that you're providing four color components
and you're not supposed to be looking behind the curtain at the internal
representation (which may not match any given platform's hardware
ordering).  If everyone uses the helpers here to pack/unpack the
components, then that avoids accidental differences in interpretation
between different platforms.

But I'm fine with changing the names; I'll do that when I incorporate
Sean's suggestion.



Matt

> 
> > +}
> > +
> > +/*
> > + * Extract the specified number of bits of a specific color component from a
> > + * standard 64-bit RGBA value.
> > + */
> > +#define DRM_RGBA_BLUE(c, numbits)  (__u16)((c & 0xFFFFull)     >> (16-numbits))
> > +#define DRM_RGBA_GREEN(c, numbits) (__u16)((c & 0xFFFFull<<16) >> (32-numbits))
> > +#define DRM_RGBA_RED(c, numbits)   (__u16)((c & 0xFFFFull<<32) >> (48-numbits))
> > +#define DRM_RGBA_ALPHA(c, numbits) (__u16)((c & 0xFFFFull<<48) >> (64-numbits))
> > +
> >  #if defined(__cplusplus)
> >  }
> >  #endif
> > -- 
> > 2.14.4
> 
> -- 
> Ville Syrjälä
> Intel

-- 
Matt Roper
Graphics Software Engineer
IoTG Platform Enabling & Development
Intel Corporation
(916) 356-2795
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2018-11-14 17:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-13 23:21 [PATCH v2 0/3] CRTC background color Matt Roper
2018-11-13 23:21 ` [PATCH v2 2/3] drm: Add CRTC background color property (v2) Matt Roper
2018-11-14 16:17   ` Sean Paul
2018-11-15  0:27     ` Matt Roper
2018-11-14 17:20   ` Ville Syrjälä
2018-11-14 17:29     ` Matt Roper [this message]
2018-11-13 23:21 ` [PATCH v2 3/3] drm/i915/gen9+: Add support for pipe background color (v2) Matt Roper
2018-11-14 18:05   ` 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=20181114172952.GC8652@mdroper-desk.amr.corp.intel.com \
    --to=matthew.d.roper@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=harish.krupo.kps@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.intel.com \
    --cc=wei.c.li@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox