/**************************************************************************
*
* Copyright 2018-2019 Alyssa Rosenzweig
- * Copyright 2018-2019 Collabora
+ * Copyright 2018-2019 Collabora, Ltd.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
#ifndef PAN_SCREEN_H
#define PAN_SCREEN_H
+#include <xf86drm.h>
#include "pipe/p_screen.h"
#include "pipe/p_defines.h"
#include "renderonly/renderonly.h"
+#include "util/u_dynarray.h"
+#include "util/bitset.h"
+#include "util/set.h"
-#include <panfrost-misc.h>
-#include "pan_allocate.h"
+#include "pan_device.h"
+#include "pan_pool.h"
+struct panfrost_batch;
struct panfrost_context;
struct panfrost_resource;
-struct panfrost_screen;
-
-//#define DUMP_PERFORMANCE_COUNTERS
-
-/* Flags for allocated memory */
-#define PAN_ALLOCATE_EXECUTE (1 << 0)
-#define PAN_ALLOCATE_GROWABLE (1 << 1)
-
-struct panfrost_driver {
- struct panfrost_bo * (*create_bo) (struct panfrost_screen *screen, const struct pipe_resource *template);
- struct panfrost_bo * (*import_bo) (struct panfrost_screen *screen, struct winsys_handle *whandle);
- uint8_t * (*map_bo) (struct panfrost_context *ctx, struct pipe_transfer *transfer);
- void (*unmap_bo) (struct panfrost_context *ctx, struct pipe_transfer *transfer);
- void (*destroy_bo) (struct panfrost_screen *screen, struct panfrost_bo *bo);
-
- int (*submit_vs_fs_job) (struct panfrost_context *ctx, bool has_draws, bool is_scanout);
- void (*force_flush_fragment) (struct panfrost_context *ctx);
- void (*allocate_slab) (struct panfrost_screen *screen,
- struct panfrost_memory *mem,
- size_t pages,
- bool same_va,
- int extra_flags,
- int commit_count,
- int extent);
- void (*enable_counters) (struct panfrost_screen *screen);
-};
struct panfrost_screen {
struct pipe_screen base;
-
- struct renderonly *ro;
- struct panfrost_driver *driver;
-
- struct panfrost_memory perf_counters;
-
- /* Memory management is based on subdividing slabs with AMD's allocator */
- struct pb_slabs slabs;
-
- /* TODO: Where? */
- struct panfrost_resource *display_target;
-
- int last_fragment_id;
- int last_fragment_flushed;
+ struct panfrost_device dev;
};
static inline struct panfrost_screen *
-panfrost_screen( struct pipe_screen *pipe )
+pan_screen(struct pipe_screen *p)
+{
+ return (struct panfrost_screen *)p;
+}
+
+static inline struct panfrost_device *
+pan_device(struct pipe_screen *p)
{
- return (struct panfrost_screen *)pipe;
+ return &(pan_screen(p)->dev);
}
+struct panfrost_fence *
+panfrost_fence_create(struct panfrost_context *ctx, uint32_t syncobj);
+
#endif /* PAN_SCREEN_H */