Re: [Mesa-dev] [PATCH] radeon/vcn: Handle crop parameters for encoder

2020-01-06 Thread Sahu, Satyajit

Thanks Michel. I could able to submit new merge request.

On 1/6/2020 2:01 PM, Michel Dänzer wrote:

[CAUTION: External Email]

On 2020-01-06 6:14 a.m., Sahu, Satyajit wrote:

Hi Michel,

I tried with git push. It is failing with below error

remote: You are not allowed to push code to this project.
fatal: unable to access 
'https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.freedesktop.org%2Fmesa%2Fmesa.git%2Fdata=02%7C01%7Csatyajit.sahu%40amd.com%7Ca4002167a6a04cdcef8a08d79282e14c%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637138963148199763sdata=697khejIBws9CYeSvWQACsxx7oJUmOHoEkz19%2BtHSrU%3Dreserved=0':
The requested URL returned error: 403

That's the main Mesa repository. You need to push to your forked
repository[0] instead: 
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.freedesktop.org%2Fdata=02%7C01%7Csatyajit.sahu%40amd.com%7Ca4002167a6a04cdcef8a08d79282e14c%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637138963148199763sdata=s9U8FDMRTIvASG8bResXNrT75EHRIKCgX70o3hpiZ4c%3Dreserved=0/mesa.git

[0] Make sure you did create a forked repository using the "Fork" button
on 
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.freedesktop.org%2Fmesa%2Fmesadata=02%7C01%7Csatyajit.sahu%40amd.com%7Ca4002167a6a04cdcef8a08d79282e14c%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637138963148199763sdata=TXEoJ6pv6dQFHR%2Fp2XaLuarvbS7yjGgcA9KdqJk3ims%3Dreserved=0
 before trying this,
otherwise git push will create a non-forked project on the fly, which
won't work for making MRs.


--
Earthling Michel Dänzer   |   
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fredhat.comdata=02%7C01%7Csatyajit.sahu%40amd.com%7Ca4002167a6a04cdcef8a08d79282e14c%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637138963148199763sdata=Pal4%2FSJHOor6d%2Bzz0eDLExbbVvmrX7Stvni3WTm9hv4%3Dreserved=0
Libre software enthusiast | Mesa and X developer

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


Re: [Mesa-dev] [PATCH] radeon/vcn: Handle crop parameters for encoder

2020-01-05 Thread Sahu, Satyajit

Hi Michel,

I tried with git push. It is failing with below error

remote: You are not allowed to push code to this project.
fatal: unable to access 'https://gitlab.freedesktop.org/mesa/mesa.git/': 
The requested URL returned error: 403


regards,

Satyajit

On 1/3/2020 9:30 PM, Michel Dänzer wrote:

[CAUTION: External Email]

On 2020-01-03 10:06 a.m., Sahu, Satyajit wrote:

I do not find new merge request option in the merge request page. Do I
need to have some specific access to create new merge request.

No, just being logged into your GitLab account should be enough.

Note that it's probably easier to create an MR by clicking on the URL in
the git push terminal output when pushing to the branch in your forked
repository.


--
Earthling Michel Dänzer   |   
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fredhat.comdata=02%7C01%7Csatyajit.sahu%40amd.com%7Cfdd53b72f98e464165ee08d79066183b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637136640495200981sdata=T5CDj9o4wF3j1yfGjXo7Zia%2BSNlmfxz4nxhqvQ71iS4%3Dreserved=0
Libre software enthusiast | Mesa and X developer

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


Re: [Mesa-dev] [PATCH] radeon/vcn: Handle crop parameters for encoder

2020-01-03 Thread Sahu, Satyajit
I do not find new merge request option in the merge request page. Do I 
need to have some specific access to create new merge request.



On 1/3/2020 2:05 AM, Liu, Leo wrote:

The mesa process has switched to using merge requests.

-Original Message-
From: mesa-dev  On Behalf Of Satyajit 
Sahu
Sent: Tuesday, December 24, 2019 4:39 AM
To: mesa-dev@lists.freedesktop.org
Cc: Sharma, Deepak ; Sahu, Satyajit 

Subject: [Mesa-dev] [PATCH] radeon/vcn: Handle crop parameters for encoder

Set proper cropping parameter if frame cropping is enabled

Signed-off-by: Satyajit Sahu 

