Exemplo n.º 1
0
static void
nouveau_disk_cache_create(struct nouveau_screen *screen)
{
   struct mesa_sha1 ctx;
   unsigned char sha1[20];
   char cache_id[20 * 2 + 1];
   uint64_t driver_flags = 0;

   _mesa_sha1_init(&ctx);
   if (!disk_cache_get_function_identifier(nouveau_disk_cache_create,
                                           &ctx))
      return;

   _mesa_sha1_final(&ctx, sha1);
   disk_cache_format_hex_id(cache_id, sha1, 20 * 2);

   if (screen->prefer_nir)
      driver_flags |= NOUVEAU_SHADER_CACHE_FLAGS_IR_NIR;
   else
      driver_flags |= NOUVEAU_SHADER_CACHE_FLAGS_IR_TGSI;

   screen->disk_shader_cache =
      disk_cache_create(nouveau_screen_get_name(&screen->base),
                        cache_id, driver_flags);
}
Exemplo n.º 2
0
static void si_disk_cache_create(struct si_screen *sscreen)
{
	/* Don't use the cache if shader dumping is enabled. */
	if (sscreen->debug_flags & DBG_ALL_SHADERS)
		return;

	struct mesa_sha1 ctx;
	unsigned char sha1[20];
	char cache_id[20 * 2 + 1];

	_mesa_sha1_init(&ctx);

	if (!disk_cache_get_function_identifier(si_disk_cache_create, &ctx) ||
	    !disk_cache_get_function_identifier(LLVMInitializeAMDGPUTargetInfo,
						&ctx))
		return;

	_mesa_sha1_final(&ctx, sha1);
	disk_cache_format_hex_id(cache_id, sha1, 20 * 2);

	/* These flags affect shader compilation. */
	#define ALL_FLAGS (DBG(FS_CORRECT_DERIVS_AFTER_KILL) |	\
			   DBG(SI_SCHED) |			\
			   DBG(GISEL) |				\
			   DBG(UNSAFE_MATH))
	uint64_t shader_debug_flags = sscreen->debug_flags &
		ALL_FLAGS;

	/* Add the high bits of 32-bit addresses, which affects
	 * how 32-bit addresses are expanded to 64 bits.
	 */
	STATIC_ASSERT(ALL_FLAGS <= UINT_MAX);
	assert((int16_t)sscreen->info.address32_hi == (int32_t)sscreen->info.address32_hi);
	shader_debug_flags |= (uint64_t)(sscreen->info.address32_hi & 0xffff) << 32;

	if (sscreen->options.enable_nir)
		shader_debug_flags |= 1ull << 48;

	sscreen->disk_shader_cache =
		disk_cache_create(sscreen->info.name,
				  cache_id,
				  shader_debug_flags);
}
Exemplo n.º 3
0
static void
nouveau_disk_cache_create(struct nouveau_screen *screen)
{
   uint32_t mesa_id;
   char *mesa_id_str;
   int res;

   if (disk_cache_get_function_identifier(nouveau_disk_cache_create,
                                          &mesa_id)) {
      res = asprintf(&mesa_id_str, "%u", mesa_id);
      if (res != -1) {
         screen->disk_shader_cache =
            disk_cache_create(nouveau_screen_get_name(&screen->base),
                              mesa_id_str, 0);
         free(mesa_id_str);
      }
   }
}