aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2014-03-09 02:07:18 +0800
committerChia-I Wu <[email protected]>2014-03-10 16:42:42 +0800
commit42c1ce4c03c0c5f4fb61b981143cf2638d87c834 (patch)
tree6d8abba785d1602df5813b0598fe6f0efbb16d24
parenta434ac045eb2e0333ee8bb6e44aa0a46de2e7438 (diff)
ilo: winsys may limit the batch buffer size
The maximum batch buffer size is determined at the time of drm_intel_bufmgr_gem_init(). Make sure the pipe driver does not exceed the limit.
-rw-r--r--src/gallium/drivers/ilo/ilo_common.h1
-rw-r--r--src/gallium/drivers/ilo/ilo_context.c8
-rw-r--r--src/gallium/drivers/ilo/ilo_cp.c4
-rw-r--r--src/gallium/drivers/ilo/ilo_cp.h2
-rw-r--r--src/gallium/drivers/ilo/ilo_screen.c1
-rw-r--r--src/gallium/winsys/intel/drm/intel_drm_winsys.c2
-rw-r--r--src/gallium/winsys/intel/intel_winsys.h1
7 files changed, 15 insertions, 4 deletions
diff --git a/src/gallium/drivers/ilo/ilo_common.h b/src/gallium/drivers/ilo/ilo_common.h
index cc17f76e243..ae7896efc27 100644
--- a/src/gallium/drivers/ilo/ilo_common.h
+++ b/src/gallium/drivers/ilo/ilo_common.h
@@ -68,6 +68,7 @@ enum ilo_debug {
struct ilo_dev_info {
/* these mirror intel_winsys_info */
int devid;
+ int max_batch_size;
bool has_llc;
bool has_gen7_sol_reset;
bool has_address_swizzling;
diff --git a/src/gallium/drivers/ilo/ilo_context.c b/src/gallium/drivers/ilo/ilo_context.c
index faf29c22778..a01934c9154 100644
--- a/src/gallium/drivers/ilo/ilo_context.c
+++ b/src/gallium/drivers/ilo/ilo_context.c
@@ -120,6 +120,7 @@ ilo_context_create(struct pipe_screen *screen, void *priv)
{
struct ilo_screen *is = ilo_screen(screen);
struct ilo_context *ilo;
+ int cp_size;
ilo = CALLOC_STRUCT(ilo_context);
if (!ilo)
@@ -135,7 +136,12 @@ ilo_context_create(struct pipe_screen *screen, void *priv)
util_slab_create(&ilo->transfer_mempool,
sizeof(struct ilo_transfer), 64, UTIL_SLAB_SINGLETHREADED);
- ilo->cp = ilo_cp_create(ilo->winsys, is->dev.has_llc);
+ /* 8192 DWords */
+ cp_size = 8192;
+ if (cp_size * 4 > is->dev.max_batch_size)
+ cp_size = is->dev.max_batch_size / 4;
+
+ ilo->cp = ilo_cp_create(ilo->winsys, cp_size, is->dev.has_llc);
ilo->shader_cache = ilo_shader_cache_create();
if (ilo->cp)
ilo->hw3d = ilo_3d_create(ilo->cp, ilo->dev);
diff --git a/src/gallium/drivers/ilo/ilo_cp.c b/src/gallium/drivers/ilo/ilo_cp.c
index 8bcb19625f8..cd94eec0fe5 100644
--- a/src/gallium/drivers/ilo/ilo_cp.c
+++ b/src/gallium/drivers/ilo/ilo_cp.c
@@ -272,7 +272,7 @@ ilo_cp_destroy(struct ilo_cp *cp)
* Create a command parser.
*/
struct ilo_cp *
-ilo_cp_create(struct intel_winsys *winsys, bool direct_map)
+ilo_cp_create(struct intel_winsys *winsys, int size, bool direct_map)
{
struct ilo_cp *cp;
@@ -286,7 +286,7 @@ ilo_cp_create(struct intel_winsys *winsys, bool direct_map)
cp->ring = ILO_CP_RING_RENDER;
cp->no_implicit_flush = false;
- cp->bo_size = 8192;
+ cp->bo_size = size;
if (!direct_map) {
cp->sys = MALLOC(cp->bo_size * 4);
diff --git a/src/gallium/drivers/ilo/ilo_cp.h b/src/gallium/drivers/ilo/ilo_cp.h
index 9a09ac9106a..1dcfab81cdf 100644
--- a/src/gallium/drivers/ilo/ilo_cp.h
+++ b/src/gallium/drivers/ilo/ilo_cp.h
@@ -85,7 +85,7 @@ struct ilo_cp_jmp_buf {
};
struct ilo_cp *
-ilo_cp_create(struct intel_winsys *winsys, bool direct_map);
+ilo_cp_create(struct intel_winsys *winsys, int size, bool direct_map);
void
ilo_cp_destroy(struct ilo_cp *cp);
diff --git a/src/gallium/drivers/ilo/ilo_screen.c b/src/gallium/drivers/ilo/ilo_screen.c
index 55bbb3abaf0..11a5be2ebf1 100644
--- a/src/gallium/drivers/ilo/ilo_screen.c
+++ b/src/gallium/drivers/ilo/ilo_screen.c
@@ -648,6 +648,7 @@ static bool
init_dev(struct ilo_dev_info *dev, const struct intel_winsys_info *info)
{
dev->devid = info->devid;
+ dev->max_batch_size = info->max_batch_size;
dev->has_llc = info->has_llc;
dev->has_gen7_sol_reset = info->has_gen7_sol_reset;
dev->has_address_swizzling = info->has_address_swizzling;
diff --git a/src/gallium/winsys/intel/drm/intel_drm_winsys.c b/src/gallium/winsys/intel/drm/intel_drm_winsys.c
index bd805fdb786..5cdf39fe32e 100644
--- a/src/gallium/winsys/intel/drm/intel_drm_winsys.c
+++ b/src/gallium/winsys/intel/drm/intel_drm_winsys.c
@@ -135,6 +135,8 @@ init_info(struct intel_winsys *winsys)
info->devid = drm_intel_bufmgr_gem_get_devid(winsys->bufmgr);
+ info->max_batch_size = BATCH_SZ;
+
get_param(winsys, I915_PARAM_HAS_LLC, &val);
info->has_llc = val;
diff --git a/src/gallium/winsys/intel/intel_winsys.h b/src/gallium/winsys/intel/intel_winsys.h
index 15f1aec1093..b5995fbb40f 100644
--- a/src/gallium/winsys/intel/intel_winsys.h
+++ b/src/gallium/winsys/intel/intel_winsys.h
@@ -70,6 +70,7 @@ struct intel_bo;
struct intel_winsys_info {
int devid;
+ int max_batch_size;
bool has_llc;
bool has_gen7_sol_reset;
bool has_address_swizzling;