public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Matt Roper <matthew.d.roper@intel.com>
To: "Konduru, Chandra" <chandra.konduru@intel.com>
Cc: "Vetter, Daniel" <daniel.vetter@intel.com>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>,
	"Conselvan De Oliveira,
	Ander" <ander.conselvan.de.oliveira@intel.com>
Subject: Re: [PATCH 06/20] drm/i915: Convert primary plane 16.16 values to regular ints
Date: Tue, 7 Apr 2015 11:45:52 -0700	[thread overview]
Message-ID: <20150407184552.GI11603@intel.com> (raw)
In-Reply-To: <76A9B330A4D78C4D99CB292C4CC06C0E36F96799@fmsmsx101.amr.corp.intel.com>

On Tue, Apr 07, 2015 at 11:29:06AM -0700, Konduru, Chandra wrote:
> 
> 
> > -----Original Message-----
> > From: Daniel Vetter [mailto:daniel.vetter@ffwll.ch] On Behalf Of Daniel Vetter
> > Sent: Tuesday, April 07, 2015 1:44 AM
> > To: Roper, Matthew D
> > Cc: Konduru, Chandra; Vetter, Daniel; intel-gfx@lists.freedesktop.org;
> > Conselvan De Oliveira, Ander
> > Subject: Re: [Intel-gfx] [PATCH 06/20] drm/i915: Convert primary plane 16.16
> > values to regular ints
> > 
> > On Thu, Apr 02, 2015 at 04:03:22PM -0700, Matt Roper wrote:
> > > On Wed, Apr 01, 2015 at 07:59:35PM -0700, Chandra Konduru wrote:
> > > > This patch converts intel_plane_state->src rect from 16.16 values
> > > > into regular ints.
> > > >
> > > > This approach aligns with sprite_plane_state->src rects which are
> > > > already in regular ints.
> > > >
> > > > Signed-off-by: Chandra Konduru <chandra.konduru@intel.com>
> > >
> > > You're not touching cursor state here, so I guess it stays in 16.16
> > > form always?  Does it need to be updated to behave the same way?
> > >
> > > Looking at our sprite code today, it treats intel_state->src as 16.16
> > > for most of the check function, then re-writes it as integer pixels
> > > near the end, which I guess matches the type of change you're doing
> > > here.  I still find this pretty confusing that our structure is
> > > sometimes interpreted in one way and other times interpreted a different way.
> > >
> > > Personally I think it would be less error-prone if we just treated src
> > > as 16.16 always, but if you to keep the current logic which changes
> > > the meaning at the end of the check() stage, can you add some comments
> > > to struct intel_plane_state clarifying that?
> > 
> > Rewriting intel_plane_state won't work since on duplicate_state we'd need to
> > undo that again. That's a bit too brittle imo. I'd go with Matt's suggestion to just
> > use 16.16 everywhere.
> > -Daniel
> 
> Recently in upstream, sprite plane src rect changed to regular int at end of check
> before entering commit but left primary src rect as 16.16.
> 
> This is causing issue for having any common helper function to handle sprites
> and primary. So my patch is aligning both primary and sprite's src rect as regular int
> after checks are done. 
> 
> Earlier Matt commented that it is upto i915's implementation how to keep
> its internal src rect values in its state which is his response to my earlier 
> change to fix a bug when passing src rect keeping them in 16.16 format.  
> I am fine whichever format you want. Can you or Matt make it clear which
> format to keep them?

The internal src/dest rect are derived state that the driver tracks for
its own purposes, so yeah, it's up to us how we decide to store it.  The
confusing (and error-prone) part is that our sprite check code treats it
as 16.16 whereas our commit code treats it as integer; to make matters
worse, we aren't even consistent with this scheme across the various
plane types (primary, sprite, cursor).

Even though the state gets copied in duplicate_state(), we don't have
any immediate problems with the existing sprite code today because it
does wind up getting blown away and recomputed before we have a chance
to mix up the meaning of the values.  Your patch here looks like it
would work without problems today too for the same reason.  But simply
the inconsistency of what the value means at various points in the
process bothers me because it is likely to cause mistakes as people
write code in the future.  Since the check phase is the more complex
logic here, and since it depends on the 16.16 storage, it seems natural
to me to just preserve that 16.16 format throughout and just shift as
necessary in the commit step.

From what I can see, the mid-operation switch between 16.16 and integer
format in the sprite code originated with commit

        commit 96d61a7f267ff355a401ca23a732810027d10ba2
        Author: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
        Date:   Fri Sep 5 17:04:47 2014 -0300

            drm/i915: split intel_update_plane into check() and commit()

