[PATCH 1/1] drm/i915: Enabling 128x128 and 256x256 ARGB Cursor Support (original) (raw)

Ville Syrjälä ville.syrjala at linux.intel.com
Tue Feb 18 05:13:33 PST 2014


On Tue, Feb 18, 2014 at 03:39:46PM +0530, sagar.a.kamble at intel.com wrote:

From: Sagar Kamble <sagar.a.kamble at intel.com>

With this patch we allow larger cursor planes of sizes 128x128 and 256x256. Planning to extend kmscursorcrc test for verifying these larger planes. Cc: Daniel Vetter <daniel.vetter at ffwll.ch> Cc: Jani Nikula <jani.nikula at linux.intel.com> Cc: David Airlie <airlied at linux.ie> Cc: dri-devel at lists.freedesktop.org Cc: linux-kernel at vger.kernel.org

Let's not spam everyone. Just intel-gfx is enough for such patches. Well, maybe keep dri-devel too since cursor size seems to be a hot topic across other drivers currently.

Signed-off-by: G, Pallavi <pallavi.g at intel.com> Signed-off-by: Sagar Kamble <sagar.a.kamble at intel.com> --- drivers/gpu/drm/i915/i915reg.h | 4 ++++ drivers/gpu/drm/i915/inteldisplay.c | 25 ++++++++++++++++++++----- 2 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915reg.h b/drivers/gpu/drm/i915/i915reg.h index 2f564ce..2fee3a2 100644 --- a/drivers/gpu/drm/i915/i915reg.h +++ b/drivers/gpu/drm/i915/i915reg.h @@ -3522,7 +3522,11 @@ /* New style CUR*CNTR flags */ #define CURSORMODE 0x27 #define CURSORMODEDISABLE 0x00 +#define CURSORMODE12832BAX 0x02 +#define CURSORMODE25632BAX 0x03 #define CURSORMODE6432BAX 0x07 +#define CURSORMODE128ARGBAX ((1 << 5) | CURSORMODE12832BAX)_ _+#define CURSORMODE256ARGBAX ((1 << 5) | CURSORMODE25632BAX)_ _#define CURSORMODE64ARGBAX ((1 << 5) | CURSORMODE6432BAX)_ _#define MCURSORPIPESELECT (1 << 28)_ _#define MCURSORPIPEA 0x00_ _diff --git a/drivers/gpu/drm/i915/inteldisplay.c b/drivers/gpu/drm/i915/inteldisplay.c_ _index f19e6ea..00b51f3 100644_ _--- a/drivers/gpu/drm/i915/inteldisplay.c_ _+++ b/drivers/gpu/drm/i915/inteldisplay.c_ _@@ -7411,10 +7411,18 @@ static void i9xxupdatecursor(struct drmcrtc *crtc, u32 base)_ _bool visible = base != 0;_ _if (intelcrtc->cursorvisible != visible) { + int16t width = intelcrtc->cursorwidth; uint32t cntl = I915READ(CURCNTR(pipe)); if (base) { cntl &= ~(CURSORMODE | MCURSORPIPESELECT); - cntl |= CURSORMODE64ARGBAX | MCURSORGAMMAENABLE; + + if (width == 64) + cntl |= CURSORMODE64ARGBAX | MCURSORGAMMAENABLE; + else if (width == 128) + cntl |= CURSORMODE128ARGBAX | MCURSORGAMMAENABLE; + else if (width == 256) + cntl |= CURSORMODE256ARGBAX | MCURSORGAMMAENABLE; + cntl |= pipe << 28; /* Connect to correct pipe */_ _} else {_ _cntl &= ~(CURSORMODE | MCURSORGAMMAENABLE);_ _@@ -7439,10 +7447,17 @@ static void ivbupdatecursor(struct drmcrtc *crtc, u32 base)_ _bool visible = base != 0;_ _if (intelcrtc->cursorvisible != visible) { + int16t width = intelcrtc->cursorwidth; uint32t cntl = I915READ(CURCNTRIVB(pipe)); if (base) { cntl &= ~CURSORMODE; - cntl |= CURSORMODE64ARGBAX | MCURSORGAMMAENABLE; + + if (width == 64) + cntl |= CURSORMODE64ARGBAX | MCURSORGAMMAENABLE; + else if (width == 128) + cntl |= CURSORMODE128ARGBAX | MCURSORGAMMAENABLE; + else if (width == 256) + cntl |= CURSORMODE256ARGBAX | MCURSORGAMMAENABLE; } else { cntl &= ~(CURSORMODE | MCURSORGAMMAENABLE); cntl |= CURSORMODEDISABLE; @@ -7538,9 +7553,9 @@ static int intelcrtccursorset(struct drmcrtc *crtc, goto finish; } - /* Currently we only support 64x64 cursors */ - if (width != 64 || height != 64) { - DRMERROR("we currently only support 64x64 cursors\n"); + /* Check for which cursor types we support */ + if (width > 256 || height > 256) {

This has to check explicitly for 64x64, 128x128, or 256x256. Any other combination of width and height is illegal.

Additionally gen2 supports only 64x64, so that has to be checked also.

Another issue is how to tell userspace about the cursor size. There was a patch on dri-devel recently adding cursor width/height capability queries to drm. I guess that should be enough for xorg since AFAICS it only uses a single fixed cursor size. The downside is that if the actual cursor image would fit one of the smaller sizes, we end up doing needless memory fetches for the extra pixels.

Once we have drm_planes for cursors, I was thinking we might add some kind of enum property that lists all the supported sizes for the plane.

+ DRMERROR("We currently only support 64x64, 128x128, 256x256 cursors\n"); return -EINVAL; }

-- 1.8.5


dri-devel mailing list dri-devel at lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- Ville Syrjälä Intel OTC



More information about the dri-devel mailing list