summaryrefslogtreecommitdiff
path: root/lib/intel_batchbuffer.c
diff options
context:
space:
mode:
authorImre Deak <imre.deak@intel.com>2017-12-08 16:43:05 +0200
committerImre Deak <imre.deak@intel.com>2017-12-11 13:49:02 +0200
commit4d40a6776f08dd87b7e007da691b73d45a9bf1fa (patch)
treec19ac1384ab72393fa53fadbd3ea88bfed5a6782 /lib/intel_batchbuffer.c
parent0f3be861eb7456a87706b72216daa3ee7e4dde5b (diff)
igt_fb: Add support for drawing to non-32bit Y/Yf tiled FBs
When drawing with cairo to Y/Yf tiled FBs we use a temporary linear buffer which is mapped to the CPU, but the fast blit needed for this only expects 32 bpp FBs. Add support for other bpps too. This is needed for upcoming patches testing non-32bit bpp formats with Y/Yf tiling. Thanks to Ville for explaining why we need the temporary buffer. (Looks like for Y tiling we could do without, but that's a separate topic.) Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Imre Deak <imre.deak@intel.com>
Diffstat (limited to 'lib/intel_batchbuffer.c')
-rw-r--r--lib/intel_batchbuffer.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c
index 53449894..9a53b6f8 100644
--- a/lib/intel_batchbuffer.c
+++ b/lib/intel_batchbuffer.c
@@ -519,7 +519,8 @@ static uint32_t fast_copy_dword0(unsigned int src_tiling,
}
static uint32_t fast_copy_dword1(unsigned int src_tiling,
- unsigned int dst_tiling)
+ unsigned int dst_tiling,
+ int bpp)
{
uint32_t dword1 = 0;
@@ -528,7 +529,25 @@ static uint32_t fast_copy_dword1(unsigned int src_tiling,
if (dst_tiling == I915_TILING_Yf)
dword1 |= XY_FAST_COPY_DST_TILING_Yf;
- dword1 |= XY_FAST_COPY_COLOR_DEPTH_32;
+ switch (bpp) {
+ case 8:
+ dword1 |= XY_FAST_COPY_COLOR_DEPTH_8;
+ break;
+ case 16:
+ dword1 |= XY_FAST_COPY_COLOR_DEPTH_16;
+ break;
+ case 32:
+ dword1 |= XY_FAST_COPY_COLOR_DEPTH_32;
+ break;
+ case 64:
+ dword1 |= XY_FAST_COPY_COLOR_DEPTH_64;
+ break;
+ case 128:
+ dword1 |= XY_FAST_COPY_COLOR_DEPTH_128;
+ break;
+ default:
+ igt_assert(0);
+ }
return dword1;
}
@@ -586,6 +605,7 @@ static void exec_blit(int fd,
* @src_y: Y coordinate of the source region to copy
* @width: Width of the region to copy
* @height: Height of the region to copy
+ * @bpp: source and destination bits per pixel
* @dst_handle: GEM handle of the source buffer
* @dst_stride: Stride (in bytes) of the destination buffer
* @dst_tiling: Tiling mode of the destination buffer
@@ -604,6 +624,9 @@ void igt_blitter_fast_copy__raw(int fd,
/* size */
unsigned int width, unsigned int height,
+ /* bpp */
+ int bpp,
+
/* dst */
uint32_t dst_handle,
unsigned int dst_stride,
@@ -621,7 +644,7 @@ void igt_blitter_fast_copy__raw(int fd,
src_pitch = fast_copy_pitch(src_stride, src_tiling);
dst_pitch = fast_copy_pitch(dst_stride, dst_tiling);
dword0 = fast_copy_dword0(src_tiling, dst_tiling);
- dword1 = fast_copy_dword1(src_tiling, dst_tiling);
+ dword1 = fast_copy_dword1(src_tiling, dst_tiling, bpp);
#define CHECK_RANGE(x) ((x) >= 0 && (x) < (1 << 15))
assert(CHECK_RANGE(src_x) && CHECK_RANGE(src_y) &&
@@ -671,6 +694,7 @@ void igt_blitter_fast_copy__raw(int fd,
* @src_y: source pixel y-coordination
* @width: width of the copied rectangle
* @height: height of the copied rectangle
+ * @bpp: source and destination bits per pixel
* @dst: destination i-g-t buffer object
* @dst_x: destination pixel x-coordination
* @dst_y: destination pixel y-coordination
@@ -682,6 +706,7 @@ void igt_blitter_fast_copy__raw(int fd,
void igt_blitter_fast_copy(struct intel_batchbuffer *batch,
struct igt_buf *src, unsigned src_x, unsigned src_y,
unsigned width, unsigned height,
+ int bpp,
struct igt_buf *dst, unsigned dst_x, unsigned dst_y)
{
uint32_t src_pitch, dst_pitch;
@@ -690,7 +715,7 @@ void igt_blitter_fast_copy(struct intel_batchbuffer *batch,
src_pitch = fast_copy_pitch(src->stride, src->tiling);
dst_pitch = fast_copy_pitch(dst->stride, src->tiling);
dword0 = fast_copy_dword0(src->tiling, dst->tiling);
- dword1 = fast_copy_dword1(src->tiling, dst->tiling);
+ dword1 = fast_copy_dword1(src->tiling, dst->tiling, bpp);
#define CHECK_RANGE(x) ((x) >= 0 && (x) < (1 << 15))
assert(CHECK_RANGE(src_x) && CHECK_RANGE(src_y) &&