From patchwork Mon Oct 22 17:13:30 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Lespiau X-Patchwork-Id: 1631261 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id 434C1DF283 for ; Tue, 23 Oct 2012 15:11:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0F2B59E954 for ; Tue, 23 Oct 2012 08:11:09 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wg0-f43.google.com (mail-wg0-f43.google.com [74.125.82.43]) by gabe.freedesktop.org (Postfix) with ESMTP id 49A769EFD8 for ; Mon, 22 Oct 2012 10:13:41 -0700 (PDT) Received: by mail-wg0-f43.google.com with SMTP id dq11so1947985wgb.12 for ; Mon, 22 Oct 2012 10:13:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:x-mailer; bh=dyAbd6pHxFO61xxbzEvIu24lCsjkgNxwjfbmccK+N+4=; b=zhqeu9OY7U9iko9lI7Y3djaU/TavfX6hyYv6YDJJq3jHP9ZbgORav9bMcCbj+6AVVN 9OLrRbPYdukXaskTMQONZTIXYwVFHPx6J6DKK0HgrN0fXjZ3hUU+KbEZbbfmeu5z3/hH +jnl2lHRTIDZjvV9xLfIdnck7YYoQMY+uKgiBieTYS+q6Pr1IuxQPzzhvAhslPrPxeps mqQXK7lZ2/eAQNPqxy1oXvXxQWohzzz9LbiboHTX+LvnK7uaM4/1LQC+sIfzrirAJlht BsHEvYEl+Kg/z2sZ9TnciGYgYJ8ojOGk4ISbGawT7zHibNiM5e4421VMLEritcE8Fkbm WMDQ== Received: by 10.216.195.144 with SMTP id p16mr5505185wen.174.1350926020280; Mon, 22 Oct 2012 10:13:40 -0700 (PDT) Received: from localhost.localdomain ([83.217.123.106]) by mx.google.com with ESMTPS id dq6sm17928821wib.5.2012.10.22.10.13.38 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 22 Oct 2012 10:13:39 -0700 (PDT) From: Damien Lespiau To: intel-gfx@lists.freedesktop.org Date: Mon, 22 Oct 2012 18:13:30 +0100 Message-Id: <1350926010-2266-1-git-send-email-damien.lespiau@gmail.com> X-Mailer: git-send-email 1.7.11.7 X-Mailman-Approved-At: Tue, 23 Oct 2012 08:10:54 -0700 Subject: [Intel-gfx] [PATCH] drm/i915: Don't try to use SPR_SCALE when we don't have a sprite scaler X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org From: Damien Lespiau Haswell does not have a scaler in the sprite pipeline anymore, so let's ensure: 1/ We bail out of update_plate() when someone is trying to ask to display a scaled framebuffer, 2/ We never write to the nonexistent SPR_SCALE register Signed-off-by: Damien Lespiau --- drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_sprite.c | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 0942fb4..97c714d 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -221,6 +221,7 @@ struct intel_plane { struct drm_plane base; enum pipe pipe; struct drm_i915_gem_object *obj; + bool can_scale; int max_downscale; u32 lut_r[1024], lut_g[1024], lut_b[1024]; void (*update_plane)(struct drm_plane *plane, diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c index f2ca943..ccfaa6f 100644 --- a/drivers/gpu/drm/i915/intel_sprite.c +++ b/drivers/gpu/drm/i915/intel_sprite.c @@ -136,7 +136,8 @@ ivb_update_plane(struct drm_plane *plane, struct drm_framebuffer *fb, I915_WRITE(SPRLINOFF(pipe), offset); } I915_WRITE(SPRSIZE(pipe), (crtc_h << 16) | crtc_w); - I915_WRITE(SPRSCALE(pipe), sprscale); + if (intel_plane->can_scale) + I915_WRITE(SPRSCALE(pipe), sprscale); I915_WRITE(SPRCTL(pipe), sprctl); I915_MODIFY_DISPBASE(SPRSURF(pipe), obj->gtt_offset); POSTING_READ(SPRSURF(pipe)); @@ -474,6 +475,12 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, goto out; /* + * We may not have a scaler, eg. HSW does not have it any more + */ + if (!intel_plane->can_scale && (crtc_w != src_w || crtc_h != src_h)) + return -EINVAL; + + /* * We can take a larger source and scale it down, but * only so much... 16x is the max on SNB. */ @@ -666,6 +673,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe) switch (INTEL_INFO(dev)->gen) { case 5: case 6: + intel_plane->can_scale = true; intel_plane->max_downscale = 16; intel_plane->update_plane = ilk_update_plane; intel_plane->disable_plane = ilk_disable_plane; @@ -682,6 +690,10 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe) break; case 7: + if (IS_HASWELL(dev)) + intel_plane->can_scale = false; + else + intel_plane->can_scale = true; intel_plane->max_downscale = 2; intel_plane->update_plane = ivb_update_plane; intel_plane->disable_plane = ivb_disable_plane;