Skip to contentSkip to conversation

gallium/xorg st/nv50/i915: add PIPE_BIND_CURSOR

PATCH In review Marcin Slusarz 4 participants 7 messages May 1, 2011 – May 8, 2011 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gallium/xorg st/nv50/i915: add PIPE_BIND_CURSOR

We need to distinguish surfaces for mouse cursors from scanouts, because nv50 hardware display engine ignores tiling flags.
i915 seems to have similar needs, so fix it too.

---
 src/gallium/drivers/i915/i915_resource_texture.c |    6 +-----
 src/gallium/drivers/nv50/nv50_miptree.c          |   11 +++++++++--
 src/gallium/include/pipe/p_defines.h             |    1 +
 src/gallium/state_trackers/xorg/xorg_crtc.c      |    1 +
 4 files changed, 12 insertions(+), 7 deletions(-)
src/gallium/drivers/i915/i915_resource_texture.c +1 -5
index 7816925..7ad191b 100644
@@ -826,11 +826,7 @@ i915_texture_create(struct pipe_screen *screen,
    }
 
    /* for scanouts and cursors, cursors arn't scanouts */
-
-   /* XXX: use a custom flag for cursors, don't rely on magically
-    * guessing that this is Xorg asking for a cursor
-    */
-   if ((template->bind & PIPE_BIND_SCANOUT) && template->width0 != 64)
+   if ((template->bind & PIPE_BIND_SCANOUT) && !(template->bind & PIPE_BIND_CURSOR))
       buf_usage = I915_NEW_SCANOUT;
    else
       buf_usage = I915_NEW_TEXTURE;
