From patchwork Wed Apr 24 17:08:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10915293 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 94B3A922 for ; Wed, 24 Apr 2019 17:08:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D7FA28A77 for ; Wed, 24 Apr 2019 17:08:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 71D8128B81; Wed, 24 Apr 2019 17:08:54 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED 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 20E7728A77 for ; Wed, 24 Apr 2019 17:08:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4B513891FF; Wed, 24 Apr 2019 17:08:53 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by gabe.freedesktop.org (Postfix) with ESMTPS id 84560891D5 for ; Wed, 24 Apr 2019 17:08:46 +0000 (UTC) Received: by mail-pg1-x542.google.com with SMTP id p6so9679437pgh.9 for ; Wed, 24 Apr 2019 10:08:46 -0700 (PDT) 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:mime-version:content-transfer-encoding; bh=fGMCTWJCYFtCmoIcDdlw37giMEwdIgyb7vmAWnlhAbU=; b=k/Epd4dN8d9pb9TcXGusRAOzQN2CHpdSPdVxcAUXHPaUI97+dOXGDE8LRQTenwoY9c 3bsxFdplAyJiqOLKZgYJgK7h0GWsz0GdEKmPYTROrJiK1BdfdkUM5pFHUwlmBZfV02g+ qaZ49F1dWl7vvPfZ7mbgS16Hea5HAnQonbaMiYsWhH7DRGuIWT+pu37rdn9tcvPtQTC4 E9ylH3PxorFpoIqu3lgPoG2r+STRaLZs3chXgxshp0Vgoo7uEnqjH92O0LNQZQGZ16Ro xKRILBHDmNVfj+3Yz4gXHhtMNjZa/4hCL+38OmnQlwsjlwaCWK88c69qiTW5v6D/gTDd vMXQ== X-Gm-Message-State: APjAAAVp2EaPI1qybBgMwAQahkgB3FGlvDzxQ/hfOKa/4DFIiBef0tl0 dbj4/t7k9zggTAEC3SjqdoKcd6qEDcc= X-Google-Smtp-Source: APXvYqz6CFw5lGSSen7EuCkTvTwvP/PD0nL/SxzVhNOmBWySmKaHoOzCFB2ss79TJh7/2xra2caRHA== X-Received: by 2002:a62:5ec2:: with SMTP id s185mr35524823pfb.16.1556125725630; Wed, 24 Apr 2019 10:08:45 -0700 (PDT) Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id e4sm4425073pfn.185.2019.04.24.10.08.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 Apr 2019 10:08:44 -0700 (PDT) From: John Stultz To: dri-devel Subject: [PATCH 1/6 v2] libdrm: Use mmap64 instead of __mmap2 Date: Wed, 24 Apr 2019 10:08:36 -0700 Message-Id: <1556125721-32145-2-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556125721-32145-1-git-send-email-john.stultz@linaro.org> References: <1556125721-32145-1-git-send-email-john.stultz@linaro.org> MIME-Version: 1.0 X-Mailman-Original-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 :mime-version:content-transfer-encoding; bh=fGMCTWJCYFtCmoIcDdlw37giMEwdIgyb7vmAWnlhAbU=; b=UTf2v6StjvEQJI37I3dzf0v43Cliy2iqN+hDTOGB6Gn8Olsb+LvnwR3EcjXKL4+Xzl Ldr7ePtP+nu58vm3NXUzS3CVrzNuhzhDgCvM27ViArCBGv+PAz+jE/t2cwmaYCKJ5uq4 9Ltc97Eu8BJYuRf1aSSRbQ9xLnilprXhQ6V1f16h3srFZ7IwA8kLusO8kU2bj+h6DsJ9 58DXBAuRSDfH1azZDVuBwRJ7LHRbpuGysYYK4ehwj6Ji7hWzJnlu4Ff6BUmyIYlK6wl4 jOvblAtvL3oGRx6dAE3cAacdVwj5JVEplH/Xu7jKn1HETxdxXr+epfzqk8FLJFUAXfeZ XljQ== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marissa Wall , Sean Paul , Alistair Strachan , Emil Velikov Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul __mmap2 isn't supported on all platforms, mmap64 is the right way to do this in android. Also folds in a fix from Stéphane Marchesin Cc: Emil Velikov Cc: Sean Paul Cc: Alistair Strachan Cc: Marissa Wall Acked-by: Alex Deucher Reviewed-by: Emil Velikov Signed-off-by: Sean Paul [jstultz: Folded in Stéphane's fix] Signed-off-by: John Stultz --- libdrm_macros.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libdrm_macros.h b/libdrm_macros.h index 95f0ef5..0dca827 100644 --- a/libdrm_macros.h +++ b/libdrm_macros.h @@ -48,8 +48,6 @@ #if defined(ANDROID) && !defined(__LP64__) #include /* for EINVAL */ -extern void *__mmap2(void *, size_t, int, int, int, size_t); - static inline void *drm_mmap(void *addr, size_t length, int prot, int flags, int fd, loff_t offset) { @@ -59,7 +57,7 @@ static inline void *drm_mmap(void *addr, size_t length, int prot, int flags, return MAP_FAILED; } - return __mmap2(addr, length, prot, flags, fd, (size_t) (offset >> 12)); + return mmap64(addr, length, prot, flags, fd, offset); } # define drm_munmap(addr, length) \ From patchwork Wed Apr 24 17:08:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10915291 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 962AA161F for ; Wed, 24 Apr 2019 17:08:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F64928A77 for ; Wed, 24 Apr 2019 17:08:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 73C7A28B81; Wed, 24 Apr 2019 17:08:51 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED 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 23E4B28A77 for ; Wed, 24 Apr 2019 17:08:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 12586891D5; Wed, 24 Apr 2019 17:08:50 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by gabe.freedesktop.org (Postfix) with ESMTPS id D7062891D5 for ; Wed, 24 Apr 2019 17:08:48 +0000 (UTC) Received: by mail-pg1-x543.google.com with SMTP id j26so9686146pgl.5 for ; Wed, 24 Apr 2019 10:08:48 -0700 (PDT) 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=9+iz4QZevRRvfzFdoUmhGoUHh5WLuHlapt5scL4pmOw=; b=oWscIaUECOBeH/iJqiZd1XFy9EVUySPPQIWxXIeODiwPE6gmPinOTvjvTSvS4hL4eE CW+c16ysTc12Pzgh6jCE0kw/hNimIgNsrCPBePGJhZAn4tWd4ayE7lHVLvp6nO8ViMs3 qU2TlRwZa/O1yhKJvxlw0x3jKOSc6ZXkFauEVCfTj72iAFzvvscDGqFuC4TQu0sSE9P5 ddYvK17mhwsaIuw53YZ0vW375RL8uBAcBqpxutbXoU1bEmJpZ3X0BCaA0UTv3A46rtCs Rm7QbyFPCN+atW0fG+q435cVcLKm3ULwvkdf4dQmuhkMiDIevIKopjLfI8g7loJ2cQ9M ZqXw== X-Gm-Message-State: APjAAAUCIQNWchIDdS5GdUEl2BeJE7fCxPItkRTRWMmQWT7lxU4qTsZV maJqGN1jmWHPNpL2UBgP/nKJ2J3CfdY= X-Google-Smtp-Source: APXvYqwfJwe0mW0WdFHM57DN2+iaUGNul2Tmeau4PwrtLWc/kKpXw0oDKSPMFZbHf64dHQxmD0lMjQ== X-Received: by 2002:a62:4e86:: with SMTP id c128mr34190550pfb.39.1556125727926; Wed, 24 Apr 2019 10:08:47 -0700 (PDT) Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id e4sm4425073pfn.185.2019.04.24.10.08.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 Apr 2019 10:08:46 -0700 (PDT) From: John Stultz To: dri-devel Subject: [PATCH 2/6 v2] libdrm: Android.mk: Add minimal Android platform check Date: Wed, 24 Apr 2019 10:08:37 -0700 Message-Id: <1556125721-32145-3-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556125721-32145-1-git-send-email-john.stultz@linaro.org> References: <1556125721-32145-1-git-send-email-john.stultz@linaro.org> X-Mailman-Original-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=9+iz4QZevRRvfzFdoUmhGoUHh5WLuHlapt5scL4pmOw=; b=qiQEVXc/IIWj5EPnUcpbIg2Xt17LgxJLF7Ic2O4l/TR4u/53yLL+w4q8T9+/ioFnTV +a4rCye6EFaVtO6Yh08+D3jw8AMkGvpi+COHzoxwAxTY4fNjD/9jIyUeRVDP/yteaijK xRGnQC+48DWBOkUSyTsAY6+6MaOqaSA7ZCZUv4NsQUXsaUQbE00Fj4qAnrD6p/P87LtE Q875N5DZLUu0PGEnNnTS0/S889HH2EtAbjyiiGDPZHbAYdJmcF3IB5KzrViH3lXIidy1 /eDVtbjwnosQhHlxKAjfF2On4rB+8Fg2NDW+2TjEJb/I76WC+H+wZlmbtxNYfeT4HBLd EFEg== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sean Paul , Marissa Wall , Alistair Strachan , Emil Velikov MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Add a check to error out on Android version K(4.4) or lower. This is due to dependency added in a previous commit on mmap64, which was introduced with Android L. Cc: Emil Velikov Cc: Sean Paul Cc: Alistair Strachan Cc: Marissa Wall Suggested-by: Emil Velikov Signed-off-by: John Stultz --- NOTE: This change was suggested by Emil, and I've implemented it as suggested, but due to the fact that the Android.mk files are no longer usable with AOSP/master, I'm not able to test this change. Help in validating would be appreciated. --- Android.mk | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Android.mk b/Android.mk index 1b77c53..0ab6f0f 100644 --- a/Android.mk +++ b/Android.mk @@ -21,6 +21,11 @@ # IN THE SOFTWARE. # +LIBDRM_ANDROID_MAJOR_VERSION := $(word 1, $(subst ., , $(PLATFORM_VERSION))) +ifneq ($(filter 2 4, $(LIBDRM_ANDROID_MAJOR_VERSION)),) +$(error "Android 4.4 and earlier not supported") +endif + LIBDRM_COMMON_MK := $(call my-dir)/Android.common.mk LOCAL_PATH := $(call my-dir) From patchwork Wed Apr 24 17:08:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10915295 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4343C922 for ; Wed, 24 Apr 2019 17:08:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2CEE928B54 for ; Wed, 24 Apr 2019 17:08:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2146628B82; Wed, 24 Apr 2019 17:08:57 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED 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 C71F828B54 for ; Wed, 24 Apr 2019 17:08:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CF5D789256; Wed, 24 Apr 2019 17:08:53 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by gabe.freedesktop.org (Postfix) with ESMTPS id 49BE4891FF for ; Wed, 24 Apr 2019 17:08:50 +0000 (UTC) Received: by mail-pg1-x542.google.com with SMTP id f6so9673975pgs.8 for ; Wed, 24 Apr 2019 10:08:50 -0700 (PDT) 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:mime-version:content-transfer-encoding; bh=zKaUzrk/ydlVbPS7i5drt5PTA8n/bRh1ygekvEDrRTg=; b=AYc1qbi6XT/WSTeMjt/hqEs/ep1X3jMRjxryQFU7ox7nkr5YvT9jrNCoJrCkjYmOyj 162YML93NKPKa+C8w6o5q09t59PKMAvtLcU42riXEW49Oe9DJEC87fhqXQM2hWT0B41k 7hOsXZ2RTQPsv9wHzyBBQvgG9+s6jPpziy8srAotybvJpo63e+muLjXpqDc2qIUgwsex E3YmOblYf4KrGguQ/1pAfYwlY58evZKw6Qh4UsbikUeX69HyHvCguCrq8D/JHQ0e77yF kQJkgsVaYh2O5i5yAOm/xFzuzRuEqjpsqbgLKbuMKVA9S26c/nmhHBle8H99O744xHTl 6DJg== X-Gm-Message-State: APjAAAVO1x6y0492QTpSjG+YjInkdAYBoRPtnCB8w/pOvbJRXIMVzZb3 ktWAuyxEcoHlkaJNuIRthHMd4xjjNFM= X-Google-Smtp-Source: APXvYqyxJZnNRgndbMjisqJ29bPkn6SEqbvQBvxDb5Pb7yXGbQjl6wBCVJJuXq8/aXpc0Wzvxvmmcw== X-Received: by 2002:a63:5c53:: with SMTP id n19mr31948290pgm.193.1556125729304; Wed, 24 Apr 2019 10:08:49 -0700 (PDT) Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id e4sm4425073pfn.185.2019.04.24.10.08.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 Apr 2019 10:08:48 -0700 (PDT) From: John Stultz To: dri-devel Subject: [PATCH 3/6 v2] libdrm: amdgpu: Initialize unions with memset rather than "= {0}" Date: Wed, 24 Apr 2019 10:08:38 -0700 Message-Id: <1556125721-32145-4-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556125721-32145-1-git-send-email-john.stultz@linaro.org> References: <1556125721-32145-1-git-send-email-john.stultz@linaro.org> MIME-Version: 1.0 X-Mailman-Original-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 :mime-version:content-transfer-encoding; bh=zKaUzrk/ydlVbPS7i5drt5PTA8n/bRh1ygekvEDrRTg=; b=wInlrsHgv5UBYVx3X8ekJYXVzKjzvTYhIMVmeLaoMmHMUd7diw0iRKPZ0ojm08uSKR Ij+kj1j5W2o+DVuPaR6TuTLABO3oQi7/KJseYYL/O3c9l7DgefLyZsNj03Hj29QqNIma VM8p6S/sxVAet6dbWMJ991lvRsDvNdZl/+9tGT63jpKBSsTZ93NbWShIiFXAdw5EgFcJ ctvM8EXvCZ1Uix5tUfbZpA2/yAg2O474UAy+XzfMntGDnJkOFqLwBOa/J3P0NEYSqD41 3lr+UJuhBUVmCMa6aP9NWkNpsngLO5QMGfnGIp44i86FqfCT1Cj08khn17lB3gFwh4ae +O6A== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sean Paul , Marissa Wall , Alistair Strachan , Emil Velikov Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Clang complains when initializing unions using "= {0}" so instead use memset. Cc: Emil Velikov Cc: Sean Paul Cc: Alistair Strachan Cc: Marissa Wall Reviewed-by: Alex Deucher Reviewed-by: Emil Velikov Reviewed-by: Christian König Signed-off-by: John Stultz --- amdgpu/amdgpu_cs.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c index 7ee844f..7c5b9d1 100644 --- a/amdgpu/amdgpu_cs.c +++ b/amdgpu/amdgpu_cs.c @@ -733,12 +733,13 @@ drm_public int amdgpu_cs_submit_raw(amdgpu_device_handle dev, struct drm_amdgpu_cs_chunk *chunks, uint64_t *seq_no) { - union drm_amdgpu_cs cs = {0}; + union drm_amdgpu_cs cs; uint64_t *chunk_array; int i, r; if (num_chunks == 0) return -EINVAL; + memset(&cs, 0, sizeof(cs)); chunk_array = alloca(sizeof(uint64_t) * num_chunks); for (i = 0; i < num_chunks; i++) chunk_array[i] = (uint64_t)(uintptr_t)&chunks[i]; @@ -763,10 +764,11 @@ drm_public int amdgpu_cs_submit_raw2(amdgpu_device_handle dev, struct drm_amdgpu_cs_chunk *chunks, uint64_t *seq_no) { - union drm_amdgpu_cs cs = {0}; + union drm_amdgpu_cs cs; uint64_t *chunk_array; int i, r; + memset(&cs, 0, sizeof(cs)); chunk_array = alloca(sizeof(uint64_t) * num_chunks); for (i = 0; i < num_chunks; i++) chunk_array[i] = (uint64_t)(uintptr_t)&chunks[i]; @@ -803,9 +805,10 @@ drm_public int amdgpu_cs_fence_to_handle(amdgpu_device_handle dev, uint32_t what, uint32_t *out_handle) { - union drm_amdgpu_fence_to_handle fth = {0}; + union drm_amdgpu_fence_to_handle fth; int r; + memset(&fth, 0, sizeof(fth)); fth.in.fence.ctx_id = fence->context->id; fth.in.fence.ip_type = fence->ip_type; fth.in.fence.ip_instance = fence->ip_instance; From patchwork Wed Apr 24 17:08:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10915297 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 969EF161F for ; Wed, 24 Apr 2019 17:08:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7FF1828A77 for ; Wed, 24 Apr 2019 17:08:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7396028B81; Wed, 24 Apr 2019 17:08: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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED 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 51FEC28A77 for ; Wed, 24 Apr 2019 17:08:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 24FE189250; Wed, 24 Apr 2019 17:08:55 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by gabe.freedesktop.org (Postfix) with ESMTPS id 26F58891FF for ; Wed, 24 Apr 2019 17:08:52 +0000 (UTC) Received: by mail-pg1-x543.google.com with SMTP id d31so9685632pgl.7 for ; Wed, 24 Apr 2019 10:08:52 -0700 (PDT) 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=dAIluZjSLJwIxa7KvWN7HZ/X+6U+jK6ejf8yyjQSeDc=; b=M4ZWsAQqnDcjvKPj5ygYQzxPin7ZRTxiqZHawZcPZdyLUs09Ki5UmTnafHyTpQjr+C 95Wes13HgwCQlhM2pAGmp8rpFwQJIURA+yfgiDi30SnwpuxWAVChVIacSkk1GtMpJSpj gd4vhcQGH4F768Jfxdr7F90UKsu7vPn41R6fS54msmL1x8LFfunf19ANfm6lyWKj6Sd/ KN5sHVwgs+Qr/a+cWb/ks3mf86jrrXJdBDYPe+Iy401As4+Y9Sfm+woLScbmB/sJIDJf StHF2yeknixB2O88IikNelXqyvhp128A4JpFXftqonBiMdtjl845ijQ7Yo3trAI/bIxa mmJA== X-Gm-Message-State: APjAAAUeokJkN/5t7uKBrfL5PNWsit0TNeesuaEYWjaXyXLR3eB5F9s1 tlU+7OfEhMDCnEaQZQA5MOCiTgL3ppw= X-Google-Smtp-Source: APXvYqxd+OclpBKmDT97OaiNa0BO9Rb/EzvIEw3NtC9kz55kQ3uXGSILcr9jYsQiwCnxnExFPSPPxw== X-Received: by 2002:a65:4302:: with SMTP id j2mr31398460pgq.291.1556125730819; Wed, 24 Apr 2019 10:08:50 -0700 (PDT) Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id e4sm4425073pfn.185.2019.04.24.10.08.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 Apr 2019 10:08:49 -0700 (PDT) From: John Stultz To: dri-devel Subject: [PATCH 4/6 v2] libdrm: Avoid additional drm open close Date: Wed, 24 Apr 2019 10:08:39 -0700 Message-Id: <1556125721-32145-5-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556125721-32145-1-git-send-email-john.stultz@linaro.org> References: <1556125721-32145-1-git-send-email-john.stultz@linaro.org> X-Mailman-Original-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=dAIluZjSLJwIxa7KvWN7HZ/X+6U+jK6ejf8yyjQSeDc=; b=DueiEhJhYxh0nPu7G/PYtL7B1BOWLQpLDU3hwpBIUNa1FWP/k3U6iYU7fOGtwIaH1i 57mSskil+0wa0VPLt/g8xulelDDhC1nmRK2Ck2ArPDcGmZZc/dUTR/obkAFkEvNNC9xs Typ11cyavRs20TV44ufkt1n8ig1vJNP3NTKmIDJUjHgw49GmOLV7WVjCkTX+3RXpBNkJ 96/HoGqtler9diU1K8wrcY16RftVmmVyoBahTrBfRweXENvbrQDT+GFMlR83meb5bl2W UahjO4K2ztu3qiTXU23SZ6z8QARJ8eToUICrl8W4VjlhTYVMlCsgQo3OsRFFe6Io/xic edQA== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alistair Strachan , Marissa Wall , Sean Paul , Prabhanjan Kandula , Emil Velikov MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Prabhanjan Kandula Avoid additional drm device open and close. Cc: Emil Velikov Cc: Sean Paul Cc: Alistair Strachan Cc: Marissa Wall Reviewed-by: Alex Deucher Signed-off-by: John Stultz --- xf86drm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xf86drm.c b/xf86drm.c index fe822ca..2c19376 100644 --- a/xf86drm.c +++ b/xf86drm.c @@ -750,8 +750,8 @@ drm_public int drmOpen(const char *name, const char *busid) */ drm_public int drmOpenWithType(const char *name, const char *busid, int type) { - if (!drmAvailable() && name != NULL && drm_server_info && - drm_server_info->load_module) { + if (name != NULL && drm_server_info && + drm_server_info->load_module && !drmAvailable()) { /* try to load the kernel module */ if (!drm_server_info->load_module(name)) { drmMsg("[drm] failed to load kernel module \"%s\"\n", name); From patchwork Wed Apr 24 17:08:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10915301 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DEEF0922 for ; Wed, 24 Apr 2019 17:09:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C7F4728A77 for ; Wed, 24 Apr 2019 17:09:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BC44428B81; Wed, 24 Apr 2019 17:09:04 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED 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 70FA928A77 for ; Wed, 24 Apr 2019 17:09:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B253B8925E; Wed, 24 Apr 2019 17:09:02 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by gabe.freedesktop.org (Postfix) with ESMTPS id 943E08925A for ; Wed, 24 Apr 2019 17:08:55 +0000 (UTC) Received: by mail-pl1-x644.google.com with SMTP id f36so9584015plb.5 for ; Wed, 24 Apr 2019 10:08:55 -0700 (PDT) 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=Kw97zKx6ijTQMTY8hmHHesW3NQxmgImJerDwv67tN38=; b=GaMtMyy3GtjnTL7Ke4s1gYBuYk/uzGJrlDzvr3vt1+6lhc8msNGMhHUfXbka8nV66k cyHsAcQfcYnHs0rEcnQvTg8TGkgA37BpXWuiy2CpUo9vOAsJyF6CRQmxVl8KZgkx5T9z H2MZ3fhQ+31iPBHd3gJlly+2jvUGXgO6vTaTUt/8R1PVNJO4BhbqtgXu9CLs+02Jl701 4DHOV2lFyVS60/vGkPy7+8SZ+YJHTlzoN7aSdYMG2YYZbE87/1T6B6fEm29MoWdbrSXy azJZIJrT1uRkm/NBVx9n9WbIZXXEar66IIMx1wxiWmjvpCPEOtj83qKgr6dq37B1S4BK X7Uw== X-Gm-Message-State: APjAAAXXhVUpHYVAaA7oT2vv033jA2XLJeS902po7kJ5UAGkcn+YIfM1 xaLFOn/v2ptWoZxHAs1GG+p16GslJ94= X-Google-Smtp-Source: APXvYqwhHdrTPysllqKY01CrRcX42uZ5LMg1LS+AWQN+Z0rDWHtrXQjq/viL8bTkPk0mhwo/gkY4dw== X-Received: by 2002:a17:902:854c:: with SMTP id d12mr33870818plo.150.1556125733827; Wed, 24 Apr 2019 10:08:53 -0700 (PDT) Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id e4sm4425073pfn.185.2019.04.24.10.08.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 Apr 2019 10:08:52 -0700 (PDT) From: John Stultz To: dri-devel Subject: [PATCH 5/6 v2] libdrm: reduce number of reallocations in drmModeAtomicAddProperty Date: Wed, 24 Apr 2019 10:08:40 -0700 Message-Id: <1556125721-32145-6-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556125721-32145-1-git-send-email-john.stultz@linaro.org> References: <1556125721-32145-1-git-send-email-john.stultz@linaro.org> X-Mailman-Original-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=Kw97zKx6ijTQMTY8hmHHesW3NQxmgImJerDwv67tN38=; b=AvtakVJH9GjFvEO+6pYWMVfAjWin/3isimRi8bNIupS7xQS2R086ojvSWT5/JMoUga TdMbBDjeQO++m5sXUD2v2KMllYuyzhmcla8PtPgbQvWIIwyhuBnyQWXnJLUKXZVe3pn7 8qXHdzWzMEcPNNwIswKCobouemNbOOUboL8xSD+uk+VE7Sl3vxXEcX74+CssqhtEDeiG SCRhvaGXYXW+cg8EtPhsyNREuN2ET1pZqdoQFmmy0Qe/1D2MlzQsGgNgCrRH5vhzvCim x81EwAavDstySkCOZXM5YIWnfnIahBhZbXprjLAwZosiklnQl6GJzv8SMtFtOUcGZO2T eMDw== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Adrian Salido , Alistair Strachan , Marissa Wall , Sean Paul , Emil Velikov MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Adrian Salido When calling drmModeAtomicAddProperty allocation of memory happens as needed in increments of 16 elements. This can be very slow if there are multiple properties to be updated in an Atomic Commit call. Increase this to as many as can fit in a memory PAGE to avoid having to reallocate memory too often. Also this patch has a small one line perf tweak in drmModeAtomicDuplicate() to only memcpy items to the cursor position in order avoid copying the entire item array if its mostly empty. Cc: Emil Velikov Cc: Sean Paul Cc: Alistair Strachan Cc: Marissa Wall Reviewed-by: Alex Deucher Reviewed-by: Emil Velikov [jstultz: Expanded commit message] Signed-off-by: John Stultz --- v2: Improved commit message --- xf86drmMode.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/xf86drmMode.c b/xf86drmMode.c index 8f8633e..c878d9e 100644 --- a/xf86drmMode.c +++ b/xf86drmMode.c @@ -1259,7 +1259,7 @@ drm_public drmModeAtomicReqPtr drmModeAtomicDuplicate(drmModeAtomicReqPtr old) return NULL; } memcpy(new->items, old->items, - old->size_items * sizeof(*new->items)); + old->cursor * sizeof(*new->items)); } else { new->items = NULL; } @@ -1322,12 +1322,13 @@ drm_public int drmModeAtomicAddProperty(drmModeAtomicReqPtr req, return -EINVAL; if (req->cursor >= req->size_items) { + const uint32_t item_size_inc = getpagesize() / sizeof(*req->items); drmModeAtomicReqItemPtr new; - req->size_items += 16; + req->size_items += item_size_inc; new = realloc(req->items, req->size_items * sizeof(*req->items)); if (!new) { - req->size_items -= 16; + req->size_items -= item_size_inc; return -ENOMEM; } req->items = new; From patchwork Wed Apr 24 17:08:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10915299 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0377A161F for ; Wed, 24 Apr 2019 17:09:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DFA1428A77 for ; Wed, 24 Apr 2019 17:09:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D3F2B28B81; Wed, 24 Apr 2019 17:09:02 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED 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 8160E28A77 for ; Wed, 24 Apr 2019 17:09:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7D4258925A; Wed, 24 Apr 2019 17:09:01 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by gabe.freedesktop.org (Postfix) with ESMTPS id 64E0A8925E for ; Wed, 24 Apr 2019 17:08:56 +0000 (UTC) Received: by mail-pl1-x641.google.com with SMTP id t16so9618858plo.0 for ; Wed, 24 Apr 2019 10:08:56 -0700 (PDT) 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=VSHWfn1d0RNfNqAGpfbv5d3OwNaRJi8ca2rT/Zc5NEk=; b=eay0H32Ce9AzUCmQEaEQmIzAX4QZxd/AMFLXB/JcTe0l/phFoJSR6/UeHqhoqaEAXP 23Pq/Atxp33bz8c102a2ZBfStvrE6sZ1W7KL9y7AhWwPdZlTE/TWz0uhjf4GlkfGlmpS 3/tH6efK7YmVkoDhjISLAUNYMfzBFYxm08ulq/hTqIF/rc65IIA2L5yTiy6TlGTT4NeE Tbs8352r2X3vESW7eISVTguX01wAqHC3RD98FPMfEro+dxf5y6AHes8ol/CKS3vuJH1S rlBL1t1U9Ux//dsnwe1fOR5kglbgTAzEM6u/gL7gmbdyRBEeE3+RoH8OFbusz6uefyNp 2zcA== X-Gm-Message-State: APjAAAWs271YriTT4qQc8ZRzwkNPnr8sl1iAKe9xyeCTx/M1ixepnjwd ZW+yJYeeBsWmsDNR5CA8vt2UGxI72Ik= X-Google-Smtp-Source: APXvYqya7QwTYvCVYNxVYj9TE2uI8RZOlmI6lMrmiMVC1ZlwS00hayspHNXIurFX3UHZmDrtrTzCbw== X-Received: by 2002:a17:902:d83:: with SMTP id 3mr34793889plv.125.1556125735424; Wed, 24 Apr 2019 10:08:55 -0700 (PDT) Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id e4sm4425073pfn.185.2019.04.24.10.08.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 Apr 2019 10:08:54 -0700 (PDT) From: John Stultz To: dri-devel Subject: [PATCH 6/6 v2] libdrm: omap: Add DRM_RDWR flag to dmabuf export Date: Wed, 24 Apr 2019 10:08:41 -0700 Message-Id: <1556125721-32145-7-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556125721-32145-1-git-send-email-john.stultz@linaro.org> References: <1556125721-32145-1-git-send-email-john.stultz@linaro.org> X-Mailman-Original-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=VSHWfn1d0RNfNqAGpfbv5d3OwNaRJi8ca2rT/Zc5NEk=; b=vxVNkJrzIVtdHtmMwZ3jt6OoA/lcnXukHd0rCfOL7ZM2arNygI0Mwg/u+IKAt72foe FlNB40hlZ6qKhUZ1zs2y9KLXPQs1Rj9JUps99x8/a4K6ccvFQVZNVLxceaqHWVWaHwcD lt7v6fApzW+17m9MmTkFAScWaBhX8//c6I89YrFe6WBRAkEtkM5n418yXo8g9sD8hBO1 tc6iiAGvVBXvmqtmkljbddL2l+D+84Z7fJXkJpf0eYJTdwxjeLghJ/s4OfFJw/F3l3XA LCrUztQ6ENwwPe93xuWCfHn1ByziNE1qDM85WOfNUf1T4X14xYZpTkSA2Wcq0wKHL6e5 xoNA== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Praneeth Bajjuri , Hemant Hariyani , Alistair Strachan , Marissa Wall , Sean Paul , Emil Velikov MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Hemant Hariyani Allows mmap on dmabuf fd with MAP_SHARED and PROT_WRITE. This fixes boot failures with Android (likely w/ closed source user-space drivers) that were caused due to mmap() returning error. Cc: Emil Velikov Cc: Sean Paul Cc: Alistair Strachan Cc: Marissa Wall Signed-off-by: Hemant Hariyani [picked and updated commitmsg from http://git.ti.com/cgit/cgit.cgi/android/external-libdrm.git/] Signed-off-by: Praneeth Bajjuri Signed-off-by: Alistair Strachan [jstultz: Tweaked commit message] Signed-off-by: John Stultz --- v2: Tweaked commit message --- omap/omap_drm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/omap/omap_drm.c b/omap/omap_drm.c index 3aed4e0..ffacea6 100644 --- a/omap/omap_drm.c +++ b/omap/omap_drm.c @@ -414,7 +414,7 @@ drm_public int omap_bo_dmabuf(struct omap_bo *bo) if (bo->fd < 0) { struct drm_prime_handle req = { .handle = bo->handle, - .flags = DRM_CLOEXEC, + .flags = DRM_CLOEXEC | DRM_RDWR, }; int ret;