#ifndef _GLTHREAD_H
#define _GLTHREAD_H
-#include "main/mtypes.h"
-
-/* Command size is a number of bytes stored in a short. */
-#define MARSHAL_MAX_CMD_SIZE 65535
+/* The size of one batch and the maximum size of one call.
+ *
+ * This should be as low as possible, so that:
+ * - multiple synchronizations within a frame don't slow us down much
+ * - a smaller number of calls per frame can still get decent parallelism
+ * - the memory footprint of the queue is low, and with that comes a lower
+ * chance of experiencing CPU cache thrashing
+ * but it should be high enough so that u_queue overhead remains negligible.
+ */
+#define MARSHAL_MAX_CMD_SIZE (8 * 1024)
/* The number of batch slots in memory.
*
* waiting batches. There must be at least 1 slot for a waiting batch,
* so the minimum number of batches is 3.
*/
-#define MARSHAL_MAX_BATCHES 4
+#define MARSHAL_MAX_BATCHES 8
#include <inttypes.h>
#include <stdbool.h>
-#include <pthread.h>
#include "util/u_queue.h"
enum marshal_dispatch_cmd_id;
+struct gl_context;
/** A single batch of commands queued up for execution. */
struct glthread_batch
struct gl_context *ctx;
/** Amount of data used by batch commands, in bytes. */
- size_t used;
+ int used;
/** Data contained in the command buffer. */
uint8_t buffer[MARSHAL_MAX_CMD_SIZE];
/** Multithreaded queue. */
struct util_queue queue;
+ /** This is sent to the driver for framebuffer overlay / HUD. */
+ struct util_queue_monitoring stats;
+
/** The ring of batches in memory. */
struct glthread_batch batches[MARSHAL_MAX_BATCHES];
* buffer) binding is in a VBO.
*/
bool element_array_is_vbo;
+ bool draw_indirect_buffer_is_vbo;
};
void _mesa_glthread_init(struct gl_context *ctx);
void _mesa_glthread_destroy(struct gl_context *ctx);
-void _mesa_glthread_restore_dispatch(struct gl_context *ctx);
+void _mesa_glthread_restore_dispatch(struct gl_context *ctx, const char *func);
+void _mesa_glthread_disable(struct gl_context *ctx, const char *func);
void _mesa_glthread_flush_batch(struct gl_context *ctx);
void _mesa_glthread_finish(struct gl_context *ctx);
+void _mesa_glthread_finish_before(struct gl_context *ctx, const char *func);
#endif /* _GLTHREAD_H*/