From: John Hodge Date: Sat, 10 May 2014 02:51:21 +0000 (+0800) Subject: Modules/UDI - Non-compiling gfx translation layer (needs heaps of algos) X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=61ed65dc502cae7989ac6def70187c3a2bce2253;p=tpg%2Facess2.git Modules/UDI - Non-compiling gfx translation layer (needs heaps of algos) - Once the GFX metalang is finalised, this code can be completed --- diff --git a/KernelLand/Modules/Interfaces/UDI/trans/gfx.c b/KernelLand/Modules/Interfaces/UDI/trans/gfx.c new file mode 100644 index 00000000..5530e7f3 --- /dev/null +++ b/KernelLand/Modules/Interfaces/UDI/trans/gfx.c @@ -0,0 +1,91 @@ +/* + * Acess2 UDI Layer + * - By John Hodge (thePowersGang) + * + * trans/gfx.c + * - Graphics interface + */ +#define DEBUG 1 +#define UDI_VERSION 0x101 +#define UDI_GFX_VERSION 0x101 +#include +#include +#include +#include + +// === TYPES === +typedef struct rdata_s +{ + +} rdata_t; + +// === PROTOTYPES === +// --- Management metalang +void acessgfx_usage_ind(udi_usage_cb_t *cb, udi_ubit8_t resource_level); +void acessgfx_devmgmt_req(udi_mgmt_cb_t *cb, udi_ubit8_t mgmt_op, udi_ubit8_t parent_ID); +void acessgfx_final_cleanup_req(udi_mgmt_cb_t *cb); +// --- GFX Binding +void acessgfx_channel_event_ind(udi_channel_event_cb_t *cb); +void acessgfx_bind_ack(udi_gfx_bind_cb_t *cb, udi_index_t sockets, udi_index_t engines, udi_status_t status); +void acessgfx_unbind_ack(udi_gfx_bind_cb_t *cb); +void acessgfx_set_connector_ack(udi_gfx_state_cb_t *cb); +void acessgfx_get_connector_ack(udi_gfx_state_cb_t *cb, udi_ubit32_t value); +void acessgfx_range_connector_ack(udi_gfx_range_cb_t *cb); +void acessgfx_set_engine_ack(udi_gfx_state_cb_t *cb); +void acessgfx_get_engine_ack(udi_gfx_state_cb_t *cb, udi_ubit32_t value); +void acessgfx_range_engine_ack(udi_gfx_range_cb_t *cb); +void acessgfx_command_ack(udi_gfx_command_cb_t *cb); + +// === CODE === +void acessgfx_usage_ind(udi_usage_cb_t *cb, udi_ubit8_t resource_level) +{ + rdata_t *rdata = UDI_GCB(cb)->context; + + // Set up structures that don't need interegating the card to do + + udi_usage_res(cb); +} + +void acessgfx_channel_event_ind(udi_channel_event_cb_t *cb) +{ + rdata_t *rdata = UDI_GCB(cb)->context; + + switch(cb->event) + { + case UDI_CHANNEL_CLOSED: + udi_channel_event_complete(cb); + return; + case UDI_CHANNEL_BOUND: + rdata->active_cb = UDI_GCB(cb); + acessgfx_channel_event_ind$bound(cb->params.parent_bound.bind_cb); + return; + default: + // TODO: emit an error of some form? + return; + } +} + +void acessgfx_channel_event_ind$bound(udi_gfx_bind_cb_t *cb) +{ + rdata_t *rdata = UDI_GCB(bind_cb)->context; + + // request metalanguage-level bind + udi_gfx_bind_req(bind_cb) + // Continued in acessgfx_bind_ack +} + +void acessgfx_bind_ack(udi_gfx_bind_cb_t *cb, udi_index_t sockets, udi_index_t engines, udi_status_t status) +{ + rdata_t *rdata = UDI_GCB(bind_cb)->context; + + if( status != UDI_OK ) { + // binding failed + + return ; + } + + // +} + +// === UDI Bindings === + diff --git a/KernelLand/Modules/Interfaces/UDI/trans/gfx.udic b/KernelLand/Modules/Interfaces/UDI/trans/gfx.udic new file mode 100644 index 00000000..48fe9a18 --- /dev/null +++ b/KernelLand/Modules/Interfaces/UDI/trans/gfx.udic @@ -0,0 +1,71 @@ +/* + * Acess2 UDI Layer + * - By John Hodge (thePowersGang) + * + * trans/gfx.c + * - Graphics interface + */ +#define DEBUG 1 +#define UDI_VERSION 0x101 +#define UDI_GFX_VERSION 0x101 +#include +#include +#include +#include + +// === TYPES === +typedef struct rdata_s +{ + +} rdata_t; + +// === CODE === +void usage_ind(udi_usage_cb_t *cb, udi_ubit8_t resource_level) +{ + // Set up structures that don't need interegating the card to do + +} + +@GFX_CLIENT channel_event_ind(udi_channel_event_cb_t *cb) +{ + udi_gfx_bind_cb_t *bind_cb = cb->params.parent_bound.bind_cb; + switch(cb->event) + { + case UDI_CHANNEL_CLOSED: + return; + case UDI_CHANNEL_BOUND: + [sockets, engines, status] = udi_gfx_bind_req(bind_cb); + if( status != UDI_OK ) { + return; + } + // allocate a CB + [new_cb] = udi_cb_alloc(bind_cb, ACESSGFX_CB_STATE); + udi_gfx_state_cb_t *state_cb = new_cb; + for( int i = 0; i < engines; i ++ ) + { + state_cb->subsystem = i; + state_cb->attribute = UDI_GFX_PROP_PIXELFORMAT; + [pixfmt] = udi_gfx_get_engine_req(state_cb); + + // TODO: Annotate udi_gfx_state_cb_t to note values are kept? + state_cb->subsystem = i; + state_cb->attribute = UDI_GFX_PROP_OPERATOR_INDEX; + [count] = udi_gfx_get_engine_req(state_cb); + for( int j = 0; j < count; j ++ ) + { + state_cb->attribute = j; + [operator, arg_1, arg_2, arg_3] = udi_gfx_engine_getop_req(state_cb); + Log_Debug("UDIGFX", "%i/%i: %i 0x%x 0x%x 0x%x", + i, j, + operator, arg_1, arg_2, arg_3); + } + } + return; + default: + // TODO: emit an error of some form? + return; + } +} + +// === UDI Bindings === + diff --git a/KernelLand/Modules/Interfaces/UDI/trans/gfx_plan.txt b/KernelLand/Modules/Interfaces/UDI/trans/gfx_plan.txt new file mode 100644 index 00000000..b8e4bb91 --- /dev/null +++ b/KernelLand/Modules/Interfaces/UDI/trans/gfx_plan.txt @@ -0,0 +1,12 @@ + +Upon binding: + +1. Enumerate connectors (types and possible inputs) +2. For all engines that can have their input be -1, get pixel format + a. Parse operator list into a tree +3. Create MIN(n_conns,n_edge) video devices + a. Each device represents an edge engine (engine selected on modeset) + +Notes: +- Need to figure out what engine(s) to use as framebuffer, and what ones to use as cursor + > Allow user/admin intervention to set these relations (based on an identifier from the driver)