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 (Arm)" X-Patchwork-Id: 10221305 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 699EA6055C for ; Thu, 15 Feb 2018 13:59:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5B96A29344 for ; Thu, 15 Feb 2018 13:59:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4FFF429347; Thu, 15 Feb 2018 13:59:40 +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=-4.2 required=2.0 tests=BAYES_00, 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 1B28429344 for ; Thu, 15 Feb 2018 13:59:40 +0000 (UTC) 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-Google-Smtp-Source: AH8x226XMR0wGJy1QGosnGDOynkTKJbSvpacPsVqVgCUKjcDETIwQiuTSI19vBNbSnB0HjifGx24Xw== 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" X-Virus-Scanned: ClamAV using ClamSMTP 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. */