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. */