video and usb driver (rk3588)

Norman Feske norman.feske at genode-labs.com
Thu Jan 19 12:32:39 CET 2023


Hi Michael,

I suspect that the arguments of the 'cache_clean_invalidate_data' 
function must be cache-line-aligned.

> Here is a bit of the code:
> 
> Genode::addr_t invalid = (rect.x1()+(rect.y1()*(size.w())))*sizeof(Pixel);
> 
> Genode::addr_t invalidz =(((rect.h()-1)*(size.w()))+(rect.w()-1))*sizeof(Pixel))
>   Genode::addr_t xxx = (Genode::addr_t)surface.addr();
>    cache_clean_invalidate_data(xxx+invalid,(invalidz));
> 
> 
> I guess the calculations are wrong.., if so please suggest what
> I should change. I noticed that rect.w() and hight added 1 to them.
> I have tried with -1 as above and without modification.

The -1s look wrong to me.

It might be easier to (1) calculate both the start offset and the end 
offset, then (2) truncate the start offset to the cache-line size, (3) 
round the end offset to the cache-line size, (4) calculate the size 
argument by subtracting the start from the end offset.

Regarding (2), when calculating the end offset via surface.w()*rect.y2() 
+ rect.x2(), it will refer to the pixel at the lower-right corner of the 
dirty rectangle. You have to add 1 to this offset value, so that the 
subsequent subtraction yields the number of covered pixels, not the 
difference. E.g., think of a rectangle of only one pixel where p1 == p2. 
Here we want to flush the cache line around this pixel. The difference 
between the start and end offsets would be zero. But the number of 
covered pixels is one.

Cheers
Norman

-- 
Dr.-Ing. Norman Feske
Genode Labs

https://www.genode-labs.com · https://genode.org

Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth




More information about the users mailing list