summaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys/intel
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2013-05-10 14:23:33 +0800
committerChia-I Wu <[email protected]>2013-05-16 11:24:59 +0800
commit5c9b69d259def75f365998603d68d6749209f8b0 (patch)
treec8390c648992cbf084c6a26be888bf04038572c2 /src/gallium/winsys/intel
parent639d0f73c137a76ae76501da4e09cdd0e33d4c37 (diff)
winsys/intel: test for and expose address swizzling
Without knowing whether addresses are swizzled or not, we cannot manipulate a tiled surface in CPU.
Diffstat (limited to 'src/gallium/winsys/intel')
-rw-r--r--src/gallium/winsys/intel/drm/intel_drm_winsys.c22
-rw-r--r--src/gallium/winsys/intel/drm/intel_winsys.h1
2 files changed, 23 insertions, 0 deletions
diff --git a/src/gallium/winsys/intel/drm/intel_drm_winsys.c b/src/gallium/winsys/intel/drm/intel_drm_winsys.c
index 8c0e29270f5..1a8d0f7292f 100644
--- a/src/gallium/winsys/intel/drm/intel_drm_winsys.c
+++ b/src/gallium/winsys/intel/drm/intel_drm_winsys.c
@@ -585,6 +585,26 @@ get_param(struct intel_drm_winsys *drm_ws, int param, int *value)
}
static bool
+test_address_swizzling(struct intel_drm_winsys *drm_ws)
+{
+ drm_intel_bo *bo;
+ uint32_t tiling = I915_TILING_X, swizzle;
+ unsigned long pitch;
+
+ bo = drm_intel_bo_alloc_tiled(drm_ws->bufmgr,
+ "address swizzling test", 64, 64, 4, &tiling, &pitch, 0);
+ if (bo) {
+ drm_intel_bo_get_tiling(bo, &tiling, &swizzle);
+ drm_intel_bo_unreference(bo);
+ }
+ else {
+ swizzle = I915_BIT_6_SWIZZLE_NONE;
+ }
+
+ return (swizzle != I915_BIT_6_SWIZZLE_NONE);
+}
+
+static bool
init_info(struct intel_drm_winsys *drm_ws)
{
struct intel_winsys_info *info = &drm_ws->info;
@@ -605,6 +625,8 @@ init_info(struct intel_drm_winsys *drm_ws)
get_param(drm_ws, I915_PARAM_HAS_GEN7_SOL_RESET, &val);
info->has_gen7_sol_reset = val;
+ info->has_address_swizzling = test_address_swizzling(drm_ws);
+
return true;
}
diff --git a/src/gallium/winsys/intel/drm/intel_winsys.h b/src/gallium/winsys/intel/drm/intel_winsys.h
index 37ee275d2d9..90f1b49df1a 100644
--- a/src/gallium/winsys/intel/drm/intel_winsys.h
+++ b/src/gallium/winsys/intel/drm/intel_winsys.h
@@ -74,6 +74,7 @@ struct intel_winsys_info {
int devid;
bool has_llc;
bool has_gen7_sol_reset;
+ bool has_address_swizzling;
};
/**