dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: dri-devel@lists.freedesktop.org
Cc: Robert Foss <robert.foss@collabora.com>
Subject: [PATCH hwc] platformdrmgeneric: get the gralloc usage directly from the handle
Date: Fri,  6 Oct 2017 17:20:05 -0500	[thread overview]
Message-ID: <20171006222005.27505-1-robh@kernel.org> (raw)

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 <robh@kernel.org>
---
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;
-- 
2.11.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

             reply	other threads:[~2017-10-06 22:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-06 22:20 Rob Herring [this message]
2017-10-09 12:23 ` [PATCH hwc] platformdrmgeneric: get the gralloc usage directly from the handle Robert Foss

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171006222005.27505-1-robh@kernel.org \
    --to=robh@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=robert.foss@collabora.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox