Hi Emil,
On 05/26/2017 09:07 AM, Emil Velikov wrote:
Hi Leo,
On 26 May 2017 at 12:24, Leo Liu <leo....@amd.com> wrote:
Signed-off-by: Leo Liu <leo....@amd.com>
---
src/amd/common/ac_gpu_info.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/amd/common/ac_gpu_info.c b/src/amd/common/ac_gpu_info.c
index 56645c4..3dae2bd 100644
--- a/src/amd/common/ac_gpu_info.c
+++ b/src/amd/common/ac_gpu_info.c
@@ -88,7 +88,7 @@ bool ac_query_gpu_info(int fd, amdgpu_device_handle dev,
{
struct amdgpu_buffer_size_alignments alignment_info = {};
struct amdgpu_heap_info vram, vram_vis, gtt;
- struct drm_amdgpu_info_hw_ip dma = {}, compute = {}, uvd = {}, vce = {};
+ struct drm_amdgpu_info_hw_ip dma = {}, compute = {}, uvd = {}, vce =
{}, vcn_dec = {};
uint32_t vce_version = 0, vce_feature = 0, uvd_version = 0,
uvd_feature = 0;
uint32_t unused_feature;
int r, i, j;
@@ -157,6 +157,14 @@ bool ac_query_gpu_info(int fd, amdgpu_device_handle dev,
return false;
}
+ if (info->drm_major == 3 && info->drm_minor >= 17) {
+ r = amdgpu_query_hw_ip_info(dev, AMDGPU_HW_IP_VCN_DEC, 0,
&vcn_dec);
+ if (r) {
+ fprintf(stderr, "amdgpu: amdgpu_query_hw_ip_info(vcn_dec)
failed.\n");
+ return false;
Drive-by question:
What would happen if the hardware does not support the said engine -
is the ioctl going to fail or it will succeed storing "unsupported
engine" type of information in vcn_dec?
That's good question, it will not fail for the unsupported, but return
the unsupported info, then based on that info, we will decide whether
enable HW decode.
Look at the kernel code for this,
case AMDGPU_HW_IP_VCN_ENC:
type = AMD_IP_BLOCK_TYPE_VCN;
for (i = 0; i < adev->vcn.num_enc_rings; i++)
ring_mask |= ((adev->vcn.ring_enc[i].ready ? 1 : 0) << i);
...
ip.available_rings = ring_mask;
It will return "available_rings" to user space, and we will check that
info from Mesa winsys below to decide if hw decode will be enabled.
ws->info.has_hw_decode =
(uvd.available_rings != 0) || (vcn_dec.available_rings != 0);
Leo
I think the code needs to be addressed in either case.
-Emil
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev