diff mbox series

[4/5] drm/vmwgfx: Remove redundant framebuffer format check

Message ID 20230109105807.18172-5-mcanal@igalia.com (mailing list archive)
State New, archived
Headers show
Series Check for valid framebuffer's format | expand

Commit Message

Maíra Canal Jan. 9, 2023, 10:58 a.m. UTC
Now that framebuffer_check() verifies that the format is properly
supported, there is no need to check it again on vmwgfx's inside
helpers.

Therefore, remove the redundant framebuffer format check from the
vmw_kms_new_framebuffer_surface() and vmw_kms_new_framebuffer_bo()
functions, letting framebuffer_check() perform the framebuffer
validation.

Signed-off-by: Maíra Canal <mcanal@igalia.com>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 18 ------------------
 1 file changed, 18 deletions(-)

Comments

Zack Rusin Jan. 12, 2023, 2:52 a.m. UTC | #1
On Mon, 2023-01-09 at 07:58 -0300, Maíra Canal wrote:
> Now that framebuffer_check() verifies that the format is properly
> supported, there is no need to check it again on vmwgfx's inside
> helpers.
> 
> Therefore, remove the redundant framebuffer format check from the
> vmw_kms_new_framebuffer_surface() and vmw_kms_new_framebuffer_bo()
> functions, letting framebuffer_check() perform the framebuffer
> validation.
> 
> Signed-off-by: Maíra Canal <mcanal@igalia.com>
> ---
>  drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 18 ------------------
>  1 file changed, 18 deletions(-)
> 
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> index 257f090071f1..05b8d8f912bf 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> @@ -1317,15 +1317,6 @@ static int vmw_kms_new_framebuffer_surface(struct
> vmw_private *dev_priv,
>          * Sanity checks.
>          */
>  
> -       if (!drm_any_plane_has_format(&dev_priv->drm,
> -                                     mode_cmd->pixel_format,
> -                                     mode_cmd->modifier[0])) {
> -               drm_dbg(&dev_priv->drm,
> -                       "unsupported pixel format %p4cc / modifier 0x%llx\n",
> -                       &mode_cmd->pixel_format, mode_cmd->modifier[0]);
> -               return -EINVAL;
> -       }
> -
>         /* Surface must be marked as a scanout. */
>         if (unlikely(!surface->metadata.scanout))
>                 return -EINVAL;
> @@ -1648,15 +1639,6 @@ static int vmw_kms_new_framebuffer_bo(struct vmw_private
> *dev_priv,
>                 return -EINVAL;
>         }
>  
> -       if (!drm_any_plane_has_format(&dev_priv->drm,
> -                                     mode_cmd->pixel_format,
> -                                     mode_cmd->modifier[0])) {
> -               drm_dbg(&dev_priv->drm,
> -                       "unsupported pixel format %p4cc / modifier 0x%llx\n",
> -                       &mode_cmd->pixel_format, mode_cmd->modifier[0]);
> -               return -EINVAL;
> -       }
> -
>         vfbd = kzalloc(sizeof(*vfbd), GFP_KERNEL);
>         if (!vfbd) {
>                 ret = -ENOMEM;

That's a nice cleanup. Thanks.

Reviewed-by: Zack Rusin <zackr@vmware.com>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index 257f090071f1..05b8d8f912bf 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -1317,15 +1317,6 @@  static int vmw_kms_new_framebuffer_surface(struct vmw_private *dev_priv,
 	 * Sanity checks.
 	 */
 
-	if (!drm_any_plane_has_format(&dev_priv->drm,
-				      mode_cmd->pixel_format,
-				      mode_cmd->modifier[0])) {
-		drm_dbg(&dev_priv->drm,
-			"unsupported pixel format %p4cc / modifier 0x%llx\n",
-			&mode_cmd->pixel_format, mode_cmd->modifier[0]);
-		return -EINVAL;
-	}
-
 	/* Surface must be marked as a scanout. */
 	if (unlikely(!surface->metadata.scanout))
 		return -EINVAL;
@@ -1648,15 +1639,6 @@  static int vmw_kms_new_framebuffer_bo(struct vmw_private *dev_priv,
 		return -EINVAL;
 	}
 
-	if (!drm_any_plane_has_format(&dev_priv->drm,
-				      mode_cmd->pixel_format,
-				      mode_cmd->modifier[0])) {
-		drm_dbg(&dev_priv->drm,
-			"unsupported pixel format %p4cc / modifier 0x%llx\n",
-			&mode_cmd->pixel_format, mode_cmd->modifier[0]);
-		return -EINVAL;
-	}
-
 	vfbd = kzalloc(sizeof(*vfbd), GFP_KERNEL);
 	if (!vfbd) {
 		ret = -ENOMEM;