*
*/
+#include "pan_bo.h"
#include "pan_context.h"
/* See mali_job for notes on how this works. But basically, for small vertex
static unsigned
panfrost_vertex_instanced(
- struct panfrost_job *batch,
+ struct panfrost_batch *batch,
struct panfrost_resource *rsrc,
unsigned divisor,
union mali_attr *attrs,
unsigned m = m_f;
/* Default case */
- unsigned magic_divisor = m, extra_flags = 0;
+ uint32_t magic_divisor = m, extra_flags = 0;
/* e = 2^(shift + 32) % d */
uint64_t e = t % hw_divisor;
/* Apply round-down algorithm? e <= 2^shift?. XXX: The blob
* seems to use a different condition */
- if (e <= (1 << shift)) {
+ if (e <= (1ll << shift)) {
magic_divisor = m - 1;
extra_flags = 1;
}
/* Top flag implicitly set */
- assert(magic_divisor & (1 << 31));
- magic_divisor &= ~(1 << 31);
+ assert(magic_divisor & (1u << 31));
+ magic_divisor &= ~(1u << 31);
/* Upload to two different slots */
}
void
-panfrost_emit_vertex_data(struct panfrost_job *batch)
+panfrost_emit_vertex_data(struct panfrost_batch *batch)
{
struct panfrost_context *ctx = batch->ctx;
struct panfrost_vertex_state *so = ctx->vertex;
* will be adjusted back when we fixup the src_offset in
* mali_attr_meta */
- mali_ptr raw_addr = panfrost_vertex_buffer_address(ctx, vbi);
+ mali_ptr raw_addr = rsrc->bo->gpu + buf->buffer_offset;
mali_ptr addr = raw_addr & ~63;
unsigned chopped_addr = raw_addr - addr;
/* Add a dependency of the batch on the vertex buffer */
- panfrost_job_add_bo(batch, rsrc->bo);
+ panfrost_batch_add_bo(batch, rsrc->bo,
+ PAN_BO_ACCESS_SHARED |
+ PAN_BO_ACCESS_READ |
+ PAN_BO_ACCESS_VERTEX_TILER);
/* Set common fields */
attrs[k].elements = addr;
attrs[k].stride = buf->stride;
- attrs[k].size = rsrc->base.width0;
+
+ /* Since we advanced the base pointer, we shrink the buffer
+ * size */
+ attrs[k].size = rsrc->base.width0 - buf->buffer_offset;
/* We need to add the extra size we masked off (for
* correctness) so the data doesn't get clamped away */
/* Upload whatever we emitted and go */
ctx->payloads[PIPE_SHADER_VERTEX].postfix.attributes =
- panfrost_upload_transient(ctx, attrs, k * sizeof(union mali_attr));
+ panfrost_upload_transient(batch, attrs, k * sizeof(union mali_attr));
}