<div dir="ltr">Hi Christian,<div><br></div><div>You missed a few things in the merge. I will send in the updated patch.</div><div><br></div><div>I looked at the code in vl_winsys.c and vl_winsys3.c and also </div><div>at the code in presentation.c where delayed rendering is used. I was trying</div><div>to compile using vl_dri3_screen_create() but its giving me some error. I will </div><div>look into the error tonight. My hardware has PRIME configuration. So </div><div>is my hardware suitable for it? Just wanted to make sure.</div><div><br></div><div>Regards,</div><div>Nayan.  <br><br>On Wed, Aug 31, 2016 at 2:22 PM, Christian König <<a href="mailto:deathsimple@vodafone.de">deathsimple@vodafone.de</a>> wrote:<br>> From: Nayan Deshmukh <<a href="mailto:nayan26deshmukh@gmail.com">nayan26deshmukh@gmail.com</a>><br>><br>> HIGH_QUALITY_SCALING_L2 to HIGH_QUALTIY_SCALING_L7<br>> uses lanczos filter with number representing the size<br>> of the sinc window.<br>><br>> v3: avoid L8 and L9 to allow for other scaling algrithms<br>> v4 (chk): rebased on master<br>><br>> Signed-off-by: Nayan Deshmukh <<a href="mailto:nayan26deshmukh@gmail.com">nayan26deshmukh@gmail.com</a>><br>> ---<br>>  src/gallium/state_trackers/vdpau/mixer.c         | 101 +++++++++++++++++------<br>>  src/gallium/state_trackers/vdpau/query.c         |   8 ++<br>>  src/gallium/state_trackers/vdpau/vdpau_private.h |   7 ++<br>>  3 files changed, 90 insertions(+), 26 deletions(-)<br>><br>> diff --git a/src/gallium/state_trackers/vdpau/mixer.c b/src/gallium/state_trackers/vdpau/mixer.c<br>> index c205427..5484ca0 100644<br>> --- a/src/gallium/state_trackers/vdpau/mixer.c<br>> +++ b/src/gallium/state_trackers/vdpau/mixer.c<br>> @@ -82,12 +82,6 @@ vlVdpVideoMixerCreate(VdpDevice device,<br>>        switch (features[i]) {<br>>        /* they are valid, but we doesn't support them */<br>>        case VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL_SPATIAL:<br>> -      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L2:<br>> -      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L3:<br>> -      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L4:<br>> -      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L5:<br>> -      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L6:<br>> -      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L7:<br>>        case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L8:<br>>        case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L9:<br>>        case VDP_VIDEO_MIXER_FEATURE_INVERSE_TELECINE:<br>> @@ -112,6 +106,15 @@ vlVdpVideoMixerCreate(VdpDevice device,<br>>        case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1:<br>>           vmixer->bicubic.supported = true;<br>>           break;<br>> +<br>> +      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L2:<br>> +      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L3:<br>> +      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L4:<br>> +      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L5:<br>> +      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L6:<br>> +      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L7:<br>> +         vmixer->lanczos.supported = true;<br>> +         break;<br>>        default: goto no_params;<br>>        }<br>>     }<br>> @@ -209,6 +212,10 @@ vlVdpVideoMixerDestroy(VdpVideoMixer mixer)<br>>        vl_bicubic_filter_cleanup(vmixer->bicubic.filter);<br>>        FREE(vmixer->bicubic.filter);<br>>     }<br>> +   if (vmixer->lanczos.filter) {<br>> +      vl_lanczos_filter_cleanup(vmixer->lanczos.filter);<br>> +      FREE(vmixer->lanczos.filter);<br>> +   }<br>>     pipe_mutex_unlock(vmixer->device->mutex);<br>>     DeviceReference(&vmixer->device, NULL);<br>><br>> @@ -337,7 +344,8 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer,<br>>     }<br>>     vl_compositor_set_buffer_layer(&vmixer->cstate, compositor, layer, video_buffer, prect, NULL, deinterlace);<br>><br>> -   if (vmixer->bicubic.filter || vmixer->sharpness.filter || vmixer->noise_reduction.filter) {<br>> +   if (vmixer->bicubic.filter || vmixer->sharpness.filter ||<br>> +       vmixer->noise_reduction.filter || vmixer->lanczos.filter) {<br>>        pipe = vmixer->device->context;<br>>        memset(&res_tmpl, 0, sizeof(res_tmpl));<br>><br>> @@ -394,7 +402,7 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer,<br>>        ++layers;<br>>     }<br>><br>> -   if (!vmixer->noise_reduction.filter && !vmixer->sharpness.filter && !vmixer->bicubic.filter)<br>> +   if (!vmixer->noise_reduction.filter && !vmixer->sharpness.filter && !vmixer->bicubic.filter && !vmixer->lanczos.filter)<br>>        vlVdpSave4DelayedRendering(vmixer->device, destination_surface, &vmixer->cstate);<br>>     else {<br>>        vl_compositor_render(&vmixer->cstate, compositor, surface, &dirty_area, true);<br>> @@ -447,6 +455,12 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer,<br>>                                   RectToPipe(destination_video_rect, &rect),<br>>                                   RectToPipe(destination_rect, &clip));<br>><br>> +      if (vmixer->lanczos.filter)<br>> +         vl_lanczos_filter_render(vmixer->lanczos.filter,<br>> +                                  sampler_view, dst->surface,<br>> +                                  RectToPipe(destination_video_rect, &rect),<br>> +                                  RectToPipe(destination_rect, &clip));<br>> +<br>>        if(surface != dst->surface) {<br>>           pipe_sampler_view_reference(&sampler_view, NULL);<br>>           pipe_surface_reference(&surface, NULL);<br>> @@ -575,6 +589,29 @@ vlVdpVideoMixerUpdateBicubicFilter(vlVdpVideoMixer *vmixer)<br>>  }<br>><br>>  /**<br>> + * Update the lanczos filter<br>> + */<br>> +static void<br>> +vlVdpVideoMixerUpdateLanczosFilter(vlVdpVideoMixer *vmixer)<br>> +{<br>> +   assert(vmixer);<br>> +<br>> +   /* if present remove the old filter first */<br>> +   if (vmixer->lanczos.filter) {<br>> +      vl_lanczos_filter_cleanup(vmixer->lanczos.filter);<br>> +      FREE(vmixer->lanczos.filter);<br>> +      vmixer->lanczos.filter = NULL;<br>> +   }<br>> +   /* and create a new filter as needed */<br>> +   if (vmixer->lanczos.enabled) {<br>> +      vmixer->lanczos.filter = MALLOC(sizeof(struct vl_lanczos_filter));<br>> +      vl_lanczos_filter_init(vmixer->lanczos.filter, vmixer->device->context,<br>> +                             vmixer->lanczos.size, vmixer->video_width,<br>> +                             vmixer->video_height);<br>> +   }<br>> +}<br>> +<br>> +/**<br>>   * Retrieve whether features were requested at creation time.<br>>   */<br>>  VdpStatus<br>> @@ -597,12 +634,6 @@ vlVdpVideoMixerGetFeatureSupport(VdpVideoMixer mixer,<br>>        switch (features[i]) {<br>>        /* they are valid, but we doesn't support them */<br>>        case VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL_SPATIAL:<br>> -      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L2:<br>> -      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L3:<br>> -      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L4:<br>> -      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L5:<br>> -      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L6:<br>> -      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L7:<br>>        case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L8:<br>>        case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L9:<br>>        case VDP_VIDEO_MIXER_FEATURE_INVERSE_TELECINE:<br>> @@ -629,6 +660,15 @@ vlVdpVideoMixerGetFeatureSupport(VdpVideoMixer mixer,<br>>           feature_supports[i] = vmixer->bicubic.supported;<br>>           break;<br>><br>> +      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L2:<br>> +      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L3:<br>> +      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L4:<br>> +      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L5:<br>> +      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L6:<br>> +      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L7:<br>> +         feature_supports[i] = vmixer->lanczos.supported;<br>> +         break;<br>> +<br>>        default:<br>>           return VDP_STATUS_INVALID_VIDEO_MIXER_FEATURE;<br>>        }<br>> @@ -661,12 +701,6 @@ vlVdpVideoMixerSetFeatureEnables(VdpVideoMixer mixer,<br>>        switch (features[i]) {<br>>        /* they are valid, but we doesn't support them */<br>>        case VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL_SPATIAL:<br>> -      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L2:<br>> -      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L3:<br>> -      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L4:<br>> -      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L5:<br>> -      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L6:<br>> -      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L7:<br>>        case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L8:<br>>        case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L9:<br>>        case VDP_VIDEO_MIXER_FEATURE_INVERSE_TELECINE:<br>> @@ -699,6 +733,18 @@ vlVdpVideoMixerSetFeatureEnables(VdpVideoMixer mixer,<br>>           vlVdpVideoMixerUpdateBicubicFilter(vmixer);<br>>           break;<br>><br>> +      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L2:<br>> +      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L3:<br>> +      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L4:<br>> +      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L5:<br>> +      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L6:<br>> +      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L7:<br>> +         vmixer->lanczos.enabled = feature_enables[i];<br>> +         vmixer->lanczos.size = features[i] -<br>> +                                VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 + 1;<br>> +         vlVdpVideoMixerUpdateLanczosFilter(vmixer);<br>> +         break;<br>> +<br>>        default:<br>>           pipe_mutex_unlock(vmixer->device->mutex);<br>>           return VDP_STATUS_INVALID_VIDEO_MIXER_FEATURE;<br>> @@ -733,12 +779,6 @@ vlVdpVideoMixerGetFeatureEnables(VdpVideoMixer mixer,<br>>        /* they are valid, but we doesn't support them */<br>>        case VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL:<br>>        case VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL_SPATIAL:<br>> -      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L2:<br>> -      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L3:<br>> -      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L4:<br>> -      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L5:<br>> -      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L6:<br>> -      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L7:<br>>        case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L8:<br>>        case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L9:<br>>        case VDP_VIDEO_MIXER_FEATURE_INVERSE_TELECINE:<br>> @@ -760,6 +800,15 @@ vlVdpVideoMixerGetFeatureEnables(VdpVideoMixer mixer,<br>>           feature_enables[i] = vmixer->bicubic.enabled;<br>>           break;<br>><br>> +      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L2:<br>> +      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L3:<br>> +      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L4:<br>> +      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L5:<br>> +      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L6:<br>> +      case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L7:<br>> +         feature_enables[i] = vmixer->lanczos.enabled;<br>> +         break;<br>> +<br>>        default:<br>>           return VDP_STATUS_INVALID_VIDEO_MIXER_FEATURE;<br>>        }<br>> diff --git a/src/gallium/state_trackers/vdpau/query.c b/src/gallium/state_trackers/vdpau/query.c<br>> index e69c9b1..fbde747 100644<br>> --- a/src/gallium/state_trackers/vdpau/query.c<br>> +++ b/src/gallium/state_trackers/vdpau/query.c<br>> @@ -472,6 +472,14 @@ vlVdpVideoMixerQueryFeatureSupport(VdpDevice device, VdpVideoMixerFeature featur<br>>     case VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL:<br>>     case VDP_VIDEO_MIXER_FEATURE_LUMA_KEY:<br>>     case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1:<br>> +   case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L2:<br>> +   case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L3:<br>> +   case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L4:<br>> +   case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L5:<br>> +   case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L6:<br>> +   case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L7:<br>> +   case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L8:<br>> +   case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L9:<br>>        *is_supported = VDP_TRUE;<br>>        break;<br>>     default:<br>> diff --git a/src/gallium/state_trackers/vdpau/vdpau_private.h b/src/gallium/state_trackers/vdpau/vdpau_private.h<br>> index bcd4bb1..e82d343 100644<br>> --- a/src/gallium/state_trackers/vdpau/vdpau_private.h<br>> +++ b/src/gallium/state_trackers/vdpau/vdpau_private.h<br>> @@ -49,6 +49,7 @@<br>>  #include "vl/vl_compositor.h"<br>>  #include "vl/vl_csc.h"<br>>  #include "vl/vl_deint_filter.h"<br>> +#include "vl/vl_lanczos_filter.h"<br>>  #include "vl/vl_matrix_filter.h"<br>>  #include "vl/vl_median_filter.h"<br>>  #include "vl/vl_winsys.h"<br>> @@ -380,6 +381,12 @@ typedef struct<br>><br>>     struct {<br>>        bool supported, enabled;<br>> +      unsigned size;<br>> +      struct vl_lanczos_filter *filter;<br>> +   } lanczos;<br>> +<br>> +   struct {<br>> +      bool supported, enabled;<br>>        unsigned level;<br>>        struct vl_median_filter *filter;<br>>     } noise_reduction;<br>> --<br>> 2.5.0<br>><br><br></div></div>