diff --git a/src/gallium/drivers/radeon/radeon_vcn_enc.c 
b/src/gallium/drivers/radeon/radeon_vcn_enc.c
index aa9182f273b..0bcce867327 100644
--- a/src/gallium/drivers/radeon/radeon_vcn_enc.c
+++ b/src/gallium/drivers/radeon/radeon_vcn_enc.c
@@ -52,10 +52,17 @@ static void radeon_vcn_enc_get_param(struct radeon_encoder 
*enc, struct pipe_pic
enc->enc_pic.ref_idx_l1 = pic->ref_idx_l1;
enc->enc_pic.not_referenced = pic->not_referenced;
enc->enc_pic.is_idr = (pic->picture_type == 
PIPE_H264_ENC_PICTURE_TYPE_IDR);
-  enc->enc_pic.crop_left = 0;
-  enc->enc_pic.crop_right = (align(enc->base.width, 16) - enc->base.width) 
/ 2;
-  enc->enc_pic.crop_top = 0;
-  enc->enc_pic.crop_bottom = (align(enc->base.height, 16) - 
enc->base.height) / 2;
+  if (pic->pic_ctrl.enc_frame_cropping_flag) {
+  enc->enc_pic.crop_left = pic->pic_ctrl.enc_frame_crop_left_offset;
+  enc->enc_pic.crop_right = pic->pic_ctrl.enc_frame_crop_right_offset;
+  enc->enc_pic.crop_top = pic->pic_ctrl.enc_frame_crop_top_offset;
+  enc->enc_pic.crop_bottom = 
pic->pic_ctrl.enc_frame_crop_bottom_offset;
+  } else {
+  enc->enc_pic.crop_left = 0;
+  enc->enc_pic.crop_right = (align(enc->base.width, 16) - 
enc->base.width) / 2;
+  enc->enc_pic.crop_top = 0;
+  enc->enc_pic.crop_bottom = (align(enc->base.height, 16) - 
enc->base.height) / 2;
+  }
enc->enc_pic.rc_layer_init.target_bit_rate = 
pic->rate_ctrl.target_bitrate;
enc->enc_pic.rc_layer_init.peak_bit_rate = pic->rate_ctrl.peak_bitrate;
enc->enc_pic.rc_layer_init.frame_rate_num = 
pic->rate_ctrl.frame_rate_num;

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


Re: [Mesa-dev] [PATCH] amdgpu: Query uvd handles info

2019-04-30 Thread Sahu, Satyajit
Kindly Ignore this. Sent to wrong mailing list. Sent another email to 
correct mailing list.

Regards,

Satyajit

On 4/30/2019 4:15 PM, Sahu, Satyajit wrote:
> [CAUTION: External Email]
>
> Query the max uvd handles and used uvd handles.
>
> Signed-off-by: Satyajit Sahu 
> ---
>   amdgpu/amdgpu.h  | 14 ++
>   amdgpu/amdgpu_gpu_info.c | 15 +++
>   2 files changed, 29 insertions(+)
>
> diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h
> index c44a495a..407b5fae 100644
> --- a/amdgpu/amdgpu.h
> +++ b/amdgpu/amdgpu.h
> @@ -1174,6 +1174,20 @@ int amdgpu_query_gpu_info(amdgpu_device_handle dev,
>   int amdgpu_query_info(amdgpu_device_handle dev, unsigned info_id,
>unsigned size, void *value);
>
> +/**
> + * Query uvd handles info.
> + *
> + *
> + * \param   dev - \c [in] Device handle. See #amdgpu_device_initialize()
> + * \param   size- \c [in] Size of the returned value.
> + * \param   value   - \c [out] Pointer to the return value.
> + *
> + * \return   0 on success\n
> + *  <0 - Negative POSIX error code
> + *
> +*/
> +int amdgpu_query_uvd_handles(amdgpu_device_handle dev,
> +  unsigned size, void *value);
>   /**
>* Query hardware or driver information.
>*
> diff --git a/amdgpu/amdgpu_gpu_info.c b/amdgpu/amdgpu_gpu_info.c
> index 777087f2..253c4da7 100644
> --- a/amdgpu/amdgpu_gpu_info.c
> +++ b/amdgpu/amdgpu_gpu_info.c
> @@ -44,6 +44,21 @@ drm_public int amdgpu_query_info(amdgpu_device_handle dev, 
> unsigned info_id,
> sizeof(struct drm_amdgpu_info));
>   }
>
> +drm_public int amdgpu_query_uvd_handles(amdgpu_device_handle dev,
> +unsigned size, void *value)
> +{
> +   struct drm_amdgpu_info request;
> +
> +   memset(, 0, sizeof(request));
> +   request.return_pointer = (uintptr_t)value;
> +   request.return_size = size;
> +   request.query = AMDGPU_INFO_NUM_HANDLES;
> +   request.query_hw_ip.type = AMDGPU_HW_IP_UVD;
> +
> +   return drmCommandWrite(dev->fd, DRM_AMDGPU_INFO, ,
> +  sizeof(struct drm_amdgpu_info));
> +}
> +
>   drm_public int amdgpu_query_crtc_from_id(amdgpu_device_handle dev, unsigned 
> id,
>   int32_t *result)
>   {
> --
> 2.19.1
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH] amdgpu: Query uvd handles info

2019-04-30 Thread Sahu, Satyajit
Query the max uvd handles and used uvd handles.

Signed-off-by: Satyajit Sahu 
---
 amdgpu/amdgpu.h  | 14 ++
 amdgpu/amdgpu_gpu_info.c | 15 +++
 2 files changed, 29 insertions(+)

diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h
index c44a495a..407b5fae 100644
--- a/amdgpu/amdgpu.h
+++ b/amdgpu/amdgpu.h
@@ -1174,6 +1174,20 @@ int amdgpu_query_gpu_info(amdgpu_device_handle dev,
 int amdgpu_query_info(amdgpu_device_handle dev, unsigned info_id,
  unsigned size, void *value);
 
+/**
+ * Query uvd handles info.
+ *
+ *
+ * \param   dev - \c [in] Device handle. See #amdgpu_device_initialize()
+ * \param   size- \c [in] Size of the returned value.
+ * \param   value   - \c [out] Pointer to the return value.
+ *
+ * \return   0 on success\n
+ *  <0 - Negative POSIX error code
+ *
+*/
+int amdgpu_query_uvd_handles(amdgpu_device_handle dev,
+  unsigned size, void *value);
 /**
  * Query hardware or driver information.
  *
diff --git a/amdgpu/amdgpu_gpu_info.c b/amdgpu/amdgpu_gpu_info.c
index 777087f2..253c4da7 100644
--- a/amdgpu/amdgpu_gpu_info.c
+++ b/amdgpu/amdgpu_gpu_info.c
@@ -44,6 +44,21 @@ drm_public int amdgpu_query_info(amdgpu_device_handle dev, 
unsigned info_id,
   sizeof(struct drm_amdgpu_info));
 }
 
+drm_public int amdgpu_query_uvd_handles(amdgpu_device_handle dev,
+unsigned size, void *value)
+{
+   struct drm_amdgpu_info request;
+
+   memset(, 0, sizeof(request));
+   request.return_pointer = (uintptr_t)value;
+   request.return_size = size;
+   request.query = AMDGPU_INFO_NUM_HANDLES;
+   request.query_hw_ip.type = AMDGPU_HW_IP_UVD;
+
+   return drmCommandWrite(dev->fd, DRM_AMDGPU_INFO, ,
+  sizeof(struct drm_amdgpu_info));
+}
+
 drm_public int amdgpu_query_crtc_from_id(amdgpu_device_handle dev, unsigned id,
 int32_t *result)
 {
-- 
2.19.1

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

[Mesa-dev] [PATCH] gallium: Query uvd handles info

2019-04-30 Thread Sahu, Satyajit
Query the uvd handles info. If the used uvd handles are equals to
max possible handles then return error.

Signed-off-by: Satyajit Sahu 
---
 src/gallium/drivers/radeon/radeon_winsys.h|  1 +
 src/gallium/drivers/radeonsi/si_get.c |  8 
 src/gallium/include/pipe/p_screen.h   |  1 +
 src/gallium/state_trackers/va/context.c   |  2 ++
 src/gallium/state_trackers/va/picture.c   | 11 ++-
 src/gallium/state_trackers/va/va_private.h|  1 +
 src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c | 11 +++
 7 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeon/radeon_winsys.h 
b/src/gallium/drivers/radeon/radeon_winsys.h
index 0c71b59ae04..b4f3a3ad09f 100644
--- a/src/gallium/drivers/radeon/radeon_winsys.h
+++ b/src/gallium/drivers/radeon/radeon_winsys.h
@@ -125,6 +125,7 @@ enum radeon_value_id {
 RADEON_CURRENT_MCLK,
 RADEON_GPU_RESET_COUNTER, /* DRM 2.43.0 */
 RADEON_CS_THREAD_TIME,
+RADEON_UVD_HANDLES,
 };
 
 enum radeon_bo_priority {
diff --git a/src/gallium/drivers/radeonsi/si_get.c 
b/src/gallium/drivers/radeonsi/si_get.c
index 4e23d283ab7..6e27b0162e0 100644
--- a/src/gallium/drivers/radeonsi/si_get.c
+++ b/src/gallium/drivers/radeonsi/si_get.c
@@ -887,6 +887,13 @@ static uint64_t si_get_timestamp(struct pipe_screen 
*screen)
sscreen->info.clock_crystal_freq;
 }
 
+//ADD function for querying uvd handles info
+static uint64_t si_get_handles_info(struct pipe_screen *screen)
+{
+   struct si_screen *sscreen = (struct si_screen*)screen;
+
+   return sscreen->ws->query_value(sscreen->ws, RADEON_UVD_HANDLES);
+}
 static void si_query_memory_info(struct pipe_screen *screen,
 struct pipe_memory_info *info)
 {
@@ -975,6 +982,7 @@ void si_init_screen_get_functions(struct si_screen *sscreen)
sscreen->b.get_device_uuid = si_get_device_uuid;
sscreen->b.get_driver_uuid = si_get_driver_uuid;
sscreen->b.query_memory_info = si_query_memory_info;
+   sscreen->b.query_handles_info = si_get_handles_info;
sscreen->b.get_disk_shader_cache = si_get_disk_shader_cache;
 
if (sscreen->info.has_hw_decode) {
diff --git a/src/gallium/include/pipe/p_screen.h 
b/src/gallium/include/pipe/p_screen.h
index d4e2d9f63ac..c41af7b842f 100644
--- a/src/gallium/include/pipe/p_screen.h
+++ b/src/gallium/include/pipe/p_screen.h
@@ -148,6 +148,7 @@ struct pipe_screen {
 * wait for rendering to complete (which cannot be achieved with queries).
 */
uint64_t (*get_timestamp)(struct pipe_screen *);
+   uint64_t (*query_handles_info)(struct pipe_screen *);
 
/**
 * Create a context.
diff --git a/src/gallium/state_trackers/va/context.c 
b/src/gallium/state_trackers/va/context.c
index 9176b7e8c5d..01dc618291f 100644
--- a/src/gallium/state_trackers/va/context.c
+++ b/src/gallium/state_trackers/va/context.c
@@ -237,8 +237,10 @@ vlVaCreateContext(VADriverContextP ctx, VAConfigID 
config_id, int picture_width,
if (!context)
   return VA_STATUS_ERROR_ALLOCATION_FAILED;
 
+   context->is_vpp =false;
if (is_vpp) {
   context->decoder = NULL;
+  context->is_vpp =true;
} else {
   context->templat.profile = config->profile;
   context->templat.entrypoint = config->entrypoint;
diff --git a/src/gallium/state_trackers/va/picture.c 
b/src/gallium/state_trackers/va/picture.c
index 04d2da0afeb..43ed53f8e82 100644
--- a/src/gallium/state_trackers/va/picture.c
+++ b/src/gallium/state_trackers/va/picture.c
@@ -42,6 +42,8 @@ vlVaBeginPicture(VADriverContextP ctx, VAContextID 
context_id, VASurfaceID rende
vlVaDriver *drv;
vlVaContext *context;
vlVaSurface *surf;
+   struct pipe_screen *pscreen;
+   int available_uvd_handles;
 
if (!ctx)
   return VA_STATUS_ERROR_INVALID_CONTEXT;
@@ -50,6 +52,8 @@ vlVaBeginPicture(VADriverContextP ctx, VAContextID 
context_id, VASurfaceID rende
if (!drv)
   return VA_STATUS_ERROR_INVALID_CONTEXT;
 
+   pscreen = VL_VA_PSCREEN(ctx);
+
mtx_lock(>mutex);
context = handle_table_get(drv->htab, context_id);
if (!context) {
@@ -73,7 +77,12 @@ vlVaBeginPicture(VADriverContextP ctx, VAContextID 
context_id, VASurfaceID rende
context->mjpeg.sampling_factor = 0;
 
if (!context->decoder) {
-
+  if (!context->is_vpp) {
+ //Query available uvd handles. If uvd handles not available fallback 
to software.
+ available_uvd_handles =  pscreen->query_handles_info(pscreen);
+ if (available_uvd_handles <= 0)
+return VA_STATUS_ERROR_ALLOCATION_FAILED;
+  }
   /* VPP */
   if (context->templat.profile == PIPE_VIDEO_PROFILE_UNKNOWN &&
   context->target->buffer_format != PIPE_FORMAT_B8G8R8A8_UNORM &&
diff --git a/src/gallium/state_trackers/va/va_private.h 
b/src/gallium/state_trackers/va/va_private.h
index b2b997d4799..a34cd6785ce 100644
--- a/src/gallium/state_trackers/va/va_private.h
+++ 

[Mesa-dev] [PATCH 1/3] vl: Add cropping flags for H264

2019-04-14 Thread Sahu, Satyajit
From: suresh guttula 

This patch adds cropping flags for H264 in pipe_h264_enc_pic_control.

Signed-off-by: Satyajit Sahu 
Reviewed-by: Leo Liu 
---
 src/gallium/include/pipe/p_video_state.h | 5 +
 1 file changed, 5 insertions(+)

diff --git a/src/gallium/include/pipe/p_video_state.h 
b/src/gallium/include/pipe/p_video_state.h
index 05855a36e23..1369f1a8ca6 100644
--- a/src/gallium/include/pipe/p_video_state.h
+++ b/src/gallium/include/pipe/p_video_state.h
@@ -395,6 +395,11 @@ struct pipe_h264_enc_pic_control
 {
unsigned enc_cabac_enable;
unsigned enc_constraint_set_flags;
+   unsigned enc_frame_cropping_flag;
+   unsigned enc_frame_crop_left_offset;
+   unsigned enc_frame_crop_right_offset;
+   unsigned enc_frame_crop_top_offset;
+   unsigned enc_frame_crop_bottom_offset;
 };
 
 struct pipe_h264_enc_picture_desc
-- 
2.19.1

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

[Mesa-dev] [PATCH 3/3] st/va/enc: Add support for frame_cropping_flag of VAEncSequenceParameterBufferH264

2019-04-14 Thread Sahu, Satyajit
From: suresh guttula 

This patch will add support for frame_cropping when the input size is not
matched with aligned size. Currently vaapi driver ignores frame cropping
values provided by client. This change will update SPS nalu with proper
cropping values.

Signed-off-by: Satyajit Sahu 
Reviewed-by: Leo Liu 
---
 src/gallium/state_trackers/va/picture_h264_enc.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/src/gallium/state_trackers/va/picture_h264_enc.c 
b/src/gallium/state_trackers/va/picture_h264_enc.c
index abfd39633de..f46b3425566 100644
--- a/src/gallium/state_trackers/va/picture_h264_enc.c
+++ b/src/gallium/state_trackers/va/picture_h264_enc.c
@@ -127,6 +127,14 @@ vlVaHandleVAEncSequenceParameterBufferTypeH264(vlVaDriver 
*drv, vlVaContext *con
context->desc.h264enc.rate_ctrl.frame_rate_num = h264->time_scale / 2;
context->desc.h264enc.rate_ctrl.frame_rate_den = h264->num_units_in_tick;
context->desc.h264enc.pic_order_cnt_type = 
h264->seq_fields.bits.pic_order_cnt_type;
+
+   if (h264->frame_cropping_flag) {
+  context->desc.h264enc.pic_ctrl.enc_frame_cropping_flag = 
h264->frame_cropping_flag;
+  context->desc.h264enc.pic_ctrl.enc_frame_crop_left_offset = 
h264->frame_crop_left_offset;
+  context->desc.h264enc.pic_ctrl.enc_frame_crop_right_offset = 
h264->frame_crop_right_offset;
+  context->desc.h264enc.pic_ctrl.enc_frame_crop_top_offset = 
h264->frame_crop_top_offset;
+  context->desc.h264enc.pic_ctrl.enc_frame_crop_bottom_offset = 
h264->frame_crop_bottom_offset;
+   }
return VA_STATUS_SUCCESS;
 }
 
-- 
2.19.1

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

[Mesa-dev] [PATCH v2 2/3] radeon/vce:Add support for frame_cropping_flag of VAEncSequenceParameterBufferH264

2019-04-14 Thread Sahu, Satyajit
From: suresh guttula 

This patch will add support for frame_cropping when the input size is not
matched with aligned size. Currently vaapi driver ignores frame cropping
values provided by client. This change will update SPS nalu with proper
cropping values.

v2: Moving default crop setting to else when enc_frame_cropping_flag is not set.

Signed-off-by: Satyajit Sahu 
Reviewed-by: Leo Liu 
---
 src/gallium/drivers/radeon/radeon_vce_52.c | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/radeon/radeon_vce_52.c 
b/src/gallium/drivers/radeon/radeon_vce_52.c
index fc7ddc62a90..364da4dbe24 100644
--- a/src/gallium/drivers/radeon/radeon_vce_52.c
+++ b/src/gallium/drivers/radeon/radeon_vce_52.c
@@ -81,8 +81,15 @@ static void get_pic_control_param(struct rvce_encoder *enc, 
struct pipe_h264_enc
unsigned encNumMBsPerSlice;
encNumMBsPerSlice = align(enc->base.width, 16) / 16;
encNumMBsPerSlice *= align(enc->base.height, 16) / 16;
-   enc->enc_pic.pc.enc_crop_right_offset = (align(enc->base.width, 16) - 
enc->base.width) >> 1;
-   enc->enc_pic.pc.enc_crop_bottom_offset = (align(enc->base.height, 16) - 
enc->base.height) >> 1;
+   if (pic->pic_ctrl.enc_frame_cropping_flag) {
+   enc->enc_pic.pc.enc_crop_left_offset = 
pic->pic_ctrl.enc_frame_crop_left_offset;
+   enc->enc_pic.pc.enc_crop_right_offset = 
pic->pic_ctrl.enc_frame_crop_right_offset;
+   enc->enc_pic.pc.enc_crop_top_offset = 
pic->pic_ctrl.enc_frame_crop_top_offset;
+   enc->enc_pic.pc.enc_crop_bottom_offset = 
pic->pic_ctrl.enc_frame_crop_bottom_offset;
+   } else {
+   enc->enc_pic.pc.enc_crop_right_offset = (align(enc->base.width, 
16) - enc->base.width) >> 1;
+   enc->enc_pic.pc.enc_crop_bottom_offset = 
(align(enc->base.height, 16) - enc->base.height) >> 1;
+   }
enc->enc_pic.pc.enc_num_mbs_per_slice = encNumMBsPerSlice;
enc->enc_pic.pc.enc_b_pic_pattern = MAX2(enc->base.max_references, 1) - 
1;
enc->enc_pic.pc.enc_number_of_reference_frames = 
MIN2(enc->base.max_references, 2);
-- 
2.19.1

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

[Mesa-dev] [PATCH 1/3] vl: Add cropping flags for H264

2019-04-11 Thread Sahu, Satyajit
From: suresh guttula 

This patch adds cropping flags for H264 in pipe_h264_enc_pic_control.

Signed-off-by: Satyajit Sahu 
---
 src/gallium/include/pipe/p_video_state.h | 5 +
 1 file changed, 5 insertions(+)

diff --git a/src/gallium/include/pipe/p_video_state.h 
b/src/gallium/include/pipe/p_video_state.h
index 05855a36e23..1369f1a8ca6 100644
--- a/src/gallium/include/pipe/p_video_state.h
+++ b/src/gallium/include/pipe/p_video_state.h
@@ -395,6 +395,11 @@ struct pipe_h264_enc_pic_control
 {
unsigned enc_cabac_enable;
unsigned enc_constraint_set_flags;
+   unsigned enc_frame_cropping_flag;
+   unsigned enc_frame_crop_left_offset;
+   unsigned enc_frame_crop_right_offset;
+   unsigned enc_frame_crop_top_offset;
+   unsigned enc_frame_crop_bottom_offset;
 };
 
 struct pipe_h264_enc_picture_desc
-- 
2.19.1

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

[Mesa-dev] [PATCH v2 2/3] radeon/vce:Add support for frame_cropping_flag of VAEncSequenceParameterBufferH264

2019-04-11 Thread Sahu, Satyajit
From: suresh guttula 

This patch will add support for frame_cropping when the input size is not
matched with aligned size. Currently vaapi driver ignores frame cropping
values provided by client. This change will update SPS nalu with proper
cropping values.

v2: Moving default crop setting to else when enc_frame_cropping_flag is not set.

Signed-off-by: Satyajit Sahu 
---
 src/gallium/drivers/radeon/radeon_vce_52.c | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/radeon/radeon_vce_52.c 
b/src/gallium/drivers/radeon/radeon_vce_52.c
index fc7ddc62a90..364da4dbe24 100644
--- a/src/gallium/drivers/radeon/radeon_vce_52.c
+++ b/src/gallium/drivers/radeon/radeon_vce_52.c
@@ -81,8 +81,15 @@ static void get_pic_control_param(struct rvce_encoder *enc, 
struct pipe_h264_enc
unsigned encNumMBsPerSlice;
encNumMBsPerSlice = align(enc->base.width, 16) / 16;
encNumMBsPerSlice *= align(enc->base.height, 16) / 16;
-   enc->enc_pic.pc.enc_crop_right_offset = (align(enc->base.width, 16) - 
enc->base.width) >> 1;
-   enc->enc_pic.pc.enc_crop_bottom_offset = (align(enc->base.height, 16) - 
enc->base.height) >> 1;
+   if (pic->pic_ctrl.enc_frame_cropping_flag) {
+   enc->enc_pic.pc.enc_crop_left_offset = 
pic->pic_ctrl.enc_frame_crop_left_offset;
+   enc->enc_pic.pc.enc_crop_right_offset = 
pic->pic_ctrl.enc_frame_crop_right_offset;
+   enc->enc_pic.pc.enc_crop_top_offset = 
pic->pic_ctrl.enc_frame_crop_top_offset;
+   enc->enc_pic.pc.enc_crop_bottom_offset = 
pic->pic_ctrl.enc_frame_crop_bottom_offset;
+   } else {
+   enc->enc_pic.pc.enc_crop_right_offset = (align(enc->base.width, 
16) - enc->base.width) >> 1;
+   enc->enc_pic.pc.enc_crop_bottom_offset = 
(align(enc->base.height, 16) - enc->base.height) >> 1;
+   }
enc->enc_pic.pc.enc_num_mbs_per_slice = encNumMBsPerSlice;
enc->enc_pic.pc.enc_b_pic_pattern = MAX2(enc->base.max_references, 1) - 
1;
enc->enc_pic.pc.enc_number_of_reference_frames = 
MIN2(enc->base.max_references, 2);
-- 
2.19.1

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

[Mesa-dev] [PATCH 3/3] st/va/enc: Add support for frame_cropping_flag of VAEncSequenceParameterBufferH264

2019-04-11 Thread Sahu, Satyajit
From: suresh guttula 

This patch will add support for frame_cropping when the input size is not
matched with aligned size. Currently vaapi driver ignores frame cropping
values provided by client. This change will update SPS nalu with proper
cropping values.

Signed-off-by: Satyajit Sahu 
---
 src/gallium/state_trackers/va/picture_h264_enc.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/src/gallium/state_trackers/va/picture_h264_enc.c 
b/src/gallium/state_trackers/va/picture_h264_enc.c
index abfd39633de..f46b3425566 100644
--- a/src/gallium/state_trackers/va/picture_h264_enc.c
+++ b/src/gallium/state_trackers/va/picture_h264_enc.c
@@ -127,6 +127,14 @@ vlVaHandleVAEncSequenceParameterBufferTypeH264(vlVaDriver 
*drv, vlVaContext *con
context->desc.h264enc.rate_ctrl.frame_rate_num = h264->time_scale / 2;
context->desc.h264enc.rate_ctrl.frame_rate_den = h264->num_units_in_tick;
context->desc.h264enc.pic_order_cnt_type = 
h264->seq_fields.bits.pic_order_cnt_type;
+
+   if (h264->frame_cropping_flag) {
+  context->desc.h264enc.pic_ctrl.enc_frame_cropping_flag = 
h264->frame_cropping_flag;
+  context->desc.h264enc.pic_ctrl.enc_frame_crop_left_offset = 
h264->frame_crop_left_offset;
+  context->desc.h264enc.pic_ctrl.enc_frame_crop_right_offset = 
h264->frame_crop_right_offset;
+  context->desc.h264enc.pic_ctrl.enc_frame_crop_top_offset = 
h264->frame_crop_top_offset;
+  context->desc.h264enc.pic_ctrl.enc_frame_crop_bottom_offset = 
h264->frame_crop_bottom_offset;
+   }
return VA_STATUS_SUCCESS;
 }
 
-- 
2.19.1

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

[Mesa-dev] [PATCH 1/3] vl: Add cropping flags for H264

2019-04-11 Thread Sahu, Satyajit
From: suresh guttula 

This patch adds cropping flags for H264 in pipe_h264_enc_pic_control.

Signed-off-by: Satyajit Sahu 
---
 src/gallium/include/pipe/p_video_state.h | 5 +
 1 file changed, 5 insertions(+)

diff --git a/src/gallium/include/pipe/p_video_state.h 
b/src/gallium/include/pipe/p_video_state.h
index 05855a36e23..1369f1a8ca6 100644
--- a/src/gallium/include/pipe/p_video_state.h
+++ b/src/gallium/include/pipe/p_video_state.h
@@ -395,6 +395,11 @@ struct pipe_h264_enc_pic_control
 {
unsigned enc_cabac_enable;
unsigned enc_constraint_set_flags;
+   unsigned enc_frame_cropping_flag;
+   unsigned enc_frame_crop_left_offset;
+   unsigned enc_frame_crop_right_offset;
+   unsigned enc_frame_crop_top_offset;
+   unsigned enc_frame_crop_bottom_offset;
 };
 
 struct pipe_h264_enc_picture_desc
-- 
2.19.1

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

[Mesa-dev] [PATCH 2/3] radeon/vce:Add support for frame_cropping_flag of VAEncSequenceParameterBufferH264

2019-04-11 Thread Sahu, Satyajit
From: suresh guttula 

This patch will add support for frame_cropping when the input size is not
matched with aligned size. Currently vaapi driver ignores frame cropping
values provided by client. This change will update SPS nalu with proper
cropping values.

Signed-off-by: Satyajit Sahu 
---
 src/gallium/drivers/radeon/radeon_vce_52.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/src/gallium/drivers/radeon/radeon_vce_52.c 
b/src/gallium/drivers/radeon/radeon_vce_52.c
index fc7ddc62a90..53f7b2f5fb5 100644
--- a/src/gallium/drivers/radeon/radeon_vce_52.c
+++ b/src/gallium/drivers/radeon/radeon_vce_52.c
@@ -83,6 +83,12 @@ static void get_pic_control_param(struct rvce_encoder *enc, 
struct pipe_h264_enc
encNumMBsPerSlice *= align(enc->base.height, 16) / 16;
enc->enc_pic.pc.enc_crop_right_offset = (align(enc->base.width, 16) - 
enc->base.width) >> 1;
enc->enc_pic.pc.enc_crop_bottom_offset = (align(enc->base.height, 16) - 
enc->base.height) >> 1;
+   if (pic->pic_ctrl.enc_frame_cropping_flag) {
+   enc->enc_pic.pc.enc_crop_left_offset = 
pic->pic_ctrl.enc_frame_crop_left_offset;
+   enc->enc_pic.pc.enc_crop_right_offset = 
pic->pic_ctrl.enc_frame_crop_right_offset;
+   enc->enc_pic.pc.enc_crop_top_offset = 
pic->pic_ctrl.enc_frame_crop_top_offset;
+   enc->enc_pic.pc.enc_crop_bottom_offset = 
pic->pic_ctrl.enc_frame_crop_bottom_offset;
+   }
enc->enc_pic.pc.enc_num_mbs_per_slice = encNumMBsPerSlice;
enc->enc_pic.pc.enc_b_pic_pattern = MAX2(enc->base.max_references, 1) - 
1;
enc->enc_pic.pc.enc_number_of_reference_frames = 
MIN2(enc->base.max_references, 2);
-- 
2.19.1

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

[Mesa-dev] [PATCH 3/3] st/va/enc: Add support for frame_cropping_flag of VAEncSequenceParameterBufferH264

2019-04-11 Thread Sahu, Satyajit
From: suresh guttula 

This patch will add support for frame_cropping when the input size is not
matched with aligned size. Currently vaapi driver ignores frame cropping
values provided by client. This change will update SPS nalu with proper
cropping values.

Signed-off-by: Satyajit Sahu 
---
 src/gallium/state_trackers/va/picture_h264_enc.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/src/gallium/state_trackers/va/picture_h264_enc.c 
b/src/gallium/state_trackers/va/picture_h264_enc.c
index abfd39633de..f46b3425566 100644
--- a/src/gallium/state_trackers/va/picture_h264_enc.c
+++ b/src/gallium/state_trackers/va/picture_h264_enc.c
@@ -127,6 +127,14 @@ vlVaHandleVAEncSequenceParameterBufferTypeH264(vlVaDriver 
*drv, vlVaContext *con
context->desc.h264enc.rate_ctrl.frame_rate_num = h264->time_scale / 2;
context->desc.h264enc.rate_ctrl.frame_rate_den = h264->num_units_in_tick;
context->desc.h264enc.pic_order_cnt_type = 
h264->seq_fields.bits.pic_order_cnt_type;
+
+   if (h264->frame_cropping_flag) {
+  context->desc.h264enc.pic_ctrl.enc_frame_cropping_flag = 
h264->frame_cropping_flag;
+  context->desc.h264enc.pic_ctrl.enc_frame_crop_left_offset = 
h264->frame_crop_left_offset;
+  context->desc.h264enc.pic_ctrl.enc_frame_crop_right_offset = 
h264->frame_crop_right_offset;
+  context->desc.h264enc.pic_ctrl.enc_frame_crop_top_offset = 
h264->frame_crop_top_offset;
+  context->desc.h264enc.pic_ctrl.enc_frame_crop_bottom_offset = 
h264->frame_crop_bottom_offset;
+   }
return VA_STATUS_SUCCESS;
 }
 
-- 
2.19.1

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

Re: [Mesa-dev] [PATCH] gallium: Add support for frame_cropping_flag of VAEncSequenceParameterBufferH264

2019-04-08 Thread Sahu, Satyajit

On 4/9/2019 12:34 AM, Liu, Leo wrote:
> On 4/8/19 1:17 AM, Sahu, Satyajit wrote:
>> From: suresh guttula 
>>
>> This patch will add support for frame_cropping when the input size is not
>> matched with aligned size. Currently vaapi driver ignores frame cropping
>> values provided by client. This change will update SPS nalu with proper
>> cropping values.
>>
>> Signed-off-by: suresh guttula 
>> Signed-off-by: Satyajit Sahu 
>> ---
>>src/gallium/drivers/radeon/radeon_vce_52.c   | 8 ++--
>>src/gallium/include/pipe/p_video_state.h | 5 +
>>src/gallium/state_trackers/va/picture_h264_enc.c | 8 
>>3 files changed, 19 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/gallium/drivers/radeon/radeon_vce_52.c 
>> b/src/gallium/drivers/radeon/radeon_vce_52.c
>> index fc7ddc62a90..593730756d5 100644
>> --- a/src/gallium/drivers/radeon/radeon_vce_52.c
>> +++ b/src/gallium/drivers/radeon/radeon_vce_52.c
>> @@ -81,8 +81,12 @@ static void get_pic_control_param(struct rvce_encoder 
>> *enc, struct pipe_h264_enc
>>  unsigned encNumMBsPerSlice;
>>  encNumMBsPerSlice = align(enc->base.width, 16) / 16;
>>  encNumMBsPerSlice *= align(enc->base.height, 16) / 16;
>> -enc->enc_pic.pc.enc_crop_right_offset = (align(enc->base.width, 16) - 
>> enc->base.width) >> 1;
>> -enc->enc_pic.pc.enc_crop_bottom_offset = (align(enc->base.height, 16) - 
>> enc->base.height) >> 1;
> Shouldn't we need to keep this code path when the cropping info is not
> available, since VA spec says it's optional.
>
> Regards,
>
> Leo

As per H264 standard

When frame_cropping_flag is equal to 0, the values of 
frame_crop_left_offset, frame_crop_right_offset, frame_crop_top_offset, 
and frame_crop_bottom_offset shall be inferred to be equal to 0. 
(https://www.itu.int/rec/T-REC-H.264)

So I think it should be under frame_cropping_flag condition.

Regards,

Satyajit

>
>
>
>> +if (pic->pic_ctrl.enc_frame_cropping_flag) {
>> +enc->enc_pic.pc.enc_crop_left_offset = 
>> pic->pic_ctrl.enc_frame_crop_left_offset;
>> +enc->enc_pic.pc.enc_crop_right_offset = 
>> pic->pic_ctrl.enc_frame_crop_right_offset;
>> +enc->enc_pic.pc.enc_crop_top_offset = 
>> pic->pic_ctrl.enc_frame_crop_top_offset;
>> +enc->enc_pic.pc.enc_crop_bottom_offset = 
>> pic->pic_ctrl.enc_frame_crop_bottom_offset;
>> +}
>>  enc->enc_pic.pc.enc_num_mbs_per_slice = encNumMBsPerSlice;
>>  enc->enc_pic.pc.enc_b_pic_pattern = MAX2(enc->base.max_references, 1) - 
>> 1;
>>  enc->enc_pic.pc.enc_number_of_reference_frames = 
>> MIN2(enc->base.max_references, 2);
>> diff --git a/src/gallium/include/pipe/p_video_state.h 
>> b/src/gallium/include/pipe/p_video_state.h
>> index 05855a36e23..1369f1a8ca6 100644
>> --- a/src/gallium/include/pipe/p_video_state.h
>> +++ b/src/gallium/include/pipe/p_video_state.h
>> @@ -395,6 +395,11 @@ struct pipe_h264_enc_pic_control
>>{
>>   unsigned enc_cabac_enable;
>>   unsigned enc_constraint_set_flags;
>> +   unsigned enc_frame_cropping_flag;
>> +   unsigned enc_frame_crop_left_offset;
>> +   unsigned enc_frame_crop_right_offset;
>> +   unsigned enc_frame_crop_top_offset;
>> +   unsigned enc_frame_crop_bottom_offset;
>>};
>>
>>struct pipe_h264_enc_picture_desc
>> diff --git a/src/gallium/state_trackers/va/picture_h264_enc.c 
>> b/src/gallium/state_trackers/va/picture_h264_enc.c
>> index abfd39633de..f46b3425566 100644
>> --- a/src/gallium/state_trackers/va/picture_h264_enc.c
>> +++ b/src/gallium/state_trackers/va/picture_h264_enc.c
>> @@ -127,6 +127,14 @@ 
>> vlVaHandleVAEncSequenceParameterBufferTypeH264(vlVaDriver *drv, vlVaContext 
>> *con
>>   context->desc.h264enc.rate_ctrl.frame_rate_num = h264->time_scale / 2;
>>   context->desc.h264enc.rate_ctrl.frame_rate_den = 
>> h264->num_units_in_tick;
>>   context->desc.h264enc.pic_order_cnt_type = 
>> h264->seq_fields.bits.pic_order_cnt_type;
>> +
>> +   if (h264->frame_cropping_flag) {
>> +  context->desc.h264enc.pic_ctrl.enc_frame_cropping_flag = 
>> h264->frame_cropping_flag;
>> +  context->desc.h264enc.pic_ctrl.enc_frame_crop_left_offset = 
>> h264->frame_crop_left_offset;
>> +  context->desc.h264enc.pic_ctrl.enc_frame_crop_right_offset = 
>> h264->frame_crop_right_offset;
>> +  context->desc.h264enc.pic_ctrl.enc_frame_crop_top_offset = 
>> h264->frame_crop_top_offset;
>> +  context->desc.h264enc.pic_ctrl.enc_frame_crop_bottom_offset = 
>> h264->frame_crop_bottom_offset;
>> +   }
>>   return VA_STATUS_SUCCESS;
>>}
>>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH] gallium: Add support for frame_cropping_flag of VAEncSequenceParameterBufferH264

2019-04-07 Thread Sahu, Satyajit
From: suresh guttula 

This patch will add support for frame_cropping when the input size is not
matched with aligned size. Currently vaapi driver ignores frame cropping
values provided by client. This change will update SPS nalu with proper
cropping values.

Signed-off-by: suresh guttula 
Signed-off-by: Satyajit Sahu 
---
 src/gallium/drivers/radeon/radeon_vce_52.c   | 8 ++--
 src/gallium/include/pipe/p_video_state.h | 5 +
 src/gallium/state_trackers/va/picture_h264_enc.c | 8 
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/radeon/radeon_vce_52.c 
b/src/gallium/drivers/radeon/radeon_vce_52.c
index fc7ddc62a90..593730756d5 100644
--- a/src/gallium/drivers/radeon/radeon_vce_52.c
+++ b/src/gallium/drivers/radeon/radeon_vce_52.c
@@ -81,8 +81,12 @@ static void get_pic_control_param(struct rvce_encoder *enc, 
struct pipe_h264_enc
unsigned encNumMBsPerSlice;
encNumMBsPerSlice = align(enc->base.width, 16) / 16;
encNumMBsPerSlice *= align(enc->base.height, 16) / 16;
-   enc->enc_pic.pc.enc_crop_right_offset = (align(enc->base.width, 16) - 
enc->base.width) >> 1;
-   enc->enc_pic.pc.enc_crop_bottom_offset = (align(enc->base.height, 16) - 
enc->base.height) >> 1;
+   if (pic->pic_ctrl.enc_frame_cropping_flag) {
+   enc->enc_pic.pc.enc_crop_left_offset = 
pic->pic_ctrl.enc_frame_crop_left_offset;
+   enc->enc_pic.pc.enc_crop_right_offset = 
pic->pic_ctrl.enc_frame_crop_right_offset;
+   enc->enc_pic.pc.enc_crop_top_offset = 
pic->pic_ctrl.enc_frame_crop_top_offset;
+   enc->enc_pic.pc.enc_crop_bottom_offset = 
pic->pic_ctrl.enc_frame_crop_bottom_offset;
+   }
enc->enc_pic.pc.enc_num_mbs_per_slice = encNumMBsPerSlice;
enc->enc_pic.pc.enc_b_pic_pattern = MAX2(enc->base.max_references, 1) - 
1;
enc->enc_pic.pc.enc_number_of_reference_frames = 
MIN2(enc->base.max_references, 2);
diff --git a/src/gallium/include/pipe/p_video_state.h 
b/src/gallium/include/pipe/p_video_state.h
index 05855a36e23..1369f1a8ca6 100644
--- a/src/gallium/include/pipe/p_video_state.h
+++ b/src/gallium/include/pipe/p_video_state.h
@@ -395,6 +395,11 @@ struct pipe_h264_enc_pic_control
 {
unsigned enc_cabac_enable;
unsigned enc_constraint_set_flags;
+   unsigned enc_frame_cropping_flag;
+   unsigned enc_frame_crop_left_offset;
+   unsigned enc_frame_crop_right_offset;
+   unsigned enc_frame_crop_top_offset;
+   unsigned enc_frame_crop_bottom_offset;
 };
 
 struct pipe_h264_enc_picture_desc
diff --git a/src/gallium/state_trackers/va/picture_h264_enc.c 
b/src/gallium/state_trackers/va/picture_h264_enc.c
index abfd39633de..f46b3425566 100644
--- a/src/gallium/state_trackers/va/picture_h264_enc.c
+++ b/src/gallium/state_trackers/va/picture_h264_enc.c
@@ -127,6 +127,14 @@ vlVaHandleVAEncSequenceParameterBufferTypeH264(vlVaDriver 
*drv, vlVaContext *con
context->desc.h264enc.rate_ctrl.frame_rate_num = h264->time_scale / 2;
context->desc.h264enc.rate_ctrl.frame_rate_den = h264->num_units_in_tick;
context->desc.h264enc.pic_order_cnt_type = 
h264->seq_fields.bits.pic_order_cnt_type;
+
+   if (h264->frame_cropping_flag) {
+  context->desc.h264enc.pic_ctrl.enc_frame_cropping_flag = 
h264->frame_cropping_flag;
+  context->desc.h264enc.pic_ctrl.enc_frame_crop_left_offset = 
h264->frame_crop_left_offset;
+  context->desc.h264enc.pic_ctrl.enc_frame_crop_right_offset = 
h264->frame_crop_right_offset;
+  context->desc.h264enc.pic_ctrl.enc_frame_crop_top_offset = 
h264->frame_crop_top_offset;
+  context->desc.h264enc.pic_ctrl.enc_frame_crop_bottom_offset = 
h264->frame_crop_bottom_offset;
+   }
return VA_STATUS_SUCCESS;
 }
 
-- 
2.19.1

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

Re: [Mesa-dev] [PATCH v2] radeonsi: Adding tiled to linear conversion functionality

2017-11-28 Thread Sahu, Satyajit



On 11/28/2017 9:33 PM, Nicolai Hähnle wrote:

On 28.11.2017 09:34, Sahu, Satyajit wrote:
[snip]

--- a/src/gallium/targets/dri/dri.sym
+++ b/src/gallium/targets/dri/dri.sym
@@ -4,6 +4,11 @@
   __driDriverGetExtensions*;
   nouveau_drm_screen_create;
   radeon_drm_winsys_create;
+    ac_compute_surface;
+    ac_query_gpu_info;
+    ac_read_write_tiled_data;
+    amdgpu_addr_create;
+    amdgpu_addr_destroy;

NAK.

I told you in internal discussions already that we shouldn't expose
new public symbols, we're arguably already exposing too much.

We need to expose certain addrlib functions in order get functionalities
like bo create, bo map (get linear data from tiled).


Please use the extension mechanism that is already there.

Are you suggesting to add a driExtension to expose addrlib functions?

Yes, if it is really needed.

By the way, are you sure read_write_tiled is going to work like that?
What if the surface has DCC?
Yes I have tested it on chromiumos, it works fine. When dumped the 
linear data, the image is proper. One of the chromium test case which 
does a bit comparison with reference image also passes.


This can be the case for a surface exported by radeonsi with explicit
flushing.

Cheers,
Nicolai


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


Re: [Mesa-dev] [PATCH v2] radeonsi: Adding tiled to linear conversion functionality

2017-11-28 Thread Sahu, Satyajit



On 11/27/2017 5:26 PM, Nicolai Hähnle wrote:

On 24.11.2017 06:22, Satyajit Sahu wrote:
Add tiled to linear conversion and expose outside mesa. This function 
converts

tiled image to linear and vice versa.
One of the use-case is, a chromiumos test case where the captured fb is
compared against a reference image. As the fb is tiled mode it needs to
be converted before comparision.

Also exposing create, compute and destroy surface functions outside. 
These

functions are also used when accessing addrlib outside of mesa.

Signed-off-by: Satyajit Sahu 
---
  src/amd/Makefile.common.am  |   4 ++
  src/amd/common/ac_gpu_info.c    |   2 +
  src/amd/common/ac_surface.c | 102 


  src/amd/common/ac_surface.h |   9 
  src/gallium/targets/dri/Makefile.am |   1 +
  src/gallium/targets/dri/dri.sym |   5 ++
  6 files changed, 123 insertions(+)

diff --git a/src/amd/Makefile.common.am b/src/amd/Makefile.common.am
index d62e9d4..651b3c7 100644
--- a/src/amd/Makefile.common.am
+++ b/src/amd/Makefile.common.am
@@ -53,6 +53,10 @@ common_libamd_common_la_CXXFLAGS = \
  $(LLVM_CXXFLAGS)
    noinst_LTLIBRARIES += $(COMMON_LIBS)
+include_HEADERS = $(top_srcdir)/src/amd/common/ac_surface.h \
+    $(top_srcdir)/src/amd/common/ac_gpu_info.h \
+    $(top_srcdir)/src/amd/common/amd_family.h
+
    common_libamd_common_la_SOURCES = \
  $(AMD_COMMON_FILES) \
diff --git a/src/amd/common/ac_gpu_info.c b/src/amd/common/ac_gpu_info.c
index 6e34a07..bb4f03f 100644
--- a/src/amd/common/ac_gpu_info.c
+++ b/src/amd/common/ac_gpu_info.c
@@ -28,6 +28,7 @@
  #include "gfx9d.h"
    #include "util/u_math.h"
+#include "util/macros.h"
    #include 
  @@ -92,6 +93,7 @@ static bool has_syncobj(int fd)
  return value ? true : false;
  }
  +PUBLIC
  bool ac_query_gpu_info(int fd, amdgpu_device_handle dev,
 struct radeon_info *info,
 struct amdgpu_gpu_info *amdinfo)
diff --git a/src/amd/common/ac_surface.c b/src/amd/common/ac_surface.c
index f7600a3..67bf28a 100644
--- a/src/amd/common/ac_surface.c
+++ b/src/amd/common/ac_surface.c
@@ -155,6 +155,7 @@ static ADDR_E_RETURNCODE ADDR_API 
freeSysMem(const ADDR_FREESYSMEM_INPUT * pInpu

  return ADDR_OK;
  }
  +PUBLIC
  ADDR_HANDLE amdgpu_addr_create(const struct radeon_info *info,
 const struct amdgpu_gpu_info *amdinfo,
 uint64_t *max_alignment)
@@ -219,6 +220,15 @@ ADDR_HANDLE amdgpu_addr_create(const struct 
radeon_info *info,

  return addrCreateOutput.hLib;
  }
  +PUBLIC
+int amdgpu_addr_destroy(ADDR_HANDLE handle) {
+   ADDR_E_RETURNCODE ret = AddrDestroy(handle);
+   if(ret = ADDR_OK)
+   return 0;
+   else
+   return -((int)ret);
+}
+
  static int surf_config_sanity(const struct ac_surf_config *config)
  {
  /* all dimension must be at least 1 ! */
@@ -1246,6 +1256,7 @@ static int gfx9_compute_surface(ADDR_HANDLE 
addrlib,

  return 0;
  }
  +PUBLIC
  int ac_compute_surface(ADDR_HANDLE addrlib, const struct 
radeon_info *info,

 const struct ac_surf_config *config,
 enum radeon_surf_mode mode,
@@ -1262,3 +1273,94 @@ int ac_compute_surface(ADDR_HANDLE addrlib, 
const struct radeon_info *info,

  else
  return gfx6_compute_surface(addrlib, info, config, mode, 
surf);

  }
+
+PUBLIC
+int ac_read_write_tiled_data(ADDR_HANDLE addrlib,
+  struct ac_surf_config * config,
+  struct radeon_surf * surf,
+  void * addr, uint8_t * linear_ptr,
+  bool write_to_tiled_buf) {
+    ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT in_param = { 0 };
+    ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT out_param;
+    const ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT *in_param_ptr = 
_param;

+    ADDR_TILEINFO tile_info = {0};
+    ADDR_E_RETURNCODE ret = ADDR_OK;
+    uint8_t *tiled_ptr;
+
+    if (!addr || !linear_ptr)
+    return -EINVAL;
+    out_param.size = sizeof(ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT);
+    in_param.size = sizeof(ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT);
+    tile_info.banks = surf->u.legacy.num_banks;
+    tile_info.bankWidth = surf->u.legacy.bankw;
+    tile_info.bankHeight = surf->u.legacy.bankh;
+    tile_info.macroAspectRatio = surf->u.legacy.mtilea;
+    tile_info.tileSplitBytes = surf->u.legacy.tile_split;
+    tile_info.pipeConfig = surf->u.legacy.pipe_config;
+    /* bpp in bytes */
+    in_param.bpp = surf->bpe << 3;
+    in_param.pitch = surf->u.legacy.level[0].nblk_x;
+    in_param.height = surf->u.legacy.level[0].nblk_y;
+    in_param.numSlices = config->info.depth;
+    in_param.numSamples = config->info.samples;
+    switch (surf->u.legacy.level[0].mode) {
+    case RADEON_SURF_MODE_LINEAR_ALIGNED:
+    in_param.tileMode = ADDR_TM_LINEAR_ALIGNED;
+    break;
+    case RADEON_SURF_MODE_1D:

Re: [Mesa-dev] [PATCH] Adding tiled to linear conversion functionality

2017-11-24 Thread Sahu, Satyajit



On 11/23/2017 9:40 PM, Ilia Mirkin wrote:

On Wed, Nov 22, 2017 at 6:00 AM, Satyajit Sahu  wrote:

Add tiled to linear conversion and expose outside mesa.
Also exposing the create compute and destroy surface fucntions outside.

typo: functions

Done



Change-Id: Ie464ba0eac5d80048797bef1f6ad730c22947601

What's this?
This was generated because I was using chromium repo. Will remove it in 
the v2 patch.



Signed-off-by: Satyajit Sahu 

I think you forgot to explain the part about why this is a good idea
and how it's going to be used.

   -ilia

I will add more description in the v2 patch.

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