From: Damien Lespiau <damien.lespiau@intel.com>
To: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 8/8] drm/i915/skl: Provide a Skylake version of get_plane_config()
Date: Mon, 19 Jan 2015 18:27:49 +0000 [thread overview]
Message-ID: <20150119182749.GA7041@strange.ger.corp.intel.com> (raw)
In-Reply-To: <545374BA.4040508@linux.intel.com>
On Fri, Oct 31, 2014 at 11:38:34AM +0000, Tvrtko Ursulin wrote:
>
> On 10/29/2014 05:22 PM, Damien Lespiau wrote:
> >Universal planes have changed a bit the register organization.
> >
> >Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
> >---
> > drivers/gpu/drm/i915/intel_display.c | 108 ++++++++++++++++++++++++++++++++---
> > 1 file changed, 101 insertions(+), 7 deletions(-)
> >
> >diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> >index 02b2a97..33e8112 100644
> >--- a/drivers/gpu/drm/i915/intel_display.c
> >+++ b/drivers/gpu/drm/i915/intel_display.c
> >@@ -2314,6 +2314,32 @@ static int i9xx_format_to_fourcc(int format)
> > }
> > }
> >
> >+static int skl_format_to_fourcc(int format, bool rgb_order, bool alpha)
> >+{
> >+ switch (format) {
> >+ case PLANE_CTL_FORMAT_RGB_565:
> >+ return DRM_FORMAT_RGB565;
> >+ default:
> >+ case PLANE_CTL_FORMAT_XRGB_8888:
> >+ if (rgb_order) {
> >+ if (alpha)
> >+ return DRM_FORMAT_ABGR8888;
> >+ else
> >+ return DRM_FORMAT_XBGR8888;
> >+ } else {
> >+ if (alpha)
> >+ return DRM_FORMAT_ARGB8888;
> >+ else
> >+ return DRM_FORMAT_XRGB8888;
> >+ }
> >+ case PLANE_CTL_FORMAT_XRGB_2101010:
> >+ if (rgb_order)
> >+ return DRM_FORMAT_XBGR2101010;
> >+ else
> >+ return DRM_FORMAT_XRGB2101010;
> >+ }
> >+}
>
> Are RGB and BGR wrong way round here?
Nop that's due to a mismatch of endianness between the DRM defines and
the register field (eg. intel_sprite.c is full of those inversions).
> > static bool intel_alloc_plane_obj(struct intel_crtc *crtc,
> > struct intel_plane_config *plane_config)
> > {
> >@@ -7456,6 +7482,69 @@ static void ironlake_get_fdi_m_n_config(struct intel_crtc *crtc,
> > &pipe_config->fdi_m_n, NULL);
> > }
> >
> >+static void skylake_get_plane_config(struct intel_crtc *crtc,
> >+ struct intel_plane_config *plane_config)
> >+{
> >+ struct drm_device *dev = crtc->base.dev;
> >+ struct drm_i915_private *dev_priv = dev->dev_private;
> >+ u32 val, base, offset, stride_mult;
> >+ int pipe = crtc->pipe;
> >+ int fourcc, pixel_format;
> >+ int aligned_height;
> >+ struct drm_framebuffer *fb;
> >+
> >+ fb = kzalloc(sizeof(struct intel_framebuffer), GFP_KERNEL);
> >+ if (!fb) {
> >+ DRM_DEBUG_KMS("failed to alloc fb\n");
> >+ return;
> >+ }
> >+
> >+ val = I915_READ(PLANE_CTL(pipe, 0));
> >+ if (val & PLANE_CTL_TILED_MASK)
> >+ plane_config->tiling = I915_TILING_X;
> >+
> >+ pixel_format = val & PLANE_CTL_FORMAT_MASK;
> >+ fourcc = skl_format_to_fourcc(pixel_format,
> >+ val & PLANE_CTL_ORDER_RGBX,
> >+ val & PLANE_CTL_ALPHA_MASK);
> >+ fb->pixel_format = fourcc;
> >+ fb->bits_per_pixel = drm_format_plane_cpp(fourcc, 0) * 8;
> >+
> >+ base = I915_READ(PLANE_SURF(pipe, 0)) & 0xfffff000;
> >+ plane_config->base = base;
> >+
> >+ offset = I915_READ(PLANE_OFFSET(pipe, 0));
> >+
> >+ val = I915_READ(PIPESRC(pipe));
> >+ fb->width = ((val >> 16) & 0xfff) + 1;
> >+ fb->height = ((val >> 0) & 0xfff) + 1;
>
> Thinking how you are reading out plane register everywhere else, I assume
> this means _PIPEASRC is guaranteed to be configured to the same size as
> _PLANE_SIZE_1_A?
"guaranteed" is a strong word, but yes, I don't expect other
configuration. That said, we now have PLANE_SIZE on gen9+, so we might
as well use it, that's indeed more correct.
> >+ val = I915_READ(PLANE_STRIDE(pipe, 0));
> >+ switch (plane_config->tiling) {
> >+ case I915_TILING_NONE:
> >+ stride_mult = 64;
> >+ break;
> >+ case I915_TILING_X:
> >+ stride_mult = 512;
> >+ break;
> >+ default:
> >+ BUG();
>
> As some other people I also dislike BUGs very much. WARN and put no fb on
> screen instead?
Sure, removed the BUG().
--
Damien
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-01-19 18:27 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-29 17:22 [PATCH 0/8] Skylake primary plane read-out Damien Lespiau
2014-10-29 17:22 ` [PATCH 1/8] drm/i915: Change plane_config to store a tiling_mode Damien Lespiau
2014-10-29 17:22 ` [PATCH 2/8] drm/i915: Use a common function for computing the fb height alignment Damien Lespiau
2014-10-29 17:22 ` [PATCH 3/8] drm/i915: Unclutter the get_plane() functions Damien Lespiau
2014-10-30 17:31 ` Tvrtko Ursulin
2014-10-30 17:41 ` Damien Lespiau
2014-10-29 17:22 ` [PATCH 4/8] drm/i915: Don't use crtc->plane in ILK+ get_config() Damien Lespiau
2014-10-29 17:22 ` [PATCH 5/8] drm/i915: Use pipe_name() in the get_plane_config() functions Damien Lespiau
2014-10-29 17:22 ` [PATCH 6/8] drm/i915: Make intel_format_to_fourcc() static Damien Lespiau
2014-10-29 17:22 ` [PATCH 7/8] drm/i915/skl: intel_format_to_fourcc() doesn't work for SKL planes Damien Lespiau
2014-10-29 17:22 ` [PATCH 8/8] drm/i915/skl: Provide a Skylake version of get_plane_config() Damien Lespiau
2014-10-31 11:38 ` Tvrtko Ursulin
2015-01-19 18:27 ` Damien Lespiau [this message]
2015-01-20 8:06 ` Daniel Vetter
2015-01-20 11:09 ` [PATCH 8/8 v4] " Damien Lespiau
2014-11-03 15:07 ` [PATCH 0/8] Skylake primary plane read-out Daniel Vetter
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=20150119182749.GA7041@strange.ger.corp.intel.com \
--to=damien.lespiau@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=tvrtko.ursulin@linux.intel.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