<p dir="ltr">On Nov 4, 2015 9:31 AM, "Michel Dänzer" <<a href="mailto:michel@daenzer.net">michel@daenzer.net</a>> wrote:<br>
><br>
> On 04.11.2015 08:46, Marek Olšák wrote:<br>
> ><br>
> > @@ -209,11 +211,48 @@ static void si_clear_buffer(struct pipe_context *ctx, struct pipe_resource *dst,<br>
> > r600_resource(dst)->TC_L2_dirty = true;<br>
> > }<br>
> ><br>
> > +/**<br>
> > + * Realign the CP DMA engine. This must be done after a copy with an unaligned<br>
> > + * size.<br>
> > + *<br>
> > + * \param size Remaining size to the CP DMA alignment.<br>
> > + */<br>
> > +static void si_cp_dma_realign_engine(struct si_context *sctx, unsigned size)<br>
> > +{<br>
> > + uint64_t va;<br>
> > + unsigned dma_flags = 0;<br>
> > + unsigned scratch_size = CP_DMA_ALIGNMENT * 2;<br>
> > +<br>
> > + assert(size < CP_DMA_ALIGNMENT);<br>
> > +<br>
> > + /* Use the scratch buffer as the dummy buffer. The 3D engine should be<br>
> > + * idle at this point.<br>
> > + */<br>
> > + if (!sctx->scratch_buffer ||<br>
> > + sctx->scratch_buffer->b.b.width0 < scratch_size) {<br>
> > + r600_resource_reference(&sctx->scratch_buffer, NULL);<br>
> > + sctx->scratch_buffer =<br>
> > + si_resource_create_custom(&sctx->screen->b.b,<br>
> > + PIPE_USAGE_DEFAULT,<br>
> > + scratch_size);<br>
> > + }<br>
> > +<br>
> > + si_cp_dma_prepare(sctx, &sctx->scratch_buffer->b.b,<br>
> > + &sctx->scratch_buffer->b.b, size, size, &dma_flags);<br>
> > +<br>
> > + va = sctx->scratch_buffer->gpu_address;<br>
> > + si_emit_cp_dma_copy_buffer(sctx, va, va + CP_DMA_ALIGNMENT, size,<br>
> > + dma_flags);<br>
> > +}<br>
><br>
> Should this update sctx->emit_scratch_reloc ?</p>
<p dir="ltr">Not strictly needed, but I'll add that before pushing.</p>
<p dir="ltr">Marek<br>
</p>