Commit b88949f7 authored by Alyssa Rosenzweig's avatar Alyssa Rosenzweig 💜

fbd->framebuffer; remove broken pandev code

parent 8bab5b03
......@@ -212,7 +212,7 @@ struct mali_payload_vertex_tiler {
uintptr_t unknown6; /* pointer */
uintptr_t viewport;
u32 zero6;
u64 fbd;
mali_ptr framebuffer;
} __attribute__((packed));
//ASSERT_SIZEOF_TYPE(struct mali_payload_vertex_tiler, 256, 256);
......@@ -348,7 +348,7 @@ struct mali_payload_fragment {
*/
u32 _min_tile_coord;
u32 _max_tile_coord;
u64 fbd;
mali_ptr framebuffer;
} __attribute__((packed));
//ASSERT_SIZEOF_TYPE(struct mali_payload_fragment, 12, 16);
......@@ -367,7 +367,7 @@ struct mali_payload_fragment {
#define MALI_CLEAR_SLOW (1 << 28)
#define MALI_CLEAR_SLOW_STENCIL (1 << 31)
struct mali_tentative_sfbd {
struct mali_single_framebuffer {
u32 unknown1;
u32 flags;
u64 unknown_address_0;
......
......@@ -143,12 +143,12 @@ static void
panwrap_replay_sfbd(uint64_t gpu_va, int job_no)
{
struct panwrap_mapped_memory *mem = panwrap_find_mapped_gpu_mem_containing(gpu_va);
const struct mali_tentative_sfbd *PANWRAP_PTR_VAR(s, mem, (mali_ptr) gpu_va);
const struct mali_single_framebuffer *PANWRAP_PTR_VAR(s, mem, (mali_ptr) gpu_va);
/* FBDs are frequently duplicated, so watch for this */
if (panwrap_deduplicate(mem, gpu_va, "fbd", job_no)) return;
if (panwrap_deduplicate(mem, gpu_va, "framebuffer", job_no)) return;
panwrap_log("struct mali_tentative_sfbd fbd_%d = {\n", job_no);
panwrap_log("struct mali_single_framebuffer framebuffer_%d = {\n", job_no);
panwrap_indent++;
panwrap_prop("unknown1 = 0x%" PRIx32, s->unknown1);
......@@ -222,7 +222,7 @@ panwrap_replay_sfbd(uint64_t gpu_va, int job_no)
if (zero_sum_pun)
panwrap_msg("Zero sum tripped (%d), replay may be wrong\n", zero_sum_pun);
TOUCH(mem, (mali_ptr) gpu_va, *s, "fbd", job_no, true);
TOUCH(mem, (mali_ptr) gpu_va, *s, "framebuffer", job_no, true);
}
void panwrap_replay_attributes(const struct panwrap_mapped_memory *mem,
......@@ -325,7 +325,7 @@ panwrap_replay_vertex_or_tiler_job(const struct mali_job_descriptor_header *h,
mali_ptr shader_meta_ptr = (u64) (uintptr_t) (v->_shader_upper << 4);
/* TODO: Isn't this an -M-FBD? What's the difference? */
panwrap_replay_sfbd((u64) (uintptr_t) v->fbd, job_no);
panwrap_replay_sfbd((u64) (uintptr_t) v->framebuffer, job_no);
int varying_count, attribute_count, uniform_count;
......@@ -688,7 +688,7 @@ panwrap_replay_vertex_or_tiler_job(const struct mali_job_descriptor_header *h,
DYN_MEMORY_PROP(v, job_no, varyings);
//DYN_MEMORY_PROP(v, job_no, unknown6);
DYN_MEMORY_PROP(v, job_no, viewport);
DYN_MEMORY_PROP(v, job_no, fbd);
DYN_MEMORY_PROP(v, job_no, framebuffer);
MEMORY_PROP(v, unknown0);
......@@ -711,7 +711,7 @@ static int panwrap_replay_fragment_job(const struct panwrap_mapped_memory *mem,
bool fbd_dumped = false;
if ((s->fbd & FBD_TYPE) == MALI_SFBD) {
if ((s->framebuffer & FBD_TYPE) == MALI_SFBD) {
/* Only SFBDs are understood, not MFBDs. We're speculating,
* based on the versioning, kernel code, etc, that the
* difference is between Single FrameBuffer Descriptor and
......@@ -720,11 +720,11 @@ static int panwrap_replay_fragment_job(const struct panwrap_mapped_memory *mem,
* including Gxx). In any event, there's some field shuffling
* that we haven't looked into yet. */
panwrap_replay_sfbd(s->fbd & FBD_MASK, job_no);
panwrap_replay_sfbd(s->framebuffer & FBD_MASK, job_no);
fbd_dumped = true;
}
uintptr_t p = (uintptr_t) s->fbd & FBD_MASK;
uintptr_t p = (uintptr_t) s->framebuffer & FBD_MASK;
panwrap_log("struct mali_payload_fragment payload_%d = {\n", job_no);
panwrap_indent++;
......@@ -748,12 +748,12 @@ static int panwrap_replay_fragment_job(const struct panwrap_mapped_memory *mem,
/* If the FBD was just decoded, we can refer to it by pointer. If not,
* we have to fallback on offsets. */
const char *fbd_type = s->fbd & MALI_MFBD ? "MALI_MFBD" : "MALI_SFBD";
const char *fbd_type = s->framebuffer & MALI_MFBD ? "MALI_MFBD" : "MALI_SFBD";
if (fbd_dumped)
panwrap_prop("fbd = fbd_%d_p | %s", job_no, fbd_type);
panwrap_prop("framebuffer = framebuffer_%d_p | %s", job_no, fbd_type);
else
panwrap_prop("fbd = %s | %s", pointer_as_memory_reference(p), fbd_type);
panwrap_prop("framebuffer = %s | %s", pointer_as_memory_reference(p), fbd_type);
panwrap_indent--;
panwrap_log("};\n");
......
......@@ -186,65 +186,6 @@ pandev_standard_allocate(int fd, int va_pages, int flags, u64 *out)
return pandev_general_allocate(fd, va_pages, va_pages, 0, flags, out);
}
int
pandev_query_mem(int fd, mali_ptr addr, enum mali_ioctl_mem_query_type attr,
u64 *out)
{
struct mali_ioctl_mem_query args;
int rc;
args.gpu_addr = addr;
args.query = attr;
rc = pandev_ioctl(fd, MALI_IOCTL_MEM_QUERY, &args);
if (rc)
return rc;
*out = args.value;
return 0;
}
#define ATOM_QUEUE_SIZE 16
struct mali_jd_atom_v2 pandev_atom_queue[ATOM_QUEUE_SIZE];
int pandev_atom_queue_count = 0;
/**
* Submit the queued jobs to the GPU, clearing the queue. Should be called
* explicitly, although pandev_submit_job may call it itself to flush the queue
*/
static int
pandev_flush_jobs(int fd)
{
struct mali_ioctl_job_submit submit = {
.addr = pandev_atom_queue,
.nr_atoms = pandev_atom_queue_count,
.stride = sizeof(struct mali_jd_atom_v2)
};
pandev_atom_queue_count = 0;
return pandev_ioctl(fd, MALI_IOCTL_JOB_SUBMIT, &submit);
}
/**
* Submit a job to the job queue, flushing the queue if necessary. Unless the
* queue is full, this routine does NOT do any I/O. Once jobs are queued
* appropriately, pandev_flush_jobs must be called explicitly.
*/
static int
pandev_submit_job(int fd, struct mali_jd_atom_v2 atom)
{
memcpy(&pandev_atom_queue[pandev_atom_queue_count++], &atom, sizeof(atom));
if(pandev_atom_queue_count == ATOM_QUEUE_SIZE)
return pandev_flush_jobs(fd);
return 0;
}
/**
* Sync data to/from the GPU explicitly.
* CPU is a pointer to the CPU-side buffer (CPU address space).
......@@ -285,69 +226,6 @@ pandev_malloc(int fd, size_t sz)
return (u8*) (uintptr_t) va;
}
static void
pandev_fragment_job(int fd)
{
void* packet = pandev_malloc(fd, sizeof(struct mali_job_descriptor_header)
+ sizeof(struct mali_payload_fragment));
struct mali_job_descriptor_header header = {
.exception_status = JOB_NOT_STARTED,
.job_descriptor_size = JOB_32_BIT, /* TODO: Bifrost compatibility */
.job_type = JOB_TYPE_FRAGMENT,
.job_index = 1, /* TODO: Allocate these correctly */
};
u64 fbd_meta = MALI_MFBD;
struct mali_payload_fragment payload = {
._min_tile_coord = MAKE_TILE_COORD(0, 0, 0),
._max_tile_coord = MAKE_TILE_COORD(29, 45, 0),
.fbd = fbd_meta
};
memcpy(packet, &header, sizeof(header));
memcpy(packet + sizeof(header), &payload, sizeof(payload));
struct mali_jd_dependency no_dependency = {
.atom_id = 0,
.dependency_type = MALI_JD_DEP_TYPE_INVALID
};
struct mali_jd_dependency depTiler = {
.atom_id = 0, /* TODO: Handle dependencies correctly */
.dependency_type = MALI_JD_DEP_TYPE_DATA
};
/*
uint64_t* resource = calloc(sizeof(u64), 1);
resource[0] = framebuffer | MALI_EXT_RES_ACCESS_EXCLUSIVE;
*/
struct mali_jd_atom_v2 job = {
.jc = (uint32_t) packet,
//.ext_res_list = (struct mali_external_resource*) resource /* TODO */,
//.nr_ext_res = 1,
.ext_res_list = NULL /* TODO */,
.nr_ext_res = 0,
.core_req = MALI_JD_REQ_EXTERNAL_RESOURCES | MALI_JD_REQ_FS,
//.atom_number = ++atom_count,
.atom_number = 0, /* TODO */
.prio = MALI_JD_PRIO_MEDIUM,
.device_nr = 0,
.pre_dep = { depTiler, no_dependency }
};
pandev_submit_job(fd, job);
}
/**
* Dump detailed GPU properties. The userspace driver *does not actually need*
* the majority of this information. At the moment, we need precisely none of
......@@ -424,14 +302,5 @@ pandev_open()
if (rc)
return rc;
pandev_fragment_job(fd);
pandev_flush_jobs(fd);
int stream_fd;
rc = pandev_create_stream(fd, "insert-queer-pun-here", &stream_fd);
if (rc)
return 0; /* This breaks, we know that, just not why */
return fd;
}
......@@ -24,7 +24,7 @@
/* Set dimensions of the framebuffer */
void
trans_fbd_dimensions(struct mali_tentative_sfbd *sfbd, int width, int height)
trans_framebuffer_dimensions(struct mali_single_framebuffer *sfbd, int width, int height)
{
sfbd->width = MALI_POSITIVE(width);
sfbd->height = MALI_POSITIVE(height);
......@@ -38,8 +38,8 @@ uint8_t normalised_float_to_u8(float f) {
}
void
trans_fbd_clear(
struct mali_tentative_sfbd *sfbd,
trans_framebuffer_clear(
struct mali_single_framebuffer *sfbd,
mali_ptr depth_stencil_buffer,
bool clear_color, bool clear_depth, bool clear_stencil,
float r, float g, float b, float a, float depth, u32 stencil)
......@@ -148,7 +148,7 @@ trans_fragment_payload(int width, int height, mali_ptr fbd, enum mali_fbd_type t
struct mali_payload_fragment ret = {
._min_tile_coord = MALI_COORDINATE_TO_TILE_MIN(0, 0, 0),
._max_tile_coord = MALI_COORDINATE_TO_TILE_MAX(width, height, 0),
.fbd = fbd | type,
.framebuffer = fbd | type,
};
return ret;
......
......@@ -17,10 +17,10 @@
#include "pandev.h"
void trans_fbd_dimensions(struct mali_tentative_sfbd *sfbd, int width, int height);
void trans_framebuffer_dimensions(struct mali_single_framebuffer *sfbd, int width, int height);
void trans_fbd_clear(
struct mali_tentative_sfbd *sfbd,
void trans_framebuffer_clear(
struct mali_single_framebuffer *sfbd,
mali_ptr depth_stencil_buffer,
bool clear_color, bool clear_depth, bool clear_stencil,
float r, float g, float b, float a, float depth, u32 stencil);
......
......@@ -164,7 +164,7 @@ void main(void) {
.job_index = 1,
.job_dependency_index_1 = 3,
};
struct mali_tentative_sfbd fbd_1 = {
struct mali_single_framebuffer framebuffer_1 = {
.unknown1 = 0x0,
.flags = 0x1f,
.heap_free_address = 0x0,
......@@ -180,9 +180,9 @@ void main(void) {
.unknown_address_4 = 0x10a127000,
};
trans_fbd_dimensions(&fbd_1, 400, 240);
trans_framebuffer_dimensions(&framebuffer_1, 400, 240);
mali_ptr fbd_1_p = pandev_upload(-1, alloc_gpu_va_19, memory_19, &fbd_1, sizeof(fbd_1), false);
mali_ptr framebuffer_1_p = pandev_upload(-1, alloc_gpu_va_19, memory_19, &framebuffer_1, sizeof(framebuffer_1), false);
struct mali_shader_meta shader_meta_1 = {
.shader = (alloc_gpu_va_12 + 960) | 5,
......@@ -281,7 +281,7 @@ void main(void) {
.attributes = attributes_1_p,
.attribute_meta = attribute_meta_1_p,
.varyings = varyings_1_p,
.fbd = fbd_1_p,
.framebuffer = framebuffer_1_p,
.unknown0 = 0x0,
._shader_upper = (shader_meta_1_p) >> 4,
.flags = 0,
......@@ -301,7 +301,7 @@ void main(void) {
.unknown_flags = 1,
.job_dependency_index_1 = 1,
};
mali_ptr fbd_2_p = fbd_1_p;
mali_ptr framebuffer_2_p = framebuffer_1_p;
struct mali_shader_meta shader_meta_2 = {
.shader = (alloc_gpu_va_12 + 1280) | 5,
.attribute_count = 0,
......@@ -346,7 +346,7 @@ void main(void) {
.gl_enables = 0x45,
.varyings = varyings_2_p,
.viewport = viewport_2_p,
.fbd = fbd_2_p,
.framebuffer = framebuffer_2_p,
.unknown0 = alloc_gpu_va_20 + 64,
._shader_upper = (shader_meta_2_p) >> 4,
.flags = 0,
......@@ -366,7 +366,7 @@ void main(void) {
.job_type = JOB_TYPE_FRAGMENT,
.job_index = 1,
};
struct mali_tentative_sfbd fbd_3 = {
struct mali_single_framebuffer framebuffer_3 = {
.unknown1 = 0x0,
.flags = 0x1f,
.heap_free_address = 0x0,
......@@ -381,12 +381,12 @@ void main(void) {
.unknown_address_4 = 0x10a127000,
};
trans_fbd_dimensions(&fbd_3, 400, 240);
trans_fbd_clear(&fbd_3, depth_stencil_buffer, true, true, true, 0.8, 1.0, 0.9, 1.0, 1.0, 1);
trans_framebuffer_dimensions(&framebuffer_3, 400, 240);
trans_framebuffer_clear(&framebuffer_3, depth_stencil_buffer, true, true, true, 0.8, 1.0, 0.9, 1.0, 1.0, 1);
mali_ptr fbd_3_p = pandev_upload(-1, alloc_gpu_va_24, memory_24, &fbd_3, sizeof(fbd_3), false);
mali_ptr framebuffer_3_p = pandev_upload(-1, alloc_gpu_va_24, memory_24, &framebuffer_3, sizeof(framebuffer_3), false);
struct mali_payload_fragment payload_3 = trans_fragment_payload(400, 240, fbd_3_p, MALI_SFBD);
struct mali_payload_fragment payload_3 = trans_fragment_payload(400, 240, framebuffer_3_p, MALI_SFBD);
mali_ptr job_3_p = pandev_upload(-1, alloc_gpu_va_19, memory_19, &job_3, sizeof(job_3) - 4, true);
mali_ptr payload_3_p = pandev_upload_sequential(alloc_gpu_va_19, memory_19, &payload_3, sizeof(payload_3));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment