--- radeon_uvd.c.orig 2014-10-22 01:22:59.690000000 +0800 +++ radeon_uvd.c 2014-10-22 01:22:10.510000000 +0800 @@ -257,11 +257,11 @@ static int radeon_uvd_cs_msg_decode(uint32_t *msg, unsigned buf_sizes[]) { - unsigned stream_type = msg[4]; - unsigned width = msg[6]; - unsigned height = msg[7]; - unsigned dpb_size = msg[9]; - unsigned pitch = msg[28]; + unsigned stream_type = cpu_to_le32(readl(&msg[4])); + unsigned width = cpu_to_le32(readl(&msg[6])); + unsigned height = cpu_to_le32(readl(&msg[7])); + unsigned dpb_size = cpu_to_le32(readl(&msg[9])); + unsigned pitch = cpu_to_le32(readl(&msg[28])); unsigned width_in_mb = width / 16; unsigned height_in_mb = ALIGN(height / 16, 2); @@ -346,7 +346,8 @@ static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo, unsigned offset, unsigned buf_sizes[]) { - int32_t *msg, msg_type, handle; + uint32_t *msg; + u32 msg_type, handle; unsigned img_size = 0; void *ptr; @@ -374,9 +375,8 @@ msg = ptr + offset; - msg_type = msg[1]; - handle = msg[2]; - + msg_type = cpu_to_le32(readl(&msg[1])); + handle = cpu_to_le32(readl(&msg[2])); if (handle == 0) { DRM_ERROR("Invalid UVD handle!\n"); @@ -588,6 +588,7 @@ r = radeon_uvd_cs_reg(p, &pkt, &data0, &data1, buf_sizes, &has_msg_cmd); + if (r) return r; break; @@ -661,7 +662,6 @@ ttm_eu_fence_buffer_objects(&ticket, &head, ib.fence); - if (fence) *fence = radeon_fence_ref(ib.fence); radeon_ib_free(rdev, &ib); @@ -702,23 +702,20 @@ return r; } - - /* stitch together an UVD create msg */ - msg[0] = cpu_to_le32(0x00000de4); - msg[1] = cpu_to_le32(0x00000000); - msg[2] = cpu_to_le32(handle); - msg[3] = cpu_to_le32(0x00000000); - msg[4] = cpu_to_le32(0x00000000); - msg[5] = cpu_to_le32(0x00000000); - msg[6] = cpu_to_le32(0x00000000); - msg[7] = cpu_to_le32(0x00000780); - msg[8] = cpu_to_le32(0x00000440); - msg[9] = cpu_to_le32(0x00000000); - msg[10] = cpu_to_le32(0x01b37000); - for (i = 11; i < 1024; ++i) - msg[i] = cpu_to_le32(0x0); - + writel(cpu_to_le32(0x00000de4),&msg[0]); + writel(cpu_to_le32(0x00000000),&msg[1]); + writel(cpu_to_le32(handle),&msg[2]); + writel(cpu_to_le32(0x00000000),&msg[3]); + writel(cpu_to_le32(0x00000000),&msg[4]); + writel(cpu_to_le32(0x00000000),&msg[5]); + writel(cpu_to_le32(0x00000000),&msg[6]); + writel(cpu_to_le32(0x00000780),&msg[7]); + writel(cpu_to_le32(0x00000440),&msg[8]); + writel(cpu_to_le32(0x00000000),&msg[9]); + writel(cpu_to_le32(0x01b37000),&msg[10]); + for (i = 11; i < 1024; ++i) + writel(cpu_to_le32(0x0),&msg[i]); radeon_bo_kunmap(bo); radeon_bo_unreserve(bo); @@ -751,22 +748,12 @@ } /* stitch together an UVD destroy msg */ -#if 0 - msg[0] = cpu_to_le32(0x00000de4); - msg[1] = cpu_to_le32(0x00000002); - msg[2] = cpu_to_le32(handle); - msg[3] = cpu_to_le32(0x00000000); - for (i = 4; i < 1024; ++i) - msg[i] = cpu_to_le32(0x0); -#endif -#if 1 writel(cpu_to_le32(0x00000de4),&msg[1]); writel(cpu_to_le32(0x00000002),&msg[2]); writel(cpu_to_le32(handle),&msg[3]); writel(cpu_to_le32(0x00000000),&msg[4]); for (i = 4; i < 1024; ++i) writel(cpu_to_le32(0x0),&msg[i]); -#endif radeon_bo_kunmap(bo); radeon_bo_unreserve(bo);