[PATCH v4 1/2] client audio: Support memfd transport

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Arun :-)

On Mon, Apr 25, 2016 at 04:30:22PM +0530, Arun Raghavan wrote:
> On Fri, 2016-04-15 at 23:06 +0200, Ahmed S. Darwish wrote:
...
> > @@ -482,6 +487,7 @@ static void setup_complete_callback(pa_pdispatch *pd, uint32_t command, uint32_t
> >          case PA_CONTEXT_AUTHORIZING: {
> >              pa_tagstruct *reply;
> >              bool shm_on_remote = false;
> > +            bool memfd_on_remote = false;
> >  
> >              if (pa_tagstruct_getu32(t, &c->version) < 0 ||
> >                  !pa_tagstruct_eof(t)) {
> > @@ -500,7 +506,15 @@ static void setup_complete_callback(pa_pdispatch *pd, uint32_t command, uint32_t
> >                 not. */
> >              if (c->version >= 13) {
> >                  shm_on_remote = !!(c->version & 0x80000000U);
> > -                c->version &= 0x7FFFFFFFU;
> > +
> > +                /* Starting with protocol version 31, the second MSB of the version
> > +                 * tag reflects whether memfd is supported on the other PA end. */
> > +                if (c->version >= 31)
> 
> You should be using (c->version & 0x40000000U) for the comparison to
> get the actual protocol version.
>
> Not a comment for this patch, but we should probably introduce some
> macros to deal with this flag setting to keep things cleaner.
>

Hmm.. if there are any flags in the most-significant bytes, then
this check shall pass and we can succesfully check for memfd
availability by checking the second MSB. That's why current patch
works as expected (that is, correctly deduce memfd availability
or non-availability) with both < 31 and > 31 PA endpoints. That's
the case too because the two most-significant bytes are force
cleared afterwards.

Nonetheless, of course what you're proposing is the more correct
logic. So if this is the only problem, let's merge and I'll create
a follow-up patch this week that introduces the desired macros and
fixes up this version-check issue in the process.

> > +                    memfd_on_remote = !!(c->version & 0x40000000U);
> > +
> > +                /* Reserve the two most-significant _bytes_ of the version tag
> > +                 * for flags. */
> > +                c->version &= 0x0000FFFFU;
> >              }
> >  
> >              pa_log_debug("Protocol version: remote %u, local %u", c->version, PA_PROTOCOL_VERSION);

Thanks!

-- 
Darwish
http://darwish.chasingpointers.com


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux