On Tue, Jan 09, 2018 at 10:05:42PM -0800, John Stultz wrote:
> In order to get the hikey960, which uses the mali bifrost driver
> working with drm_hwcomposer, its needed to tweak some extension
> and funciton names used in the shaders.
> 
> Specifically:
> * GL_OES_EGL_image_external_essl3 instead of
>   GL_OES_EGL_image_external
> * texture() instead of texture2D()
> 
> Which is configured using a build time definition.

Build time is kinda uncool, at least in the spirit of multiarch kernels
:-) Can't we try a few alternatives until the glsl compiler takes it? For
extensions you could/should even query them upfront and then pick the
right one.
-Daniel

> Credit to Matt Szczesiak for suggesting these changes to get
> hikey960 working!
> 
> I'm a bit new to all this, and I expect there may be a better
> way to do this, so I'd love any feedback or comments!
> 
> Change-Id: I2c8f08341ad086479b66241b903c79b00f2a0feb
> Cc: Marissa Wall <maris...@google.com>
> Cc: Sean Paul <seanp...@google.com>
> Cc: Dmitry Shmidt <dimitr...@google.com>
> Cc: Robert Foss <robert.f...@collabora.com>
> Cc: Matt Szczesiak <matt.szczes...@arm.com>
> Cc: Liviu Dudau <liviu.du...@arm.com>
> Cc: David Hanna <david.hann...@gmail.com>
> Cc: Rob Herring <rob.herr...@linaro.org>
> Signed-off-by: John Stutlz <john.stu...@linaro.org>
> ---
>  glworker.cpp | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/glworker.cpp b/glworker.cpp
> index ca726bf..c35d1b6 100644
> --- a/glworker.cpp
> +++ b/glworker.cpp
> @@ -41,6 +41,17 @@
>  
>  #define MAX_OVERLAPPING_LAYERS 64
>  
> +#ifdef USE_TEXTURE_FN
> + #define TEXTURE_STR "texture"
> +#else
> + #define TEXTURE_STR "texture2D"
> +#endif
> +
> +#ifdef USE_IMAGE_EXTERNAL_ESSL3
> + #define IMAGE_EXTERNAL_STR "GL_OES_EGL_image_external_essl3"
> +#else
> + #define IMAGE_EXTERNAL_STR "GL_OES_EGL_image_external"
> +#endif
>  namespace android {
>  
>  // clang-format off
> @@ -237,7 +248,7 @@ static std::string GenerateFragmentShader(int 
> layer_count) {
>    std::ostringstream fragment_shader_stream;
>    fragment_shader_stream << "#version 300 es\n"
>                           << "#define LAYER_COUNT " << layer_count << "\n"
> -                         << "#extension GL_OES_EGL_image_external : 
> require\n"
> +                         << "#extension " << IMAGE_EXTERNAL_STR << " : 
> require\n"
>                           << "precision mediump float;\n";
>    for (int i = 0; i < layer_count; ++i) {
>      fragment_shader_stream << "uniform samplerExternalOES uLayerTexture" << i
> @@ -257,7 +268,7 @@ static std::string GenerateFragmentShader(int 
> layer_count) {
>        fragment_shader_stream << "  if (alphaCover > 0.5/255.0) {\n";
>      // clang-format off
>      fragment_shader_stream
> -        << "  texSample = texture2D(uLayerTexture" << i << ",\n"
> +        << "  texSample = " << TEXTURE_STR << "(uLayerTexture" << i << ",\n"
>          << "                        fTexCoords[" << i << "]);\n"
>          << "  multRgb = texSample.rgb *\n"
>          << "            max(texSample.a, uLayerPremult[" << i << "]);\n"
> -- 
> 2.7.4
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to