Re: [Mesa-dev] [PATCH 17/20] radeon/uvd: add YUYV format support for target buffer

2017-08-18 Thread Christian König

Am 18.08.2017 um 18:31 schrieb Leo Liu:

YUYV is a packed YUV format, and there is no chorma plane


At better description would be something like: "Make chroma plane 
optional for YUYV support."


Signed-off-by: Leo Liu 


Anyway patch is Reviewed-by: Christian König 

Regards,
Christian.


---
  src/gallium/drivers/radeon/radeon_uvd.c | 6 --
  src/gallium/drivers/radeonsi/si_uvd.c   | 2 +-
  2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/radeon/radeon_uvd.c 
b/src/gallium/drivers/radeon/radeon_uvd.c
index 9ebc31c170..648a493b59 100644
--- a/src/gallium/drivers/radeon/radeon_uvd.c
+++ b/src/gallium/drivers/radeon/radeon_uvd.c
@@ -1566,10 +1566,12 @@ void ruvd_set_dt_surfaces(struct ruvd_msg *msg, struct 
radeon_surf *luma,
}
  
  		msg->body.decode.dt_luma_top_offset = texture_offset(luma, 0, type);

-   msg->body.decode.dt_chroma_top_offset = texture_offset(chroma, 
0, type);
+   if (chroma)
+   msg->body.decode.dt_chroma_top_offset = 
texture_offset(chroma, 0, type);
if (msg->body.decode.dt_field_mode) {
msg->body.decode.dt_luma_bottom_offset = 
texture_offset(luma, 1, type);
-   msg->body.decode.dt_chroma_bottom_offset = 
texture_offset(chroma, 1, type);
+   if (chroma)
+   msg->body.decode.dt_chroma_bottom_offset = 
texture_offset(chroma, 1, type);
} else {
msg->body.decode.dt_luma_bottom_offset = 
msg->body.decode.dt_luma_top_offset;
msg->body.decode.dt_chroma_bottom_offset = 
msg->body.decode.dt_chroma_top_offset;
diff --git a/src/gallium/drivers/radeonsi/si_uvd.c 
b/src/gallium/drivers/radeonsi/si_uvd.c
index d17a6656a4..2441ad248c 100644
--- a/src/gallium/drivers/radeonsi/si_uvd.c
+++ b/src/gallium/drivers/radeonsi/si_uvd.c
@@ -131,7 +131,7 @@ static struct pb_buffer* si_uvd_set_dtb(struct ruvd_msg 
*msg, struct vl_video_bu
  
  	msg->body.decode.dt_field_mode = buf->base.interlaced;
  
-	ruvd_set_dt_surfaces(msg, >surface, >surface, type);

+   ruvd_set_dt_surfaces(msg, >surface, (chroma) ? >surface : 
NULL, type);
  
  	return luma->resource.buf;

  }



___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 17/20] radeon/uvd: add YUYV format support for target buffer

2017-08-18 Thread Leo Liu
YUYV is a packed YUV format, and there is no chorma plane

Signed-off-by: Leo Liu 
---
 src/gallium/drivers/radeon/radeon_uvd.c | 6 --
 src/gallium/drivers/radeonsi/si_uvd.c   | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/radeon/radeon_uvd.c 
b/src/gallium/drivers/radeon/radeon_uvd.c
index 9ebc31c170..648a493b59 100644
--- a/src/gallium/drivers/radeon/radeon_uvd.c
+++ b/src/gallium/drivers/radeon/radeon_uvd.c
@@ -1566,10 +1566,12 @@ void ruvd_set_dt_surfaces(struct ruvd_msg *msg, struct 
radeon_surf *luma,
}
 
msg->body.decode.dt_luma_top_offset = texture_offset(luma, 0, 
type);
-   msg->body.decode.dt_chroma_top_offset = texture_offset(chroma, 
0, type);
+   if (chroma)
+   msg->body.decode.dt_chroma_top_offset = 
texture_offset(chroma, 0, type);
if (msg->body.decode.dt_field_mode) {
msg->body.decode.dt_luma_bottom_offset = 
texture_offset(luma, 1, type);
-   msg->body.decode.dt_chroma_bottom_offset = 
texture_offset(chroma, 1, type);
+   if (chroma)
+   msg->body.decode.dt_chroma_bottom_offset = 
texture_offset(chroma, 1, type);
} else {
msg->body.decode.dt_luma_bottom_offset = 
msg->body.decode.dt_luma_top_offset;
msg->body.decode.dt_chroma_bottom_offset = 
msg->body.decode.dt_chroma_top_offset;
diff --git a/src/gallium/drivers/radeonsi/si_uvd.c 
b/src/gallium/drivers/radeonsi/si_uvd.c
index d17a6656a4..2441ad248c 100644
--- a/src/gallium/drivers/radeonsi/si_uvd.c
+++ b/src/gallium/drivers/radeonsi/si_uvd.c
@@ -131,7 +131,7 @@ static struct pb_buffer* si_uvd_set_dtb(struct ruvd_msg 
*msg, struct vl_video_bu
 
msg->body.decode.dt_field_mode = buf->base.interlaced;
 
-   ruvd_set_dt_surfaces(msg, >surface, >surface, type);
+   ruvd_set_dt_surfaces(msg, >surface, (chroma) ? >surface : 
NULL, type);
 
return luma->resource.buf;
 }
-- 
2.11.0

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 17/20] radeon/uvd: add YUYV format support for target buffer

2017-08-17 Thread Leo Liu



On 08/17/2017 06:35 AM, Christian König wrote:

Am 17.08.2017 um 12:27 schrieb Leo Liu:



On 08/17/2017 05:15 AM, Christian König wrote:

Am 16.08.2017 um 19:53 schrieb Leo Liu:

YUYV is a packed YUV format, and there is no chorma plane

v2: add stream type check for YUYV pitch setup

Signed-off-by: Leo Liu 
---
  src/gallium/drivers/radeon/radeon_uvd.c | 8 ++--
  src/gallium/drivers/radeonsi/si_uvd.c   | 2 +-
  2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/radeon/radeon_uvd.c 
b/src/gallium/drivers/radeon/radeon_uvd.c

index b6106c6e1f..e809e24405 100644
--- a/src/gallium/drivers/radeon/radeon_uvd.c
+++ b/src/gallium/drivers/radeon/radeon_uvd.c
@@ -1547,6 +1547,8 @@ void ruvd_set_dt_surfaces(struct ruvd_msg 
*msg, struct radeon_surf *luma,

  default:
  case RUVD_SURFACE_TYPE_LEGACY:
  msg->body.decode.dt_pitch = luma->u.legacy.level[0].nblk_x;
+if (msg->body.decode.stream_type == RUVD_CODEC_MJPEG && 
!chroma)

+msg->body.decode.dt_pitch *= 2;


That still doesn't look correct to me. Please try the following 
instead:


msg->body.decode.dt_pitch = luma->u.legacy.level[0].nblk_x * luma->bpe;

Does that work as well?


I think it works. I tried that in the very beginning, but I have to 
double check when back to the office later.


Unfortunately, it doesn't work. NV12 luma->bpe is 1, YUYV bpe is 4.
In order to get it work. It has to be luma->u.legacy.level[0].nblk_x * 
(luma->bpe / 2). i.e originally "msg->body.decode.dt_pitch *= 2".


I am going to check with firmware guys. In the meantime, any ideas?

Leo




There was a patch back to March "radeon/UVD: fix the decoding target 
pitch calculation" removed "bpe" for normal NV12 format.


Crap, yeah. That was for 10bit handling.



so I think for this YUYV, we still need condition, and code will be like

if (msg->body.decode.stream_type == RUVD_CODEC_MJPEG && !chroma)
   msg->body.decode.dt_pitch = luma->u.legacy.level[0].nblk_x * 
luma->bpe;


Looks like the firmware guys interpret the dt_pitch field differently 
depending on the codec.


Feel free to add my rb on this version, but if you have time please 
double check with the firmware team what they really expect.


Other than that, could you review the patch 1 v2 ? that's the only 
one left not reviewed in the series after this "pitch" one.




___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 17/20] radeon/uvd: add YUYV format support for target buffer

