[virglrenderer-devel] [PATCH 1/2] vrend: Support caps struct v2

Dave Airlie airlied at gmail.com
Mon Feb 12 08:02:39 UTC 2018


On 10 February 2018 at 11:20, Stéphane Marchesin <marcheu at chromium.org> wrote:
> This new struct allows us to report accurate max point size
> and line width.

Hi,

Okay I went and brought up a virgl box today and tested. The Mesa
patch has a bug
in the fallback path. It should check ret == -1 && errno = EINVAL

However I do wonder if we should relax the kernel API a bit, it might be good
to allow any buffer bigger than the caps, then have userspace check what version
it gets back. For now we'd have to do both as the current API is out
there in the world.

Dave.

>
> Signed-off-by: Stéphane Marchesin <marcheu at chromium.org>
> ---
>  src/virgl_hw.h       | 29 +++++++++++++++++++++++++++++
>  src/vrend_renderer.c | 19 ++++++++++++++++++-
>  2 files changed, 47 insertions(+), 1 deletion(-)
>
> diff --git a/src/virgl_hw.h b/src/virgl_hw.h
> index 8c6f523..ca043a3 100644
> --- a/src/virgl_hw.h
> +++ b/src/virgl_hw.h
> @@ -257,9 +257,38 @@ struct virgl_caps_v1 {
>          uint32_t max_texture_gather_components;
>  };
>
> +struct virgl_caps_v2 {
> +        uint32_t max_version;
> +        struct virgl_supported_format_mask sampler;
> +        struct virgl_supported_format_mask render;
> +        struct virgl_supported_format_mask depthstencil;
> +        struct virgl_supported_format_mask vertexbuffer;
> +        struct virgl_caps_bool_set1 bset;
> +        uint32_t glsl_level;
> +        uint32_t max_texture_array_layers;
> +        uint32_t max_streamout_buffers;
> +        uint32_t max_dual_source_render_targets;
> +        uint32_t max_render_targets;
> +        uint32_t max_samples;
> +        uint32_t prim_mask;
> +        uint32_t max_tbo_size;
> +        uint32_t max_uniform_blocks;
> +        uint32_t max_viewports;
> +        uint32_t max_texture_gather_components;
> +       float min_aliased_point_size;
> +       float max_aliased_point_size;
> +       float min_smooth_point_size;
> +       float max_smooth_point_size;
> +       float min_aliased_line_width;
> +       float max_aliased_line_width;
> +       float min_smooth_line_width;
> +       float max_smooth_line_width;
> +};
> +
>  union virgl_caps {
>          uint32_t max_version;
>          struct virgl_caps_v1 v1;
> +        struct virgl_caps_v2 v2;
>  };
>
>  enum virgl_errors {
> diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
> index ec37fc8..6ef6cff 100644
> --- a/src/vrend_renderer.c
> +++ b/src/vrend_renderer.c
> @@ -6208,6 +6208,7 @@ void vrend_renderer_fill_caps(uint32_t set, uint32_t version,
>  {
>     int i;
>     GLint max;
> +   GLfloat range[2];
>     int gl_ver = epoxy_gl_version();
>
>     if (!caps)
> @@ -6220,7 +6221,7 @@ void vrend_renderer_fill_caps(uint32_t set, uint32_t version,
>        return;
>     }
>
> -   caps->max_version = 1;
> +   caps->max_version = 2;
>
>     caps->v1.bset.occlusion_query = 1;
>     if (gl_ver >= 30) {
> @@ -6381,6 +6382,22 @@ void vrend_renderer_fill_caps(uint32_t set, uint32_t version,
>           }
>        }
>     }
> +
> +   glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, range);
> +   caps->v2.min_aliased_point_size = range[0];
> +   caps->v2.max_aliased_point_size = range[1];
> +
> +   glGetFloatv(GL_SMOOTH_POINT_SIZE_RANGE, range);
> +   caps->v2.min_smooth_point_size = range[0];
> +   caps->v2.max_smooth_point_size = range[1];
> +
> +   glGetFloatv(GL_ALIASED_LINE_WIDTH_RANGE, range);
> +   caps->v2.min_aliased_line_width = range[0];
> +   caps->v2.max_aliased_line_width = range[1];
> +
> +   glGetFloatv(GL_SMOOTH_LINE_WIDTH_RANGE, range);
> +   caps->v2.min_smooth_line_width = range[0];
> +   caps->v2.max_smooth_line_width = range[1];
>  }
>
>  GLint64 vrend_renderer_get_timestamp(void)
> --
> 2.16.0.rc1.238.g530d649a79-goog
>
> _______________________________________________
> 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