src/gallium/drivers/nv50/nv50_miptree.c +9 -2
index 9eeca05..d632e21 100644
@@ -158,7 +158,9 @@ nv50_miptree_create(struct pipe_screen *pscreen,
       tile_flags = 0x6000;
       break;
    default:
-      if ((pt->bind & PIPE_BIND_SCANOUT) &&
+      if (pt->bind & PIPE_BIND_CURSOR)
+         tile_flags = 0; /* PDISPLAY does not support tiling */
+      else if ((pt->bind & PIPE_BIND_SCANOUT) &&
           util_format_get_blocksizebits(pt->format) == 32)
          tile_flags = 0x7a00;
       else
@@ -176,7 +178,12 @@ nv50_miptree_create(struct pipe_screen *pscreen,
       unsigned blocksize = util_format_get_blocksize(pt->format);
 
       lvl->offset = mt->total_size;
-      lvl->tile_mode = get_tile_dims(nbx, nby, d);
+
+      if (tile_flags == 0)
+         lvl->tile_mode = 0;
+      else
+         lvl->tile_mode = get_tile_dims(nbx, nby, d);
+
       lvl->pitch = align(nbx * blocksize, NV50_TILE_PITCH(lvl->tile_mode));
 
       mt->total_size += lvl->pitch *
src/gallium/include/pipe/p_defines.h +1 -0
index 431a7fb..ae82baa 100644
@@ -301,6 +301,7 @@ enum pipe_transfer_usage {
 #define PIPE_BIND_TRANSFER_READ        (1 << 10) /* get_transfer */
 #define PIPE_BIND_STREAM_OUTPUT        (1 << 11) /* set_stream_output_buffers */
 #define PIPE_BIND_CUSTOM               (1 << 16) /* state-tracker/winsys usages */
+#define PIPE_BIND_CURSOR               (1 << 17) /* mouse cursor */
 
 /* The first two flags above were previously part of the amorphous
  * TEXTURE_USAGE, most of which are now descriptions of the ways a
src/gallium/state_trackers/xorg/xorg_crtc.c +1 -0
index d751ac1..8eaf414 100644
@@ -218,6 +218,7 @@ crtc_load_cursor_argb_ga3d(xf86CrtcPtr crtc, CARD32 * image)
 	memset(&templat, 0, sizeof(templat));
 	templat.bind |= PIPE_BIND_RENDER_TARGET;
 	templat.bind |= PIPE_BIND_SCANOUT;
+	templat.bind |= PIPE_BIND_CURSOR;
 	templat.target = PIPE_TEXTURE_2D;
 	templat.last_level = 0;
 	templat.depth0 = 1;
Signature · 1 line
1.7.4.1
Acked-by on v1 1/1
#1 lore raw
Quoted 3 lines · Marcin Slusarz

We need to distinguish surfaces for mouse cursors from scanouts, because nv50 hardware display engine ignores tiling flags.
i915 seems to have similar needs, so fix it too.

For the i915g part:

Signature · 2 lines
Daniel Vetter
[email protected] - +41 (0) 79 364 57 48 - http://blog.ffwll.ch
#2 lore raw

I think in i915g the CURSOR flag should be used in i9x5_scanout_layout for the "special case for cursors" as well, instead of only checking only pt->width0 == 64 && pt->height0 == 64.

2011/5/2 Daniel Vetter <[email protected]>:

Quoted 16 lines
Quoted 3 lines · Marcin Slusarz

We need to distinguish surfaces for mouse cursors from scanouts, because nv50 hardware display engine ignores tiling flags.
i915 seems to have similar needs, so fix it too.

For the i915g part:

--
Daniel Vetter
[email protected] - +41 (0) 79 364 57 48 - http://blog.ffwll.ch
_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

A message that is not in the archive (sent off-list or not yet received): BANLkTikbYs7y2gCELyyi1OKcuZYYVCfieA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#4 lore raw
Quoted 3 lines · Benjamin Franzke

I think in i915g the CURSOR flag should be used in i9x5_scanout_layout for the "special case for cursors" as well, instead of only checking only pt->width0 == 64 && pt->height0 == 64.

Oops, so much for actually re-checking the code. On the other hand, that part is broken, it needs a
tex->tiling = I915_TILE_NONE;
and perhaps some check that width == height == 64 indeed holds. Then move it out as the first if clause and it'd start to make sense ... -Daniel

Signature · 2 lines
Daniel Vetter
daniel.vetter-/[email protected] - +41 (0) 79 364 57 48 - http://blog.ffwll.ch
#5 lore raw
Quoted 11 lines · Daniel Vetter
Quoted 3 lines · Benjamin Franzke

I think in i915g the CURSOR flag should be used in i9x5_scanout_layout for the "special case for cursors" as well, instead of only checking only pt->width0 == 64 && pt->height0 == 64.

Oops, so much for actually re-checking the code. On the other hand, that part is broken, it needs a
tex->tiling = I915_TILE_NONE;
and perhaps some check that width == height == 64 indeed holds. Then move it out as the first if clause and it'd start to make sense ...

Could you fix it in separate patch?

I couldn't even test it...

Marcin

#6 lore raw
Quoted 7 lines · Marcin Slusarz
Quoted 6 lines · Daniel Vetter
Quoted 3 lines · Benjamin Franzke

I think in i915g the CURSOR flag should be used in i9x5_scanout_layout for the "special case for cursors" as well, instead of only checking only pt->width0 == 64 && pt->height0 == 64.

Quoted 7 lines
Quoted 5 lines

Oops, so much for actually re-checking the code. On the other hand, that part is broken, it needs a
   tex->tiling = I915_TILE_NONE;
and perhaps some check that width == height == 64 indeed holds. Then move it out as the first if clause and it'd start to make sense ...

Could you fix it in separate patch?

Jakob has said (on irc) that he intends to again play with xorg-i915g ... -Daniel

Signature · 2 lines
Daniel Vetter
[email protected] - +41 (0) 79 364 57 48 - http://blog.ffwll.ch
#7 lore raw
Quoted 14 lines · Daniel Vetter
Quoted 13 lines · Marcin Slusarz
Quoted 11 lines · Daniel Vetter
Quoted 3 lines · Benjamin Franzke

I think in i915g the CURSOR flag should be used in i9x5_scanout_layout for the "special case for cursors" as well, instead of only checking only pt->width0 == 64 && pt->height0 == 64.

Oops, so much for actually re-checking the code. On the other hand, that part is broken, it needs a
   tex->tiling = I915_TILE_NONE;
and perhaps some check that width == height == 64 indeed holds. Then move it out as the first if clause and it'd start to make sense ...

Quoted 3 lines
Quoted 1 line

Could you fix it in separate patch?

Jakob has said (on irc) that he intends to again play with xorg-i915g ...

Christoph commited generic and nv50 part (Thanks again!). i915 part below.

---
From: Marcin Slusarz <[email protected]>
Subject: [PATCH] i915: use PIPE_BIND_CURSOR

---
 src/gallium/drivers/i915/i915_resource_texture.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)
src/gallium/drivers/i915/i915_resource_texture.c +1 -5
index e05b059..97ac012 100644
@@ -825,11 +825,7 @@ i915_texture_create(struct pipe_screen *screen,
    }
 
    /* for scanouts and cursors, cursors arn't scanouts */
-
-   /* XXX: use a custom flag for cursors, don't rely on magically
-    * guessing that this is Xorg asking for a cursor
-    */
-   if ((template->bind & PIPE_BIND_SCANOUT) && template->width0 != 64)
+   if ((template->bind & PIPE_BIND_SCANOUT) && !(template->bind & PIPE_BIND_CURSOR))
       buf_usage = I915_NEW_SCANOUT;
    else
       buf_usage = I915_NEW_TEXTURE;
Signature · 5 lines
1.7.4.1
_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev