From: Sean Paul <seanpaul@chromium.org>
To: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
Cc: ayan.halder@arm.com, liviu.dudau@arm.com,
dri-devel@lists.freedesktop.org, nd@arm.com
Subject: Re: [PATCH hwc v2 09/18] drm_hwcomposer: Handle writeback connectors
Date: Tue, 17 Apr 2018 11:45:30 -0400 [thread overview]
Message-ID: <20180417154530.GE73214@art_vandelay> (raw)
In-Reply-To: <1523460149-1740-10-git-send-email-alexandru-cosmin.gheorghe@arm.com>
On Wed, Apr 11, 2018 at 04:22:20PM +0100, Alexandru Gheorghe wrote:
> When writeback connectors are available assign them to displays, in
> order to be able to use them for flattening of the current displayed
> scene. The pipeline for each display will look like this:
>
> CRTC ---- encoder ------------ display connector.
> |------- writeback enc ------ writeback connector.
>
> However, the writeback connector will be later used/enabled only if
> one of the following conditions are met:
> - Could be a clone of the display connector, as pointed by the
> possible_clones property.
> - The display_connector is disconnected, so we are safe to use it for
> flattening the scene that's already presented on another display.
>
> Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
> ---
> drmresources.cpp | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
> drmresources.h | 3 +++
> 2 files changed, 63 insertions(+), 2 deletions(-)
>
> diff --git a/drmresources.cpp b/drmresources.cpp
> index 39f50be..fef6835 100644
> --- a/drmresources.cpp
> +++ b/drmresources.cpp
> @@ -64,6 +64,14 @@ int DrmResources::Init(ResourceManager *resource_manager, char *path,
> return ret;
> }
>
> +#ifdef DRM_CLIENT_CAP_WRITEBACK_CONNECTORS
> + ret = drmSetClientCap(fd(), DRM_CLIENT_CAP_WRITEBACK_CONNECTORS, 1);
> + if (ret) {
> + ALOGI("Failed to set writeback cap %d", ret);
> + ret = 0;
> + }
> +#endif
> +
> drmModeResPtr res = drmModeGetResources(fd());
> if (!res) {
> ALOGE("Failed to get DrmResources resources");
> @@ -169,7 +177,7 @@ int DrmResources::Init(ResourceManager *resource_manager, char *path,
> conn->set_display(0);
> displays_[0] = 0;
> found_primary = true;
> - } else {
> + } else if (conn->external()) {
> conn->set_display(display_num);
> displays_[display_num] = display_num;
> ++display_num;
> @@ -230,6 +238,8 @@ int DrmResources::Init(ResourceManager *resource_manager, char *path,
> }
>
> for (auto &conn : connectors_) {
> + if (conn->writeback())
> + continue;
> ret = CreateDisplayPipe(conn.get());
> if (ret) {
> ALOGE("Failed CreateDisplayPipe %d with %d", conn->id(), ret);
> @@ -245,7 +255,15 @@ bool DrmResources::HandlesDisplay(int display) const {
>
> DrmConnector *DrmResources::GetConnectorForDisplay(int display) const {
> for (auto &conn : connectors_) {
> - if (conn->display() == display)
> + if (conn->display() == display && !conn->writeback())
> + return conn.get();
> + }
> + return NULL;
> +}
> +
> +DrmConnector *DrmResources::GetWritebackConnectorForDisplay(int display) const {
> + for (auto &conn : connectors_) {
> + if (conn->display() == display && conn->writeback())
> return conn.get();
> }
> return NULL;
> @@ -280,6 +298,7 @@ int DrmResources::TryEncoderForDisplay(int display, DrmEncoder *enc) {
> DrmCrtc *crtc = enc->crtc();
> if (crtc && crtc->can_bind(display)) {
> crtc->set_display(display);
> + enc->set_display(display);
> return 0;
> }
>
> @@ -306,6 +325,7 @@ int DrmResources::CreateDisplayPipe(DrmConnector *connector) {
> if (connector->encoder()) {
> int ret = TryEncoderForDisplay(display, connector->encoder());
> if (!ret) {
> + AttachWriteback(connector);
AttachWriteback returns int, but you throw it away here. Additionally,
AttachWriteback always follows a successful TryEncoderForDisplay, so it makes
sense to just call it from there.
> return 0;
> } else if (ret != -EAGAIN) {
> ALOGE("Could not set mode %d/%d", display, ret);
> @@ -317,6 +337,7 @@ int DrmResources::CreateDisplayPipe(DrmConnector *connector) {
> int ret = TryEncoderForDisplay(display, enc);
> if (!ret) {
> connector->set_encoder(enc);
> + AttachWriteback(connector);
> return 0;
> } else if (ret != -EAGAIN) {
> ALOGE("Could not set mode %d/%d", display, ret);
> @@ -328,6 +349,43 @@ int DrmResources::CreateDisplayPipe(DrmConnector *connector) {
> return -ENODEV;
> }
>
> +/*
> + * Attach writeback connector to the CRTC linked to the display_conn
> + *
> + */
> +int DrmResources::AttachWriteback(DrmConnector *display_conn) {
> + int ret = -EINVAL;
This isn't really used, just return the error code directly at the bottom.
> + if (display_conn->writeback())
> + return -EINVAL;
This condition would benefit from a log
> + DrmEncoder *display_enc = display_conn->encoder();
> + if (!display_enc)
> + return -EINVAL;
> + DrmCrtc *display_crtc = display_enc->crtc();
> + if (!display_crtc)
> + return -EINVAL;
Are these possible given this is only called after a successful
TryEncoderForDisplay()?
> + if (GetWritebackConnectorForDisplay(display_crtc->display()) != NULL)
> + return -EINVAL;
Again, logging would be useful.
> + for (auto &writeback_conn : connectors_) {
> + if (writeback_conn->display() >= 0 || !writeback_conn->writeback())
There doesn't seem to be any situation where you iterate through connectors_ and
you don't have some type of writeback() check. So it seems like it'd make sense
to track these in different vectors.
> + continue;
> + for (DrmEncoder *writeback_enc : writeback_conn->possible_encoders()) {
> + for (DrmCrtc *possible_crtc : writeback_enc->possible_crtcs()) {
> + if (possible_crtc != display_crtc)
> + continue;
> + // Use just encoders which had not been bound already
> + if (writeback_enc->can_bind(display_crtc->display())) {
> + writeback_enc->set_crtc(display_crtc);
> + writeback_conn->set_encoder(writeback_enc);
> + writeback_conn->set_display(display_crtc->display());
> + writeback_conn->UpdateModes();
> + return 0;
> + }
> + }
> + }
> + }
> + return ret;
> +}
> +
> int DrmResources::CreatePropertyBlob(void *data, size_t length,
> uint32_t *blob_id) {
> struct drm_mode_create_blob create_blob;
> diff --git a/drmresources.h b/drmresources.h
> index 4cdcd87..4fb17fc 100644
> --- a/drmresources.h
> +++ b/drmresources.h
> @@ -59,6 +59,8 @@ class DrmResources {
> }
>
> DrmConnector *GetConnectorForDisplay(int display) const;
> + DrmConnector *GetWritebackConnectorForDisplay(int display) const;
> + DrmConnector *FindWritebackConnector(int display) const;
> DrmCrtc *GetCrtcForDisplay(int display) const;
> DrmPlane *GetPlane(uint32_t id) const;
> DrmEventListener *event_listener();
> @@ -84,6 +86,7 @@ class DrmResources {
> DrmProperty *property);
>
> int CreateDisplayPipe(DrmConnector *connector);
> + int AttachWriteback(DrmConnector *display_conn);
>
> UniqueFd fd_;
> uint32_t mode_id_ = 0;
> --
> 2.7.4
>
--
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2018-04-17 15:45 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-11 15:22 [PATCH hwc v2 00/18] Add scene flattening support Alexandru Gheorghe
2018-04-11 15:22 ` [PATCH hwc v2 01/18] drm_hwcomposer: vsyncworker: Fix uninitialized enabled_ field Alexandru Gheorghe
2018-04-16 10:30 ` Robert Foss
2018-04-16 12:18 ` Alexandru-Cosmin Gheorghe
2018-04-17 13:45 ` Sean Paul
2018-04-17 14:09 ` Alexandru-Cosmin Gheorghe
2018-04-11 15:22 ` [PATCH hwc v2 02/18] drm_hwcomposer: vsyncworker: Fix deadlock on exit path Alexandru Gheorghe
2018-04-16 10:31 ` Robert Foss
2018-04-16 19:25 ` Sean Paul
2018-04-17 13:32 ` Alexandru-Cosmin Gheorghe
2018-04-11 15:22 ` [PATCH hwc v2 03/18] drm_hwcomposer: drmeventlistener: Set nl_pid to 0 Alexandru Gheorghe
2018-04-16 10:32 ` Robert Foss
2018-04-11 15:22 ` [PATCH hwc v2 04/18] drm_hwcomposer: Add resource manager class Alexandru Gheorghe
2018-04-17 15:33 ` Sean Paul
2018-04-17 16:08 ` Robert Foss
2018-04-18 10:12 ` Alexandru-Cosmin Gheorghe
2018-04-18 10:14 ` Robert Foss
2018-04-11 15:22 ` [PATCH hwc v2 05/18] drm_hwcomposer: Enable resource manager support Alexandru Gheorghe
2018-04-16 19:54 ` Sean Paul
2018-04-17 13:43 ` Alexandru-Cosmin Gheorghe
2018-04-17 14:22 ` Sean Paul
2018-04-17 14:26 ` Sean Paul
2018-04-11 15:22 ` [PATCH hwc v2 06/18] drm_hwcomposer: Add writeback connector support Alexandru Gheorghe
2018-04-16 19:59 ` Sean Paul
2018-04-17 13:46 ` Alexandru-Cosmin Gheorghe
2018-04-11 15:22 ` [PATCH hwc v2 07/18] drm_hwcomposer: Add display field to Drmencoder Alexandru Gheorghe
2018-04-16 20:02 ` Sean Paul
2018-04-17 13:49 ` Alexandru-Cosmin Gheorghe
2018-04-11 15:22 ` [PATCH hwc v2 08/18] drm_hwcomposer: Parse and store possible_clones information Alexandru Gheorghe
2018-04-16 20:19 ` Sean Paul
2018-04-17 14:03 ` Alexandru-Cosmin Gheorghe
2018-04-11 15:22 ` [PATCH hwc v2 09/18] drm_hwcomposer: Handle writeback connectors Alexandru Gheorghe
2018-04-17 15:45 ` Sean Paul [this message]
2018-04-11 15:22 ` [PATCH hwc v2 10/18] drm_hwcomposer: hwcutils: Add function for cloning a DrmHwcLayer Alexandru Gheorghe
2018-04-17 16:14 ` Sean Paul
2018-04-18 10:22 ` Alexandru-Cosmin Gheorghe
2018-04-11 15:22 ` [PATCH hwc v2 11/18] drm_hwcomposer: Add utility functions to copy displaycomposition internals Alexandru Gheorghe
2018-04-17 16:34 ` Sean Paul
2018-04-11 15:22 ` [PATCH hwc v2 12/18] drm_hwcomposer: Add utility function to create an initialized composition Alexandru Gheorghe
2018-04-17 16:37 ` Sean Paul
2018-04-18 10:29 ` Alexandru-Cosmin Gheorghe
2018-04-11 15:22 ` [PATCH hwc v2 13/18] drm_hwcomposer: Pass buffer sizes to Prepareframebuffer Alexandru Gheorghe
2018-04-17 16:51 ` Sean Paul
2018-04-11 15:22 ` [PATCH hwc v2 14/18] drm_hwcomposer: Fix race in ApplyFrame Alexandru Gheorghe
2018-04-17 17:02 ` Sean Paul
2018-04-18 10:43 ` Alexandru-Cosmin Gheorghe
2018-04-11 15:22 ` [PATCH hwc v2 15/18] drm_hwcomposer: Add worker to trigger scene flattenning Alexandru Gheorghe
2018-04-17 17:07 ` Sean Paul
2018-04-11 15:22 ` [PATCH hwc v2 16/18] drm_hwcomposer: Find writeback connector for scene flattening Alexandru Gheorghe
2018-04-17 17:15 ` Sean Paul
2018-04-11 15:22 ` [PATCH hwc v2 17/18] drm_hwcomposer: Flatten scene synchronously Alexandru Gheorghe
2018-04-17 17:47 ` Sean Paul
2018-04-18 11:14 ` Alexandru-Cosmin Gheorghe
2018-04-18 14:49 ` Sean Paul
2018-04-11 15:22 ` [PATCH hwc v2 18/18] drm_hwcomposer: Flatten scene asynchronously Alexandru Gheorghe
2018-04-12 23:18 ` [PATCH hwc v2 00/18] Add scene flattening support John Stultz
2018-04-13 9:52 ` Alexandru-Cosmin Gheorghe
2018-04-13 12:48 ` Alexandru-Cosmin Gheorghe
2018-04-18 17:21 ` John Stultz
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=20180417154530.GE73214@art_vandelay \
--to=seanpaul@chromium.org \
--cc=alexandru-cosmin.gheorghe@arm.com \
--cc=ayan.halder@arm.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=liviu.dudau@arm.com \
--cc=nd@arm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.