提交 a4f38a80 编写于 作者: I Inki Dae

drm/exynos: fix fimd pixel format setting

This patch fixes wrong pixel format setting.

A pixel format is decided according to bpp and depth, or user-requested
format but fimd driver considered only bpp value to decide a proper pixel
format. So this patch makes a proper pixel format to be set according
to drm_framebuffer's pixel_format which is set by addfb with bpp and
depth, or addfb2 with user-requested format.
Signed-off-by: NInki Dae <inki.dae@samsung.com>
Reviewed-by: NTomasz Figa <t.figa@samsung.com>
Signed-off-by: NKyungmin Park <kyungmin.park@samsung.com>
上级 4db7fcdf
...@@ -91,6 +91,7 @@ struct fimd_win_data { ...@@ -91,6 +91,7 @@ struct fimd_win_data {
unsigned int fb_width; unsigned int fb_width;
unsigned int fb_height; unsigned int fb_height;
unsigned int bpp; unsigned int bpp;
unsigned int pixel_format;
dma_addr_t dma_addr; dma_addr_t dma_addr;
unsigned int buf_offsize; unsigned int buf_offsize;
unsigned int line_size; /* bytes */ unsigned int line_size; /* bytes */
...@@ -397,6 +398,7 @@ static void fimd_win_mode_set(struct device *dev, ...@@ -397,6 +398,7 @@ static void fimd_win_mode_set(struct device *dev,
win_data->fb_height = overlay->fb_height; win_data->fb_height = overlay->fb_height;
win_data->dma_addr = overlay->dma_addr[0] + offset; win_data->dma_addr = overlay->dma_addr[0] + offset;
win_data->bpp = overlay->bpp; win_data->bpp = overlay->bpp;
win_data->pixel_format = overlay->pixel_format;
win_data->buf_offsize = (overlay->fb_width - overlay->crtc_width) * win_data->buf_offsize = (overlay->fb_width - overlay->crtc_width) *
(overlay->bpp >> 3); (overlay->bpp >> 3);
win_data->line_size = overlay->crtc_width * (overlay->bpp >> 3); win_data->line_size = overlay->crtc_width * (overlay->bpp >> 3);
...@@ -418,39 +420,29 @@ static void fimd_win_set_pixfmt(struct device *dev, unsigned int win) ...@@ -418,39 +420,29 @@ static void fimd_win_set_pixfmt(struct device *dev, unsigned int win)
val = WINCONx_ENWIN; val = WINCONx_ENWIN;
switch (win_data->bpp) { switch (win_data->pixel_format) {
case 1: case DRM_FORMAT_C8:
val |= WINCON0_BPPMODE_1BPP;
val |= WINCONx_BITSWP;
val |= WINCONx_BURSTLEN_4WORD;
break;
case 2:
val |= WINCON0_BPPMODE_2BPP;
val |= WINCONx_BITSWP;
val |= WINCONx_BURSTLEN_8WORD;
break;
case 4:
val |= WINCON0_BPPMODE_4BPP;
val |= WINCONx_BITSWP;
val |= WINCONx_BURSTLEN_8WORD;
break;
case 8:
val |= WINCON0_BPPMODE_8BPP_PALETTE; val |= WINCON0_BPPMODE_8BPP_PALETTE;
val |= WINCONx_BURSTLEN_8WORD; val |= WINCONx_BURSTLEN_8WORD;
val |= WINCONx_BYTSWP; val |= WINCONx_BYTSWP;
break; break;
case 16: case DRM_FORMAT_XRGB1555:
val |= WINCON0_BPPMODE_16BPP_1555;
val |= WINCONx_HAWSWP;
val |= WINCONx_BURSTLEN_16WORD;
break;
case DRM_FORMAT_RGB565:
val |= WINCON0_BPPMODE_16BPP_565; val |= WINCON0_BPPMODE_16BPP_565;
val |= WINCONx_HAWSWP; val |= WINCONx_HAWSWP;
val |= WINCONx_BURSTLEN_16WORD; val |= WINCONx_BURSTLEN_16WORD;
break; break;
case 24: case DRM_FORMAT_XRGB8888:
val |= WINCON0_BPPMODE_24BPP_888; val |= WINCON0_BPPMODE_24BPP_888;
val |= WINCONx_WSWP; val |= WINCONx_WSWP;
val |= WINCONx_BURSTLEN_16WORD; val |= WINCONx_BURSTLEN_16WORD;
break; break;
case 32: case DRM_FORMAT_ARGB8888:
val |= WINCON1_BPPMODE_28BPP_A4888 val |= WINCON1_BPPMODE_25BPP_A1888
| WINCON1_BLD_PIX | WINCON1_ALPHA_SEL; | WINCON1_BLD_PIX | WINCON1_ALPHA_SEL;
val |= WINCONx_WSWP; val |= WINCONx_WSWP;
val |= WINCONx_BURSTLEN_16WORD; val |= WINCONx_BURSTLEN_16WORD;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册