Commit d4d769a4 authored by Chris Wilson's avatar Chris Wilson 🤔

Prepare for split BLT ring on Sandybridge.

Depends on libdrm 057fab3382c02af54126ce395c43d4e6dce9439a

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=31123Signed-off-by: Chris Wilson's avatarChris Wilson <chris@chris-wilson.co.uk>
parent 8934395d
......@@ -58,6 +58,7 @@
#include "drmtest.h"
#include "intel_bufmgr.h"
#include "intel_batchbuffer.h"
#include "intel_gpu_tools.h"
#define OBJECT_WIDTH 1280
#define OBJECT_HEIGHT 720
......@@ -128,7 +129,7 @@ int main(int argc, char **argv)
bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
drm_intel_bufmgr_gem_enable_reuse(bufmgr);
batch = intel_batchbuffer_alloc(bufmgr);
batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
dst_bo = drm_intel_bo_alloc(bufmgr, "dst", object_size, 4096);
......
......@@ -58,6 +58,7 @@
#include "drmtest.h"
#include "intel_bufmgr.h"
#include "intel_batchbuffer.h"
#include "intel_gpu_tools.h"
#define OBJECT_WIDTH 1280
#define OBJECT_HEIGHT 720
......@@ -128,7 +129,7 @@ int main(int argc, char **argv)
bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
drm_intel_bufmgr_gem_enable_reuse(bufmgr);
batch = intel_batchbuffer_alloc(bufmgr);
batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
dst_bo = drm_intel_bo_alloc(bufmgr, "dst", object_size, 4096);
......
......@@ -61,6 +61,7 @@
#include "drmtest.h"
#include "intel_bufmgr.h"
#include "intel_batchbuffer.h"
#include "intel_gpu_tools.h"
#define OBJECT_WIDTH 1280
#define OBJECT_HEIGHT 720
......@@ -131,7 +132,7 @@ int main(int argc, char **argv)
bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
drm_intel_bufmgr_gem_enable_reuse(bufmgr);
batch = intel_batchbuffer_alloc(bufmgr);
batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
dst_bo = drm_intel_bo_alloc(bufmgr, "dst", object_size, 4096);
......
......@@ -54,6 +54,7 @@
#include "drmtest.h"
#include "intel_bufmgr.h"
#include "intel_batchbuffer.h"
#include "intel_gpu_tools.h"
/* Happens to be 128k, the size of the VBOs used by i965's Mesa driver. */
#define OBJECT_WIDTH 256
......@@ -141,7 +142,7 @@ int main(int argc, char **argv)
bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
drm_intel_bufmgr_gem_enable_reuse(bufmgr);
batch = intel_batchbuffer_alloc(bufmgr);
batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
dst_bo = drm_intel_bo_alloc(bufmgr, "dst", object_size, 4096);
......
......@@ -58,11 +58,12 @@ intel_batchbuffer_reset(struct intel_batchbuffer *batch)
}
struct intel_batchbuffer *
intel_batchbuffer_alloc(drm_intel_bufmgr *bufmgr)
intel_batchbuffer_alloc(drm_intel_bufmgr *bufmgr, uint32_t devid)
{
struct intel_batchbuffer *batch = calloc(sizeof(*batch), 1);
batch->bufmgr = bufmgr;
batch->devid = devid;
intel_batchbuffer_reset(batch);
return batch;
......@@ -82,6 +83,7 @@ void
intel_batchbuffer_flush(struct intel_batchbuffer *batch)
{
unsigned int used = batch->ptr - batch->map;
int ring;
int ret;
if (used == 0)
......@@ -104,7 +106,10 @@ intel_batchbuffer_flush(struct intel_batchbuffer *batch)
batch->map = NULL;
batch->ptr = NULL;
ret = drm_intel_bo_exec(batch->bo, used, NULL, 0, 0);
ring = 0;
if (IS_GEN6(batch->devid))
ring = I915_EXEC_BLT;
ret = drm_intel_bo_mrb_exec(batch->bo, used, NULL, 0, 0, ring);
assert(ret == 0);
intel_batchbuffer_reset(batch);
......@@ -145,7 +150,7 @@ intel_batchbuffer_data(struct intel_batchbuffer *batch,
void
intel_copy_bo(struct intel_batchbuffer *batch,
drm_intel_bo *dst_bo, drm_intel_bo *src_bo,
int width, int height, uint32_t devid)
int width, int height)
{
uint32_t src_tiling, dst_tiling, swizzle;
uint32_t src_pitch, dst_pitch;
......@@ -155,13 +160,13 @@ intel_copy_bo(struct intel_batchbuffer *batch,
drm_intel_bo_get_tiling(dst_bo, &dst_tiling, &swizzle);
src_pitch = width * 4;
if (IS_965(devid) && src_tiling != I915_TILING_NONE) {
if (IS_965(batch->devid) && src_tiling != I915_TILING_NONE) {
src_pitch /= 4;
cmd_bits |= XY_SRC_COPY_BLT_SRC_TILED;
}
dst_pitch = width * 4;
if (IS_965(devid) && dst_tiling != I915_TILING_NONE) {
if (IS_965(batch->devid) && dst_tiling != I915_TILING_NONE) {
dst_pitch /= 4;
cmd_bits |= XY_SRC_COPY_BLT_DST_TILED;
}
......
......@@ -11,6 +11,7 @@
struct intel_batchbuffer
{
drm_intel_bufmgr *bufmgr;
uint32_t devid;
drm_intel_bo *bo;
......@@ -28,7 +29,8 @@ struct intel_batchbuffer
unsigned int size;
};
struct intel_batchbuffer *intel_batchbuffer_alloc(drm_intel_bufmgr *bufmgr);
struct intel_batchbuffer *intel_batchbuffer_alloc(drm_intel_bufmgr *bufmgr,
uint32_t devid);
void intel_batchbuffer_free(struct intel_batchbuffer *batch);
......@@ -117,6 +119,6 @@ intel_batchbuffer_emit_mi_flush(struct intel_batchbuffer *batch)
void intel_copy_bo(struct intel_batchbuffer *batch,
drm_intel_bo *dst_bo, drm_intel_bo *src_bo,
int width, int height, uint32_t devid);
int width, int height);
#endif
......@@ -68,7 +68,7 @@ int main(int argc, char **argv)
bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
drm_intel_bufmgr_gem_enable_reuse(bufmgr);
batch = intel_batchbuffer_alloc(bufmgr);
batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
bad_store();
......
......@@ -64,7 +64,7 @@ int main(int argc, char **argv)
bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
drm_intel_bufmgr_gem_enable_reuse(bufmgr);
batch = intel_batchbuffer_alloc(bufmgr);
batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
bad_batch();
......
......@@ -100,19 +100,17 @@ bad_blit(drm_intel_bo *src_bo, uint32_t devid)
int main(int argc, char **argv)
{
drm_intel_bo *src;
uint32_t devid;
int fd;
fd = drm_open_any();
devid = intel_get_drm_devid(fd);
bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
drm_intel_bufmgr_gem_enable_reuse(bufmgr);
batch = intel_batchbuffer_alloc(bufmgr);
batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
src = drm_intel_bo_alloc(bufmgr, "src", 128 * 128, 4096);
bad_blit(src, devid);
bad_blit(src, batch->devid);
intel_batchbuffer_free(batch);
drm_intel_bufmgr_destroy(bufmgr);
......
......@@ -81,11 +81,10 @@ int main(int argc, char **argv)
bad_pipe = atoi(argv[1]);
fd = drm_open_any();
intel_get_drm_devid(fd);
bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
drm_intel_bufmgr_gem_enable_reuse(bufmgr);
batch = intel_batchbuffer_alloc(bufmgr);
batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
gpu_hang();
......
......@@ -131,14 +131,12 @@ main(int argc, char **argv)
drm_intel_bo *src1, *src2, *bo;
uint32_t start1 = 0;
uint32_t start2 = 1024 * 1024 / 4;
uint32_t devid;
fd = drm_open_any();
devid = intel_get_drm_devid(fd);
bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
drm_intel_bufmgr_gem_enable_reuse(bufmgr);
batch = intel_batchbuffer_alloc(bufmgr);
batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
src1 = create_bo(start1);
src2 = create_bo(start2);
......@@ -147,21 +145,21 @@ main(int argc, char **argv)
/* First, do a full-buffer read after blitting */
printf("Large read after blit 1\n");
intel_copy_bo(batch, bo, src1, width, height, devid);
intel_copy_bo(batch, bo, src1, width, height);
verify_large_read(bo, start1);
printf("Large read after blit 2\n");
intel_copy_bo(batch, bo, src2, width, height, devid);
intel_copy_bo(batch, bo, src2, width, height);
verify_large_read(bo, start2);
printf("Small reads after blit 1\n");
intel_copy_bo(batch, bo, src1, width, height, devid);
intel_copy_bo(batch, bo, src1, width, height);
verify_small_read(bo, start1);
printf("Small reads after blit 2\n");
intel_copy_bo(batch, bo, src2, width, height, devid);
intel_copy_bo(batch, bo, src2, width, height);
verify_small_read(bo, start2);
printf("Large read after blit 3\n");
intel_copy_bo(batch, bo, src1, width, height, devid);
intel_copy_bo(batch, bo, src1, width, height);
verify_large_read(bo, start1);
drm_intel_bo_unreference(src1);
......
......@@ -55,16 +55,14 @@ static const int size = 1024 * 1024;
int main(int argc, char **argv)
{
int fd;
uint32_t devid;
int i;
drm_intel_bo *src_bo, *dst_bo;
fd = drm_open_any();
devid = intel_get_drm_devid(fd);
bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
drm_intel_bufmgr_gem_enable_reuse(bufmgr);
batch = intel_batchbuffer_alloc(bufmgr);
batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
src_bo = drm_intel_bo_alloc(bufmgr, "src bo", size, 4096);
dst_bo = drm_intel_bo_alloc(bufmgr, "src bo", size, 4096);
......@@ -85,7 +83,7 @@ int main(int argc, char **argv)
* doing this, we aren't likely to with this test.
*/
for (i = 0; i < 128 * 1024 / (8 * 4) * 1.25; i++) {
intel_copy_bo(batch, dst_bo, src_bo, width, height, devid);
intel_copy_bo(batch, dst_bo, src_bo, width, height);
intel_batchbuffer_flush(batch);
}
......
......@@ -60,7 +60,6 @@
static drm_intel_bufmgr *bufmgr;
struct intel_batchbuffer *batch;
static int width = 512, height = 512;
static uint32_t devid;
static drm_intel_bo *
create_bo(uint32_t start_val)
......@@ -86,7 +85,7 @@ create_bo(uint32_t start_val)
}
drm_intel_bo_unmap(linear_bo);
intel_copy_bo (batch, bo, linear_bo, width, height, devid);
intel_copy_bo (batch, bo, linear_bo, width, height);
drm_intel_bo_unreference(linear_bo);
......@@ -102,7 +101,7 @@ check_bo(drm_intel_bo *bo, uint32_t start_val)
linear_bo = drm_intel_bo_alloc(bufmgr, "linear dst", 1024 * 1024, 4096);
intel_copy_bo(batch, linear_bo, bo, width, height, devid);
intel_copy_bo(batch, linear_bo, bo, width, height);
drm_intel_bo_map(linear_bo, 0);
linear = linear_bo->virtual;
......@@ -131,11 +130,10 @@ int main(int argc, char **argv)
int i;
fd = drm_open_any();
devid = intel_get_drm_devid(fd);
bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
drm_intel_bufmgr_gem_enable_reuse(bufmgr);
batch = intel_batchbuffer_alloc(bufmgr);
batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
for (i = 0; i < bo_count; i++) {
bo[i] = create_bo(start);
......@@ -156,7 +154,7 @@ int main(int argc, char **argv)
if (src == dst)
continue;
intel_copy_bo(batch, bo[dst], bo[src], width, height, devid);
intel_copy_bo(batch, bo[dst], bo[src], width, height);
bo_start_val[dst] = bo_start_val[src];
/*
......
......@@ -81,7 +81,7 @@ create_bo(uint32_t devid)
linear[i] = val++;
drm_intel_bo_unmap(linear_bo);
intel_copy_bo(batch, bo, linear_bo, width, height, devid);
intel_copy_bo(batch, bo, linear_bo, width, height);
drm_intel_bo_unreference(linear_bo);
......@@ -133,7 +133,7 @@ main(int argc, char **argv)
bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
drm_intel_bufmgr_gem_enable_reuse(bufmgr);
batch = intel_batchbuffer_alloc(bufmgr);
batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
bo = create_bo(devid);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment