#ifndef __BUILDER_H__
#define __BUILDER_H__
-#define MFBD
-
#define _LARGEFILE64_SOURCE 1
#define CACHE_LINE_SIZE 1024 /* TODO */
#include <sys/mman.h>
#include <assert.h>
#include "pan_resource.h"
+#include "pan_job.h"
#include "pipe/p_compiler.h"
#include "pipe/p_config.h"
#include "pipe/p_screen.h"
#include "pipe/p_state.h"
#include "util/u_blitter.h"
+#include "util/hash_table.h"
/* Forward declare to avoid extra header dep */
struct prim_convert_context;
-/* TODO: Handle on newer hardware */
-#ifdef MFBD
-#define PANFROST_DEFAULT_FBD (MALI_MFBD)
-#define PANFROST_FRAMEBUFFER struct bifrost_framebuffer
-#else
-#define PANFROST_DEFAULT_FBD (MALI_SFBD)
-#define PANFROST_FRAMEBUFFER struct mali_single_framebuffer
-#endif
-
#define MAX_DRAW_CALLS 4096
#define MAX_VARYINGS 4096
#define PAN_DIRTY_SAMPLERS (1 << 8)
#define PAN_DIRTY_TEXTURES (1 << 9)
+#define SET_BIT(lval, bit, cond) \
+ if (cond) \
+ lval |= (bit); \
+ else \
+ lval &= ~(bit);
+
struct panfrost_constant_buffer {
bool dirty;
size_t size;
struct panfrost_transfer transfer;
};
+struct panfrost_fence {
+ struct pipe_reference reference;
+ int fd;
+};
+
#define PANFROST_MAX_TRANSIENT_ENTRIES 64
struct panfrost_transient_pool {
/* Gallium context */
struct pipe_context base;
+ /* Bound job and map of panfrost_job_key to jobs */
+ struct panfrost_job *job;
+ struct hash_table *jobs;
+
/* Bit mask for supported PIPE_DRAW for this hardware */
unsigned draw_modes;
struct panfrost_memory misc_1;
struct panfrost_memory depth_stencil_buffer;
- struct {
- unsigned buffers;
- const union pipe_color_union *color;
- double depth;
- unsigned stencil;
- } last_clear;
-
struct panfrost_query *occlusion_query;
- /* Each render job has multiple framebuffer descriptors associated with
- * it, used for various purposes with more or less the same format. The
- * most obvious is the fragment framebuffer descriptor, which carries
- * e.g. clearing information */
-
-#ifdef SFBD
- struct mali_single_framebuffer fragment_fbd;
-#else
- struct bifrost_framebuffer fragment_fbd;
-
- struct bifrost_fb_extra fragment_extra;
-
- struct bifrost_render_target fragment_rts[4];
-#endif
-
/* Each draw has corresponding vertex and tiler payloads */
struct midgard_payload_vertex_tiler payload_vertex;
struct midgard_payload_vertex_tiler payload_tiler;
/* Per-draw Dirty flags are setup like any other driver */
int dirty;
- /* Per frame dirty flag - whether there was a clear. If not, we need to do a partial update, maybe */
- bool frame_cleared;
-
unsigned vertex_count;
union mali_attr attributes[PIPE_MAX_ATTRIBS];
unsigned varying_height;
- struct mali_viewport *viewport;
- PANFROST_FRAMEBUFFER vt_framebuffer;
+ struct mali_single_framebuffer vt_framebuffer_sfbd;
+ struct bifrost_framebuffer vt_framebuffer_mfbd;
/* TODO: Multiple uniform buffers (index =/= 0), finer updates? */
struct pipe_blend_color blend_color;
struct pipe_depth_stencil_alpha_state *depth_stencil;
struct pipe_stencil_ref stencil_ref;
+
+ /* True for t6XX, false for t8xx. */
+ bool is_t6xx;
+
+ /* If set, we'll require the use of single render-target framebuffer
+ * descriptors (SFBD), for older hardware -- specifically, <T760 hardware, If
+ * false, we'll use the MFBD no matter what. New hardware -does- retain support
+ * for SFBD, and in theory we could flip between them on a per-RT basis, but
+ * there's no real advantage to doing so */
+ bool require_sfbd;
+
+ uint32_t out_sync;
};
/* Corresponds to the CSO */
struct pipe_fence_handle **fence,
unsigned flags);
+bool
+panfrost_is_scanout(struct panfrost_context *ctx);
+
+mali_ptr
+panfrost_sfbd_fragment(struct panfrost_context *ctx, bool flip_y);
+
+mali_ptr
+panfrost_mfbd_fragment(struct panfrost_context *ctx, bool flip_y);
+
+struct bifrost_framebuffer
+panfrost_emit_mfbd(struct panfrost_context *ctx);
+
+struct mali_single_framebuffer
+panfrost_emit_sfbd(struct panfrost_context *ctx);
+
mali_ptr
panfrost_fragment_job(struct panfrost_context *ctx);