[Mesa-dev] [PATCH kmscube 2/3] add video cube

Emil Velikov emil.l.velikov at gmail.com
Mon Mar 27 09:41:02 UTC 2017


On 25 March 2017 at 20:11, Rob Clark <robdclark at gmail.com> wrote:

> --- a/common.h
> +++ b/common.h

>
> +#ifdef HAVE_CONFIG_H
> +#  include "config.h"
> +#endif
> +
config.h is no more as of commit 24830fe38257c6b0df8fa86acfa8cdb08eb41dcf
Drop the hunk.

>  #include <GLES2/gl2.h>
>  #include <GLES2/gl2ext.h>
>  #include <EGL/egl.h>
> @@ -85,9 +89,25 @@ enum mode {
>         RGBA,          /* single-plane RGBA */
>         NV12_2IMG,     /* NV12, handled as two textures and converted to RGB in shader */
>         NV12_1IMG,     /* NV12, imported as planar YUV eglimg */
> +       VIDEO,         /* video textured cube */
>  };
>
>  const struct egl * init_cube_smooth(const struct gbm *gbm);
>  const struct egl * init_cube_tex(const struct gbm *gbm, enum mode mode);
> +#ifdef HAVE_GST
> +struct decoder;
> +struct decoder * video_init(const struct egl *egl, const struct gbm *gbm, const char *filename);
> +EGLImage video_frame(struct decoder *dec);
> +void video_deinit(struct decoder *dec);
> +const struct egl * init_cube_video(const struct gbm *gbm, const char *video);
> +#else
> +static inline const struct egl *
> +init_cube_video(const struct gbm *gbm, const char *video)
> +{
> +       (void)gbm; (void)video;
> +       printf("no GStreamer support!\n");
> +       return NULL;
> +}
> +#endif
>
Improve readability by adding some new lines in the above.

> --- a/cube-tex.c
> +++ b/cube-tex.c
> @@ -46,7 +46,7 @@ struct {
>         GLuint tex[2];
>  } gl;
>
> -const struct egl *egl = &gl.egl;
> +static const struct egl *egl = &gl.egl;
>
Unrelated - please move to separate patch.

>  static const GLfloat vVertices[] = {
>                 // front
> @@ -81,7 +81,7 @@ static const GLfloat vVertices[] = {
>                 +1.0f, -1.0f, +1.0f,
>  };
>
> -GLfloat vTexCoords[] = {
> +static GLfloat vTexCoords[] = {
Ditto - 'static const' even?

> +struct {
> +       struct egl egl;
> +
> +       GLfloat aspect;
> +       const struct gbm *gbm;
> +
> +       GLuint program, blit_program;
> +       /* uniform handles: */
> +       GLint modelviewmatrix, modelviewprojectionmatrix, normalmatrix;
> +       GLint texture, blit_texture;
> +       GLuint vbo;
> +       GLuint positionsoffset, texcoordsoffset, normalsoffset;
variable_name vs variablename is a bit confusing, but meh.


> +               dec->egl->eglDestroyImageKHR(dec->egl->display, dec->last_frame);

Unrelated: we must be using glGetString(GL_EXTENSIONS) and
eglQueryString(... EGL_EXTENSIONS) alongside eglGetProcAddress().
It's not cool that kmscube does not follow the documentation :-\

The the above nitpicks
Reviewed-by: Emil Velikov <emil.l.velikov at gmail.com>

-Emil


More information about the mesa-dev mailing list