[PATCH 2/5] drm/radeon: fix cayman_vm_set_page

Christian König deathsimple at vodafone.de
Mon Oct 22 08:24:27 PDT 2012


On 22.10.2012 17:12, Alex Deucher wrote:
> On Mon, Oct 22, 2012 at 4:55 AM, Christian König
> <deathsimple at vodafone.de> wrote:
>> Handle requests that won't fit into a single packet.
>>
>> Signed-off-by: Christian König <deathsimple at vodafone.de>
>> ---
>>   drivers/gpu/drm/radeon/ni.c |   41 +++++++++++++++++++++++------------------
>>   1 file changed, 23 insertions(+), 18 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c
>> index 19b7fe1..ae6d087 100644
>> --- a/drivers/gpu/drm/radeon/ni.c
>> +++ b/drivers/gpu/drm/radeon/ni.c
>> @@ -1538,26 +1538,31 @@ void cayman_vm_set_page(struct radeon_device *rdev, uint64_t pe,
>>   {
>>          struct radeon_ring *ring = &rdev->ring[rdev->asic->vm.pt_ring_index];
>>          uint32_t r600_flags = cayman_vm_page_flags(rdev, flags);
>> -       int i;
>>
>> -       radeon_ring_write(ring, PACKET3(PACKET3_ME_WRITE, 1 + count * 2));
>> -       radeon_ring_write(ring, pe);
>> -       radeon_ring_write(ring, upper_32_bits(pe) & 0xff);
>> -       for (i = 0; i < count; ++i) {
>> -               uint64_t value = 0;
>> -               if (flags & RADEON_VM_PAGE_SYSTEM) {
>> -                       value = radeon_vm_map_gart(rdev, addr);
>> -                       value &= 0xFFFFFFFFFFFFF000ULL;
>> -                       addr += incr;
>> -
>> -               } else if (flags & RADEON_VM_PAGE_VALID) {
>> -                       value = addr;
>> -                       addr += incr;
>> -               }
>> +       while (count) {
>> +               unsigned ndw = 1 + count * 2;
>> +               if (ndw > 0x3FFF)
>> +                       ndw = 0x3FFF;
>> +
>> +               radeon_ring_write(ring, PACKET3(PACKET3_ME_WRITE, ndw));
>> +               radeon_ring_write(ring, pe);
>> +               radeon_ring_write(ring, upper_32_bits(pe) & 0xff);
> We need to adjust the the value of pe here if we are doing multiple loops.

Oh yes indeed, missed that cause my test code didn't actually accessed 
the pages.

Going to send out a v2 soon.

Christian.

>
> Alex
>
>> +               for (; ndw > 1; ndw -= 2, --count) {
>> +                       uint64_t value = 0;
>> +                       if (flags & RADEON_VM_PAGE_SYSTEM) {
>> +                               value = radeon_vm_map_gart(rdev, addr);
>> +                               value &= 0xFFFFFFFFFFFFF000ULL;
>> +                               addr += incr;
>> +
>> +                       } else if (flags & RADEON_VM_PAGE_VALID) {
>> +                               value = addr;
>> +                               addr += incr;
>> +                       }
>>
>> -               value |= r600_flags;
>> -               radeon_ring_write(ring, value);
>> -               radeon_ring_write(ring, upper_32_bits(value));
>> +                       value |= r600_flags;
>> +                       radeon_ring_write(ring, value);
>> +                       radeon_ring_write(ring, upper_32_bits(value));
>> +               }
>>          }
>>   }
>>
>> --
>> 1.7.9.5
>>



More information about the dri-devel mailing list