[virglrenderer-devel] [PATCH] add support for shader clock.
Erik Faye-Lund
erik.faye-lund at collabora.com
Mon Aug 6 20:09:27 UTC 2018
Sure:
Reviewed-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
On 06. aug. 2018 22:05, Dave Airlie wrote:
> ping? anyone want to review, it's pretty trivial.
>
> Dave.
>
> On 31 July 2018 at 08:58, Dave Airlie <airlied at gmail.com> wrote:
>> From: Dave Airlie <airlied at redhat.com>
>>
>> This was pretty trivial.
>> ---
>> src/gallium/auxiliary/tgsi/tgsi_info.c | 4 +++-
>> src/gallium/include/pipe/p_shader_tokens.h | 3 ++-
>> src/virgl_hw.h | 1 +
>> src/vrend_renderer.c | 6 ++++++
>> src/vrend_shader.c | 7 +++++++
>> 5 files changed, 19 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c
>> index 149db9e..eb85b53 100644
>> --- a/src/gallium/auxiliary/tgsi/tgsi_info.c
>> +++ b/src/gallium/auxiliary/tgsi/tgsi_info.c
>> @@ -262,7 +262,8 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] =
>> { 1, 1, 0, 0, 0, 0, COMP, "DFLR", TGSI_OPCODE_DFLR },
>> { 1, 1, 0, 0, 0, 0, COMP, "DROUND", TGSI_OPCODE_DROUND },
>> { 1, 1, 0, 0, 0, 0, COMP, "DSSG", TGSI_OPCODE_DSSG },
>> - { 1, 2, 0, 0, 0, 0, COMP, "DDIV", TGSI_OPCODE_DDIV }
>> + { 1, 2, 0, 0, 0, 0, COMP, "DDIV", TGSI_OPCODE_DDIV },
>> + { 1, 0, 0, 0, 0, 0, OTHR, "CLOCK", TGSI_OPCODE_CLOCK }
>> };
>>
>> const struct tgsi_opcode_info *
>> @@ -354,6 +355,7 @@ tgsi_opcode_infer_type( uint opcode )
>> case TGSI_OPCODE_LSB:
>> case TGSI_OPCODE_UMSB:
>> case TGSI_OPCODE_D2U:
>> + case TGSI_OPCODE_CLOCK:
>> return TGSI_TYPE_UNSIGNED;
>> case TGSI_OPCODE_ARL:
>> case TGSI_OPCODE_ARR:
>> diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h
>> index ff723e0..1925f8e 100644
>> --- a/src/gallium/include/pipe/p_shader_tokens.h
>> +++ b/src/gallium/include/pipe/p_shader_tokens.h
>> @@ -569,7 +569,8 @@ struct tgsi_property_data {
>> #define TGSI_OPCODE_DROUND 221 /* nvc0 */
>> #define TGSI_OPCODE_DSSG 222
>> #define TGSI_OPCODE_DDIV 223
>> -#define TGSI_OPCODE_LAST 224
>> +#define TGSI_OPCODE_CLOCK 224
>> +#define TGSI_OPCODE_LAST 225
>>
>> /**
>> * Opcode is the operation code to execute. A given operation defines the
>> diff --git a/src/virgl_hw.h b/src/virgl_hw.h
>> index 739500f..890fada 100644
>> --- a/src/virgl_hw.h
>> +++ b/src/virgl_hw.h
>> @@ -226,6 +226,7 @@ enum virgl_formats {
>> #define VIRGL_CAP_MEMORY_BARRIER (1 << 6)
>> #define VIRGL_CAP_COMPUTE_SHADER (1 << 7)
>> #define VIRGL_CAP_FB_NO_ATTACH (1 << 8)
>> +#define VIRGL_CAP_SHADER_CLOCK (1 << 9)
>>
>> /* virgl bind flags - these are compatible with mesa 10.5 gallium.
>> * but are fixed, no other should be passed to virgl either.
>> diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
>> index 0cd736f..68c21b3 100644
>> --- a/src/vrend_renderer.c
>> +++ b/src/vrend_renderer.c
>> @@ -120,6 +120,7 @@ enum features_id
>> feat_sample_mask,
>> feat_sample_shading,
>> feat_samplers,
>> + feat_shader_clock,
>> feat_ssbo,
>> feat_ssbo_barrier,
>> feat_stencil_texturing,
>> @@ -178,6 +179,7 @@ static const struct {
>> [feat_sample_mask] = { 32, 31, { "GL_ARB_texture_multisample" } },
>> [feat_sample_shading] = { 40, UNAVAIL, { "GL_ARB_sample_shading" } },
>> [feat_samplers] = { 33, UNAVAIL, { "GL_ARB_sampler_objects" } },
>> + [feat_shader_clock] = { UNAVAIL, UNAVAIL, { "GL_ARB_shader_clock" } },
>> [feat_ssbo] = { 43, 31, { "GL_ARB_shader_storage_buffer_object" } },
>> [feat_ssbo_barrier] = { 43, 31, {} },
>> [feat_stencil_texturing] = { 43, UNAVAIL, { "GL_ARB_stencil_texturing" } },
>> @@ -8217,6 +8219,10 @@ void vrend_renderer_fill_caps(uint32_t set, UNUSED uint32_t version,
>>
>> if (has_feature(feat_copy_image))
>> caps->v2.capability_bits |= VIRGL_CAP_COPY_IMAGE;
>> +
>> + if (has_feature(feat_shader_clock))
>> + caps->v2.capability_bits |= VIRGL_CAP_SHADER_CLOCK;
>> +
>> }
>>
>> GLint64 vrend_renderer_get_timestamp(void)
>> diff --git a/src/vrend_shader.c b/src/vrend_shader.c
>> index fb323cf..0b877ab 100644
>> --- a/src/vrend_shader.c
>> +++ b/src/vrend_shader.c
>> @@ -60,6 +60,7 @@ extern int vrend_dump_shaders;
>> #define SHADER_REQ_ES31_COMPAT (1 << 16)
>> #define SHADER_REQ_IMAGE_SIZE (1 << 17)
>> #define SHADER_REQ_TXQS (1 << 18)
>> +#define SHADER_REQ_SHADER_CLOCK (1 << 19)
>>
>> struct vrend_shader_io {
>> unsigned name;
>> @@ -235,6 +236,7 @@ static const struct vrend_shader_table shader_req_table[] = {
>> { SHADER_REQ_ES31_COMPAT, "GL_ARB_ES3_1_compatibility" },
>> { SHADER_REQ_IMAGE_SIZE, "GL_ARB_shader_image_size" },
>> { SHADER_REQ_TXQS, "GL_ARB_shader_texture_image_samples" },
>> + { SHADER_REQ_SHADER_CLOCK, "GL_ARB_shader_clock" },
>> };
>>
>> enum vrend_type_qualifier {
>> @@ -3885,6 +3887,11 @@ iter_instruction(struct tgsi_iterate_context *iter,
>> if (ret)
>> return FALSE;
>> break;
>> + case TGSI_OPCODE_CLOCK:
>> + ctx->shader_req_bits |= SHADER_REQ_SHADER_CLOCK;
>> + snprintf(buf, 255, "%s = uintBitsToFloat(clock2x32ARB());\n", dsts[0]);
>> + EMIT_BUF_WITH_RET(ctx, buf);
>> + break;
>> default:
>> fprintf(stderr,"failed to convert opcode %d\n", inst->Instruction.Opcode);
>> break;
>> --
>> 2.14.3
>>
>> _______________________________________________
>> virglrenderer-devel mailing list
>> virglrenderer-devel at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/virglrenderer-devel
> _______________________________________________
> virglrenderer-devel mailing list
> virglrenderer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/virglrenderer-devel
More information about the virglrenderer-devel
mailing list