[PATCH hwc v2 06/18] drm_hwcomposer: Add writeback connector support
Sean Paul
seanpaul at chromium.org
Mon Apr 16 19:59:07 UTC 2018
On Wed, Apr 11, 2018 at 04:22:17PM +0100, Alexandru Gheorghe wrote:
> Writeback connector is a special case of connector, which can be
> linked to a CRTC in order to get the result of the composition back to
> a memory buffer. This had not been merged to the mainline kernel yet,
> latest version of the kernel patches could be found here [1].
>
> [1] https://lists.freedesktop.org/archives/dri-devel/2018-February/167703.html
>
> Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe at arm.com>
> ---
> drmconnector.cpp | 42 +++++++++++++++++++++++++++++++++++++++++-
> drmconnector.h | 7 +++++++
> 2 files changed, 48 insertions(+), 1 deletion(-)
>
> diff --git a/drmconnector.cpp b/drmconnector.cpp
> index 145518f..e482832 100644
> --- a/drmconnector.cpp
> +++ b/drmconnector.cpp
> @@ -52,6 +52,26 @@ int DrmConnector::Init() {
> ALOGE("Could not get CRTC_ID property\n");
> return ret;
> }
> + if (writeback()) {
> + ret = drm_->GetConnectorProperty(*this, "WRITEBACK_PIXEL_FORMATS",
> + &writeback_pixel_formats_);
> + if (ret) {
> + ALOGE("Could not get WRITEBACK_PIXEL_FORMATS connector_id = %d\n", id_);
> + return ret;
> + }
> + ret =
> + drm_->GetConnectorProperty(*this, "WRITEBACK_FB_ID", &writeback_fb_id_);
Please break on the function arguments instead of the =
> + if (ret) {
> + ALOGE("Could not get WRITEBACK_FB_ID connector_id = %d\n", id_);
> + return ret;
> + }
> + ret = drm_->GetConnectorProperty(*this, "WRITEBACK_OUT_FENCE_PTR",
> + &writeback_out_fence_);
Like this :)
With that,
Reviewed-by: Sean Paul <seanpaul at chromium.org>
> + if (ret) {
> + ALOGE("Could not get WRITEBACK_OUT_FENCE_PTR connector_id = %d\n", id_);
> + return ret;
> + }
> + }
> return 0;
> }
>
> @@ -78,8 +98,16 @@ bool DrmConnector::external() const {
> type_ == DRM_MODE_CONNECTOR_VGA;
> }
>
> +bool DrmConnector::writeback() const {
> +#ifdef DRM_MODE_CONNECTOR_WRITEBACK
> + return type_ == DRM_MODE_CONNECTOR_WRITEBACK;
> +#else
> + return false;
> +#endif
> +}
> +
> bool DrmConnector::valid_type() const {
> - return internal() || external();
> + return internal() || external() || writeback();
> }
>
> int DrmConnector::UpdateModes() {
> @@ -130,6 +158,18 @@ const DrmProperty &DrmConnector::crtc_id_property() const {
> return crtc_id_property_;
> }
>
> +const DrmProperty &DrmConnector::writeback_pixel_formats() const {
> + return writeback_pixel_formats_;
> +}
> +
> +const DrmProperty &DrmConnector::writeback_fb_id() const {
> + return writeback_fb_id_;
> +}
> +
> +const DrmProperty &DrmConnector::writeback_out_fence() const {
> + return writeback_out_fence_;
> +}
> +
> DrmEncoder *DrmConnector::encoder() const {
> return encoder_;
> }
> diff --git a/drmconnector.h b/drmconnector.h
> index 5601e06..e139730 100644
> --- a/drmconnector.h
> +++ b/drmconnector.h
> @@ -46,6 +46,7 @@ class DrmConnector {
>
> bool internal() const;
> bool external() const;
> + bool writeback() const;
> bool valid_type() const;
>
> int UpdateModes();
> @@ -58,6 +59,9 @@ class DrmConnector {
>
> const DrmProperty &dpms_property() const;
> const DrmProperty &crtc_id_property() const;
> + const DrmProperty &writeback_pixel_formats() const;
> + const DrmProperty &writeback_fb_id() const;
> + const DrmProperty &writeback_out_fence() const;
>
> const std::vector<DrmEncoder *> &possible_encoders() const {
> return possible_encoders_;
> @@ -88,6 +92,9 @@ class DrmConnector {
>
> DrmProperty dpms_property_;
> DrmProperty crtc_id_property_;
> + DrmProperty writeback_pixel_formats_;
> + DrmProperty writeback_fb_id_;
> + DrmProperty writeback_out_fence_;
>
> std::vector<DrmEncoder *> possible_encoders_;
> };
> --
> 2.7.4
>
--
Sean Paul, Software Engineer, Google / Chromium OS
More information about the dri-devel
mailing list