Mesa (master): gallium/xorg st/nv50: add PIPE_BIND_CURSOR

Christoph Bumiller chrisbmr at kemper.freedesktop.org
Fri May 6 17:15:46 UTC 2011


Module: Mesa
Branch: master
Commit: 3b2bc4ac5b63429738687fd296180149b54e67a4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3b2bc4ac5b63429738687fd296180149b54e67a4

Author: Marcin Slusarz <marcin.slusarz at gmail.com>
Date:   Fri May  6 19:06:20 2011 +0200

gallium/xorg st/nv50: add PIPE_BIND_CURSOR

We need to distinguish surfaces for mouse cursors from scanouts,
because nv50 hardware display engine ignores tiling flags.

---

 src/gallium/drivers/nv50/nv50_miptree.c     |   10 +++++++++-
 src/gallium/include/pipe/p_defines.h        |    3 ++-
 src/gallium/state_trackers/xorg/xorg_crtc.c |    1 +
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_miptree.c b/src/gallium/drivers/nv50/nv50_miptree.c
index 9eeca05..486b368 100644
--- a/src/gallium/drivers/nv50/nv50_miptree.c
+++ b/src/gallium/drivers/nv50/nv50_miptree.c
@@ -158,6 +158,9 @@ nv50_miptree_create(struct pipe_screen *pscreen,
       tile_flags = 0x6000;
       break;
    default:
+      if (pt->bind & PIPE_BIND_CURSOR)
+         tile_flags = 0;
+      else
       if ((pt->bind & PIPE_BIND_SCANOUT) &&
           util_format_get_blocksizebits(pt->format) == 32)
          tile_flags = 0x7a00;
@@ -165,6 +168,8 @@ nv50_miptree_create(struct pipe_screen *pscreen,
          tile_flags = 0x7000;
       break;
    }
+   if (pt->bind & (PIPE_BIND_SCANOUT | PIPE_BIND_CURSOR))
+      tile_flags |= NOUVEAU_BO_TILE_SCANOUT;
 
    /* For 3D textures, a mipmap is spanned by all the layers, for array
     * textures and cube maps, each layer contains its own mipmaps.
@@ -176,7 +181,10 @@ 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 & NOUVEAU_BO_TILE_LAYOUT_MASK)
+         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 *
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 431a7fb..5f7dd96 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -300,7 +300,8 @@ enum pipe_transfer_usage {
 #define PIPE_BIND_TRANSFER_WRITE       (1 << 9) /* get_transfer */
 #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 << 16) /* mouse cursor */
+#define PIPE_BIND_CUSTOM               (1 << 17) /* state-tracker/winsys usages */
 
 /* The first two flags above were previously part of the amorphous
  * TEXTURE_USAGE, most of which are now descriptions of the ways a
diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c b/src/gallium/state_trackers/xorg/xorg_crtc.c
index 40b8434..0499ed1 100644
--- a/src/gallium/state_trackers/xorg/xorg_crtc.c
+++ b/src/gallium/state_trackers/xorg/xorg_crtc.c
@@ -221,6 +221,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;




More information about the mesa-commit mailing list