#include "util/u_format_s3tc.h"
#include "util/u_string.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
#include <stdio.h>
#include <errno.h>
return cpu_time + nouveau_screen(pscreen)->cpu_gpu_time_delta;
}
+static struct disk_cache *
+nouveau_screen_get_disk_shader_cache(struct pipe_screen *pscreen)
+{
+ return nouveau_screen(pscreen)->disk_shader_cache;
+}
+
static void
nouveau_screen_fence_ref(struct pipe_screen *pscreen,
struct pipe_fence_handle **ptr,
static boolean
nouveau_screen_fence_finish(struct pipe_screen *screen,
+ struct pipe_context *ctx,
struct pipe_fence_handle *pfence,
uint64_t timeout)
{
struct nouveau_bo *bo = 0;
int ret;
+ if (whandle->offset != 0) {
+ debug_printf("%s: attempt to import unsupported winsys offset %d\n",
+ __FUNCTION__, whandle->offset);
+ return NULL;
+ }
+
if (whandle->type != DRM_API_HANDLE_TYPE_SHARED &&
whandle->type != DRM_API_HANDLE_TYPE_FD) {
debug_printf("%s: attempt to import unsupported handle type %d\n",
}
}
+static void
+nouveau_disk_cache_create(struct nouveau_screen *screen)
+{
+ uint32_t mesa_timestamp;
+ char *timestamp_str;
+ int res;
+
+ if (disk_cache_get_function_timestamp(nouveau_disk_cache_create,
+ &mesa_timestamp)) {
+ res = asprintf(×tamp_str, "%u", mesa_timestamp);
+ if (res != -1) {
+ screen->disk_shader_cache =
+ disk_cache_create(nouveau_screen_get_name(&screen->base),
+ timestamp_str, 0);
+ free(timestamp_str);
+ }
+ }
+}
+
int
nouveau_screen_init(struct nouveau_screen *screen, struct nouveau_device *dev)
{
pscreen->get_name = nouveau_screen_get_name;
pscreen->get_vendor = nouveau_screen_get_vendor;
pscreen->get_device_vendor = nouveau_screen_get_device_vendor;
+ pscreen->get_disk_shader_cache = nouveau_screen_get_disk_shader_cache;
pscreen->get_timestamp = nouveau_screen_get_timestamp;
pscreen->fence_reference = nouveau_screen_fence_ref;
pscreen->fence_finish = nouveau_screen_fence_finish;
- util_format_s3tc_init();
+ nouveau_disk_cache_create(screen);
screen->lowmem_bindings = PIPE_BIND_GLOBAL; /* gallium limit */
screen->vidmem_bindings =
nouveau_device_del(&screen->device);
nouveau_drm_del(&screen->drm);
close(fd);
+
+ disk_cache_destroy(screen->disk_shader_cache);
}
static void