[PATCH v3] drm/exynos: mixer: cleanup pixelformat handling

2015-05-04 Thread Inki Dae
On 2015년 04월 28일 06:11, Tobias Jakobi wrote:
> Move the defines for the pixelformats that the mixer supports out
> of mixer_graph_buffer() to the top of the source.
> Then select the mixer pixelformat (pf) in mixer_graph_buffer() based on
> the plane's pf (and not bpp).
> Also add handling of RGB565 and XRGB1555 to the switch statement and
> exit early if the plane has an unsupported pf.

Applied.

Thanks,
Inki Dae

> 
> Partially based on 'drm/exynos: enable/disable blend based on pixel
> format' by Gustavo Padovan .
> 
> v2: Use the shorter MXR_FORMAT as prefix.
> v3: Re-add ARGB because of compatibility reasons
> (suggested by Joonyoung Shim).
> 
> Reviewed-by: Gustavo Padovan 
> Signed-off-by: Tobias Jakobi 
> ---
>  drivers/gpu/drm/exynos/exynos_mixer.c | 33 +++--
>  1 file changed, 23 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c 
> b/drivers/gpu/drm/exynos/exynos_mixer.c
> index fbec750..0474fd3 100644
> --- a/drivers/gpu/drm/exynos/exynos_mixer.c
> +++ b/drivers/gpu/drm/exynos/exynos_mixer.c
> @@ -44,6 +44,12 @@
>  #define MIXER_WIN_NR 3
>  #define MIXER_DEFAULT_WIN0
>  
> +/* The pixelformats that are natively supported by the mixer. */
> +#define MXR_FORMAT_RGB5654
> +#define MXR_FORMAT_ARGB1555  5
> +#define MXR_FORMAT_ARGB  6
> +#define MXR_FORMAT_ARGB  7
> +
>  struct mixer_resources {
>   int irq;
>   void __iomem*mixer_regs;
> @@ -531,20 +537,27 @@ static void mixer_graph_buffer(struct mixer_context 
> *ctx, int win)
>  
>   plane = >planes[win];
>  
> - #define RGB565 4
> - #define ARGB1555 5
> - #define ARGB 6
> - #define ARGB 7
> + switch (plane->pixel_format) {
> + case DRM_FORMAT_XRGB:
> + fmt = MXR_FORMAT_ARGB;
> + break;
> +
> + case DRM_FORMAT_XRGB1555:
> + fmt = MXR_FORMAT_ARGB1555;
> + break;
>  
> - switch (plane->bpp) {
> - case 16:
> - fmt = ARGB;
> + case DRM_FORMAT_RGB565:
> + fmt = MXR_FORMAT_RGB565;
>   break;
> - case 32:
> - fmt = ARGB;
> +
> + case DRM_FORMAT_XRGB:
> + case DRM_FORMAT_ARGB:
> + fmt = MXR_FORMAT_ARGB;
>   break;
> +
>   default:
> - fmt = ARGB;
> + DRM_DEBUG_KMS("pixelformat unsupported by mixer\n");
> + return;
>   }
>  
>   /* check if mixer supports requested scaling setup */
> 



[PATCH v3] drm/exynos: mixer: cleanup pixelformat handling

2015-04-28 Thread Joonyoung Shim
Hi Tobias,

On 04/28/2015 06:11 AM, Tobias Jakobi wrote:
> Move the defines for the pixelformats that the mixer supports out
> of mixer_graph_buffer() to the top of the source.
> Then select the mixer pixelformat (pf) in mixer_graph_buffer() based on
> the plane's pf (and not bpp).
> Also add handling of RGB565 and XRGB1555 to the switch statement and
> exit early if the plane has an unsupported pf.
> 
> Partially based on 'drm/exynos: enable/disable blend based on pixel
> format' by Gustavo Padovan .
> 
> v2: Use the shorter MXR_FORMAT as prefix.
> v3: Re-add ARGB because of compatibility reasons
> (suggested by Joonyoung Shim).
> 
> Reviewed-by: Gustavo Padovan 
> Signed-off-by: Tobias Jakobi 
> ---
>  drivers/gpu/drm/exynos/exynos_mixer.c | 33 +++--
>  1 file changed, 23 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c 
> b/drivers/gpu/drm/exynos/exynos_mixer.c
> index fbec750..0474fd3 100644
> --- a/drivers/gpu/drm/exynos/exynos_mixer.c
> +++ b/drivers/gpu/drm/exynos/exynos_mixer.c
> @@ -44,6 +44,12 @@
>  #define MIXER_WIN_NR 3
>  #define MIXER_DEFAULT_WIN0
>  
> +/* The pixelformats that are natively supported by the mixer. */
> +#define MXR_FORMAT_RGB5654
> +#define MXR_FORMAT_ARGB1555  5
> +#define MXR_FORMAT_ARGB  6
> +#define MXR_FORMAT_ARGB  7
> +
>  struct mixer_resources {
>   int irq;
>   void __iomem*mixer_regs;
> @@ -531,20 +537,27 @@ static void mixer_graph_buffer(struct mixer_context 
> *ctx, int win)
>  
>   plane = >planes[win];
>  
> - #define RGB565 4
> - #define ARGB1555 5
> - #define ARGB 6
> - #define ARGB 7
> + switch (plane->pixel_format) {
> + case DRM_FORMAT_XRGB:
> + fmt = MXR_FORMAT_ARGB;
> + break;
> +

Actually i don't prefer that use new blank line like above on switch
case statement.

> + case DRM_FORMAT_XRGB1555:
> + fmt = MXR_FORMAT_ARGB1555;
> + break;
>  
> - switch (plane->bpp) {
> - case 16:
> - fmt = ARGB;
> + case DRM_FORMAT_RGB565:
> + fmt = MXR_FORMAT_RGB565;
>   break;
> - case 32:
> - fmt = ARGB;
> +
> + case DRM_FORMAT_XRGB:
> + case DRM_FORMAT_ARGB:
> + fmt = MXR_FORMAT_ARGB;
>   break;
> +
>   default:
> - fmt = ARGB;
> + DRM_DEBUG_KMS("pixelformat unsupported by mixer\n");
> + return;
>   }
>  
>   /* check if mixer supports requested scaling setup */
> 

If except minor comment,

Acked-by: Joonyoung Shim 

Thanks.


[PATCH v3] drm/exynos: mixer: cleanup pixelformat handling

2015-04-28 Thread Tobias Jakobi
Move the defines for the pixelformats that the mixer supports out
of mixer_graph_buffer() to the top of the source.
Then select the mixer pixelformat (pf) in mixer_graph_buffer() based on
the plane's pf (and not bpp).
Also add handling of RGB565 and XRGB1555 to the switch statement and
exit early if the plane has an unsupported pf.

Partially based on 'drm/exynos: enable/disable blend based on pixel
format' by Gustavo Padovan .

v2: Use the shorter MXR_FORMAT as prefix.
v3: Re-add ARGB because of compatibility reasons
(suggested by Joonyoung Shim).

Reviewed-by: Gustavo Padovan 
Signed-off-by: Tobias Jakobi 
---
 drivers/gpu/drm/exynos/exynos_mixer.c | 33 +++--
 1 file changed, 23 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c 
b/drivers/gpu/drm/exynos/exynos_mixer.c
index fbec750..0474fd3 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -44,6 +44,12 @@
 #define MIXER_WIN_NR   3
 #define MIXER_DEFAULT_WIN  0

+/* The pixelformats that are natively supported by the mixer. */
+#define MXR_FORMAT_RGB565  4
+#define MXR_FORMAT_ARGB15555
+#define MXR_FORMAT_ARGB6
+#define MXR_FORMAT_ARGB7
+
 struct mixer_resources {
int irq;
void __iomem*mixer_regs;
@@ -531,20 +537,27 @@ static void mixer_graph_buffer(struct mixer_context *ctx, 
int win)

plane = >planes[win];

-   #define RGB565 4
-   #define ARGB1555 5
-   #define ARGB 6
-   #define ARGB 7
+   switch (plane->pixel_format) {
+   case DRM_FORMAT_XRGB:
+   fmt = MXR_FORMAT_ARGB;
+   break;
+
+   case DRM_FORMAT_XRGB1555:
+   fmt = MXR_FORMAT_ARGB1555;
+   break;

-   switch (plane->bpp) {
-   case 16:
-   fmt = ARGB;
+   case DRM_FORMAT_RGB565:
+   fmt = MXR_FORMAT_RGB565;
break;
-   case 32:
-   fmt = ARGB;
+
+   case DRM_FORMAT_XRGB:
+   case DRM_FORMAT_ARGB:
+   fmt = MXR_FORMAT_ARGB;
break;
+
default:
-   fmt = ARGB;
+   DRM_DEBUG_KMS("pixelformat unsupported by mixer\n");
+   return;
}

/* check if mixer supports requested scaling setup */
-- 
2.0.5