mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 02:28:10 +02:00
glthread: return consumed bytes
Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11493>
This commit is contained in:
parent
9a9860bd11
commit
7e2d4f505d
8 changed files with 57 additions and 28 deletions
|
|
@ -238,7 +238,7 @@ class PrintCode(gl_XML.gl_print_base):
|
|||
fixed_params = func.fixed_params
|
||||
variable_params = func.variable_params
|
||||
|
||||
out('void')
|
||||
out('uint32_t')
|
||||
out(('_mesa_unmarshal_{0}(struct gl_context *ctx, '
|
||||
'const struct marshal_cmd_{0} *cmd, const uint64_t *last)').format(func.name))
|
||||
out('{')
|
||||
|
|
@ -281,6 +281,13 @@ class PrintCode(gl_XML.gl_print_base):
|
|||
i += 1
|
||||
|
||||
self.print_sync_call(func, unmarshal = 1)
|
||||
if variable_params:
|
||||
out('return cmd->cmd_base.cmd_size;')
|
||||
else:
|
||||
struct = 'struct marshal_cmd_{0}'.format(func.name)
|
||||
out('const unsigned cmd_size = (align(sizeof({0}), 8) / 8);'.format(struct))
|
||||
out('assert (cmd_size == cmd->cmd_base.cmd_size);')
|
||||
out('return cmd_size;'.format(struct))
|
||||
out('}')
|
||||
|
||||
def validate_count_or_fallback(self, func):
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ class PrintCode(gl_XML.gl_print_base):
|
|||
flavor = func.marshal_flavor()
|
||||
if flavor in ('custom', 'async'):
|
||||
print('struct marshal_cmd_{0};'.format(func.name))
|
||||
print(('void _mesa_unmarshal_{0}(struct gl_context *ctx, '
|
||||
print(('uint32_t _mesa_unmarshal_{0}(struct gl_context *ctx, '
|
||||
'const struct marshal_cmd_{0} *cmd, const uint64_t *last);').format(func.name))
|
||||
print('{0} GLAPIENTRY _mesa_marshal_{1}({2});'.format(func.return_type, func.name, func.get_parameter_string()))
|
||||
elif flavor == 'sync':
|
||||
|
|
|
|||
|
|
@ -62,8 +62,7 @@ glthread_unmarshal_batch(void *job, void *gdata, int thread_index)
|
|||
const struct marshal_cmd_base *cmd =
|
||||
(const struct marshal_cmd_base *)&buffer[pos];
|
||||
|
||||
_mesa_unmarshal_dispatch[cmd->cmd_id](ctx, cmd, last);
|
||||
pos += cmd->cmd_size;
|
||||
pos += _mesa_unmarshal_dispatch[cmd->cmd_id](ctx, cmd, last);
|
||||
}
|
||||
|
||||
ctx->TexturesLocked = false;
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ struct marshal_cmd_BufferData
|
|||
/* Next size bytes are GLubyte data[size] */
|
||||
};
|
||||
|
||||
void
|
||||
uint32_t
|
||||
_mesa_unmarshal_BufferData(struct gl_context *ctx,
|
||||
const struct marshal_cmd_BufferData *cmd,
|
||||
const uint64_t *last)
|
||||
|
|
@ -264,22 +264,25 @@ _mesa_unmarshal_BufferData(struct gl_context *ctx,
|
|||
CALL_BufferData(ctx->CurrentServerDispatch,
|
||||
(target_or_name, size, data, usage));
|
||||
}
|
||||
return cmd->cmd_base.cmd_size;
|
||||
}
|
||||
|
||||
void
|
||||
uint32_t
|
||||
_mesa_unmarshal_NamedBufferData(struct gl_context *ctx,
|
||||
const struct marshal_cmd_NamedBufferData *cmd,
|
||||
const uint64_t *last)
|
||||
{
|
||||
unreachable("never used - all BufferData variants use DISPATCH_CMD_BufferData");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
uint32_t
|
||||
_mesa_unmarshal_NamedBufferDataEXT(struct gl_context *ctx,
|
||||
const struct marshal_cmd_NamedBufferDataEXT *cmd,
|
||||
const uint64_t *last)
|
||||
{
|
||||
unreachable("never used - all BufferData variants use DISPATCH_CMD_BufferData");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -361,7 +364,7 @@ struct marshal_cmd_BufferSubData
|
|||
/* Next size bytes are GLubyte data[size] */
|
||||
};
|
||||
|
||||
void
|
||||
uint32_t
|
||||
_mesa_unmarshal_BufferSubData(struct gl_context *ctx,
|
||||
const struct marshal_cmd_BufferSubData *cmd,
|
||||
const uint64_t *last)
|
||||
|
|
@ -381,22 +384,25 @@ _mesa_unmarshal_BufferSubData(struct gl_context *ctx,
|
|||
CALL_BufferSubData(ctx->CurrentServerDispatch,
|
||||
(target_or_name, offset, size, data));
|
||||
}
|
||||
return cmd->cmd_base.cmd_size;
|
||||
}
|
||||
|
||||
void
|
||||
uint32_t
|
||||
_mesa_unmarshal_NamedBufferSubData(struct gl_context *ctx,
|
||||
const struct marshal_cmd_NamedBufferSubData *cmd,
|
||||
const uint64_t *last)
|
||||
{
|
||||
unreachable("never used - all BufferSubData variants use DISPATCH_CMD_BufferSubData");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
uint32_t
|
||||
_mesa_unmarshal_NamedBufferSubDataEXT(struct gl_context *ctx,
|
||||
const struct marshal_cmd_NamedBufferSubDataEXT *cmd,
|
||||
const uint64_t *last)
|
||||
{
|
||||
unreachable("never used - all BufferSubData variants use DISPATCH_CMD_BufferSubData");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -264,7 +264,7 @@ struct marshal_cmd_DrawArrays
|
|||
GLuint baseinstance;
|
||||
};
|
||||
|
||||
void
|
||||
uint32_t
|
||||
_mesa_unmarshal_DrawArrays(struct gl_context *ctx,
|
||||
const struct marshal_cmd_DrawArrays *cmd,
|
||||
const uint64_t *last)
|
||||
|
|
@ -283,6 +283,7 @@ _mesa_unmarshal_DrawArrays(struct gl_context *ctx,
|
|||
CALL_DrawArraysInstancedBaseInstance(ctx->CurrentServerDispatch,
|
||||
(mode, first, count, instance_count,
|
||||
baseinstance));
|
||||
return cmd->cmd_base.cmd_size;
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE void
|
||||
|
|
@ -312,7 +313,7 @@ struct marshal_cmd_DrawArraysInstancedBaseInstance
|
|||
GLuint user_buffer_mask;
|
||||
};
|
||||
|
||||
void
|
||||
uint32_t
|
||||
_mesa_unmarshal_DrawArraysInstancedBaseInstance(struct gl_context *ctx,
|
||||
const struct marshal_cmd_DrawArraysInstancedBaseInstance *cmd,
|
||||
const uint64_t *last)
|
||||
|
|
@ -346,6 +347,7 @@ _mesa_unmarshal_DrawArraysInstancedBaseInstance(struct gl_context *ctx,
|
|||
_mesa_InternalBindVertexBuffers(ctx, buffers, user_buffer_mask,
|
||||
true);
|
||||
}
|
||||
return cmd->cmd_base.cmd_size;
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE void
|
||||
|
|
@ -423,7 +425,7 @@ struct marshal_cmd_MultiDrawArrays
|
|||
GLuint user_buffer_mask;
|
||||
};
|
||||
|
||||
void
|
||||
uint32_t
|
||||
_mesa_unmarshal_MultiDrawArrays(struct gl_context *ctx,
|
||||
const struct marshal_cmd_MultiDrawArrays *cmd,
|
||||
const uint64_t *last)
|
||||
|
|
@ -454,6 +456,7 @@ _mesa_unmarshal_MultiDrawArrays(struct gl_context *ctx,
|
|||
_mesa_InternalBindVertexBuffers(ctx, buffers, user_buffer_mask,
|
||||
true);
|
||||
}
|
||||
return cmd->cmd_base.cmd_size;
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE void
|
||||
|
|
@ -565,7 +568,7 @@ struct marshal_cmd_DrawElementsInstancedARB
|
|||
const GLvoid *indices;
|
||||
};
|
||||
|
||||
void
|
||||
uint32_t
|
||||
_mesa_unmarshal_DrawElementsInstancedARB(struct gl_context *ctx,
|
||||
const struct marshal_cmd_DrawElementsInstancedARB *cmd,
|
||||
const uint64_t *last)
|
||||
|
|
@ -588,6 +591,7 @@ _mesa_unmarshal_DrawElementsInstancedARB(struct gl_context *ctx,
|
|||
(mode, count, type, indices,
|
||||
instance_count, basevertex,
|
||||
baseinstance));
|
||||
return cmd->cmd_base.cmd_size;
|
||||
}
|
||||
|
||||
struct marshal_cmd_DrawRangeElementsBaseVertex
|
||||
|
|
@ -602,7 +606,7 @@ struct marshal_cmd_DrawRangeElementsBaseVertex
|
|||
const GLvoid *indices;
|
||||
};
|
||||
|
||||
void
|
||||
uint32_t
|
||||
_mesa_unmarshal_DrawRangeElementsBaseVertex(struct gl_context *ctx,
|
||||
const struct marshal_cmd_DrawRangeElementsBaseVertex *cmd,
|
||||
const uint64_t *last)
|
||||
|
|
@ -618,6 +622,7 @@ _mesa_unmarshal_DrawRangeElementsBaseVertex(struct gl_context *ctx,
|
|||
CALL_DrawRangeElementsBaseVertex(ctx->CurrentServerDispatch,
|
||||
(mode, min_index, max_index, count,
|
||||
type, indices, basevertex));
|
||||
return cmd->cmd_base.cmd_size;
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE void
|
||||
|
|
@ -670,7 +675,7 @@ struct marshal_cmd_DrawElementsInstancedBaseVertexBaseInstance
|
|||
struct gl_buffer_object *index_buffer;
|
||||
};
|
||||
|
||||
void
|
||||
uint32_t
|
||||
_mesa_unmarshal_DrawElementsInstancedBaseVertexBaseInstance(struct gl_context *ctx,
|
||||
const struct marshal_cmd_DrawElementsInstancedBaseVertexBaseInstance *cmd,
|
||||
const uint64_t *last)
|
||||
|
|
@ -724,6 +729,7 @@ _mesa_unmarshal_DrawElementsInstancedBaseVertexBaseInstance(struct gl_context *c
|
|||
_mesa_InternalBindVertexBuffers(ctx, buffers, user_buffer_mask,
|
||||
true);
|
||||
}
|
||||
return cmd->cmd_base.cmd_size;
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE void
|
||||
|
|
@ -877,7 +883,7 @@ struct marshal_cmd_MultiDrawElementsBaseVertex
|
|||
struct gl_buffer_object *index_buffer;
|
||||
};
|
||||
|
||||
void
|
||||
uint32_t
|
||||
_mesa_unmarshal_MultiDrawElementsBaseVertex(struct gl_context *ctx,
|
||||
const struct marshal_cmd_MultiDrawElementsBaseVertex *cmd,
|
||||
const uint64_t *last)
|
||||
|
|
@ -929,6 +935,7 @@ _mesa_unmarshal_MultiDrawElementsBaseVertex(struct gl_context *ctx,
|
|||
_mesa_InternalBindVertexBuffers(ctx, buffers, user_buffer_mask,
|
||||
true);
|
||||
}
|
||||
return cmd->cmd_base.cmd_size;
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE void
|
||||
|
|
@ -1214,44 +1221,51 @@ _mesa_marshal_MultiDrawElementsEXT(GLenum mode, const GLsizei *count,
|
|||
draw_count, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
uint32_t
|
||||
_mesa_unmarshal_DrawArraysInstancedARB(struct gl_context *ctx, const struct marshal_cmd_DrawArraysInstancedARB *cmd, const uint64_t *last)
|
||||
{
|
||||
unreachable("never used - DrawArraysInstancedBaseInstance is used instead");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
uint32_t
|
||||
_mesa_unmarshal_DrawElements(struct gl_context *ctx, const struct marshal_cmd_DrawElements *cmd, const uint64_t *last)
|
||||
{
|
||||
unreachable("never used - DrawElementsInstancedBaseVertexBaseInstance is used instead");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
uint32_t
|
||||
_mesa_unmarshal_DrawRangeElements(struct gl_context *ctx, const struct marshal_cmd_DrawRangeElements *cmd, const uint64_t *last)
|
||||
{
|
||||
unreachable("never used - DrawElementsInstancedBaseVertexBaseInstance is used instead");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
uint32_t
|
||||
_mesa_unmarshal_DrawElementsBaseVertex(struct gl_context *ctx, const struct marshal_cmd_DrawElementsBaseVertex *cmd, const uint64_t *last)
|
||||
{
|
||||
unreachable("never used - DrawElementsInstancedBaseVertexBaseInstance is used instead");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
uint32_t
|
||||
_mesa_unmarshal_DrawElementsInstancedBaseVertex(struct gl_context *ctx, const struct marshal_cmd_DrawElementsInstancedBaseVertex *cmd, const uint64_t *last)
|
||||
{
|
||||
unreachable("never used - DrawElementsInstancedBaseVertexBaseInstance is used instead");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
uint32_t
|
||||
_mesa_unmarshal_DrawElementsInstancedBaseInstance(struct gl_context *ctx, const struct marshal_cmd_DrawElementsInstancedBaseInstance *cmd, const uint64_t *last)
|
||||
{
|
||||
unreachable("never used - DrawElementsInstancedBaseVertexBaseInstance is used instead");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
uint32_t
|
||||
_mesa_unmarshal_MultiDrawElementsEXT(struct gl_context *ctx, const struct marshal_cmd_MultiDrawElementsEXT *cmd, const uint64_t *last)
|
||||
{
|
||||
unreachable("never used - MultiDrawElementsBaseVertex is used instead");
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,12 +24,13 @@
|
|||
#include "main/glthread_marshal.h"
|
||||
#include "main/dispatch.h"
|
||||
|
||||
void
|
||||
uint32_t
|
||||
_mesa_unmarshal_GetIntegerv(struct gl_context *ctx,
|
||||
const struct marshal_cmd_GetIntegerv *cmd,
|
||||
const uint64_t *last)
|
||||
{
|
||||
unreachable("never executed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void GLAPIENTRY
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ struct marshal_cmd_base
|
|||
uint16_t cmd_size;
|
||||
};
|
||||
|
||||
typedef void (*_mesa_unmarshal_func)(struct gl_context *ctx, const void *cmd, const uint64_t *last);
|
||||
typedef uint32_t (*_mesa_unmarshal_func)(struct gl_context *ctx, const void *cmd, const uint64_t *last);
|
||||
extern const _mesa_unmarshal_func _mesa_unmarshal_dispatch[NUM_DISPATCH_CMD];
|
||||
|
||||
static inline void *
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ struct marshal_cmd_ShaderSource
|
|||
};
|
||||
|
||||
|
||||
void
|
||||
uint32_t
|
||||
_mesa_unmarshal_ShaderSource(struct gl_context *ctx,
|
||||
const struct marshal_cmd_ShaderSource *cmd,
|
||||
const uint64_t *last)
|
||||
|
|
@ -54,6 +54,7 @@ _mesa_unmarshal_ShaderSource(struct gl_context *ctx,
|
|||
CALL_ShaderSource(ctx->CurrentServerDispatch,
|
||||
(cmd->shader, cmd->count, string, cmd_length));
|
||||
free((void *)string);
|
||||
return cmd->cmd_base.cmd_size;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -126,12 +127,13 @@ _mesa_glthread_ProgramChanged(struct gl_context *ctx)
|
|||
_mesa_glthread_flush_batch(ctx);
|
||||
}
|
||||
|
||||
void
|
||||
uint32_t
|
||||
_mesa_unmarshal_GetActiveUniform(struct gl_context *ctx,
|
||||
const struct marshal_cmd_GetActiveUniform *cmd,
|
||||
const uint64_t *last)
|
||||
{
|
||||
unreachable("never executed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void GLAPIENTRY
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue