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: 9990595 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 9492C60247 for ; Fri, 6 Oct 2017 22:20:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 840EC28E20 for ; Fri, 6 Oct 2017 22:20:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 740E428E4C; Fri, 6 Oct 2017 22:20:19 +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=-3.7 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM 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 CBADE28E47 for ; Fri, 6 Oct 2017 22:20:10 +0000 (UTC) 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" X-Virus-Scanned: ClamAV using ClamSMTP 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;