From patchwork Thu Feb 15 13:59:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 128428 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1778596ljc; Thu, 15 Feb 2018 06:00:04 -0800 (PST) X-Google-Smtp-Source: AH8x226ZXlflEgiM6WhHhUts4YjXDZ752XcoP7IGqCh3xrLjMKkS/PGmkKk6vmTNKbLGpQgn+eIC X-Received: by 10.99.190.15 with SMTP id l15mr2349313pgf.325.1518703204475; Thu, 15 Feb 2018 06:00:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518703204; cv=none; d=google.com; s=arc-20160816; b=x/S9eRR1nexHcj0Do9L3w6LrGLcbvPoexH842W/el0WubkyM8HTar2lZi77dUn+1jL aTe3J3nFGy45cdjEPKSBfNYWM2x6wN0MVonXlMvhw6R0XbDNglIUIniIGSDWVGdW+haa i+7Ll6VNCCD4kXGKP8eGyoIoUhA0TWF339KaAOQVZVCZtxUS6g5zsjA5G1RYhQaOFRAi GGFvJpVPDvaYHw0QL0SaDSjCYwRheFNP367LXdogC/L4lBylFIrkV6YJu+vQnWwolt6A l7/Ic6bSYpvlJ34koq2uIRw0vJGcV25LHTTkby1CU8HUTy4H5wcJw9x7NkVg9r76aVyE nGRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:delivered-to:arc-authentication-results; bh=JO7nnz8ElFHHO5oSKA2kDr0SPydM+q02rf40AecRTto=; b=TwoGyS2H7Yv0Qv1C92na3zUKOnqyfyCMzAcW+K2Jlfc8UN4sMdV13IkkOU+BWRYTha My8Bo4OXGf1XdINmvnyMGsH6vRuQMQ97Utp/XHrSwY6f21JveLPtbhbfefDcZ3FJ4WLo B6umbIxWp1W1TF0t6Dwx3mKkMMgbCtp0Z/sV0MuyHepYtN/d3ecXJXrWphnxOtCHZHMT bd4jOz4B2UnzcQ5vR8qTC9aTI2gsHu1MH0gK1HaV1LU5zs0jnUCcq9cLcjCRCxt3wRsV Pcq1voSrNwGlsd4+GLdJ24JLnfnSd8L5DU9Gh87RFchR+8DGKpc9i0FCsZbdG/kK85lB DgOQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id m197si1388646pga.206.2018.02.15.06.00.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Feb 2018 06:00:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1C0816E525; Thu, 15 Feb 2018 13:59:33 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-oi0-f66.google.com (mail-oi0-f66.google.com [209.85.218.66]) by gabe.freedesktop.org (Postfix) with ESMTPS id 486166E524 for ; Thu, 15 Feb 2018 13:59:30 +0000 (UTC) Received: by mail-oi0-f66.google.com with SMTP id x21so19097436oie.13 for ; Thu, 15 Feb 2018 05:59:30 -0800 (PST) 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=CHIWpcrP50wuGb/a4HhCH4ADcGpqYb/K2lzv7IEKJU8=; b=KGNM3INt4tCiaaClF5HI1qJ+ESs6dVBRQqkxn6NUeyKnTsXm86JZV/155WVAUj1H8U 3Ldpt4Mb3Yv7GA8BwoMZuj6t18XUwycW0BJMGz6aDufR6HX6tZ6cAH/EYa1Vazuaw0/z fCOfigjNfuAjIW4clrXoVRe1qKnHEcit2ToHrMp77bWWLo+EwpQKPNICin4dY6iiFiYn KuyvR2h598lvZfoxT1tKTiJZWMAPw1qdMmN8Mw6bHK3UO4/9EMUhBgJCWgzE7bSHsvGb svcAwEZHyOeIb9Zbe3/WRk2+max9k9eesuADiEzKrfBOcLu9voff+JJo5L5iSg3yVs3n H3tQ== X-Gm-Message-State: APf1xPBSzG9QSjvQRQDgmjr8ScExVkMjauF/Fdm7X8cmCsUDJezPQIO4 PxSFT9BH2qHxyyBKwodi+TXKYts= X-Received: by 10.202.98.139 with SMTP id w133mr1731605oib.282.1518703169252; Thu, 15 Feb 2018 05:59:29 -0800 (PST) Received: from xps15.herring.priv (216-188-254-6.dyn.grandenetworks.net. [216.188.254.6]) by smtp.googlemail.com with ESMTPSA id t8sm8677327otj.31.2018.02.15.05.59.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Feb 2018 05:59:28 -0800 (PST) From: Rob Herring To: dri-devel@lists.freedesktop.org Subject: [PATCH libdrm 1/4] android: revert making handle magic and version members const Date: Thu, 15 Feb 2018 07:59:23 -0600 Message-Id: <20180215135926.9502-2-robh@kernel.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180215135926.9502-1-robh@kernel.org> References: <20180215135926.9502-1-robh@kernel.org> 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: Robert Foss MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Const members are problematic for dynamically allocating struct gralloc_handle_t, so just drop the const modifier. Signed-off-by: Rob Herring --- android/gralloc_handle.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android/gralloc_handle.h b/android/gralloc_handle.h index b47bee191f94..b035e03566cc 100644 --- a/android/gralloc_handle.h +++ b/android/gralloc_handle.h @@ -51,8 +51,8 @@ struct gralloc_handle_t { int prime_fd; /* api variables */ - const uint32_t magic; /* differentiate between allocator impls */ - const uint32_t version; /* api version */ + uint32_t magic; /* differentiate between allocator impls */ + uint32_t version; /* api version */ uint32_t width; /* width of buffer in pixels */ uint32_t height; /* height of buffer in pixels */ From patchwork Thu Feb 15 13:59:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 128427 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1778191ljc; Thu, 15 Feb 2018 05:59:36 -0800 (PST) X-Google-Smtp-Source: AH8x226LkHDhJ8AEjd/BsccuSXTnyeAyo1LC5y7DoEVqOHotc6lJBbXF0srXpX+AmridnJeO1c1t X-Received: by 2002:a17:902:a9cb:: with SMTP id b11-v6mr2644873plr.315.1518703176430; Thu, 15 Feb 2018 05:59:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518703176; cv=none; d=google.com; s=arc-20160816; b=GpdZ0eLO6tDn5FKk6aMhVWPILNSg2MAFUx3pgBPAvXx0xfp7wAt6Uyi4cxccMODp/5 UFKOSlg0qp6BZ4LbHrhwP5Lpop8CX5A2l3nujwfw+yDrRcVFuLjtTNkiYMU6ZtHVV2jj OWTalGSQVRyIDNa7ylw46B8HnoClaGpxCeMAT21V4Ehk7q8YI6jd1pmnu5D82rSZ7KE1 rHJ8xhm7swdDfO2CrbRiTdJs8HrGNs1MtfTWQ4qoCcT30gjhcxMW3j9O/ThrTqIvzIfG rg02tNOZHloM0VquWoX/df4JxRBwo+GEyMPWyQTHIZ5q3ZUJ/+3aF47pC1aepkTFlEhe UPyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:delivered-to:arc-authentication-results; bh=MH5L+h00mCZ1KQsX8RB5F7EL5qSRebplTFIS8v/CMVw=; b=HztzE4byDmKMLlRxPE+4Ez2SYSXYxX9NRH2S5bnwm5GEFAf59d9Z9hmdq5hOfsKJRU s0f+qjUGSr2aSq8/512YUlkx9R7gRSYdrUUXZx2UKxx0yEQBsdtcQciiwsOWn/zpbXu8 pcc3XXew210d2WnRrmQ+JBphqZeduVnbghz58kLbf6mUon/9HE69mDSbSpk1IEIOC2PD DWlRj8xwNbgp5yHjxoeGDtgmQxVH2TCqawpSPldNM1DY8LN+vJ8W6NyrVhpzx9KXf1by 3iYCnlG3Hprb5NNNGByYF9ChPCtWSq3/l5KzIY3Ptj5IkXb1hy5Wu3899Fj8/rVLccNQ u6Kw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id o18si1284349pge.300.2018.02.15.05.59.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Feb 2018 05:59:36 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 39DAE6E526; Thu, 15 Feb 2018 13:59:33 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-oi0-f65.google.com (mail-oi0-f65.google.com [209.85.218.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 481386E525 for ; Thu, 15 Feb 2018 13:59:31 +0000 (UTC) Received: by mail-oi0-f65.google.com with SMTP id y16so1370588oie.1 for ; Thu, 15 Feb 2018 05:59:31 -0800 (PST) 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=QqT1h5P4E83PF1xN3T/G4BD3DFrXshSK/TrV8udhGC8=; b=nb7cOt3SQs1Q2REtX2AkT12PBSgEiYVDnfBUdzzZ7hGSJkLZAkigGH9au3J8PBNv1r wprfjJHXLwxerIROLSCtPi4RJJPXez+UWewiKx1AxRwDZtPt70K24ADJExjyRQAt76UQ HMFHyWwtvjDznrLjKpi3o558TJrpCA38HuCi5PePsVsnhfLnsmnU+Al1tw8khAYNwqk7 lBhFkQWXegbjLHYmG5gnpanubvBRGFv5QVHTD6x2oqCd/Eh+/+sYDxrsLpoRYpoH06XY It97ys6qc8pM09D2TVdoonDgYKdaRGcePREiy5eK8hZNg09PcihyMoKH5vLOAb6Xc4Gq EcbA== X-Gm-Message-State: APf1xPAgCNdCCxFRRhap+BrWmcKzO6agU8j5eYUO3p24k8gfYs9VhseJ AS+tx2c8iVMjDz/ZEydDW/RTtdA= X-Received: by 10.202.185.70 with SMTP id j67mr1924785oif.285.1518703170219; Thu, 15 Feb 2018 05:59:30 -0800 (PST) Received: from xps15.herring.priv (216-188-254-6.dyn.grandenetworks.net. [216.188.254.6]) by smtp.googlemail.com with ESMTPSA id t8sm8677327otj.31.2018.02.15.05.59.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Feb 2018 05:59:29 -0800 (PST) From: Rob Herring To: dri-devel@lists.freedesktop.org Subject: [PATCH libdrm 2/4] android: fix mis-named alloc_handle_t Date: Thu, 15 Feb 2018 07:59:24 -0600 Message-Id: <20180215135926.9502-3-robh@kernel.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180215135926.9502-1-robh@kernel.org> References: <20180215135926.9502-1-robh@kernel.org> 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: Robert Foss MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Fix a typo where alloc_handle_t should be gralloc_handle_t. One still remains in gralloc_handle_create, but a subsequent commit will fix that along with other problems in gralloc_handle_create. Signed-off-by: Rob Herring --- android/gralloc_handle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/gralloc_handle.h b/android/gralloc_handle.h index b035e03566cc..b0f5048cc6a1 100644 --- a/android/gralloc_handle.h +++ b/android/gralloc_handle.h @@ -73,7 +73,7 @@ struct gralloc_handle_t { #define GRALLOC_HANDLE_MAGIC 0x60585350 #define GRALLOC_HANDLE_NUM_FDS 1 #define GRALLOC_HANDLE_NUM_INTS ( \ - ((sizeof(struct alloc_handle_t) - sizeof(native_handle_t))/sizeof(int)) \ + ((sizeof(struct gralloc_handle_t) - sizeof(native_handle_t))/sizeof(int)) \ - GRALLOC_HANDLE_NUM_FDS) /** From patchwork Thu Feb 15 13:59:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 128430 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1778695ljc; Thu, 15 Feb 2018 06:00:10 -0800 (PST) X-Google-Smtp-Source: AH8x227iAEyk7HAQ0xGHg7n1tfe70hNoNyrVJS9lDzkvH2F4g5YDvBw51Q2znwt1KZ2QS/H2qXWi X-Received: by 2002:a17:902:a984:: with SMTP id bh4-v6mr2610891plb.95.1518703210238; Thu, 15 Feb 2018 06:00:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518703210; cv=none; d=google.com; s=arc-20160816; b=AWcvNXWT2r/GcL9d34v2orUJJeT/yjNDD2wp3aRI+t+rcaxn4LZr3XQ9qQdu4BWrUD XNj7ebjFLZhLAQh5cewzODXSukBt+K6i06RfIEBeAt3kcAJVbgtz3Fklz0QXlWAHZIBl 6/c0+9qSue23ls4PlopDuVbUNhudnT2ggmYIEyUOobX0YIwgkt7Y/+s7leQKSogvW3Sr yck3g3vY62yV6vW/htVnCf1ZekQv7He6lXMSZRmjsmJrc6Ee/Yvybp+ICnae56WxpVZC zGYnLgwpCqR6icmOsZ7bEZQI3+xdLA2/Rkg1zlcTmMRt53Loam9uNjeX+3329C34u2F2 RXpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:delivered-to:arc-authentication-results; bh=t1DNpOSIjgUvRo7o/E7gH0icS4+/Gr67qShlWlYfKds=; b=o14DFGZfhdw8XZWFxa8e0cPvw52UvPSKMx3dBxOpNBQImwBg8ovWQizg3B0GQAraK5 XY7yAJKgBi3mu6aT2lndu41zJFdm+JbHKEeeB1acU9uN91qIsPQP07uiUetXzVTTTcBo geMErjZ9moA8YntZkJdHQ9LHjExEjH6icxLA1k2rM6GQj9zUzlrMFCkzH0hS3y3AqgPh 3Q0rrOArWQfy1/HtUEPv28Y2pmXdrWWVU2ne1C12H+MnqTuIlUz+kRrxc7CKWfbFvxjk QSWuuqGYNvDkjgarLfKha2Hvjk3EzE4kwaM8U9tkpp62gJ2apwRiuKW56iY7Ej7YOTNM 5PhQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id u14si3989959pfa.271.2018.02.15.06.00.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Feb 2018 06:00:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8718E6E528; Thu, 15 Feb 2018 13:59:38 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-oi0-f67.google.com (mail-oi0-f67.google.com [209.85.218.67]) by gabe.freedesktop.org (Postfix) with ESMTPS id DB82B6E525 for ; Thu, 15 Feb 2018 13:59:32 +0000 (UTC) Received: by mail-oi0-f67.google.com with SMTP id a22so4109544oia.4 for ; Thu, 15 Feb 2018 05:59:32 -0800 (PST) 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=jWzrBpbe/9ELwTEcxlSOFUO7zxQQa9njfe2YTQo5KB0=; b=pL1eO9XTcw94Jmv/Hdl9y6zNBILwwd7RJjoLgc3XSF0r2AKh+c8qfRl5PqhsO4c8As OCxpQpw4JmvAxGA20WG5AvhnggrvGOIVkg5dJXEMCn+7lJQxQCNbnWfL8aQTdL3eiP/A QexSpHY0orhVxkwL6tMO2fVJ4XjM/IBkVx/70nUQBcWOd2HoJs/leisc+nKGE8tf/brz Xh2G6sJmtaNn6LGSIQ9klLsGs9174TjQSJRWXfnSXsPEvFUAU2sfpTLCS/JpU6/wNMM2 M5XbDe/P0Xuwzfm+xTK8vNyh7x0+6PPxL1Cx+Jpk2Dxyml+psfxJAF7OhsCZ4yMl5+ik 9A9A== X-Gm-Message-State: APf1xPCekmLbHhxCabXrgzMospXLnkyFg7sEjEdUvArrLYqkVb3H/+m4 o0VsHtw01hw+7doqQQxtgMGn0rI= X-Received: by 10.202.69.86 with SMTP id s83mr1711075oia.251.1518703171749; Thu, 15 Feb 2018 05:59:31 -0800 (PST) Received: from xps15.herring.priv (216-188-254-6.dyn.grandenetworks.net. [216.188.254.6]) by smtp.googlemail.com with ESMTPSA id t8sm8677327otj.31.2018.02.15.05.59.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Feb 2018 05:59:31 -0800 (PST) From: Rob Herring To: dri-devel@lists.freedesktop.org Subject: [PATCH libdrm 3/4] android: add helper to convert buffer_handle_t to gralloc_handle_t ptr Date: Thu, 15 Feb 2018 07:59:25 -0600 Message-Id: <20180215135926.9502-4-robh@kernel.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180215135926.9502-1-robh@kernel.org> References: <20180215135926.9502-1-robh@kernel.org> 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: Robert Foss MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Clients frequently need to convert a buffer_handle_t (aka native_handle_t *) to a gralloc_handle_t ptr. This is a simple cast, but add an inline function to do the conversion. Signed-off-by: Rob Herring --- android/gralloc_handle.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/android/gralloc_handle.h b/android/gralloc_handle.h index b0f5048cc6a1..43255ba539c2 100644 --- a/android/gralloc_handle.h +++ b/android/gralloc_handle.h @@ -76,6 +76,11 @@ struct gralloc_handle_t { ((sizeof(struct gralloc_handle_t) - sizeof(native_handle_t))/sizeof(int)) \ - GRALLOC_HANDLE_NUM_FDS) +static inline struct gralloc_handle_t *gralloc_handle(buffer_handle_t handle) +{ + return (struct gralloc_handle_t *)handle; +} + /** * Create a buffer handle. */ From patchwork Thu Feb 15 13:59:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 128429 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1778657ljc; Thu, 15 Feb 2018 06:00:08 -0800 (PST) X-Google-Smtp-Source: AH8x2260H54uBXkreRCklZ7FPTT2nwRLJ32N/hEWNivJgyPIYBZ348ngcTJhAMigyVmHlv4f0Xdk X-Received: by 10.99.117.89 with SMTP id f25mr2273955pgn.18.1518703207969; Thu, 15 Feb 2018 06:00:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518703207; cv=none; d=google.com; s=arc-20160816; b=kiGnsG0cFj+a7GjZVFr4py0OxHtt/FQqmC4zGNb+HIs+LhVQQPRzQ8ydyG0PcnTJ+6 JVHgUM/UrqE8JB3fyqs7KMf0WEjPztp2YxCBKYlM4W1jty0KSo9Z0odqPOOsQan7/Udm VCYx0hKPxxzPdOzisdFB6qt9hQp7KCtOhWVYxAhdHun9KKz1uer58xnOOcluJf0NPPaD FZJBbd7F9JQ3sKTDQbWGsp65TkhApL96YxB/a1KgjizQiPDpBuSrU7Q0Mb5MdfJ6EBPG nsHvmnBCVucpUGPZf6GmJ2j1kFw/Nup09ZwtCizjrQsXzdRZuRSLwQVybDQlanxq8Kiw i6+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:delivered-to:arc-authentication-results; bh=FqWrIHfzfmACkqcC5DEWFDkrkJqgiPAfN1osdJsmF/Q=; b=LHDluiF+Hse4VBpbZDIKw4KFIoavLNtlmSm9r+/RK6NGKP8eYziNTjUSB7lzhcAFOL jc0cD7JxGkNK9wg0zaL3vK0KBMkEahzdheWz4YovDxUXThkgcISEF/PaTiazIaOhuXsj eKW5q1kzKUuE0GwAhOZHrGsbd8489roK0s89dPpZh5AlLJpXM0tGPZ1VU8eJSG5WNZxK AqViJDYnKXUG+kF/2iVtOGqfBYywpvSoNrN6z5+B7hFeokgOZkIwIolyDK1E83P7BrNJ J1e4iajBjUTvtaK9mrudN/oG+tTTr9YdgO5OTRMtcegVszsB+dmqk25WBdsf+GCRGSSW gjhA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id g4si1246695pgr.797.2018.02.15.06.00.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Feb 2018 06:00:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1515B6E527; Thu, 15 Feb 2018 13:59:35 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-oi0-f67.google.com (mail-oi0-f67.google.com [209.85.218.67]) by gabe.freedesktop.org (Postfix) with ESMTPS id 796EC6E527 for ; Thu, 15 Feb 2018 13:59:33 +0000 (UTC) Received: by mail-oi0-f67.google.com with SMTP id u6so19109295oiv.9 for ; Thu, 15 Feb 2018 05:59:33 -0800 (PST) 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=9mg8HhSu6iYxNfzTjy0+I5ntssfhVWMX1w9+ahFPWjE=; b=MT7zhIVCXKTSC/9eQo+vKdzMyaeYXppzXGXumgxW5YSeqqbiyqUSzAVrdvIIe5T827 uTt/dvJk1YwSHH5WR3HHYqx66DPp749kVOq8JoTlAypBWMpGO7VxZYvvqMu+8FOnd0ZR WLL9Sd6QeL50OliQ9BIItFwGR+MVcMNl1aRN2pnkUFqerDJYXa/WzoDguVOB50rFmFoR 2yeZtLmfZFjuRkgDo6XIWhQYj7yoL8qqj0KyhuAZo4Di+wfjBqB+si4DT7roID55YKdT N4pl6G9SBDmHAIZW+uy0NPjfmeMWqJ0BmoDToqgM/sjYi01p28JOu173MYTJ/ySBp8cI V4eg== X-Gm-Message-State: APf1xPBXYXSsXhKH1JH9EE9rHz33bvc1EWuOw3tBK8Gsq0g7wKpEwatV kNBsdCNnz7uO0WPYKjdVa0FnFns= X-Received: by 10.202.8.76 with SMTP id 73mr1719895oii.326.1518703172563; Thu, 15 Feb 2018 05:59:32 -0800 (PST) Received: from xps15.herring.priv (216-188-254-6.dyn.grandenetworks.net. [216.188.254.6]) by smtp.googlemail.com with ESMTPSA id t8sm8677327otj.31.2018.02.15.05.59.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Feb 2018 05:59:32 -0800 (PST) From: Rob Herring To: dri-devel@lists.freedesktop.org Subject: [PATCH libdrm 4/4] android: fix gralloc_handle_create() problems Date: Thu, 15 Feb 2018 07:59:26 -0600 Message-Id: <20180215135926.9502-5-robh@kernel.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180215135926.9502-1-robh@kernel.org> References: <20180215135926.9502-1-robh@kernel.org> 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: Robert Foss MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" There's a number of problems with gralloc_handle_create starting with it doesn't even compile. More importantly, it doesn't really create (i.e. allocate) a handle. It allocates a native_handle_t, copies it to a struct gralloc_handle_t on the stack and returns the struct (not a ptr). So the caller still has to allocate a struct gralloc_handle_t to hold the returned struct. Rework gralloc_handle_create() to allocate a new handle and return the pointer to the allocated handle. Callers should free the handle with native_handle_close() and native_handle_delete(). Signed-off-by: Rob Herring --- android/gralloc_handle.h | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/android/gralloc_handle.h b/android/gralloc_handle.h index 43255ba539c2..3177f7a1fd8f 100644 --- a/android/gralloc_handle.h +++ b/android/gralloc_handle.h @@ -84,28 +84,26 @@ static inline struct gralloc_handle_t *gralloc_handle(buffer_handle_t handle) /** * Create a buffer handle. */ -static struct gralloc_handle_t gralloc_handle_create(int32_t width, +static inline struct gralloc_handle_t *gralloc_handle_create(int32_t width, int32_t height, int32_t format, int32_t usage) { - struct alloc_handle_t handle = { - .magic = GRALLOC_HANDLE_MAGIC, - .version = GRALLOC_HANDLE_VERSION }; - + struct gralloc_handle_t *handle; native_handle_t *nhandle = native_handle_create(GRALLOC_HANDLE_NUM_FDS, - GRALLOC_HANDLE_NUM_INTS); - handle.base = *nhandle; - native_handle_delete(nhandle); - - handle.width = width; - handle.height = height; - handle.format = format; - handle.usage = usage; - handle.prime_fd = -1; - - handle->data_owner = getpid(); - handle->data = bo; + GRALLOC_HANDLE_NUM_INTS); + + if (!nhandle) + return NULL; + + handle = gralloc_handle(nhandle); + handle->magic = GRALLOC_HANDLE_MAGIC; + handle->version = GRALLOC_HANDLE_VERSION; + handle->width = width; + handle->height = height; + handle->format = format; + handle->usage = usage; + handle->prime_fd = -1; return handle; }