[Mesa-dev] [PATCH] mapi: Enable assembly language API acceleration for PPC64LE

Emil Velikov emil.l.velikov at gmail.com
Fri Jun 2 11:07:38 UTC 2017


Hi guys,

Ben please add some commit message. If nothing obvious comes to mind,
do mention how you tested the patch.
My PPC ASM is quite limited, so there's only minor suggestions below.

> --- a/src/mapi/Makefile.sources
> +++ b/src/mapi/Makefile.sources
> @@ -15,6 +15,7 @@
>  #    this mode, compile MAPI_BRIDGE_FILES with MAPI_MODE_BRIDGE defined.
>
>  MAPI_UTIL_FILES = \
> +       ../util/u_endian.h \
Even though the header is used in entry.c we don't need this line.


> --- a/src/mapi/entry.c
> +++ b/src/mapi/entry.c
> @@ -27,6 +27,10 @@
>
>  #include "entry.h"
>  #include "u_current.h"
> +#include "../util/u_endian.h"
> +
$mesa_top/src is already in the search paths, so you can drop the "../" here.

> +#include <stdlib.h>
> +#include <stdint.h>
>
Nit: please move system headers to the top.


> --- /dev/null
> +++ b/src/mapi/entry_ppc64le_tls.h

> +
> +void
> +entry_patch_public(void)
> +{
> +}
> +
We have some code only in the x86 tls case, haven't looked too closely why.
If anything comes to mind why the code is safe [as-is], please add a
small comment.


> +
> +void
> +entry_patch(mapi_func entry, int slot)
> +{
> +   char *code = (char *) entry;
> +   *((uint64_t *) (code + TEMPLATE_OFFSET_SLOT)) = slot * sizeof(mapi_func);
> +}
> +
> +mapi_func
> +entry_generate(int slot)
> +{
> +   char *code;
To be consistent with the existing code base, please add

   mapi_func entry;

> +
> +   code = u_execmem_alloc(sizeof(code_templ));
> +   if (!code)
> +      return NULL;
> +
> +   memcpy(code, code_templ, sizeof(code_templ));
> +
> +   *((uint64_t *) (code + TEMPLATE_OFFSET_TLS_ADDR)) = ppc64le_dispatch_tls();

> +   *((uint64_t *) (code + TEMPLATE_OFFSET_SLOT)) = slot * sizeof(mapi_func);
> +
> +     return (mapi_func) code;
... and replace the above with

   entry = (mapi_func) code;
   entry_patch(entry, slot);

   return entry;

Can you do the same in the TSD file?

Thanks
Emil


More information about the mesa-dev mailing list