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

Remove old stuff

parent ffe0cb0f
......@@ -12,6 +12,7 @@
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
......@@ -28,25 +29,6 @@
/* From Linux arch/arm/include/asm/page.h */
#define PAGE_SHIFT 12
#define PAGE_SIZE (1 << PAGE_SHIFT)
#define PAGE_MASK (~(PAGE_SIZE - 1))
/* From the kernel module */
#define MALI_MEM_MAP_TRACKING_HANDLE (3ull << 12)
#define MALI_CONTEXT_CREATE_FLAG_NONE 0
#define MAKE_TILE_COORD(X, Y, flag) ((X) | ((Y) << 16) | (flag))
/* From who knows where */
#define JOB_32_BIT 0
#define JOB_64_BIT 1
#include <sys/user.h>
/* From Linux arch/arm/include/asm/page.h */
#define PAGE_SHIFT 12
#ifndef PAGE_SIZE
# define PAGE_SIZE (1 << PAGE_SHIFT)
......@@ -112,37 +94,6 @@ pandev_set_flags(int fd)
return pandev_ioctl(fd, MALI_IOCTL_SET_FLAGS, &args);
}
static int
pandev_allocate(int fd, int va_pages, int commit_pages, int extent, int flags, u64 *out)
{
struct mali_ioctl_mem_alloc args = {
.va_pages = va_pages,
.commit_pages = commit_pages,
.extent = extent,
.flags = flags
};
int rc;
rc = pandev_ioctl(fd, MALI_IOCTL_MEM_ALLOC, &args);
if (rc)
return rc;
if (args.flags & MALI_MEM_SAME_VA) {
u8 *buffer = mmap(NULL, va_pages << PAGE_SHIFT, PROT_READ |
PROT_WRITE, MAP_SHARED, fd, args.gpu_va);
if (buffer == MAP_FAILED)
return -1;
*out = (u64) (uintptr_t) buffer;
} else {
*out = args.gpu_va;
}
return 0;
}
int
pandev_general_allocate(int fd, int va_pages, int commit_pages, int extent, int flags, u64 *out)
{
......@@ -169,50 +120,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);
}
/**
* Sync data to/from the GPU explicitly.
* CPU is a pointer to the CPU-side buffer (CPU address space).
* GPU is the GPU address to the GPU mapping.
* Direction is one of MALI_SYNC_TO_DEVICE or MALI_SYNC_FROM_DEVICE
*
* Apparently (?), syncs must be page aligned, so a little excess is synced.
*
* TODO: Figure out exactly what and when data needs to be synced.
*/
static int
pandev_sync_gpu(int fd, u8* cpu, u64 gpu, size_t sz, int direction)
{
struct mali_ioctl_sync sync = {
.handle = gpu & PAGE_MASK,
.user_addr = cpu - (gpu & ~PAGE_MASK),
.size = (gpu & ~PAGE_MASK) + sz,
.type = direction
};
return pandev_ioctl(fd, MALI_IOCTL_SYNC, &sync);
}
/**
* Dump detailed GPU properties. The userspace driver *does not actually need*
* the majority of this information. At the moment, we need precisely none of
* it. That said, when coupled with panwrap, this enables a nicely formatted
* property display, which works without needing the blob at all.
*/
static int
pandev_dump_gpu_properties(int fd)
{
struct mali_ioctl_gpu_props_reg_dump args = {};
int rc;
rc = pandev_ioctl(fd, MALI_IOCTL_GPU_PROPS_REG_DUMP, &args);
if (rc)
return rc;
return 0;
}
/**
* Low-level open call, used by the main pandev_open
*/
......@@ -234,12 +141,11 @@ pandev_map_mtp(int fd)
return mmap(NULL, PAGE_SIZE, PROT_NONE, MAP_SHARED, fd, MALI_MEM_MAP_TRACKING_HANDLE);
}
/**
* Open the device file for communicating with the mali kernelspace driver,
* and make sure it's a version of the kernel driver we're familiar with.
*
* Returns: fd on success, -1 on failure
* Returns: fd on success, exits on failure
*/
int
pandev_open()
......@@ -249,21 +155,22 @@ pandev_open()
unsigned major, minor;
if (fd < 0)
return fd;
goto fail;
rc = pandev_get_driver_version(fd, &major, &minor);
if (rc)
return rc;
printf("Found kernel driver version v%d.%d at /dev/mali0\n",
major, minor);
goto fail;
if (pandev_map_mtp(fd) == MAP_FAILED)
return -1;
goto fail;
rc = pandev_set_flags(fd);
if (rc)
return rc;
goto fail;
return fd;
fail:
printf("Error opening kernel driver\n");
exit(0);
}
......@@ -955,20 +955,15 @@ trans_setup_framebuffer(struct panfrost_context *ctx)
static void
trans_setup_hardware(struct panfrost_context *ctx)
{
ctx->fd = pandev_open();
if (ctx->fd < 0) {
printf("Error opening kernel driver\n");
exit(0);
}
trans_setup_framebuffer(ctx);
trans_allocate_slab(ctx, &ctx->cmdstream, 8*64, true, true, 0, 0, 0);
trans_allocate_slab(ctx, &ctx->scratchpad, 8, true, true, 0, 0, 0);
trans_allocate_slab(ctx, &ctx->varying_mem, 32, false, true, MALI_MEM_COHERENT_LOCAL, 0, 0);
trans_allocate_slab(ctx, &ctx->shaders, 4096, true, false, MALI_MEM_PROT_GPU_EX, 1, 0);
trans_allocate_slab(ctx, &ctx->tiler_jc_list, 32768, false, false, MALI_MEM_GROW_ON_GPF, 1, 128);
ctx->fd = pandev_open();
trans_setup_framebuffer(ctx);
trans_allocate_slab(ctx, &ctx->cmdstream, 8*64, true, true, 0, 0, 0);
trans_allocate_slab(ctx, &ctx->scratchpad, 8, true, true, 0, 0, 0);
trans_allocate_slab(ctx, &ctx->varying_mem, 32, false, true, MALI_MEM_COHERENT_LOCAL, 0, 0);
trans_allocate_slab(ctx, &ctx->shaders, 4096, true, false, MALI_MEM_PROT_GPU_EX, 1, 0);
trans_allocate_slab(ctx, &ctx->tiler_jc_list, 32768, false, false, MALI_MEM_GROW_ON_GPF, 1, 128);
}
/* New context creation, which also does hardware initialisation since I don't
......
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