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: 124015 Delivered-To: patches@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4884417qgn; Tue, 9 Jan 2018 22:05:56 -0800 (PST) X-Received: by 10.84.129.226 with SMTP id b89mr3908437plb.389.1515564356886; Tue, 09 Jan 2018 22:05:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515564356; cv=none; d=google.com; s=arc-20160816; b=Y0jULf36TShu549TUtU8ff/u1NywFT32BtzpB1gYbm+bDQloJ+oTJEVouwmALgn76Q wm6yAQ/dZxqkRI430OxCX7VECX5a4WKg00eTrv01y+/aw7LeZvdrKHbpzAKmiD7RWbZG dgn/44KLq0UG772Vs+JFSh2Yjr6bXs1qwZipGdK2qNNGq3+DmZwfZihCCKYFVf6d7ZzW h5LoQysISgogDl/gTZts0e090nd6XPKJ/cevy6xrjs1cquqBGqr4+AMg6DsknPE/DQN1 Nbw6yqou1Xx8CMOFteOOtmREfWE9Izc12XOQW+n7opqaX5jCNb8RlUfRpGjHtX1WtHwt fMeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=tU/oQWpnnXX79FVyBTFU3aSO/+hPM+VT530RADnKzDg=; b=aB3P1X/g+3CCBeHXY5hJAKw3ieXsWcHE2tbi8OnYNZ+cA3kXngG4qoYT4uh9z9+qfq 3M3LqT/MwSg1GHQ9yD3R+j6ZdqyPQVZI6cNWjFi/PQ/l9djDDfWkEcjV0/GUoxxMIGVA 2Ha+69bAx/LXUmm0mCff62puiP/dZrlO4wJpjnwcESNOjk8+qF/fL4csgpPk05zDoSSv O8XsbUNuCifodsunTK7ppYO4qPmCgA4Av1cqc06zZUaXCZn66K23yvijeoDBegkDFm56 u4Yi4+PhYLBfC9akIesz/RFqogkmQHwAkPW5ZxY44b3flD7s9Vra0LBMGlV0NHFdWpBO XHQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HT7aW32i; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id c22sor4114590pfj.17.2018.01.09.22.05.56 for (Google Transport Security); Tue, 09 Jan 2018 22:05:56 -0800 (PST) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HT7aW32i; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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=ggL9KTWT/HzSnRyP4bxiUAzUS7LAkeu7W7IGaVrnGiwDHnC55vbOQMd5BEne1Io96y q7dfhmEayfzKCse1JA72ZodkL0S8AHQeqUhHpNhYmgfi3Xy09NQOHj3IPwdOWBCQDuJj VS+n3Gl8h6JUkJeB5kmTNhVWNM0hpnxDTxh8sdGHbhRs+KrXQSo2Q3hZbKZkzRwcVA3r bpeRtjPl+nI7VOyzsL0cq1WdZxXX/38e2zPFWnIZGIPVbVRujAciI81KvKLkXIKWFpW0 c9bg31xB7dLGA18FU1ae2J5d6syrUQOBUlabitlw7bw28FuV3o0AsMnLkaCCea5HMW0m 6o2g== X-Gm-Message-State: AKwxytdSqFfr2QEiw8pVMinn9hr7ypRS8OS9xQj1qjhFzzPGMstSH5xy Z/nTetioCYVp9kL6IvjzhWm5JJfb 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) Return-Path: 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 Cc: John Stultz , Marissa Wall , Sean Paul , Dmitry Shmidt , Robert Foss , Matt Szczesiak , Liviu Dudau , David Hanna , Rob Herring 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> 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(-) -- 2.7.4 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"