From patchwork Wed Jan 10 06:05:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10154031 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EF7CB602D8 for ; Wed, 10 Jan 2018 06:05:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E352920572 for ; Wed, 10 Jan 2018 06:05:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D794526E16; Wed, 10 Jan 2018 06:05:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8D2B320572 for ; Wed, 10 Jan 2018 06:05:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4FDDF6E1A6; Wed, 10 Jan 2018 06:05:58 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg0-x243.google.com (mail-pg0-x243.google.com [IPv6:2607:f8b0:400e:c05::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5EEBB6E1A6 for ; Wed, 10 Jan 2018 06:05:57 +0000 (UTC) Received: by mail-pg0-x243.google.com with SMTP id c194so9082064pga.12 for ; Tue, 09 Jan 2018 22:05:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tU/oQWpnnXX79FVyBTFU3aSO/+hPM+VT530RADnKzDg=; b=HT7aW32ifaUhNbUdh1EpeG+gI9kS2/MQQ1spUl/XVHRLpA3pgA04M2ySy1O1y+TDM0 wMAMseC9I/t2/MHB20zfR2sDGvPWFzYcMXNtDXmvDz6JVJ93ntA7DipiZKWtkqPbQZn0 lvUizLRnYUKTSYo13rVDTo6CWESGoKP+I9L44= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tU/oQWpnnXX79FVyBTFU3aSO/+hPM+VT530RADnKzDg=; b=bFivY9iLSxFzk+/PZEOP1uX5Ov5AjDHLDlWsRDhE9u3VaH7ppLO4MC/LjTF606behh d2xrb/99CdLilzh/YtFvx//ds+OZZXeAPdSrgEvf993OFhKYdk3B9S9k+GqSX45i/ynY TQcvj8XRjwTTb65GFEQzwpOMqaFYlticI7tRGlX9/Yhh40VZsrJLsvsDsXgTvye/qQ/I xmrJ4D7YaTYhIjh9jfiuwSNOcqA6CtULu5jlwffagtcH6EJX2kTRTHqYsNf8eToKCHPY JAdA9Emf03UNNRKDZ1zEwdarE02l/dmolvVqx9SwQi8JvXpJtMEh19LbLSv5u5+uGr4E n/EQ== X-Gm-Message-State: AKwxytfonUBt/owkxz0pmApQEZZG4NjW630oglxoj5tjQD8OgKjEf6Lq sve8bbD0CAGQ6KBRemexTzpmqE6NABs= X-Google-Smtp-Source: ACJfBot/837xc13lrmrxJjCOgOrIIv38JxBMCid8Q8WL1tQVgZiRhdizebHw97pim6GxHvxHYFlPMA== X-Received: by 10.98.103.209 with SMTP id t78mr4142620pfj.53.1515564356502; Tue, 09 Jan 2018 22:05:56 -0800 (PST) Received: from localhost.localdomain ([2601:1c2:600:5100:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id g8sm25538595pgs.55.2018.01.09.22.05.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 09 Jan 2018 22:05:55 -0800 (PST) From: John Stultz To: dri-devel@lists.freedesktop.org Subject: [RFC][PATCH 2/5] drm_hwcomposer: glworker: Add build time options for certain shader feature names Date: Tue, 9 Jan 2018 22:05:42 -0800 Message-Id: <1515564345-1339-3-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515564345-1339-1-git-send-email-john.stultz@linaro.org> References: <1515564345-1339-1-git-send-email-john.stultz@linaro.org> Cc: Rob Herring , Matt Szczesiak , Dmitry Shmidt , Sean Paul , Robert Foss , Liviu Dudau , Marissa Wall , David Hanna X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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. 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 Cc: Sean Paul Cc: Dmitry Shmidt Cc: Robert Foss Cc: Matt Szczesiak Cc: Liviu Dudau Cc: David Hanna Cc: Rob Herring Signed-off-by: John Stutlz --- 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"