2017-08-17 Thread Christian König

Am 17.08.2017 um 12:27 schrieb Leo Liu:



On 08/17/2017 05:15 AM, Christian König wrote:

Am 16.08.2017 um 19:53 schrieb Leo Liu:

YUYV is a packed YUV format, and there is no chorma plane

v2: add stream type check for YUYV pitch setup

Signed-off-by: Leo Liu 
---
  src/gallium/drivers/radeon/radeon_uvd.c | 8 ++--
  src/gallium/drivers/radeonsi/si_uvd.c   | 2 +-
  2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/radeon/radeon_uvd.c 
b/src/gallium/drivers/radeon/radeon_uvd.c

index b6106c6e1f..e809e24405 100644
--- a/src/gallium/drivers/radeon/radeon_uvd.c
+++ b/src/gallium/drivers/radeon/radeon_uvd.c
@@ -1547,6 +1547,8 @@ void ruvd_set_dt_surfaces(struct ruvd_msg 
*msg, struct radeon_surf *luma,

  default:
  case RUVD_SURFACE_TYPE_LEGACY:
  msg->body.decode.dt_pitch = luma->u.legacy.level[0].nblk_x;
+if (msg->body.decode.stream_type == RUVD_CODEC_MJPEG && 
!chroma)

+msg->body.decode.dt_pitch *= 2;


That still doesn't look correct to me. Please try the following instead:

msg->body.decode.dt_pitch = luma->u.legacy.level[0].nblk_x * luma->bpe;

Does that work as well?


I think it works. I tried that in the very beginning, but I have to 
double check when back to the office later.


There was a patch back to March "radeon/UVD: fix the decoding target 
pitch calculation" removed "bpe" for normal NV12 format.


Crap, yeah. That was for 10bit handling.



so I think for this YUYV, we still need condition, and code will be like

if (msg->body.decode.stream_type == RUVD_CODEC_MJPEG && !chroma)
   msg->body.decode.dt_pitch = luma->u.legacy.level[0].nblk_x * 
luma->bpe;


Looks like the firmware guys interpret the dt_pitch field differently 
depending on the codec.


Feel free to add my rb on this version, but if you have time please 
double check with the firmware team what they really expect.


Other than that, could you review the patch 1 v2 ? that's the only one 
left not reviewed in the series after this "pitch" one.


Sorry, it looks like thunderbids spam filter recently became a racist 
and randomly blocks mails from senders with not western names :(


You are by far not the only one affected and I should probably start to 
figure out what is happening here.


Regards,
Christian.



Thanks,
Leo



Christian.


  switch (luma->u.legacy.level[0].mode) {
  case RADEON_SURF_MODE_LINEAR_ALIGNED:
  msg->body.decode.dt_tiling_mode = RUVD_TILE_LINEAR;
@@ -1566,10 +1568,12 @@ void ruvd_set_dt_surfaces(struct ruvd_msg 
*msg, struct radeon_surf *luma,

  }
msg->body.decode.dt_luma_top_offset = 
texture_offset(luma, 0, type);
-msg->body.decode.dt_chroma_top_offset = 
texture_offset(chroma, 0, type);

+if (chroma)
+msg->body.decode.dt_chroma_top_offset = 
texture_offset(chroma, 0, type);

  if (msg->body.decode.dt_field_mode) {
  msg->body.decode.dt_luma_bottom_offset = 
texture_offset(luma, 1, type);
-msg->body.decode.dt_chroma_bottom_offset = 
texture_offset(chroma, 1, type);

+if (chroma)
+msg->body.decode.dt_chroma_bottom_offset = 
texture_offset(chroma, 1, type);

  } else {
  msg->body.decode.dt_luma_bottom_offset = 
msg->body.decode.dt_luma_top_offset;
  msg->body.decode.dt_chroma_bottom_offset = 
msg->body.decode.dt_chroma_top_offset;
diff --git a/src/gallium/drivers/radeonsi/si_uvd.c 
b/src/gallium/drivers/radeonsi/si_uvd.c

index d17a6656a4..2441ad248c 100644
--- a/src/gallium/drivers/radeonsi/si_uvd.c
+++ b/src/gallium/drivers/radeonsi/si_uvd.c
@@ -131,7 +131,7 @@ static struct pb_buffer* si_uvd_set_dtb(struct 
ruvd_msg *msg, struct vl_video_bu

msg->body.decode.dt_field_mode = buf->base.interlaced;
  -ruvd_set_dt_surfaces(msg, >surface, >surface, 
type);
+ruvd_set_dt_surfaces(msg, >surface, (chroma) ? 
>surface : NULL, type);

return luma->resource.buf;
  }







___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 17/20] radeon/uvd: add YUYV format support for target buffer

2017-08-17 Thread Leo Liu



On 08/17/2017 05:15 AM, Christian König wrote:

Am 16.08.2017 um 19:53 schrieb Leo Liu:

YUYV is a packed YUV format, and there is no chorma plane

v2: add stream type check for YUYV pitch setup

Signed-off-by: Leo Liu 
---
  src/gallium/drivers/radeon/radeon_uvd.c | 8 ++--
  src/gallium/drivers/radeonsi/si_uvd.c   | 2 +-
  2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/radeon/radeon_uvd.c 
b/src/gallium/drivers/radeon/radeon_uvd.c

index b6106c6e1f..e809e24405 100644
--- a/src/gallium/drivers/radeon/radeon_uvd.c
+++ b/src/gallium/drivers/radeon/radeon_uvd.c
@@ -1547,6 +1547,8 @@ void ruvd_set_dt_surfaces(struct ruvd_msg *msg, 
struct radeon_surf *luma,

  default:
  case RUVD_SURFACE_TYPE_LEGACY:
  msg->body.decode.dt_pitch = luma->u.legacy.level[0].nblk_x;
+if (msg->body.decode.stream_type == RUVD_CODEC_MJPEG && 
!chroma)

+msg->body.decode.dt_pitch *= 2;


That still doesn't look correct to me. Please try the following instead:

msg->body.decode.dt_pitch = luma->u.legacy.level[0].nblk_x * luma->bpe;

Does that work as well?


I think it works. I tried that in the very beginning, but I have to 
double check when back to the office later.


There was a patch back to March "radeon/UVD: fix the decoding target 
pitch calculation" removed "bpe" for normal NV12 format.


so I think for this YUYV, we still need condition, and code will be like

if (msg->body.decode.stream_type == RUVD_CODEC_MJPEG && !chroma)
   msg->body.decode.dt_pitch = luma->u.legacy.level[0].nblk_x * luma->bpe;


Other than that, could you review the patch 1 v2 ? that's the only one 
left not reviewed in the series after this "pitch" one.


Thanks,
Leo



Christian.


  switch (luma->u.legacy.level[0].mode) {
  case RADEON_SURF_MODE_LINEAR_ALIGNED:
  msg->body.decode.dt_tiling_mode = RUVD_TILE_LINEAR;
@@ -1566,10 +1568,12 @@ void ruvd_set_dt_surfaces(struct ruvd_msg 
*msg, struct radeon_surf *luma,

  }
msg->body.decode.dt_luma_top_offset = 
texture_offset(luma, 0, type);
-msg->body.decode.dt_chroma_top_offset = 
texture_offset(chroma, 0, type);

+if (chroma)
+msg->body.decode.dt_chroma_top_offset = 
texture_offset(chroma, 0, type);

  if (msg->body.decode.dt_field_mode) {
  msg->body.decode.dt_luma_bottom_offset = 
texture_offset(luma, 1, type);
-msg->body.decode.dt_chroma_bottom_offset = 
texture_offset(chroma, 1, type);

+if (chroma)
+msg->body.decode.dt_chroma_bottom_offset = 
texture_offset(chroma, 1, type);

  } else {
  msg->body.decode.dt_luma_bottom_offset = 
msg->body.decode.dt_luma_top_offset;
  msg->body.decode.dt_chroma_bottom_offset = 
msg->body.decode.dt_chroma_top_offset;
diff --git a/src/gallium/drivers/radeonsi/si_uvd.c 
b/src/gallium/drivers/radeonsi/si_uvd.c

index d17a6656a4..2441ad248c 100644
--- a/src/gallium/drivers/radeonsi/si_uvd.c
+++ b/src/gallium/drivers/radeonsi/si_uvd.c
@@ -131,7 +131,7 @@ static struct pb_buffer* si_uvd_set_dtb(struct 
ruvd_msg *msg, struct vl_video_bu

msg->body.decode.dt_field_mode = buf->base.interlaced;
  -ruvd_set_dt_surfaces(msg, >surface, >surface, 
type);
+ruvd_set_dt_surfaces(msg, >surface, (chroma) ? 
>surface : NULL, type);

return luma->resource.buf;
  }





___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 17/20] radeon/uvd: add YUYV format support for target buffer

2017-08-17 Thread Christian König

Am 16.08.2017 um 19:53 schrieb Leo Liu:

YUYV is a packed YUV format, and there is no chorma plane

v2: add stream type check for YUYV pitch setup

Signed-off-by: Leo Liu 
---
  src/gallium/drivers/radeon/radeon_uvd.c | 8 ++--
  src/gallium/drivers/radeonsi/si_uvd.c   | 2 +-
  2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/radeon/radeon_uvd.c 
b/src/gallium/drivers/radeon/radeon_uvd.c
index b6106c6e1f..e809e24405 100644
--- a/src/gallium/drivers/radeon/radeon_uvd.c
+++ b/src/gallium/drivers/radeon/radeon_uvd.c
@@ -1547,6 +1547,8 @@ void ruvd_set_dt_surfaces(struct ruvd_msg *msg, struct 
radeon_surf *luma,
default:
case RUVD_SURFACE_TYPE_LEGACY:
msg->body.decode.dt_pitch = luma->u.legacy.level[0].nblk_x;
+   if (msg->body.decode.stream_type == RUVD_CODEC_MJPEG && !chroma)
+   msg->body.decode.dt_pitch *= 2;


That still doesn't look correct to me. Please try the following instead:

msg->body.decode.dt_pitch = luma->u.legacy.level[0].nblk_x * luma->bpe;

Does that work as well?

Christian.


switch (luma->u.legacy.level[0].mode) {
case RADEON_SURF_MODE_LINEAR_ALIGNED:
msg->body.decode.dt_tiling_mode = RUVD_TILE_LINEAR;
@@ -1566,10 +1568,12 @@ void ruvd_set_dt_surfaces(struct ruvd_msg *msg, struct 
radeon_surf *luma,
}
  
  		msg->body.decode.dt_luma_top_offset = texture_offset(luma, 0, type);

-   msg->body.decode.dt_chroma_top_offset = texture_offset(chroma, 
0, type);
+   if (chroma)
+   msg->body.decode.dt_chroma_top_offset = 
texture_offset(chroma, 0, type);
if (msg->body.decode.dt_field_mode) {
msg->body.decode.dt_luma_bottom_offset = 
texture_offset(luma, 1, type);
-   msg->body.decode.dt_chroma_bottom_offset = 
texture_offset(chroma, 1, type);
+   if (chroma)
+   msg->body.decode.dt_chroma_bottom_offset = 
texture_offset(chroma, 1, type);
} else {
msg->body.decode.dt_luma_bottom_offset = 
msg->body.decode.dt_luma_top_offset;
msg->body.decode.dt_chroma_bottom_offset = 
msg->body.decode.dt_chroma_top_offset;
diff --git a/src/gallium/drivers/radeonsi/si_uvd.c 
b/src/gallium/drivers/radeonsi/si_uvd.c
index d17a6656a4..2441ad248c 100644
--- a/src/gallium/drivers/radeonsi/si_uvd.c
+++ b/src/gallium/drivers/radeonsi/si_uvd.c
@@ -131,7 +131,7 @@ static struct pb_buffer* si_uvd_set_dtb(struct ruvd_msg 
*msg, struct vl_video_bu
  
  	msg->body.decode.dt_field_mode = buf->base.interlaced;
  
-	ruvd_set_dt_surfaces(msg, >surface, >surface, type);

+   ruvd_set_dt_surfaces(msg, >surface, (chroma) ? >surface : 
NULL, type);
  
  	return luma->resource.buf;

  }



___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 17/20] radeon/uvd: add yuyv format support for target buffer

2017-08-16 Thread Christian König

Am 15.08.2017 um 22:08 schrieb Leo Liu:

YUYV is a packed YUV format, and there is no chorma plane

Signed-off-by: Leo Liu 
---
  src/gallium/drivers/radeon/radeon_uvd.c | 8 ++--
  src/gallium/drivers/radeonsi/si_uvd.c   | 2 +-
  2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/radeon/radeon_uvd.c 
b/src/gallium/drivers/radeon/radeon_uvd.c
index 59d1f199e9..5e5638d565 100644
--- a/src/gallium/drivers/radeon/radeon_uvd.c
+++ b/src/gallium/drivers/radeon/radeon_uvd.c
@@ -1543,6 +1543,8 @@ void ruvd_set_dt_surfaces(struct ruvd_msg *msg, struct 
radeon_surf *luma,
default:
case RUVD_SURFACE_TYPE_LEGACY:
msg->body.decode.dt_pitch = luma->u.legacy.level[0].nblk_x;
+   if (!chroma)
+   msg->body.decode.dt_pitch *= 2;


Patch looks good to me, except for this hunk.

Can we get the pitch somehow else instead of making it depending if 
chroma is present or not?


Cause that is clearly not correct in all cases.

Christian.


switch (luma->u.legacy.level[0].mode) {
case RADEON_SURF_MODE_LINEAR_ALIGNED:
msg->body.decode.dt_tiling_mode = RUVD_TILE_LINEAR;
@@ -1562,10 +1564,12 @@ void ruvd_set_dt_surfaces(struct ruvd_msg *msg, struct 
radeon_surf *luma,
}
  
  		msg->body.decode.dt_luma_top_offset = texture_offset(luma, 0, type);

-   msg->body.decode.dt_chroma_top_offset = texture_offset(chroma, 
0, type);
+   if (chroma)
+   msg->body.decode.dt_chroma_top_offset = 
texture_offset(chroma, 0, type);
if (msg->body.decode.dt_field_mode) {
msg->body.decode.dt_luma_bottom_offset = 
texture_offset(luma, 1, type);
-   msg->body.decode.dt_chroma_bottom_offset = 
texture_offset(chroma, 1, type);
+   if (chroma)
+   msg->body.decode.dt_chroma_bottom_offset = 
texture_offset(chroma, 1, type);
} else {
msg->body.decode.dt_luma_bottom_offset = 
msg->body.decode.dt_luma_top_offset;
msg->body.decode.dt_chroma_bottom_offset = 
msg->body.decode.dt_chroma_top_offset;
diff --git a/src/gallium/drivers/radeonsi/si_uvd.c 
b/src/gallium/drivers/radeonsi/si_uvd.c
index d17a6656a4..2441ad248c 100644
--- a/src/gallium/drivers/radeonsi/si_uvd.c
+++ b/src/gallium/drivers/radeonsi/si_uvd.c
@@ -131,7 +131,7 @@ static struct pb_buffer* si_uvd_set_dtb(struct ruvd_msg 
*msg, struct vl_video_bu
  
  	msg->body.decode.dt_field_mode = buf->base.interlaced;
  
-	ruvd_set_dt_surfaces(msg, >surface, >surface, type);

+   ruvd_set_dt_surfaces(msg, >surface, (chroma) ? >surface : 
NULL, type);
  
  	return luma->resource.buf;

  }



___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 17/20] radeon/uvd: add yuyv format support for target buffer

2017-08-15 Thread Leo Liu
YUYV is a packed YUV format, and there is no chorma plane

Signed-off-by: Leo Liu 
---
 src/gallium/drivers/radeon/radeon_uvd.c | 8 ++--
 src/gallium/drivers/radeonsi/si_uvd.c   | 2 +-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/radeon/radeon_uvd.c 
b/src/gallium/drivers/radeon/radeon_uvd.c
index 59d1f199e9..5e5638d565 100644
--- a/src/gallium/drivers/radeon/radeon_uvd.c
+++ b/src/gallium/drivers/radeon/radeon_uvd.c
@@ -1543,6 +1543,8 @@ void ruvd_set_dt_surfaces(struct ruvd_msg *msg, struct 
radeon_surf *luma,
default:
case RUVD_SURFACE_TYPE_LEGACY:
msg->body.decode.dt_pitch = luma->u.legacy.level[0].nblk_x;
+   if (!chroma)
+   msg->body.decode.dt_pitch *= 2;
switch (luma->u.legacy.level[0].mode) {
case RADEON_SURF_MODE_LINEAR_ALIGNED:
msg->body.decode.dt_tiling_mode = RUVD_TILE_LINEAR;
@@ -1562,10 +1564,12 @@ void ruvd_set_dt_surfaces(struct ruvd_msg *msg, struct 
radeon_surf *luma,
}
 
msg->body.decode.dt_luma_top_offset = texture_offset(luma, 0, 
type);
-   msg->body.decode.dt_chroma_top_offset = texture_offset(chroma, 
0, type);
+   if (chroma)
+   msg->body.decode.dt_chroma_top_offset = 
texture_offset(chroma, 0, type);
if (msg->body.decode.dt_field_mode) {
msg->body.decode.dt_luma_bottom_offset = 
texture_offset(luma, 1, type);
-   msg->body.decode.dt_chroma_bottom_offset = 
texture_offset(chroma, 1, type);
+   if (chroma)
+   msg->body.decode.dt_chroma_bottom_offset = 
texture_offset(chroma, 1, type);
} else {
msg->body.decode.dt_luma_bottom_offset = 
msg->body.decode.dt_luma_top_offset;
msg->body.decode.dt_chroma_bottom_offset = 
msg->body.decode.dt_chroma_top_offset;
diff --git a/src/gallium/drivers/radeonsi/si_uvd.c 
b/src/gallium/drivers/radeonsi/si_uvd.c
index d17a6656a4..2441ad248c 100644
--- a/src/gallium/drivers/radeonsi/si_uvd.c
+++ b/src/gallium/drivers/radeonsi/si_uvd.c
@@ -131,7 +131,7 @@ static struct pb_buffer* si_uvd_set_dtb(struct ruvd_msg 
*msg, struct vl_video_bu
 
msg->body.decode.dt_field_mode = buf->base.interlaced;
 
-   ruvd_set_dt_surfaces(msg, >surface, >surface, type);
+   ruvd_set_dt_surfaces(msg, >surface, (chroma) ? >surface : 
NULL, type);
 
return luma->resource.buf;
 }
-- 
2.11.0

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev