[Mesa-dev] [PATCH 3/3] clover: Pass buffer offsets to the driver in set_global_binding() v2

Michel Dänzer michel at daenzer.net
Wed Feb 19 18:39:42 PST 2014


On Don, 2014-02-20 at 00:53 +0100, Francisco Jerez wrote:
> Tom Stellard <thomas.stellard at amd.com> writes:
> 
> > diff --git a/src/gallium/drivers/r600/evergreen_compute.c b/src/gallium/drivers/r600/evergreen_compute.c
> > index 70efe5c..efd7143 100644
> > --- a/src/gallium/drivers/r600/evergreen_compute.c
> > +++ b/src/gallium/drivers/r600/evergreen_compute.c
> > @@ -662,10 +662,18 @@ static void evergreen_set_global_binding(
> >  
> >  	for (int i = 0; i < n; i++)
> >  	{
> > +		uint32_t buffer_offset;
> > +		uint32_t handle;
> >  		assert(resources[i]->target == PIPE_BUFFER);
> >  		assert(resources[i]->bind & PIPE_BIND_GLOBAL);
> >  
> > -		*(handles[i]) = buffers[i]->chunk->start_in_dw * 4;
> > +		buffer_offset = util_le32_to_cpu(*(handles[i]));
> > +		handle = buffer_offset + buffers[i]->chunk->start_in_dw * 4;
> > +		if (R600_BIG_ENDIAN) {
> > +			handle = util_bswap32(handle);
> > +		}
> > +
> > +		*(handles[i]) = handle;
> 
> I guess you could just do "*(handles[i]) = util_cpu_to_le32(handle)"?
> Oh, right, there isn't such a function -- though it would be trivial to
> implement.

Right, just add:

#define util_cpu_to_le64 util_le64_to_cpu [0]
#define util_cpu_to_le32 util_le32_to_cpu
#define util_cpu_to_le16 util_le16_to_cpu

[0] and add util_le64_to_cpu in the first place :)


-- 
Earthling Michel Dänzer            |                  http://www.amd.com
Libre software enthusiast          |                Mesa and X developer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140220/baaecea0/attachment.pgp>


More information about the mesa-dev mailing list