when the check and commit steps were first split apart.  The change
isn't directly referenced in the commit message, so I think it just sort
of snuck in under the radar.


Matt

> 
> > --
> > Daniel Vetter
> > Software Engineer, Intel Corporation
> > http://blog.ffwll.ch

-- 
Matt Roper
Graphics Software Engineer
IoTG Platform Enabling & Development
Intel Corporation
(916) 356-2795
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-04-07 18:45 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-02  2:59 [PATCH 00/20] skylake display scalers Chandra Konduru
2015-04-02  2:59 ` [PATCH 01/20] drm/i915: Adding drm helper function drm_plane_from_index() Chandra Konduru
2015-04-02 23:01   ` Matt Roper
2015-04-02  2:59 ` [PATCH 02/20] drm/i915: Register definitions for skylake scalers Chandra Konduru
2015-04-02  2:59 ` [PATCH 03/20] drm/i915: skylake scaler structure definitions Chandra Konduru
2015-04-02 23:01   ` Matt Roper
2015-04-02  2:59 ` [PATCH 04/20] drm/i915: Initialize plane colorkey to NONE Chandra Konduru
2015-04-02  2:59 ` [PATCH 05/20] drm/i915: Initialize skylake scalers Chandra Konduru
2015-04-02  2:59 ` [PATCH 06/20] drm/i915: Convert primary plane 16.16 values to regular ints Chandra Konduru
2015-04-02 23:03   ` Matt Roper
2015-04-07  8:43     ` Daniel Vetter
2015-04-07 18:29       ` Konduru, Chandra
2015-04-07 18:45         ` Matt Roper [this message]
2015-04-07 19:02           ` Konduru, Chandra
2015-04-02  2:59 ` [PATCH 07/20] drm/i915: Dump scaler_state too as part of dumping crtc_state Chandra Konduru
2015-04-02  2:59 ` [PATCH 08/20] drm/i915: Helper function to update skylake scaling ratio Chandra Konduru
2015-04-02 23:03   ` Matt Roper
2015-04-02  2:59 ` [PATCH 09/20] drm/i915: Add helper function to update scaler_users in crtc_state Chandra Konduru
2015-04-02 23:04   ` Matt Roper
2015-04-02  2:59 ` [PATCH 10/20] drm/i915: Add atomic function to setup scalers scalers for a crtc Chandra Konduru
2015-04-02 23:04   ` Matt Roper
2015-04-06  4:44     ` Konduru, Chandra
2015-04-02  2:59 ` [PATCH 11/20] drm/i915: Helper function to detach a scaler from a plane or crtc Chandra Konduru
2015-04-02 23:04   ` Matt Roper
2015-04-02  2:59 ` [PATCH 12/20] drm/i915: Preserve scaler state when clearing crtc_state Chandra Konduru
2015-04-02  2:59 ` [PATCH 13/20] drm/i915: use current scaler state during readout_hw_state Chandra Konduru
2015-04-02 23:04   ` Matt Roper
2015-04-06  4:52     ` Konduru, Chandra
2015-04-02  2:59 ` [PATCH 14/20] drm/i915: Update scaling ratio as part of crtc_compute_config Chandra Konduru
2015-04-02  2:59 ` [PATCH 15/20] drm/i915: Ensure setting up scalers into staged crtc_state Chandra Konduru
2015-04-02  2:59 ` [PATCH 16/20] drm/i915: copy staged scaler state from drm state to crtc->config Chandra Konduru
2015-04-02  2:59 ` [PATCH 17/20] drm/i915: stage panel fitting scaler request for fixed mode panel Chandra Konduru
2015-04-02  2:59 ` [PATCH 18/20] drm/i915: Enable skylake panel fitting using skylake shared scalers Chandra Konduru
2015-04-02  2:59 ` [PATCH 19/20] drm/i915: Enable skylake primary plane scaling using " Chandra Konduru
2015-04-02 23:05   ` Matt Roper
2015-04-02  2:59 ` [PATCH 20/20] drm/i915: Enable skylake sprite " Chandra Konduru
2015-04-02 14:44   ` shuang.he
2015-04-02 17:20     ` Konduru, Chandra
2015-04-03  2:50       ` He, Shuang
2015-04-02 23:05   ` Matt Roper
2015-04-02 23:20 ` [PATCH 00/20] skylake display scalers Matt Roper

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=20150407184552.GI11603@intel.com \
    --to=matthew.d.roper@intel.com \
    --cc=ander.conselvan.de.oliveira@intel.com \
    --cc=chandra.konduru@intel.com \
    --cc=daniel.vetter@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /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