aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2010-10-18 09:45:58 +1000
committerDave Airlie <[email protected]>2010-10-18 13:46:42 +1000
commit8a74f7422bedb419f3527bb1ccd60e1e9220502c (patch)
tree47d850865e467744e57cc10d70c2961f57770356 /src/gallium/winsys
parent375613afe38e0704b4ce38e64765b12d9660a846 (diff)
r600g: retrieve tiling info from kernel for shared buffers.
we need to know if the back is tiled so we can blit from it properly.
Diffstat (limited to 'src/gallium/winsys')
-rw-r--r--src/gallium/winsys/r600/drm/r600_bo.c18
-rw-r--r--src/gallium/winsys/r600/drm/r600_priv.h7
-rw-r--r--src/gallium/winsys/r600/drm/radeon_bo.c19
3 files changed, 42 insertions, 2 deletions
diff --git a/src/gallium/winsys/r600/drm/r600_bo.c b/src/gallium/winsys/r600/drm/r600_bo.c
index 9498f3a82ea..7d54ff18fc2 100644
--- a/src/gallium/winsys/r600/drm/r600_bo.c
+++ b/src/gallium/winsys/r600/drm/r600_bo.c
@@ -26,7 +26,9 @@
#include <pipe/p_compiler.h>
#include <pipe/p_screen.h>
#include <pipebuffer/pb_bufmgr.h>
+#include "radeon_drm.h"
#include "r600_priv.h"
+#include "r600d.h"
struct r600_bo *r600_bo(struct radeon *radeon,
unsigned size, unsigned alignment, unsigned usage)
@@ -55,7 +57,7 @@ struct r600_bo *r600_bo(struct radeon *radeon,
}
struct r600_bo *r600_bo_handle(struct radeon *radeon,
- unsigned handle)
+ unsigned handle, unsigned *array_mode)
{
struct r600_bo *ws_bo = calloc(1, sizeof(struct r600_bo));
struct radeon_bo *bo;
@@ -68,6 +70,20 @@ struct r600_bo *r600_bo_handle(struct radeon *radeon,
bo = radeon_bo_pb_get_bo(ws_bo->pb);
ws_bo->size = bo->size;
pipe_reference_init(&ws_bo->reference, 1);
+
+ radeon_bo_get_tiling_flags(radeon, bo, &ws_bo->tiling_flags,
+ &ws_bo->kernel_pitch);
+ if (array_mode) {
+ if (ws_bo->tiling_flags) {
+ if (ws_bo->tiling_flags & RADEON_TILING_MICRO)
+ *array_mode = V_0280A0_ARRAY_1D_TILED_THIN1;
+ if ((ws_bo->tiling_flags & (RADEON_TILING_MICRO | RADEON_TILING_MACRO)) ==
+ (RADEON_TILING_MICRO | RADEON_TILING_MACRO))
+ *array_mode = V_0280A0_ARRAY_2D_TILED_THIN1;
+ } else {
+ *array_mode = 0;
+ }
+ }
return ws_bo;
}
diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h
index 08e243b00d0..b5bd7bd92c1 100644
--- a/src/gallium/winsys/r600/drm/r600_priv.h
+++ b/src/gallium/winsys/r600/drm/r600_priv.h
@@ -77,6 +77,8 @@ struct r600_bo {
struct pipe_reference reference;
struct pb_buffer *pb;
unsigned size;
+ unsigned tiling_flags;
+ unsigned kernel_pitch;
};
@@ -95,7 +97,10 @@ int radeon_bo_wait(struct radeon *radeon, struct radeon_bo *bo);
int radeon_bo_busy(struct radeon *radeon, struct radeon_bo *bo, uint32_t *domain);
void radeon_bo_pbmgr_flush_maps(struct pb_manager *_mgr);
int radeon_bo_fencelist(struct radeon *radeon, struct radeon_bo **bolist, uint32_t num_bo);
-
+int radeon_bo_get_tiling_flags(struct radeon *radeon,
+ struct radeon_bo *bo,
+ uint32_t *tiling_flags,
+ uint32_t *pitch);
/* radeon_bo_pb.c */
struct radeon_bo *radeon_bo_pb_get_bo(struct pb_buffer *_buf);
diff --git a/src/gallium/winsys/r600/drm/radeon_bo.c b/src/gallium/winsys/r600/drm/radeon_bo.c
index 14a00161c8b..9d664b7e537 100644
--- a/src/gallium/winsys/r600/drm/radeon_bo.c
+++ b/src/gallium/winsys/r600/drm/radeon_bo.c
@@ -200,3 +200,22 @@ int radeon_bo_busy(struct radeon *radeon, struct radeon_bo *bo, uint32_t *domain
*domain = args.domain;
return ret;
}
+
+int radeon_bo_get_tiling_flags(struct radeon *radeon,
+ struct radeon_bo *bo,
+ uint32_t *tiling_flags,
+ uint32_t *pitch)
+{
+ struct drm_radeon_gem_get_tiling args;
+ int ret;
+
+ args.handle = bo->handle;
+ ret = drmCommandWriteRead(radeon->fd, DRM_RADEON_GEM_GET_TILING,
+ &args, sizeof(args));
+ if (ret)
+ return ret;
+
+ *tiling_flags = args.tiling_flags;
+ *pitch = args.pitch;
+ return ret;
+}