Skip to content

Commit

Permalink
DRM: ARC: PGU: fix framebuffer format switching
Browse files Browse the repository at this point in the history
Current implementation don't switch to RGB565 format if BGR888 was
previously used. Fix that.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
  • Loading branch information
Eugeniy Paltsev authored and Alexey Brodkin committed Dec 16, 2019
1 parent d1eef1c commit 4c5b36e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions drivers/gpu/drm/arc/arcpgu_crtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ static void arc_pgu_set_pxl_fmt(struct drm_crtc *crtc)
uint32_t pixel_format = fb->format->format;
struct simplefb_format *format = NULL;
int i;
u32 reg_ctrl;

for (i = 0; i < ARRAY_SIZE(supported_formats); i++) {
if (supported_formats[i].fourcc == pixel_format)
Expand All @@ -41,11 +42,12 @@ static void arc_pgu_set_pxl_fmt(struct drm_crtc *crtc)
if (WARN_ON(!format))
return;

if (format->fourcc == DRM_FORMAT_RGB888)
arc_pgu_write(arcpgu, ARCPGU_REG_CTRL,
arc_pgu_read(arcpgu, ARCPGU_REG_CTRL) |
ARCPGU_MODE_RGB888_MASK);

reg_ctrl = arc_pgu_read(arcpgu, ARCPGU_REG_CTRL);
if (format->fourcc == DRM_FORMAT_RGB565)
reg_ctrl &= ~ARCPGU_MODE_RGB888_MASK;
else
reg_ctrl |= ARCPGU_MODE_RGB888_MASK;
arc_pgu_write(arcpgu, ARCPGU_REG_CTRL, reg_ctrl);
}

static const struct drm_crtc_funcs arc_pgu_crtc_funcs = {
Expand Down

0 comments on commit 4c5b36e

Please sign in to comment.