From patchwork Sat Apr 20 04:24:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 162543 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp170052jan; Fri, 19 Apr 2019 21:25:02 -0700 (PDT) X-Received: by 2002:a17:902:7d91:: with SMTP id a17mr7576552plm.338.1555734302490; Fri, 19 Apr 2019 21:25:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555734302; cv=none; d=google.com; s=arc-20160816; b=QseiHM12o2iSWPEwkAhnVmRUhqs6bZNtM73CPAnvf6YsXCC9je1TJFfZWRjdyx9o/5 GKyi9KyKDE7aumBHyURgNPSVWExynJjN7eFW5XBZkCJXppE8H6vOIF/WPg+VVRfAWGaN SYsqDd4yn1EN8DSRns2XSB3deBHpJmRORND73B51S9I/Np5YYgx6KEcM8VbVXSskCfnG DsMr2w7ihiRPO4LkO0RBCRVf4XAgsMYwYFbtAoH02y2kvA8fHUizZQnttF1H97KGaBgg rwBstsCdXeFVMnhoqy1Ado7vBlO3tlqoPeoveTIrzxjoCz5H7P7ZKEsgdEPKOqCRr8oI j12w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=8GlL8e7dydduT1qq3AnMjS2RKGc+UfMUnizCaLTad1s=; b=Di0P7Ab8j8Hh+94bYtxcwoK1qfQwn278shA0MI3mzQinv8rGtZ+q3bLWyglWF7Zcvi ANcCle/QrTo4Z1fnrIVVdI82a1zWKtgPsu/I8gAm31SMbdduvAfRJZwd+pwQccjYY3tQ Ugf3/x3JPmPk4pLyYALWeR1FnPBWOefBAg2xbiImAmt76XVzpk2TMEngN/peFZWVodi7 BFJSaZEA3xGZAUCp0E4D2jSRzHDqUJsliAOFE7ZepPLaMbtzjO/dQTfi4HdR/b8Mo0oT V9gnP9ocxlyt8JKof8D9UuaDQEjlmvG2ogtZvsw5RLL5uu97Xw8uAPjsOf4b1ssyVsaX K56g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Yjm1qHnL; 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 a12sor7181896pgw.35.2019.04.19.21.25.02 for (Google Transport Security); Fri, 19 Apr 2019 21:25:02 -0700 (PDT) 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=Yjm1qHnL; 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 :mime-version:content-transfer-encoding; bh=8GlL8e7dydduT1qq3AnMjS2RKGc+UfMUnizCaLTad1s=; b=Yjm1qHnLZ9RFX7UJ7bDH/v43stBnD9hvseu3lguDQGuQy5Knw4tIepOwhlNNlP0nRu Nh+Wk6orD92XJ3bR4NktfvBn4ASRljk7rBaupj3ejCjpnD529ONyP2c7rQNM7ccFD97a mjITWWc7uPjrrUYLXPSlioJN5Y0iznPt2t9+aQ2VIEBvVBzqcfnFwyN4JinMjwgucS90 6NfVgTOrHFFoZtEvAFdh3EZGS+1MBHF1uvBkgopB6rb0k9qIuXljZVCeteVDb8HxMeeP rWYqoH5mkp1WNf2GLUSh1TjsIizhUt9Zn5yJKdFSM6Uf4TxSzp97U4n8jfWa6aa/o+Bw VJAQ== 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=8GlL8e7dydduT1qq3AnMjS2RKGc+UfMUnizCaLTad1s=; b=SXCIP1C/Lix/vtd+09m/W0r5RqEsIj7NJLJtcP64AJzLr5wxYN9ZLH5GagU+2PENQi 9vqby+SzfAM0fgGuyq8tSgCAkXUl2K02NgSo1yfbNaHLIOBe8EKevc+EemM+3HJojzxK qbSQeTSR6uSXYsD7c6apaBqPMweSy0BFIklR3juhya2H67OFNQv56XvVlMW04z6kSg9b EPYWh4Ox9DMVrq4yRGiCBwXRY3yXE6rUSG1ch09Gut4kqzAd1TaIhqo0574Xrr2mNzyw 4xqMUnd34dn+paJ0mMDV0Wh3FLp8zUswsfl01MIBSwYNd2Uph+pAJ+sSpae86zHfCkBc 10Fw== X-Gm-Message-State: APjAAAWFO0hEoME0lvxJHGhBzu/pa0LaZc9XOFIg4HRh2e9ZZol2hinf Jcv1G1AqYW2nNFnh28mj45LAtODG X-Google-Smtp-Source: APXvYqy8aFkZeFV/M4PHlMRXVlYrPI3Ajpeftkj0AZU7bhp0qbZzLSAaqooBTwWBANoH31r0ibOM8Q== X-Received: by 2002:a63:1852:: with SMTP id 18mr3458321pgy.283.1555734302058; Fri, 19 Apr 2019 21:25:02 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id i1sm15578372pgc.63.2019.04.19.21.25.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 19 Apr 2019 21:25:01 -0700 (PDT) From: John Stultz To: dri-devel Cc: Sean Paul , Emil Velikov , Alistair Strachan , Marissa Wall , John Stultz Subject: [RFC][PATCH 1/5] libdrm: Use mmap64 instead of __mmap2 Date: Fri, 19 Apr 2019 21:24:51 -0700 Message-Id: <1555734295-31015-2-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1555734295-31015-1-git-send-email-john.stultz@linaro.org> References: <1555734295-31015-1-git-send-email-john.stultz@linaro.org> MIME-Version: 1.0 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 to use an offset in bytes not pages, as that's what mmap64 takes. Cc: Emil Velikov Cc: Sean Paul Cc: Alistair Strachan Cc: Marissa Wall Signed-off-by: Sean Paul Signed-off-by: John Stultz --- libdrm_macros.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) -- 2.7.4 Acked-by: Alex Deucher Reviewed-by: Emil Velikov 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 Sat Apr 20 04:24:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 162544 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp170066jan; Fri, 19 Apr 2019 21:25:03 -0700 (PDT) X-Received: by 2002:a62:be13:: with SMTP id l19mr7951678pff.137.1555734303774; Fri, 19 Apr 2019 21:25:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555734303; cv=none; d=google.com; s=arc-20160816; b=LumQ18HwsLPR9zsuJ4y4qxqwB7w+YWcXCN308gOgowHlrJYq16v805/m+XVbF9GSzY QBYRex33tS4FKUw0gVdQNnAIjh3c4wFQQYHQZLbF2GCMU6whx0XahbzgAMS7ZSFVGU7b dFTHZVvwbO8aYGWA/sZbylBqTo9zAybOUOqT1FN9Ib2Nxfik6oExPoqQha4WAgeSYZcc mAO0zkJVXtQyvYLQ44d/MrDgNcA/aeDRMyyx3xQK82tftnxF+bN7LX6xko2FI07OjSIa a+0vWP71bexbSkDiH8/Li8JSoUPDMEcY13ysmNzkrL2ZoOCwte5PaONE7AyH0yZbWDDI 110g== 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; bh=ICzolK1vGHJtMx6aiA0wVAu6ysqyrhnjQX3IXkGcMrE=; b=No1FFcDimvcqfpe8AFk4Itv8fayBBTPQNaBDgZ9JD6c36TRS2UAk+t3p8LP7FDqKQ6 G+DAn2SaaePttCzOTRXxLoCC7P2/deSmtF94MOqOp2QxsgKC7f4FecHn4SVBLZLUC36/ dzjBnnYNN+hhKhrNT4Bh3Z8uKAAqEX2D48jNZAjUbhEfmpvO/F4EW0ZiI4vM8UhFmjsW 4ykQd2/kWBkl1glh8bQ5DVa6AgjnkNUDGzBlfxEF1qWYAuVVXlzWJbyg1yl3MROyfkDQ ZFnSrHzHusKsrLhvGl7abk4IzcE/gIQczRoUn8JFWQF/zebED1UqMkZN/e3njC5zffd2 HvzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CKMhLwSL; 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 c193sor3788777pga.4.2019.04.19.21.25.03 for (Google Transport Security); Fri, 19 Apr 2019 21:25:03 -0700 (PDT) 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=CKMhLwSL; 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=ICzolK1vGHJtMx6aiA0wVAu6ysqyrhnjQX3IXkGcMrE=; b=CKMhLwSLxlJln343f+Yw4Cb5B9/clLRibP9DwzobpAnnjIn3bryQhG03fS7pyJYkb5 pLETLuuMIwLe5I6Ud8Jf0iuR9elhyIZCu+OeTLT3qYXASyQsIVQTjCxdx6SgHJ2TnC4D E8LElMIWXxi8baoivDSPVSybxER5ozNAHpbCZ0tqRLIqK98NbQb/dQSPxhZBXGt8IlID Io0Cc/k0zt/xMCb+9LSG+Fz9er9R6or/W+fTssix8COexN4vPuMZoHB855PXmiDLfXGX AFv6froD0ST2msChKxsVEzgO48pvwxz7cna5OBAuHLs4EdapSl8hJ7kJj4qW622WcIFC pPPw== 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=ICzolK1vGHJtMx6aiA0wVAu6ysqyrhnjQX3IXkGcMrE=; b=QXoWg7nIQ4z1YIXzsbNXADJPQsBn8BxoEHXZAHtetzmUFdhCIYNSkOv52sA4rZpl2P UUe0ywG6mFDPctW5qLpH4SDokHOy5h1RLTBUJZyp4s1pBacbrSAsD7pR93nJsi9yCs69 4wyP8Jn8UC8Eq0lfS05Bqb73/Ofc7yvcaArPSFOFpr+3yI0w1PgPArohhb88Yw9EfPzb KUHtJR34J+ff6FuLVWcKfZauS/L/Q2vLyDpyoeXUnm+KdOMLrhs8CWO0K7ifmmG5P4V8 WI9XMernDRU+U2WOh/tKXugGYch/zkq4cf1QG6LW0jSwF3MN0yYRXjrAXq7gz90dfYmZ rEug== X-Gm-Message-State: APjAAAW58dZyFbwQF7nm2n4IHE+E7falHXfHWSrL9jzu5TXFlQ1KmSzz ZzrRrTDuT4akM9QkOzeMcEP1Fsctftjd5g== X-Google-Smtp-Source: APXvYqzvzUK7tYAwxUlFHku8ef7NzrL8q1SF9mrFniWhDD9qw6573m0t7MTD92jX/0EzCWbRhCUA8g== X-Received: by 2002:a63:c749:: with SMTP id v9mr7457861pgg.432.1555734303382; Fri, 19 Apr 2019 21:25:03 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id i1sm15578372pgc.63.2019.04.19.21.25.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 19 Apr 2019 21:25:02 -0700 (PDT) From: John Stultz To: dri-devel Cc: John Stultz , Emil Velikov , Sean Paul , Alistair Strachan , Marissa Wall Subject: [RFC][PATCH 2/5] libdrm: amdgpu: Initialize unions with memset rather than "= {0}" Date: Fri, 19 Apr 2019 21:24:52 -0700 Message-Id: <1555734295-31015-3-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1555734295-31015-1-git-send-email-john.stultz@linaro.org> References: <1555734295-31015-1-git-send-email-john.stultz@linaro.org> Clang complains when initializing unions using "= {0}" so instead use memset. Cc: Emil Velikov Cc: Sean Paul Cc: Alistair Strachan Cc: Marissa Wall Signed-off-by: John Stultz --- amdgpu/amdgpu_cs.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) -- 2.7.4 Reviewed-by: Alex Deucher Reviewed-by: Emil Velikov Reviewed-by: Christian König 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 Sat Apr 20 04:24:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 162545 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp170076jan; Fri, 19 Apr 2019 21:25:05 -0700 (PDT) X-Received: by 2002:a17:902:5a4b:: with SMTP id f11mr7636226plm.211.1555734305163; Fri, 19 Apr 2019 21:25:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555734305; cv=none; d=google.com; s=arc-20160816; b=deMQlKAUaC161JSMKnYCORdZ0iryt0EdCYj3EEv0QLpZdTZo0NzOjAsZVShXyfgFJJ 81Ka+lnZApFQVSc4VofBUnwZMqKBht2j6nN4EnmBhO3bjU203rmonN+1IlwBx8CtbR0u EMjdiB7n4uaNK6IkjwuNLkTHau55QLuauuXAPElfDlbuFgvW/6wFLMd7sIx2op3o5N32 va8NimyWNLwcUhGOLdcrQbOjyoyNCPoqlGCE7gTsV8+TUeVc1KTwu3tk5352Kj5emp/S 1yHGRk9lbQM1VbQhO50xvCr8MA1/yWVDihB7lC77VoXIHpcRZKO08BMsX08NSCTbo6E0 YPmg== 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; bh=dFUdtdP/ypVic56bhSTqPu40xHoF+qrMfw3zZAVOZk8=; b=V/k6e0N+2SWT5glQG4taySG6rbqP14nJoyKOa/JhUmQi93eFyWIUOym9109lv3Lh4N zACTM8WObpxbSlF5AQIEGFY4fS92P5IHGkEdyC8LKAbbYOQ84lxGK1q4Vuf6I4QAoDBp Y0zVS44CzN7/9P5/hj7HyRN7lPimVQEYDgXamrlE01pRWwyl0Zwnt5BcsfNh3lXDU2Zf TA1flJD2QXDcPEX0XlkvyL6dBzBnpZZw/ajA/5T3gQo8Wwav+2ZCpnKeQh4UUuHd+ST7 uytR9tM2OXz0dB5hcamJzmZnUTUULMgzjvmkWvjbz/SzWFZZFl2k491WuT1DBb2aySNl Om5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="dd6u7iM/"; 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 b2sor7863001pfj.12.2019.04.19.21.25.05 for (Google Transport Security); Fri, 19 Apr 2019 21:25:05 -0700 (PDT) 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="dd6u7iM/"; 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=dFUdtdP/ypVic56bhSTqPu40xHoF+qrMfw3zZAVOZk8=; b=dd6u7iM/QVJ5VAm6UJnHZxkfAjOpHILyOTbtPEWF65RYD7E5Ac8U5JE55Z+Fv7//BI Gv3hQ0Uccznvvg2k5gJ8C7R7CuE/D5ogDm3rAWjBXD+gqajonvhFiSB/J+CgHCUQAQOz fTJZakA/A7/U0zynMiqPRagsUG23f03752uIZVHLCYxomjKFWY1eYDhrUjmmn+/XHYeE xfxOzP/qJybiWvZC+H+2/RE3F3XNeVoS5aUVHcksk8ZpLuBxMt8P1RGZ4oU7peTI7Qtr Nv9ehYfAoX3G0stG5tOBki9Z0oIjywcXIcSiay94WHZDBlKov9kk7XukyztLk7Dtd+2Y hn8w== 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=dFUdtdP/ypVic56bhSTqPu40xHoF+qrMfw3zZAVOZk8=; b=cfU/ew05MFZruKaXzTLpLnxD0htzymnwLloC/94keFiSaANn1s/uXT+qgF6kJxY7Kj HjUotiVBZb11bTQJAmRkIBTWfNJyZv+v4ukThRDwgiJmQJGM6RIXK8EX12p4078iAcqJ WV3NnfZ16CE75zWGyzx6VziUh7/9EZMpzoauxpQ5oSf1sDBwvEvUHI71odk51ZGzufdc 6T1cX7FtMMGGhMUcGhov5PAQj1SC/PIKv6U95pqihnqcHbYxleqYHTvVjyTsJK0x+BaB guFeHGRrj2jfU25gxJ0f9q8YV0yflYyhvPfvRL1srHyb92yu+X5ZAZ0aUvzjO5E8SuFH iy/A== X-Gm-Message-State: APjAAAXs4/9cWq0tOBi2D6nv8ntuar7zqdl516bAUk6w6qx09HCpCjhG mYAdvvzK2p1jHc/spJX8jdXBcwva X-Google-Smtp-Source: APXvYqxyJMGxPyEJWj+txeYPF1zs21vUhkg5OgOuypXpRKFogp/aiyoij9kmZx8dmSS+xibCcMa0eQ== X-Received: by 2002:a63:c746:: with SMTP id v6mr7430567pgg.401.1555734304796; Fri, 19 Apr 2019 21:25:04 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id i1sm15578372pgc.63.2019.04.19.21.25.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 19 Apr 2019 21:25:03 -0700 (PDT) From: John Stultz To: dri-devel Cc: Prabhanjan Kandula , Emil Velikov , Sean Paul , Alistair Strachan , Marissa Wall , John Stultz Subject: [RFC][PATCH 3/5] libdrm: Avoid additional drm open close Date: Fri, 19 Apr 2019 21:24:53 -0700 Message-Id: <1555734295-31015-4-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1555734295-31015-1-git-send-email-john.stultz@linaro.org> References: <1555734295-31015-1-git-send-email-john.stultz@linaro.org> From: Prabhanjan Kandula Avoid additional drm device open and close. Cc: Emil Velikov Cc: Sean Paul Cc: Alistair Strachan Cc: Marissa Wall Signed-off-by: John Stultz --- xf86drm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.7.4 Reviewed-by: Alex Deucher 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 Sat Apr 20 04:24:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 162546 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp170100jan; Fri, 19 Apr 2019 21:25:07 -0700 (PDT) X-Received: by 2002:a63:c54a:: with SMTP id g10mr7377302pgd.71.1555734307396; Fri, 19 Apr 2019 21:25:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555734307; cv=none; d=google.com; s=arc-20160816; b=vXgFQ5ZhsSCpcfSLyu/TqlBtXCSKNef4YLa5roPvg1Ilq7bw8B0F6O50s3A1/i7fAv /YYadg/GwnBz7qcPTkzVymQrkeijN7AXlVjW8AVbDQat54REG0PigE0pFodt9JuWOoaz CVVMbu97Wxlyy0/TlEz4/ae+KvD7qnvO/8yxaVzLMeO3qVJ6FFS3sGsp5rBlKZOh8exo AbSEn7HB8T9Ql8QQzjASM4FELxcmSwuBzbG3AvQqOg4B9ADowWRYe1Y7WGV+Mude+xDB nGZ7ZAKZQOQBr6eBH23q+k76ph8NHf19y4qQpim4SVmq3gHPsMPsS2Jeiig4jg+cme90 M3yQ== 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; bh=O5k3Wm3IwUSsiLjZy8zGeLHsxYBqF2V3pMzYBlwtwzk=; b=pkyAL7oQJxvh3lRisJhXtQFZ5DbuIH4IaNC73ZsGqWcHijv4F0F9PgU0YzuSE4I7KX TQdThv7Im9H6Q71B2QvQpjkOT3rdRc7Bm7wgRkk6UMwU8p24z0+RjECOjP5jkOoUY7S5 gM5Dt5G1mPBTbaJMfuddffcRx1m6i0bl3Tps1OLBXAC3lpAV/G+e5YvPk9KWQcJjamvl P3HhZN0WT0P5nkD+138FJ3oihIJ4voDVIaCMCkm08gP+eL7U0+DjUq73T/wAq1BsT3IE Hf2nzJ9lKZP4uwIBenLdtdjWQtSztr9Str5ObgStpVX4G2Bo1y6fnuTIQoIln9gSfHKA 0++Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="s/ag80O8"; 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 a12sor7182053pgw.35.2019.04.19.21.25.07 for (Google Transport Security); Fri, 19 Apr 2019 21:25:07 -0700 (PDT) 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="s/ag80O8"; 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=O5k3Wm3IwUSsiLjZy8zGeLHsxYBqF2V3pMzYBlwtwzk=; b=s/ag80O8omLYdoFpDuV4OtsRmTWhfBqGUE1rrt5WSKubsAptPyLGsF21ISP2Bp+V3g Oh5k0MRjRcAjf3fLCvbpa/KbX5syw03khhvfkSXlvmE1dCh7fFY3jKpSeZh/wxGjR34U qXaY1gebAGXFUW3Bp6N7Uym3VWnA9nC4193b6ZSvE/7sclMSogEh/5lah/aKZ3qLjQCs S2+/+7MZ8jGaIJ2E1Ad/2JAD5oyAP05+CVdzw9Q226n74XctubE9ZAmsRPhBw2GdZ3Q7 2SgYVZwYrrMh8YcyvWCt3hW3QZk2f1r1MLscbRzcnnZ3V2LZ08WVY6khpwWoNjJAfSMU SksQ== 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=O5k3Wm3IwUSsiLjZy8zGeLHsxYBqF2V3pMzYBlwtwzk=; b=Q1Q2A/fGgqcaMpJXY4K03PxeY/dmaLsx/CbTKnqIF9eSP05+qyN5bYSu4q8Gai+5zg sMLJZwXeIfAk/H8htVgej4+VlxJEgqu/09EoH0FSRP3YE8QKdEtCgN9MLDIbOWNBQfSe FdIxopwGI5zCUCVkoWlV/Ge38YvZIRDcfrKeXrawiy2Qe2E/CGdmUZrUhWC/dYYGNZNL SDMeiYNvtqL7cgc4a7B1j7YdY4nQPB41bn/JZxzSBPUNW/MgNUjLNsyJiiKu19chRzY8 7Fmo4U5Y8uNOpRmbnfS/5JAOXCwaLUxkIxZuwqEp3FBWkejx9oQfyb9ZXyD96DTsImbG uTcA== X-Gm-Message-State: APjAAAWzN07Iyi40GzNbqLG0SXwEtCAotSxW9BSuZTFca8heLubKJBSb lnv/isVNmUSQQeYN1vVO8Ig0HOKG X-Google-Smtp-Source: APXvYqxmp4tlwEwD2UHhnCCkSjipGk2Uqo/Mx8LoKXBecfh5u8rWoPjImEpawZFMQua9AhfHeBfxZA== X-Received: by 2002:a65:5941:: with SMTP id g1mr7507570pgu.51.1555734307030; Fri, 19 Apr 2019 21:25:07 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id i1sm15578372pgc.63.2019.04.19.21.25.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 19 Apr 2019 21:25:05 -0700 (PDT) From: John Stultz To: dri-devel Cc: Adrian Salido , Emil Velikov , Sean Paul , Alistair Strachan , Marissa Wall , John Stultz Subject: [RFC][PATCH 4/5] libdrm: reduce number of reallocations in drmModeAtomicAddProperty Date: Fri, 19 Apr 2019 21:24:54 -0700 Message-Id: <1555734295-31015-5-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1555734295-31015-1-git-send-email-john.stultz@linaro.org> References: <1555734295-31015-1-git-send-email-john.stultz@linaro.org> 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. Cc: Emil Velikov Cc: Sean Paul Cc: Alistair Strachan Cc: Marissa Wall Signed-off-by: John Stultz --- xf86drmMode.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) -- 2.7.4 Reviewed-by: Alex Deucher Reviewed-by: Emil Velikov 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 Sat Apr 20 04:24:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 162547 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp170116jan; Fri, 19 Apr 2019 21:25:08 -0700 (PDT) X-Received: by 2002:a63:155d:: with SMTP id 29mr7349861pgv.389.1555734308773; Fri, 19 Apr 2019 21:25:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555734308; cv=none; d=google.com; s=arc-20160816; b=Fli3n3b/BZieHGYrJPrZqAIHyiY/qfyZgOLgzxyO/8kYtajMfeMVIt+4OMuh+p/jan In/6PSe7IWzGYVDsOQGjQ2IQy0Zoe/NgpyUzJ/MdVR/L3w0OpB9BkGOEV7tObFibEMNi udYh/lzy4ZY/oKCI1++Db7Eyp1j9/KC386XDWf0pSFVzGNSbGK4DGtuwTt+/rL3EYFd8 fB9RBvmWJDDeVVq8jCj/dM3ufFmdY9M5JNlln2HdnOkEp2UlU2/ugbYi2AwiJCXcUXWx Qui3DWW7dvzRWAt0ZGZoS7/BcArwTcYEFgCuUq+7bcD/FCSgVx22JzZXAg2pjYeT0k17 lF4w== 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; bh=EK81QH2GNQAqa9nToty5xa9jzrO3pRv0tX0BTrEk+r4=; b=TgCgFLjcR6ZMIUxnH4vHCk9DdQBXRgewYWtvXimF0Wtp9dBrNdbN6Rutl+boG9TJSi ULMpzQdm8Twlvjrqg55oHKei0MaVouvmVu4LGz7SagIpXDFmPIv7Kq68bsK9i+FhteJh X5ZiyC8EUhpK+bYqH4r0IUukhq4z2Lt58zpJRDeATe52Uk2ZqMZznd80QgF/PmyBDLe9 oWVrtx5qGUm/FONs5PFmfUUff6j5c8K7Y36TZduhQLfcPxGaGKRVJTkLMuz8jRrzvIoD 0Sxn+kkgoeP4P3+QnhffPznugT6yordqn7ylr4Go1TEFtJqW32pbuXJCDpXD8xSdd1j2 rNBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uYyjfPet; 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 31sor7038811pgn.17.2019.04.19.21.25.08 for (Google Transport Security); Fri, 19 Apr 2019 21:25:08 -0700 (PDT) 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=uYyjfPet; 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=EK81QH2GNQAqa9nToty5xa9jzrO3pRv0tX0BTrEk+r4=; b=uYyjfPetgdrnUyYMWYjOKjnOLLnx66tejMKfXTREqcv8Zg39GOipoGobqtSIUWx+gQ eQ3sq9x0OD4DsLy0fbYIzawc6upDj/t1eJy2twvzcT/V+JpUGOniclLb7zJgSmaSkGHJ iFuCLiSIUfZMwtOTBtxSyK7Vu2qWB+E55640vIFJz8n/kVK1TeUCTdAIV3sT9RR8CZC0 NjAzUK7ne22v+ZsB63dM8VINku0NBPhYF7X1QA4XUEGwD72/fnbb7j4VrRsePf1tXBHg iD+/HWMyPLtwnNoXLqgvixfxa3NvTkA5jIVCr8COZq5QpqmzQoe6FChPfokpGkM3bTIa Lalg== 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=EK81QH2GNQAqa9nToty5xa9jzrO3pRv0tX0BTrEk+r4=; b=SSotxABuduD4R/UONBm/pk1CuyIciNNr7pBEj6fEx/tckiu0eW7Pj5KMkVgqngXM3V 0PN6LFCGFvJXaeyuZtHAr9C6PGMyCQGpbkE6O54yFTq+cilEiY8SsdoWLBn8MbADX2AV 6HbRubPnuzT5jwdta4QPHxCYPRI7vCzJrO8MchvIZbLnBPD88BSFw+AQA6s43qJWti9a WB8X7evYEdE5J2RuTomldmLMwQSy8SxBOzMVG2KjxLdPd5mVrW4T/o0YhT045OrlCnyY VOVqSa9h6fRYcsbTOBQbL+i0Gb6R1WME5DUn3eBtkc0MJQKncGSxflDEfj4XpdtM/g+e s5zQ== X-Gm-Message-State: APjAAAU0G/NsEa7IGBg8lVwElkdaEg2Bz5YUyudiFPT2RpiyTnkenicQ +io/YMekQNVTUmvt22uIgbNPvNVQ X-Google-Smtp-Source: APXvYqznXQbUsgngbP9puaZoTUdLN+9wh5M2daoVxaIqKArGae2Pa32sU7Syaq5zs80IDPvax2Hu8g== X-Received: by 2002:a65:410c:: with SMTP id w12mr7538762pgp.268.1555734308363; Fri, 19 Apr 2019 21:25:08 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id i1sm15578372pgc.63.2019.04.19.21.25.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 19 Apr 2019 21:25:07 -0700 (PDT) From: John Stultz To: dri-devel Cc: Hemant Hariyani , Emil Velikov , Sean Paul , Alistair Strachan , Marissa Wall , Praneeth Bajjuri , John Stultz Subject: [RFC][PATCH 5/5] libdrm: omap: Add DRM_RDWR flag to dmabuf export Date: Fri, 19 Apr 2019 21:24:55 -0700 Message-Id: <1555734295-31015-6-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1555734295-31015-1-git-send-email-john.stultz@linaro.org> References: <1555734295-31015-1-git-send-email-john.stultz@linaro.org> From: Hemant Hariyani Allows mmap on dmabuf fd with MAP_SHARED and PROT_WRITE. This fixes boot failures 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 Signed-off-by: John Stultz --- omap/omap_drm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4 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;