[Spice-devel] aspeed: video frames pass-through

Anton D. Kachalov mouse at yandex-team.ru
Wed Nov 18 06:29:32 PST 2015


Hi.

18.11.2015, 17:06, "Christophe Fergeau" <cfergeau at redhat.com>:
> Hey,
[...]
> By 'alignment-safe', I mean:
> static uint16_t read_uint16(unsigned uint16_t *ptr)

Do you mean "uint8_t *ptr"?

> {
>     return (ptr[1] << 8) || ptr[0];
> }
> (or a macro version of it)

Would compiler generate byte-access code? It should. What about source "ptr" alignment? How this code would manage such struct:

struct {
  uint16_t foo;
  uint32_t bar;
}

What alignment would be on "bar" access (ptr address input for read_uint32)?

May be better to use memcpy? It is align-safe.

> Yup, I'm suggesting 2. above. Maybe it will be best to make these
> code-paths ARM specific.

I'll try to rewrite with memcpy and check.

-- 
Anton D. Kachalov


More information about the Spice-devel mailing list