drm: rename main to single_color

This commit is contained in:
Zack Buhman 2025-10-13 18:41:42 -05:00
parent 983be7592f
commit 6b3fe1bbdb
4 changed files with 66 additions and 36 deletions

4
drm/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
*
!*.*
!*/
!Makefile

24
drm/Makefile Normal file
View File

@ -0,0 +1,24 @@
OPT = -O0
CFLAGS += -g
CFLAGS += -Wall -Werror -Wfatal-errors
CFLAGS += $(shell pkg-config --cflags libdrm)
LDFLAGS += $(shell pkg-config --libs libdrm)
%: %.c
$(CC) $(ARCH) $(CFLAGS) $(LDFLAGS) $(OPT) $< -o $@
clean:
find . -type f ! -name "*.*" -delete
.SUFFIXES:
.INTERMEDIATE:
.SECONDARY:
.PHONY: all clean phony
%: RCS/%,v
%: RCS/%
%: %,v
%: s.%
%: SCCS/s.%

37
drm/command_processor.h Normal file
View File

@ -0,0 +1,37 @@
#pragma once
#define TYPE_0_COUNT(c) (((c) & 0x3fff) << 16)
#define TYPE_0_ONE_REG (1 << 15)
#define TYPE_0_BASE_INDEX(i) (((i) & 0x1fff) << 0)
#define TYPE_3_COUNT(c) (((c) & 0x3fff) << 16)
#define TYPE_3_OPCODE(o) (((o) & 0xff) << 8)
#define T0(address, count) \
do { \
ib[ix++].u32 = TYPE_0_COUNT(count) | TYPE_0_BASE_INDEX(address >> 2); \
} while (0);
#define T0_ONE_REG(address, count) \
do { \
ib[ix++].u32 = TYPE_0_COUNT(count) | TYPE_0_ONE_REG | TYPE_0_BASE_INDEX(address >> 2); \
} while (0);
#define T0V(address, value) \
do { \
ib[ix++].u32 = TYPE_0_COUNT(0) | TYPE_0_BASE_INDEX(address >> 2); \
ib[ix++].u32 = value; \
} while (0);
#define T0Vf(address, value) \
do { \
ib[ix++].u32 = TYPE_0_COUNT(0) | TYPE_0_BASE_INDEX(address >> 2); \
ib[ix++].f32 = value; \
} while (0);
#define T3(opcode, count) \
do { \
ib[ix++].u32 = (0b11 << 30) | TYPE_3_COUNT(count) | TYPE_3_OPCODE(opcode); \
} while (0);
#define _3D_DRAW_IMMD_2 0x35

View File

@ -14,6 +14,7 @@
#include "3d_registers.h"
#include "3d_registers_undocumented.h"
#include "3d_registers_bits.h"
#include "command_processor.h"
union u32_f32 {
uint32_t u32;
@ -22,42 +23,6 @@ union u32_f32 {
static union u32_f32 ib[16384];
#define TYPE_0_COUNT(c) (((c) & 0x3fff) << 16)
#define TYPE_0_ONE_REG (1 << 15)
#define TYPE_0_BASE_INDEX(i) (((i) & 0x1fff) << 0)
#define TYPE_3_COUNT(c) (((c) & 0x3fff) << 16)
#define TYPE_3_OPCODE(o) (((o) & 0xff) << 8)
#define T0(address, count) \
do { \
ib[ix++].u32 = TYPE_0_COUNT(count) | TYPE_0_BASE_INDEX(address >> 2); \
} while (0);
#define T0_ONE_REG(address, count) \
do { \
ib[ix++].u32 = TYPE_0_COUNT(count) | TYPE_0_ONE_REG | TYPE_0_BASE_INDEX(address >> 2); \
} while (0);
#define T0V(address, value) \
do { \
ib[ix++].u32 = TYPE_0_COUNT(0) | TYPE_0_BASE_INDEX(address >> 2); \
ib[ix++].u32 = value; \
} while (0);
#define T0Vf(address, value) \
do { \
ib[ix++].u32 = TYPE_0_COUNT(0) | TYPE_0_BASE_INDEX(address >> 2); \
ib[ix++].f32 = value; \
} while (0);
#define T3(opcode, count) \
do { \
ib[ix++].u32 = (0b11 << 30) | TYPE_3_COUNT(count) | TYPE_3_OPCODE(opcode); \
} while (0);
#define _3D_DRAW_IMMD_2 0x35
int indirect_buffer()
{
int ix = 0;