From patchwork Thu Dec 15 19:05:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Zanoni, Paulo R" X-Patchwork-Id: 9476747 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 B32B1607EE for ; Thu, 15 Dec 2016 19:05:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A71022882E for ; Thu, 15 Dec 2016 19:05:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A4D728830; Thu, 15 Dec 2016 19:05:12 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED 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 029892882E for ; Thu, 15 Dec 2016 19:05:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EC9AA6EA78; Thu, 15 Dec 2016 19:05:10 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by gabe.freedesktop.org (Postfix) with ESMTPS id D05516EA78 for ; Thu, 15 Dec 2016 19:05:09 +0000 (UTC) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP; 15 Dec 2016 11:05:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,353,1477983600"; d="scan'208";a="42972901" Received: from przanoni-mobl.amr.corp.intel.com ([10.254.182.181]) by fmsmga005.fm.intel.com with ESMTP; 15 Dec 2016 11:05:07 -0800 Message-ID: <1481828705.2548.156.camel@intel.com> From: Paulo Zanoni To: ville.syrjala@linux.intel.com, intel-gfx@lists.freedesktop.org Date: Thu, 15 Dec 2016 17:05:05 -0200 In-Reply-To: <1479830524-7882-9-git-send-email-ville.syrjala@linux.intel.com> References: <1479830524-7882-1-git-send-email-ville.syrjala@linux.intel.com> <1479830524-7882-9-git-send-email-ville.syrjala@linux.intel.com> X-Mailer: Evolution 3.20.5 (3.20.5-1.fc24) Mime-Version: 1.0 Subject: Re: [Intel-gfx] [PATCH 8/9] drm/i915: Don't populate plane->plane for cursors and sprites X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Em Ter, 2016-11-22 às 18:02 +0200, ville.syrjala@linux.intel.com escreveu: > From: Ville Syrjälä > > With plane->plane now purely reserved for the primary planes, let's > not even populate it for cursors and sprites. Let's switch the type > to enum plane as well since it's no longer being abused for anything > else. Since it's a primary plane thing, I think it makes more sense to just leave it at struct intel_crtc instead of having a field that's unused and doesn't make sense in some cases. The crtc struct already includes some fields that are specific to primary planes, so I think it's a good place. Or we could create a new class: struct intel_primary_plane { struct intel_plane base; enum plane legacy_plane }; Following is a patch suggestion (probably impossible to apply due to my editor breaking long lines). Any arguments against it? --8<---------------------------------------------------------- plane);   intel_plane->check_plane = intel_check_sprite_plane; --8<---------------------------------------------------------- > > Signed-off-by: Ville Syrjälä > --- >  drivers/gpu/drm/i915/intel_display.c | 1 - >  drivers/gpu/drm/i915/intel_drv.h     | 2 +- >  drivers/gpu/drm/i915/intel_sprite.c  | 1 - >  3 files changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/i915/intel_display.c > b/drivers/gpu/drm/i915/intel_display.c > index b6d5d5e5cc99..f180f14fcf3a 100644 > --- a/drivers/gpu/drm/i915/intel_display.c > +++ b/drivers/gpu/drm/i915/intel_display.c > @@ -15188,7 +15188,6 @@ intel_cursor_plane_create(struct > drm_i915_private *dev_priv, enum pipe pipe) >   cursor->can_scale = false; >   cursor->max_downscale = 1; >   cursor->pipe = pipe; > - cursor->plane = pipe; >   cursor->id = PLANE_CURSOR; >   cursor->frontbuffer_bit = INTEL_FRONTBUFFER_CURSOR(pipe); >   cursor->check_plane = intel_check_cursor_plane; > diff --git a/drivers/gpu/drm/i915/intel_drv.h > b/drivers/gpu/drm/i915/intel_drv.h > index c1b245853ba9..d14718e09911 100644 > --- a/drivers/gpu/drm/i915/intel_drv.h > +++ b/drivers/gpu/drm/i915/intel_drv.h > @@ -767,7 +767,7 @@ struct intel_plane_wm_parameters { >   >  struct intel_plane { >   struct drm_plane base; > - u8 plane; > + enum plane plane; >   enum plane_id id; >   enum pipe pipe; >   bool can_scale; > diff --git a/drivers/gpu/drm/i915/intel_sprite.c > b/drivers/gpu/drm/i915/intel_sprite.c > index 63154a5a9305..1044095d0084 100644 > --- a/drivers/gpu/drm/i915/intel_sprite.c > +++ b/drivers/gpu/drm/i915/intel_sprite.c > @@ -1111,7 +1111,6 @@ intel_sprite_plane_create(struct > drm_i915_private *dev_priv, >   } >   >   intel_plane->pipe = pipe; > - intel_plane->plane = plane; >   intel_plane->id = PLANE_SPRITE0 + plane; >   intel_plane->frontbuffer_bit = > INTEL_FRONTBUFFER_SPRITE(pipe, plane); >   intel_plane->check_plane = intel_check_sprite_plane; diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index bc1af87..c54b1a7 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -15065,14 +15065,6 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)   state->scaler_id = -1;   }   primary->pipe = pipe; - /* -  * On gen2/3 only plane A can do FBC, but the panel fitter and LVDS -  * port is hooked to pipe B. Hence we want plane A feeding pipe B. -  */ - if (HAS_FBC(dev_priv) && INTEL_GEN(dev_priv) < 4) - primary->plane = (enum plane) !pipe; - else - primary->plane = (enum plane) pipe;   primary->id = PLANE_PRIMARY;   primary->frontbuffer_bit = INTEL_FRONTBUFFER_PRIMARY(pipe);   primary->check_plane = intel_check_primary_plane; @@ -15120,7 +15112,7 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)          0, &intel_plane_funcs,          intel_primary_formats, num_formats,          DRM_PLANE_TYPE_PRIMARY, -        "plane %c", plane_name(primary->plane)); +        "plane %c", pipe_name(pipe)); /* FIXME */   if (ret)   goto fail;   @@ -15272,7 +15264,6 @@ intel_cursor_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)   cursor->can_scale = false;   cursor->max_downscale = 1;   cursor->pipe = pipe; - cursor->plane = pipe;   cursor->id = PLANE_CURSOR;   cursor->frontbuffer_bit = INTEL_FRONTBUFFER_CURSOR(pipe);   cursor->check_plane = intel_check_cursor_plane; @@ -15390,7 +15381,14 @@ static int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)   goto fail;     intel_crtc->pipe = pipe; - intel_crtc->plane = primary->plane; + /* +  * On gen2/3 only plane A can do FBC, but the panel fitter and LVDS +  * port is hooked to pipe B. Hence we want plane A feeding pipe B. +  */ + if (HAS_FBC(dev_priv) && INTEL_GEN(dev_priv) < 4) + intel_crtc->plane = (enum plane) !pipe; + else + intel_crtc->plane = (enum plane) pipe;     intel_crtc->cursor_base = ~0;   intel_crtc->cursor_cntl = ~0; @@ -16866,11 +16864,11 @@ void i915_redisable_vga(struct drm_i915_private *dev_priv)   intel_display_power_put(dev_priv, POWER_DOMAIN_VGA);  }   -static bool primary_get_hw_state(struct intel_plane *plane) +static bool primary_get_hw_state(struct intel_crtc *crtc)  { - struct drm_i915_private *dev_priv = to_i915(plane->base.dev); + struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);   - return I915_READ(DSPCNTR(plane->plane)) & DISPLAY_PLANE_ENABLE; + return I915_READ(DSPCNTR(crtc->plane)) & DISPLAY_PLANE_ENABLE;  }    /* FIXME read out full plane state for all planes */ @@ -16880,8 +16878,7 @@ static void readout_plane_state(struct intel_crtc *crtc)   struct intel_plane_state *plane_state =   to_intel_plane_state(primary->state);   - plane_state->base.visible = crtc->active && - primary_get_hw_state(to_intel_plane(primary)); + plane_state->base.visible = crtc->active && primary_get_hw_state(crtc);     if (plane_state->base.visible)   crtc->base.state->plane_mask |= 1 << drm_plane_index(primary); diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 362f698..b2bdd49 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -767,7 +767,6 @@ struct intel_plane_wm_parameters {    struct intel_plane {   struct drm_plane base; - u8 plane;   enum plane_id id;   enum pipe pipe;   bool can_scale; diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c index 63154a5..1044095 100644 --- a/drivers/gpu/drm/i915/intel_sprite.c +++ b/drivers/gpu/drm/i915/intel_sprite.c @@ -1111,7 +1111,6 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv,   }     intel_plane->pipe = pipe; - intel_plane->plane = plane;   intel_plane->id = PLANE_SPRITE0 + plane;   intel_plane->frontbuffer_bit = INTEL_FRONTBUFFER_SPRITE(pipe,