From patchwork Fri Oct 6 22:20:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 115140 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp37964qgn; Fri, 6 Oct 2017 15:20:11 -0700 (PDT) X-Received: by 10.98.102.20 with SMTP id a20mr3473739pfc.208.1507328411166; Fri, 06 Oct 2017 15:20:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507328411; cv=none; d=google.com; s=arc-20160816; b=DSM+fGADnCce8j307HuUQ5ZlWOZ3np7LOSWelS7ExHgy1v0VFBm/d+YBrAfRaObSJX fKIcGiD8GwFsvOCTexnIoY8Rx4mJuktl4KiZdEZR/XDwEkh14riHAhLF3tQIXCohzeDf JErvLH9dAR8Yy56IVBRC2hJ3raXWzKnfVmMpA8CNhXBfqlq7xw8/UMIH1rTdAQEveHpR 9do24NZD73d56exkz1LWPqhosnthy9hFfbFOAV6/FUiY0HJsanjrR22EvnGrB6EpNxkd qLMYml7Fb/DrJHbyhkqzWgZe7yTw6kes1iVvRVKVWHW/ptCyu5ofahl0wYxmRa50L03g e+ng== 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 :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:cc:message-id:date:subject:to:from:delivered-to :arc-authentication-results; bh=aSS/s/QbTwp2e3WTeSDk/6NvwBQknGzo8TyrcFsx5cA=; b=q3KFlMnUo2ehdj8LqdcIbFl76f0JgQIsT8XwFND3BxVDgLbYT4pqYxtIkfJo4r99vW T4qD0Cq+dabU6tuIw/m1FCoMqeK60M86rT4YdGA9uNS0DScpdyrK00aoq6g56tM4kqsZ gVc/ksmgQZw1XdVR33Rqvr1m/Mu3ISIhWGxUdHWatZjZfp/XtLjcOU8cbI+ZWn2aVXYc +E2Wpxmb4DqoD3SK2LNA1AEp7f/sFJmJnWGtcYR2rbuW1Wqx4k8HceoSYWY10dVCob+d 9kJUUmawVQwjC82iZKP+jPxZzjPGvW90JHBdfqIkdanGu9c7AWq5MuOKRtCNYCu7LX9D 7Zwg== 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 q85si1986267pfi.330.2017.10.06.15.20.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Oct 2017 15:20:11 -0700 (PDT) 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 0DB726E9DE; Fri, 6 Oct 2017 22:20:10 +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 2AE576E9DE for ; Fri, 6 Oct 2017 22:20:09 +0000 (UTC) Received: by mail-oi0-f66.google.com with SMTP id h200so4558688oib.1 for ; Fri, 06 Oct 2017 15:20:08 -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; bh=ZeAdvEr+q7cS3tXmBwlSJn2qpGqQr4aJoNvV4kwP4fY=; b=eHpo+WFDaI6ojnldn5UXjeXipvRmiNWhKx7lpLyVsh7CDcY6wvl9tyq3gaHOcwZj4+ x1lGTpcEf/BEg4QLR1KrBzq9puYpI/b+ebcCyYeUe0WIk6TssWGgrquqV/8g2cEfg3Sm jC2Cz7Cfn2XDgcAP8wv/Tmc4OztdWYhrpOccAAfRmXHocbVg73Nv2wDgtcUups8YAqfm HxEWVVGmjuBklbx0p9Jr6exvK68Dlbra3KzQbbP1w7ZeMvB47ny0u+6lMYiNVRcAeVO0 B7Pz4eUK1zi18p2VA7UvnruQ13XTSdv+sLc4qG2yRS5dO8QwePmkAIQ3ApLzE/OvwLpW hiRQ== X-Gm-Message-State: AMCzsaXIanJ8On47Z/jam5u8MmQ3XAsTSKqMkvmtgFAsk8Mr+MmSnpek YH08CxuDT0wMz/u2lHYn38+Z+5c= X-Google-Smtp-Source: AOwi7QArIOK8z4Z1VHcNjQNtfEe4aC+nsCjIUR+WtY8sEeCwCc+8vWS2SLoiOkvTgBBhk0tmWy6X1A== X-Received: by 10.157.37.177 with SMTP id q46mr2395243ota.55.1507328408046; Fri, 06 Oct 2017 15:20:08 -0700 (PDT) Received: from localhost.localdomain (216-188-254-6.dyn.grandenetworks.net. [216.188.254.6]) by smtp.googlemail.com with ESMTPSA id n13sm1437773ote.29.2017.10.06.15.20.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Oct 2017 15:20:07 -0700 (PDT) From: Rob Herring To: dri-devel@lists.freedesktop.org Subject: [PATCH hwc] platformdrmgeneric: get the gralloc usage directly from the handle Date: Fri, 6 Oct 2017 17:20:05 -0500 Message-Id: <20171006222005.27505-1-robh@kernel.org> X-Mailer: git-send-email 2.11.0 Cc: Robert Foss X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" There's no point in using a gralloc perform() op to retrieve the usage as it is already stored in the handle like width, height, format, etc. So just copy it to the hwc_drm_bo_t and get it directly. Signed-off-by: Rob Herring --- I was a bit quick on the trigger with the previous patch. This one is a dependency for it. drmhwcgralloc.h | 1 + hwcutils.cpp | 8 ++------ platformdrmgeneric.cpp | 1 + 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/drmhwcgralloc.h b/drmhwcgralloc.h index 765c8979d2df..c4a42eaf1c54 100644 --- a/drmhwcgralloc.h +++ b/drmhwcgralloc.h @@ -56,6 +56,7 @@ typedef struct hwc_drm_bo { uint32_t width; uint32_t height; uint32_t format; /* DRM_FORMAT_* from drm_fourcc.h */ + uint32_t usage; uint32_t pitches[4]; uint32_t offsets[4]; uint32_t gem_handles[4]; diff --git a/hwcutils.cpp b/hwcutils.cpp index 00915757469e..53a7d82889b8 100644 --- a/hwcutils.cpp +++ b/hwcutils.cpp @@ -159,12 +159,8 @@ int DrmHwcLayer::ImportBuffer(Importer *importer, if (ret) return ret; - ret = gralloc->perform(gralloc, GRALLOC_MODULE_PERFORM_GET_USAGE, - handle.get(), &gralloc_buffer_usage); - if (ret) { - ALOGE("Failed to get usage for buffer %p (%d)", handle.get(), ret); - return ret; - } + gralloc_buffer_usage = buffer.operator->()->usage; + return 0; } diff --git a/platformdrmgeneric.cpp b/platformdrmgeneric.cpp index aa3d0faee7c0..741d42b6ac33 100644 --- a/platformdrmgeneric.cpp +++ b/platformdrmgeneric.cpp @@ -116,6 +116,7 @@ int DrmGenericImporter::ImportBuffer(buffer_handle_t handle, hwc_drm_bo_t *bo) { bo->width = gr_handle->width; bo->height = gr_handle->height; bo->format = ConvertHalFormatToDrm(gr_handle->format); + bo->usage = gr_handle->usage; bo->pitches[0] = gr_handle->stride; bo->gem_handles[0] = gem_handle; bo->offsets[0] = 0;