etnaviv: implement emit_string_marker

Writes string to cmdstream in payload of a nop command.
Could be useful for internal driver debugging too.

Here is how it looks decoded:

    0x18000000, /* NOP (3) OP=NOP */
    0x65736572, /*   rese */
    0x18000000, /* NOP (3) OP=NOP */
    0x00000074, /*   t */
    0x00000000, /*   GL.API_MODE := OPENGL */

or

    0x00000705, /*   GL.STALL_TOKEN := FROM=RA,TO=PE,FLIP0=0,FLIP1=0 */
    0x00000001, /*   TS.FLUSH_CACHE := FLUSH=1 */
    0x18000000, /* NOP (3) OP=NOP */
    0x616e7465, /*   etna */
    0x18000000, /* NOP (3) OP=NOP */
    0x6275735f, /*   _sub */
    0x18000000, /* NOP (3) OP=NOP */
    0x5f74696d, /*   mit_ */
    0x18000000, /* NOP (3) OP=NOP */
    0x735f7372, /*   rs_s */
    0x18000000, /* NOP (3) OP=NOP */
    0x65746174, /*   tate */
    0x00004606, /*   RS.CONFIG := SOURCE_FORMAT=A8R8G8B8

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3744>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3744>
This commit is contained in:
Christian Gmeiner 2020-02-04 11:12:15 +01:00 committed by Marge Bot
parent 4460628330
commit d8f3d0a3a8
2 changed files with 32 additions and 0 deletions

View file

@ -57,6 +57,36 @@
#include "hw/common.xml.h"
static inline void
etna_emit_nop_with_data(struct etna_cmd_stream *stream, uint32_t value)
{
etna_cmd_stream_emit(stream, VIV_FE_NOP_HEADER_OP_NOP);
etna_cmd_stream_emit(stream, value);
}
static void
etna_emit_string_marker(struct pipe_context *pctx, const char *string, int len)
{
struct etna_context *ctx = etna_context(pctx);
struct etna_cmd_stream *stream = ctx->stream;
const uint32_t *buf = (const void *)string;
etna_cmd_stream_reserve(stream, len * 2);
while (len >= 4) {
etna_emit_nop_with_data(stream, *buf);
buf++;
len -= 4;
}
/* copy remainder bytes without reading past end of input string */
if (len > 0) {
uint32_t w = 0;
memcpy(&w, buf, len);
etna_emit_nop_with_data(stream, w);
}
}
static void
etna_context_destroy(struct pipe_context *pctx)
{
@ -561,6 +591,7 @@ etna_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
pctx->set_debug_callback = etna_set_debug_callback;
pctx->create_fence_fd = etna_create_fence_fd;
pctx->fence_server_sync = etna_fence_server_sync;
pctx->emit_string_marker = etna_emit_string_marker;
/* creation of compile states */
pctx->create_blend_state = etna_blend_state_create;

View file

@ -151,6 +151,7 @@ etna_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_VERTEX_COLOR_UNCLAMPED:
case PIPE_CAP_MIXED_COLOR_DEPTH_BITS:
case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES:
case PIPE_CAP_STRING_MARKER:
return 1;
case PIPE_CAP_NATIVE_FENCE_FD:
return screen->drm_version >= ETNA_DRM_VERSION_FENCE_FD;