[Mesa-dev] Question regarding cs_gem_write_reloc in radeon_cs_gem.c

Tom Stellard thomas.stellard at amd.com
Fri Jun 15 08:05:57 PDT 2012


On Fri, Jun 15, 2012 at 02:15:34PM +0100, Miguel Lopes Santos Ramos wrote:
> Hi all,
> 
> I'm trying to learn to program radeons in assembly in Linux and
> already got help once in this mailing list.
> 
> I'm programming in C++ using the kernel DRM ioctls directly because
> libdrm appears to be a thin wrapper around these (for my purpose,
> which is using the GPU for computing), but in doing so, I need to
> understand what libdrm is doing.
>

r600g has preliminary support for OpenCL programs using the clover state
tracker [1].  If you are interested in using the GPU for computing I
would recommend using clover or writing your own state tracker to take
advantage of the compute code that already exists in r600g.

-Tom

[1] http://dri.freedesktop.org/wiki/GalliumCompute

> Now, the cs_gem_write_reloc function, emits two dwords which encode a
> relocation and adds information on that relocation to an array which
> is passed to the kernel.
> The function goes to some length to make sure a single
> drm_radeon_cs_reloc structure is passed to the kernel for each buffer
> object.
> 
> Now, I'm trying to understand what are the constraints, I don't know
> what is the desired behaviour.
> 
> This function begins with:
> 
>  if ((read_domain && write_domain) || (!read_domain && !write_domain)) {
>         /* in one CS a bo can only be in read or write domain but not
>          * in read & write domain at the same sime
>          */
> 
> Now, the comment seems to say one thing whereas the if-condition seems
> to say the opposite. Am I mistaken? Which is the desired behaviour,
> that of the comment or that of the code?
> 
> Then, the code block within if (reloc->handle == bo->handle) { ... }
> is even more confusing to me.
> For instance, the following line:
> 
> reloc->flags |= (flags & reloc->flags);
> 
> This seems to be a no-op. Anyway, I'm not so worried about these flags
> which appear never to be used...
> But what are really the constraints for this read_domains and write_domain?
> 
> 
> Thank you very much,
> 
> --
> Miguel Ramos
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 



More information about the mesa-dev mailing list