2018-05-19 14:40:25 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#if defined (__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
typedef struct ControlListAddress
|
|
|
|
{
|
2018-05-19 18:35:24 +02:00
|
|
|
uint32_t handle; //handle to buffer object
|
|
|
|
uint32_t offset; //offset within buffer object
|
2018-05-19 14:40:25 +02:00
|
|
|
} ControlListAddress;
|
|
|
|
|
2019-09-01 20:14:47 +02:00
|
|
|
typedef struct CLMarker
|
|
|
|
{
|
2019-09-02 23:37:42 +02:00
|
|
|
//current binning cl buf position is this struct in the CL plus sizeof(this struct)
|
2019-09-01 20:14:47 +02:00
|
|
|
struct CLMarker* nextMarker;
|
|
|
|
uint32_t size; //in bytes
|
2020-02-17 22:01:56 +01:00
|
|
|
void* writeImage; //_image* to render to
|
|
|
|
void* readImage;
|
|
|
|
void* writeDepthStencilImage; //_image* to render depth/stencil to
|
|
|
|
void* readDepthStencilImage;
|
|
|
|
void* writeMSAAimage;
|
|
|
|
void* writeMSAAdepthStencilImage;
|
2019-09-02 23:37:42 +02:00
|
|
|
uint32_t flags; //used to store clear flag etc.
|
2020-02-18 22:59:15 +01:00
|
|
|
uint32_t performResolve;
|
|
|
|
uint32_t readMSAAimage;
|
|
|
|
uint32_t readMSAAdepthStencilImage;
|
2020-02-24 22:45:47 +01:00
|
|
|
void* perfmonID;
|
2020-02-25 22:18:14 +01:00
|
|
|
uint32_t clearColor[2];
|
|
|
|
uint32_t clearDepth, clearStencil;
|
2019-09-02 23:37:42 +02:00
|
|
|
|
|
|
|
//pointers that point to where all the other CL data is
|
|
|
|
//plus sizes
|
|
|
|
uint8_t* handlesBuf;
|
2019-09-01 20:14:47 +02:00
|
|
|
uint32_t handlesSize;
|
2019-09-02 23:37:42 +02:00
|
|
|
uint8_t* shaderRecBuf;
|
2019-09-01 20:14:47 +02:00
|
|
|
uint32_t shaderRecSize;
|
|
|
|
uint32_t shaderRecCount;
|
2019-09-02 23:37:42 +02:00
|
|
|
uint8_t* uniformsBuf;
|
2019-09-01 20:14:47 +02:00
|
|
|
uint32_t uniformsSize;
|
|
|
|
} CLMarker;
|
|
|
|
|
2018-05-19 18:42:10 +02:00
|
|
|
typedef struct ControlList
|
|
|
|
{
|
2019-09-07 18:41:46 +02:00
|
|
|
uint8_t* buffer;
|
2018-05-20 18:13:46 +02:00
|
|
|
uint32_t numBlocks;
|
2020-03-01 16:26:12 +01:00
|
|
|
uint32_t blockSize;
|
2018-05-19 18:42:10 +02:00
|
|
|
uint8_t* nextFreeByte; //pointer to the next available free byte
|
2019-09-01 20:14:47 +02:00
|
|
|
CLMarker* currMarker;
|
2018-05-19 18:42:10 +02:00
|
|
|
} ControlList;
|
|
|
|
|
2019-09-02 23:37:42 +02:00
|
|
|
void clEmitShaderRelocation(ControlList* relocCl, ControlList* handlesCl, uint8_t* handlesBuf, uint32_t handlesSize, const ControlListAddress* address);
|
2018-10-14 12:12:17 +02:00
|
|
|
void clDummyRelocation(ControlList* relocCl, const ControlListAddress* address);
|
2018-05-19 14:40:25 +02:00
|
|
|
|
|
|
|
#define __gen_user_data struct ControlList
|
|
|
|
#define __gen_address_type ControlListAddress
|
|
|
|
#define __gen_address_offset(reloc) ((reloc)->offset)
|
2018-10-14 12:12:17 +02:00
|
|
|
#define __gen_emit_reloc clDummyRelocation
|
2018-05-19 14:40:25 +02:00
|
|
|
|
2018-10-15 23:37:09 +02:00
|
|
|
#include <string.h>
|
|
|
|
|
2018-08-21 22:03:43 +02:00
|
|
|
#include "brcm/cle/v3d_packet_v21_pack.h"
|
2018-05-19 14:40:25 +02:00
|
|
|
|
2018-08-26 15:11:43 +02:00
|
|
|
uint32_t divRoundUp(uint32_t n, uint32_t d);
|
|
|
|
uint32_t moveBits(uint32_t d, uint32_t bits, uint32_t offset);
|
|
|
|
uint32_t clHasEnoughSpace(ControlList* cl, uint32_t size);
|
2020-03-01 16:26:12 +01:00
|
|
|
void clInit(ControlList* cl, void* buffer, uint32_t blockSize);
|
2020-02-17 22:01:56 +01:00
|
|
|
void clInsertNewCLMarker(ControlList* cl,
|
|
|
|
ControlList* handlesCL,
|
|
|
|
ControlList* shaderRecCL,
|
|
|
|
uint32_t shaderRecCount,
|
|
|
|
ControlList* uniformsCL,
|
|
|
|
void* writeImagePtr,
|
|
|
|
void* readImagePtr,
|
|
|
|
void* writeDepthStencilImagePtr,
|
|
|
|
void* readDepthStencilImagePtr,
|
|
|
|
void* writeMSAAimagePtr,
|
2020-02-18 22:59:15 +01:00
|
|
|
void* writeMSAAdepthStencilImagePtr,
|
|
|
|
uint32_t performResolve,
|
|
|
|
uint32_t readMSAAimage,
|
|
|
|
uint32_t readMSAAdepthStencilImage);
|
2019-09-02 23:37:42 +02:00
|
|
|
void clCloseCurrentMarker(ControlList* cl, ControlList* handlesCL, ControlList* shaderRecCL, uint32_t shaderRecCount, ControlList* uniformsCL);
|
2019-07-27 22:57:13 +02:00
|
|
|
void clInsertData(ControlList* cl, uint32_t size, uint8_t* data);
|
2018-10-14 17:34:24 +02:00
|
|
|
void clInsertUniformConstant(ControlList* cl, uint32_t data);
|
|
|
|
void clInsertUniformXYScale(ControlList* cl, float data);
|
|
|
|
void clInsertUniformZOffset(ControlList* cl, float data);
|
2018-08-26 15:11:43 +02:00
|
|
|
void clInsertHalt(ControlList* cl);
|
|
|
|
void clInsertNop(ControlList* cl);
|
|
|
|
void clInsertFlush(ControlList* cl);
|
|
|
|
void clInsertFlushAllState(ControlList* cl);
|
|
|
|
void clInsertStartTileBinning(ControlList* cl);
|
|
|
|
void clInsertIncrementSemaphore(ControlList* cl);
|
|
|
|
void clInsertWaitOnSemaphore(ControlList* cl);
|
|
|
|
void clInsertBranch(ControlList* cls, ControlListAddress address);
|
|
|
|
void clInsertBranchToSubList(ControlList* cls, ControlListAddress address);
|
|
|
|
void clInsertReturnFromSubList(ControlList* cl);
|
|
|
|
void clInsertStoreMultiSampleResolvedTileColorBuffer(ControlList* cl);
|
|
|
|
void clInsertStoreMultiSampleResolvedTileColorBufferAndEOF(ControlList* cl);
|
2018-05-19 14:40:25 +02:00
|
|
|
void clInsertIndexedPrimitiveList(ControlList* cl,
|
|
|
|
uint32_t maxIndex,
|
|
|
|
uint32_t indicesAddress,
|
|
|
|
uint32_t length,
|
|
|
|
uint32_t indexType, //0/1: 8 or 16 bit
|
2018-08-26 15:11:43 +02:00
|
|
|
enum V3D21_Primitive primitiveMode);
|
2018-05-19 14:40:25 +02:00
|
|
|
void clInsertVertexArrayPrimitives(ControlList* cl,
|
|
|
|
uint32_t firstVertexIndex,
|
|
|
|
uint32_t length,
|
2018-08-26 15:11:43 +02:00
|
|
|
enum V3D21_Primitive primitiveMode);
|
2018-05-19 14:40:25 +02:00
|
|
|
void clInsertPrimitiveListFormat(ControlList* cl,
|
|
|
|
uint32_t dataType, //1/3: 16 or 32 bit
|
2018-08-26 15:11:43 +02:00
|
|
|
uint32_t primitiveType); //0/1/2/3: point/line/tri/rhy
|
2018-05-19 14:40:25 +02:00
|
|
|
void clInsertShaderState(ControlList* cl,
|
|
|
|
uint32_t address,
|
|
|
|
uint32_t extendedShaderRecord, //0/1: true/false
|
2018-08-26 15:11:43 +02:00
|
|
|
uint32_t numberOfAttributeArrays);
|
2018-05-19 14:40:25 +02:00
|
|
|
void clInsertConfigurationBits(ControlList* cl,
|
|
|
|
uint32_t earlyZUpdatesEnable, //0/1
|
|
|
|
uint32_t earlyZEnable, //0/1
|
|
|
|
uint32_t zUpdatesEnable, //0/1
|
|
|
|
enum V3D21_Compare_Function depthTestFunction,
|
|
|
|
uint32_t coverageReadMode, //0/1 clear/leave as is
|
|
|
|
uint32_t coveragePipeSelect, //0/1
|
|
|
|
uint32_t coverageUpdateMode, //0/1/2/3 nonzero, odd, or, zero
|
|
|
|
uint32_t coverageReadType, //0/1 4*8bit, 16 bit mask
|
|
|
|
uint32_t rasterizerOversampleMode, //0/1/2 none, 4x, 16x
|
|
|
|
uint32_t enableDepthOffset, //0/1
|
|
|
|
uint32_t clockwisePrimitives, //0/1
|
|
|
|
uint32_t enableReverseFacingPrimitive, //0/1
|
2018-08-26 15:11:43 +02:00
|
|
|
uint32_t enableForwardFacingPrimitive); //0/1
|
2018-05-19 14:40:25 +02:00
|
|
|
void clInsertFlatShadeFlags(ControlList* cl,
|
2018-08-26 15:11:43 +02:00
|
|
|
uint32_t flags);
|
2018-05-19 14:40:25 +02:00
|
|
|
void clInsertPointSize(ControlList* cl,
|
2018-08-26 15:11:43 +02:00
|
|
|
float size);
|
2018-05-19 14:40:25 +02:00
|
|
|
void clInsertLineWidth(ControlList* cl,
|
2018-08-26 15:11:43 +02:00
|
|
|
float width);
|
2018-05-19 14:40:25 +02:00
|
|
|
void clInsertRHTXBoundary(ControlList* cl,
|
2018-08-26 15:11:43 +02:00
|
|
|
uint32_t boundary); //sint16
|
2018-05-19 14:40:25 +02:00
|
|
|
void clInsertDepthOffset(ControlList* cl,
|
|
|
|
uint32_t units, //float 187
|
2018-08-26 15:11:43 +02:00
|
|
|
uint32_t factor); //float 187
|
2018-05-19 14:40:25 +02:00
|
|
|
void clInsertClipWindow(ControlList* cl,
|
|
|
|
uint32_t width, //uint16
|
|
|
|
uint32_t height, //uint16
|
|
|
|
uint32_t bottomPixelCoord, //uint16
|
2018-08-26 15:11:43 +02:00
|
|
|
uint32_t leftPixelCoord); //uint16
|
2018-05-19 14:40:25 +02:00
|
|
|
void clInsertViewPortOffset(ControlList* cl,
|
2018-10-14 12:12:17 +02:00
|
|
|
int16_t x, //sint16
|
|
|
|
int16_t y //sint16
|
2018-08-26 15:11:43 +02:00
|
|
|
);
|
2018-05-19 14:40:25 +02:00
|
|
|
void clInsertZMinMaxClippingPlanes(ControlList* cl,
|
|
|
|
float minZw,
|
2018-05-19 18:42:10 +02:00
|
|
|
float maxZw
|
2018-08-26 15:11:43 +02:00
|
|
|
);
|
2018-05-19 14:40:25 +02:00
|
|
|
void clInsertClipperXYScaling(ControlList* cl,
|
|
|
|
float width, //half height in 1/16 of pixel
|
2018-05-19 18:42:10 +02:00
|
|
|
float height //half width in 1/16 of pixel
|
2018-08-26 15:11:43 +02:00
|
|
|
);
|
2018-05-19 14:40:25 +02:00
|
|
|
void clInsertClipperZScaleOffset(ControlList* cl,
|
|
|
|
float zOffset, //zc to zs
|
2018-05-19 18:42:10 +02:00
|
|
|
float zScale //zc to zs
|
2018-08-26 15:11:43 +02:00
|
|
|
);
|
2018-05-19 14:40:25 +02:00
|
|
|
void clInsertTileBinningModeConfiguration(ControlList* cl,
|
|
|
|
uint32_t doubleBufferInNonMsMode, //0/1
|
|
|
|
uint32_t tileAllocationBlockSize, //0/1/2/3 32/64/128/256 bytes
|
|
|
|
uint32_t tileAllocationInitialBlockSize, //0/1/2/3 32/64/128/256 bytes
|
|
|
|
uint32_t autoInitializeTileStateDataArray, //0/1
|
|
|
|
uint32_t tileBuffer64BitColorDepth, //0/1
|
|
|
|
uint32_t multisampleMode4x, //0/1
|
|
|
|
uint32_t widthInPixels,
|
|
|
|
uint32_t heightInPixels,
|
|
|
|
uint32_t tileStateDataArrayAddress, //16 byte aligned, size of 48 bytes * num tiles
|
|
|
|
uint32_t tileAllocationMemorySize,
|
|
|
|
uint32_t tileAllocationMemoryAddress
|
2018-08-26 15:11:43 +02:00
|
|
|
);
|
2018-05-19 14:40:25 +02:00
|
|
|
void clInsertGEMRelocations(ControlList* cl,
|
|
|
|
uint32_t buffer0,
|
2018-08-26 15:11:43 +02:00
|
|
|
uint32_t buffer1);
|
2018-05-19 18:35:24 +02:00
|
|
|
void clInsertShaderRecord(ControlList* cls,
|
2018-10-14 12:12:17 +02:00
|
|
|
ControlList* relocCl,
|
|
|
|
ControlList* handlesCl,
|
2019-09-02 23:37:42 +02:00
|
|
|
uint8_t* handlesBuf, uint32_t handlesSize,
|
2018-05-19 14:40:25 +02:00
|
|
|
uint32_t fragmentShaderIsSingleThreaded, //0/1
|
|
|
|
uint32_t pointSizeIncludedInShadedVertexData, //0/1
|
|
|
|
uint32_t enableClipping, //0/1
|
|
|
|
uint32_t fragmentNumberOfUnusedUniforms,
|
|
|
|
uint32_t fragmentNumberOfVaryings,
|
|
|
|
uint32_t fragmentUniformsAddress,
|
2018-05-19 18:35:24 +02:00
|
|
|
ControlListAddress fragmentCodeAddress,
|
2018-05-19 14:40:25 +02:00
|
|
|
uint32_t vertexNumberOfUnusedUniforms,
|
|
|
|
uint32_t vertexAttributeArraySelectBits,
|
|
|
|
uint32_t vertexTotalAttributesSize,
|
2018-05-19 18:35:24 +02:00
|
|
|
uint32_t vertexUniformsAddress,
|
2018-09-27 23:17:31 +02:00
|
|
|
ControlListAddress vertexCodeAddress,
|
|
|
|
uint32_t coordinateNumberOfUnusedUniforms,
|
|
|
|
uint32_t coordinateAttributeArraySelectBits,
|
|
|
|
uint32_t coordinateTotalAttributesSize,
|
|
|
|
uint32_t coordinateUniformsAddress,
|
|
|
|
ControlListAddress coordinateCodeAddress);
|
2018-05-19 18:35:24 +02:00
|
|
|
void clInsertAttributeRecord(ControlList* cls,
|
2018-10-14 12:12:17 +02:00
|
|
|
ControlList* relocCl,
|
|
|
|
ControlList* handlesCl,
|
2019-09-02 23:37:42 +02:00
|
|
|
uint8_t* handlesBuf, uint32_t handlesSize,
|
2018-05-19 14:40:25 +02:00
|
|
|
ControlListAddress address,
|
|
|
|
uint32_t sizeBytes,
|
|
|
|
uint32_t stride,
|
2018-09-27 23:17:31 +02:00
|
|
|
uint32_t vertexVPMOffset,
|
|
|
|
uint32_t coordinateVPMOffset);
|
2019-09-02 23:37:42 +02:00
|
|
|
uint32_t clGetHandleIndex(ControlList* handlesCl, uint8_t* handlesBuf, uint32_t handlesSize, uint32_t handle);
|
2018-05-19 14:40:25 +02:00
|
|
|
|
|
|
|
#if defined (__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|