summaryrefslogtreecommitdiff
path: root/src/i830_exa.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2009-02-27 19:09:49 -0800
committerEric Anholt <eric@anholt.net>2009-02-27 19:09:49 -0800
commit5bfd73cd31ba197a62f549cdbad1a1270b571027 (patch)
tree50430d9a372c5a69c84c73e8f7fdd7b48041f149 /src/i830_exa.c
parentf53bdad1412f841075232455837578f00709c6ef (diff)
Only allocate pixmaps aligned for tiling when requested by DRI2 GetBuffers.
This saves massive quantities of memory on pre-965 since the DRI2 tiling enable caused the minimum size of any pixmap to be 1MB.
Diffstat (limited to 'src/i830_exa.c')
-rw-r--r--src/i830_exa.c38
1 files changed, 25 insertions, 13 deletions
diff --git a/src/i830_exa.c b/src/i830_exa.c
index b9d6c643..0a224864 100644
--- a/src/i830_exa.c
+++ b/src/i830_exa.c
@@ -935,29 +935,38 @@ i830_uxa_create_pixmap (ScreenPtr screen, int w, int h, int depth, unsigned usag
if (w && h)
{
unsigned int size;
+ uint32_t tiling = I915_TILING_NONE;
stride = ROUND_TO((w * pixmap->drawable.bitsPerPixel + 7) / 8,
i830->accel_pixmap_pitch_alignment);
- /* Use the I915_FENCE_TILING_X even if it may end up being TILING_Y,
- * as it just results in larger alignment. Really, we need to use the
- * usage hint to tell what the pixmap's going to be.
- */
- stride = i830_get_fence_pitch(i830, stride, I915_TILING_X);
- /* Round the object up to the size of the fence it will live in
- * if necessary. We could potentially make the kernel allocate
- * a larger aperture space and just bind the subset of pages in,
- * but this is easier and also keeps us out of trouble (as much)
- * with drm_intel_bufmgr_check_aperture().
- */
- size = i830_get_fence_size(i830, stride * h);
+ if (usage == INTEL_CREATE_PIXMAP_TILING_X)
+ tiling = I915_TILING_X;
+ else if (usage == INTEL_CREATE_PIXMAP_TILING_Y)
+ tiling = I915_TILING_Y;
+
+ if (tiling == I915_TILING_NONE) {
+ size = stride * h;
+ } else {
+ stride = i830_get_fence_pitch(i830, stride, tiling);
+ /* Round the object up to the size of the fence it will live in
+ * if necessary. We could potentially make the kernel allocate
+ * a larger aperture space and just bind the subset of pages in,
+ * but this is easier and also keeps us out of trouble (as much)
+ * with drm_intel_bufmgr_check_aperture().
+ */
+ size = i830_get_fence_size(i830, stride * h);
+ }
bo = drm_intel_bo_alloc_for_render(i830->bufmgr, "pixmap", size, 0);
if (!bo) {
fbDestroyPixmap (pixmap);
return NullPixmap;
}
-
+
+ if (tiling != I915_TILING_NONE)
+ drm_intel_bo_set_tiling(bo, &tiling, stride);
+
screen->ModifyPixmapHeader (pixmap, w, h, 0, 0, stride, NULL);
i830_uxa_set_pixmap_bo (pixmap, bo);
@@ -971,6 +980,9 @@ i830_uxa_create_pixmap (ScreenPtr screen, int w, int h, int depth, unsigned usag
static PixmapPtr
i830_uxa_server_14_create_pixmap (ScreenPtr screen, int w, int h, int depth)
{
+ /* For server pre-1.6, we're never allocating DRI2 buffers, so no need for
+ * a hint.
+ */
return i830_uxa_create_pixmap(screen, w, h, depth, 0);
}
#endif