Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'arcpgu-updates-2019.12.16' of github.com:abrodkin/linux into drm-next

Clean-up and fixes for FourCC handling in ARC PGU.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
From: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
Link: https://patchwork.freedesktop.org/patch/msgid/CY4PR1201MB01204228B5788F0A6619FE45A1510@CY4PR1201MB0120.namprd12.prod.outlook.com

+19 -19
+18 -18
drivers/gpu/drm/arc/arcpgu_crtc.c
··· 20 20 21 21 #define ENCODE_PGU_XY(x, y) ((((x) - 1) << 16) | ((y) - 1)) 22 22 23 - static struct simplefb_format supported_formats[] = { 24 - { "r5g6b5", 16, {11, 5}, {5, 6}, {0, 5}, {0, 0}, DRM_FORMAT_RGB565 }, 25 - { "r8g8b8", 24, {16, 8}, {8, 8}, {0, 8}, {0, 0}, DRM_FORMAT_RGB888 }, 23 + static const u32 arc_pgu_supported_formats[] = { 24 + DRM_FORMAT_RGB565, 25 + DRM_FORMAT_XRGB8888, 26 + DRM_FORMAT_ARGB8888, 26 27 }; 27 28 28 29 static void arc_pgu_set_pxl_fmt(struct drm_crtc *crtc) ··· 31 30 struct arcpgu_drm_private *arcpgu = crtc_to_arcpgu_priv(crtc); 32 31 const struct drm_framebuffer *fb = crtc->primary->state->fb; 33 32 uint32_t pixel_format = fb->format->format; 34 - struct simplefb_format *format = NULL; 33 + u32 format = DRM_FORMAT_INVALID; 35 34 int i; 35 + u32 reg_ctrl; 36 36 37 - for (i = 0; i < ARRAY_SIZE(supported_formats); i++) { 38 - if (supported_formats[i].fourcc == pixel_format) 39 - format = &supported_formats[i]; 37 + for (i = 0; i < ARRAY_SIZE(arc_pgu_supported_formats); i++) { 38 + if (arc_pgu_supported_formats[i] == pixel_format) 39 + format = arc_pgu_supported_formats[i]; 40 40 } 41 41 42 - if (WARN_ON(!format)) 42 + if (WARN_ON(format == DRM_FORMAT_INVALID)) 43 43 return; 44 44 45 - if (format->fourcc == DRM_FORMAT_RGB888) 46 - arc_pgu_write(arcpgu, ARCPGU_REG_CTRL, 47 - arc_pgu_read(arcpgu, ARCPGU_REG_CTRL) | 48 - ARCPGU_MODE_RGB888_MASK); 49 - 45 + reg_ctrl = arc_pgu_read(arcpgu, ARCPGU_REG_CTRL); 46 + if (format == DRM_FORMAT_RGB565) 47 + reg_ctrl &= ~ARCPGU_MODE_XRGB8888; 48 + else 49 + reg_ctrl |= ARCPGU_MODE_XRGB8888; 50 + arc_pgu_write(arcpgu, ARCPGU_REG_CTRL, reg_ctrl); 50 51 } 51 52 52 53 static const struct drm_crtc_funcs arc_pgu_crtc_funcs = { ··· 196 193 { 197 194 struct arcpgu_drm_private *arcpgu = drm->dev_private; 198 195 struct drm_plane *plane = NULL; 199 - u32 formats[ARRAY_SIZE(supported_formats)], i; 200 196 int ret; 201 197 202 198 plane = devm_kzalloc(drm->dev, sizeof(*plane), GFP_KERNEL); 203 199 if (!plane) 204 200 return ERR_PTR(-ENOMEM); 205 201 206 - for (i = 0; i < ARRAY_SIZE(supported_formats); i++) 207 - formats[i] = supported_formats[i].fourcc; 208 - 209 202 ret = drm_universal_plane_init(drm, plane, 0xff, &arc_pgu_plane_funcs, 210 - formats, ARRAY_SIZE(formats), 203 + arc_pgu_supported_formats, 204 + ARRAY_SIZE(arc_pgu_supported_formats), 211 205 NULL, 212 206 DRM_PLANE_TYPE_PRIMARY, NULL); 213 207 if (ret)
+1 -1
drivers/gpu/drm/arc/arcpgu_regs.h
··· 25 25 #define ARCPGU_CTRL_VS_POL_OFST 0x3 26 26 #define ARCPGU_CTRL_HS_POL_MASK 0x1 27 27 #define ARCPGU_CTRL_HS_POL_OFST 0x4 28 - #define ARCPGU_MODE_RGB888_MASK 0x04 28 + #define ARCPGU_MODE_XRGB8888 BIT(2) 29 29 #define ARCPGU_STAT_BUSY_MASK 0x02 30 30 31 31 #endif