linux-snps-arc.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] DRM: PGU: ARC: fixies related to framebuffer format
@ 2019-11-19 14:41 Eugeniy Paltsev
  2019-11-19 14:41 ` [PATCH 1/4] DRM: ARC: PGU: fix framebuffer format switching Eugeniy Paltsev
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Eugeniy Paltsev @ 2019-11-19 14:41 UTC (permalink / raw)
  To: dri-devel, Alexey Brodkin
  Cc: David Airlie, linux-snps-arc, Eugeniy Paltsev, linux-kernel,
	Daniel Vetter

Eugeniy Paltsev (4):
  DRM: ARC: PGU: fix framebuffer format switching
  DRM: ARC: PGU: cleanup supported format list code
  DRM: ARC: PGU: replace unsupported by HW RGB888 format by XRGB888
  DRM: ARC: PGU: add ARGB8888 format to supported format list

 drivers/gpu/drm/arc/arcpgu_crtc.c | 36 +++++++++++++++----------------
 drivers/gpu/drm/arc/arcpgu_regs.h |  2 +-
 2 files changed, 19 insertions(+), 19 deletions(-)

-- 
2.21.0


_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/4] DRM: ARC: PGU: fix framebuffer format switching
  2019-11-19 14:41 [PATCH 0/4] DRM: PGU: ARC: fixies related to framebuffer format Eugeniy Paltsev
@ 2019-11-19 14:41 ` Eugeniy Paltsev
  2019-11-19 14:41 ` [PATCH 2/4] DRM: ARC: PGU: cleanup supported format list code Eugeniy Paltsev
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Eugeniy Paltsev @ 2019-11-19 14:41 UTC (permalink / raw)
  To: dri-devel, Alexey Brodkin
  Cc: David Airlie, linux-snps-arc, Eugeniy Paltsev, linux-kernel,
	Daniel Vetter

Current implementation don't switch to RGB565 format if BGR888 was
previously used. Fix that.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
---
 drivers/gpu/drm/arc/arcpgu_crtc.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/arc/arcpgu_crtc.c b/drivers/gpu/drm/arc/arcpgu_crtc.c
index dfaddbb7da0d..31d9824c46cc 100644
--- a/drivers/gpu/drm/arc/arcpgu_crtc.c
+++ b/drivers/gpu/drm/arc/arcpgu_crtc.c
@@ -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)
@@ -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 = {
-- 
2.21.0


_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/4] DRM: ARC: PGU: cleanup supported format list code
  2019-11-19 14:41 [PATCH 0/4] DRM: PGU: ARC: fixies related to framebuffer format Eugeniy Paltsev
  2019-11-19 14:41 ` [PATCH 1/4] DRM: ARC: PGU: fix framebuffer format switching Eugeniy Paltsev
@ 2019-11-19 14:41 ` Eugeniy Paltsev
  2019-11-19 14:41 ` [PATCH 3/4] DRM: ARC: PGU: replace unsupported by HW RGB888 format by XRGB888 Eugeniy Paltsev
  2019-11-19 14:41 ` [PATCH 4/4] DRM: ARC: PGU: add ARGB8888 format to supported format list Eugeniy Paltsev
  3 siblings, 0 replies; 5+ messages in thread
From: Eugeniy Paltsev @ 2019-11-19 14:41 UTC (permalink / raw)
  To: dri-devel, Alexey Brodkin
  Cc: David Airlie, linux-snps-arc, Eugeniy Paltsev, linux-kernel,
	Daniel Vetter

Get rid of 'simplefb_format' structure usage as we only use its
'fourcc' field.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
---
 drivers/gpu/drm/arc/arcpgu_crtc.c | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/arc/arcpgu_crtc.c b/drivers/gpu/drm/arc/arcpgu_crtc.c
index 31d9824c46cc..5473b19a52ee 100644
--- a/drivers/gpu/drm/arc/arcpgu_crtc.c
+++ b/drivers/gpu/drm/arc/arcpgu_crtc.c
@@ -20,9 +20,9 @@
 
 #define ENCODE_PGU_XY(x, y)	((((x) - 1) << 16) | ((y) - 1))
 
-static struct simplefb_format supported_formats[] = {
-	{ "r5g6b5", 16, {11, 5}, {5, 6}, {0, 5}, {0, 0}, DRM_FORMAT_RGB565 },
-	{ "r8g8b8", 24, {16, 8}, {8, 8}, {0, 8}, {0, 0}, DRM_FORMAT_RGB888 },
+static const u32 arc_pgu_supported_formats[] = {
+	DRM_FORMAT_RGB565,
+	DRM_FORMAT_RGB888,
 };
 
 static void arc_pgu_set_pxl_fmt(struct drm_crtc *crtc)
@@ -30,20 +30,20 @@ static void arc_pgu_set_pxl_fmt(struct drm_crtc *crtc)
 	struct arcpgu_drm_private *arcpgu = crtc_to_arcpgu_priv(crtc);
 	const struct drm_framebuffer *fb = crtc->primary->state->fb;
 	uint32_t pixel_format = fb->format->format;
-	struct simplefb_format *format = NULL;
+	u32 format = DRM_FORMAT_INVALID;
 	int i;
 	u32 reg_ctrl;
 
-	for (i = 0; i < ARRAY_SIZE(supported_formats); i++) {
-		if (supported_formats[i].fourcc == pixel_format)
-			format = &supported_formats[i];
+	for (i = 0; i < ARRAY_SIZE(arc_pgu_supported_formats); i++) {
+		if (arc_pgu_supported_formats[i] == pixel_format)
+			format = arc_pgu_supported_formats[i];
 	}
 
-	if (WARN_ON(!format))
+	if (WARN_ON(format == DRM_FORMAT_INVALID))
 		return;
 
 	reg_ctrl = arc_pgu_read(arcpgu, ARCPGU_REG_CTRL);
-	if (format->fourcc == DRM_FORMAT_RGB565)
+	if (format == DRM_FORMAT_RGB565)
 		reg_ctrl &= ~ARCPGU_MODE_RGB888_MASK;
 	else
 		reg_ctrl |= ARCPGU_MODE_RGB888_MASK;
@@ -195,18 +195,15 @@ static struct drm_plane *arc_pgu_plane_init(struct drm_device *drm)
 {
 	struct arcpgu_drm_private *arcpgu = drm->dev_private;
 	struct drm_plane *plane = NULL;
-	u32 formats[ARRAY_SIZE(supported_formats)], i;
 	int ret;
 
 	plane = devm_kzalloc(drm->dev, sizeof(*plane), GFP_KERNEL);
 	if (!plane)
 		return ERR_PTR(-ENOMEM);
 
-	for (i = 0; i < ARRAY_SIZE(supported_formats); i++)
-		formats[i] = supported_formats[i].fourcc;
-
 	ret = drm_universal_plane_init(drm, plane, 0xff, &arc_pgu_plane_funcs,
-				       formats, ARRAY_SIZE(formats),
+				       arc_pgu_supported_formats,
+				       ARRAY_SIZE(arc_pgu_supported_formats),
 				       NULL,
 				       DRM_PLANE_TYPE_PRIMARY, NULL);
 	if (ret)
-- 
2.21.0


_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/4] DRM: ARC: PGU: replace unsupported by HW RGB888 format by XRGB888
  2019-11-19 14:41 [PATCH 0/4] DRM: PGU: ARC: fixies related to framebuffer format Eugeniy Paltsev
  2019-11-19 14:41 ` [PATCH 1/4] DRM: ARC: PGU: fix framebuffer format switching Eugeniy Paltsev
  2019-11-19 14:41 ` [PATCH 2/4] DRM: ARC: PGU: cleanup supported format list code Eugeniy Paltsev
@ 2019-11-19 14:41 ` Eugeniy Paltsev
  2019-11-19 14:41 ` [PATCH 4/4] DRM: ARC: PGU: add ARGB8888 format to supported format list Eugeniy Paltsev
  3 siblings, 0 replies; 5+ messages in thread
From: Eugeniy Paltsev @ 2019-11-19 14:41 UTC (permalink / raw)
  To: dri-devel, Alexey Brodkin
  Cc: David Airlie, linux-snps-arc, Eugeniy Paltsev, linux-kernel,
	Daniel Vetter

ARC PGU doesn't support RGB888 (24 bit) format but supports
XRGB888 (32 bit) format. Fix incorrect format list in a driver.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
---
 drivers/gpu/drm/arc/arcpgu_crtc.c | 6 +++---
 drivers/gpu/drm/arc/arcpgu_regs.h | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/arc/arcpgu_crtc.c b/drivers/gpu/drm/arc/arcpgu_crtc.c
index 5473b19a52ee..980e00180e6f 100644
--- a/drivers/gpu/drm/arc/arcpgu_crtc.c
+++ b/drivers/gpu/drm/arc/arcpgu_crtc.c
@@ -22,7 +22,7 @@
 
 static const u32 arc_pgu_supported_formats[] = {
 	DRM_FORMAT_RGB565,
-	DRM_FORMAT_RGB888,
+	DRM_FORMAT_XRGB8888,
 };
 
 static void arc_pgu_set_pxl_fmt(struct drm_crtc *crtc)
@@ -44,9 +44,9 @@ static void arc_pgu_set_pxl_fmt(struct drm_crtc *crtc)
 
 	reg_ctrl = arc_pgu_read(arcpgu, ARCPGU_REG_CTRL);
 	if (format == DRM_FORMAT_RGB565)
-		reg_ctrl &= ~ARCPGU_MODE_RGB888_MASK;
+		reg_ctrl &= ~ARCPGU_MODE_XRGB8888;
 	else
-		reg_ctrl |= ARCPGU_MODE_RGB888_MASK;
+		reg_ctrl |= ARCPGU_MODE_XRGB8888;
 	arc_pgu_write(arcpgu, ARCPGU_REG_CTRL, reg_ctrl);
 }
 
diff --git a/drivers/gpu/drm/arc/arcpgu_regs.h b/drivers/gpu/drm/arc/arcpgu_regs.h
index dab2c380f7f3..b689a382d556 100644
--- a/drivers/gpu/drm/arc/arcpgu_regs.h
+++ b/drivers/gpu/drm/arc/arcpgu_regs.h
@@ -25,7 +25,7 @@
 #define ARCPGU_CTRL_VS_POL_OFST	0x3
 #define ARCPGU_CTRL_HS_POL_MASK	0x1
 #define ARCPGU_CTRL_HS_POL_OFST	0x4
-#define ARCPGU_MODE_RGB888_MASK	0x04
+#define ARCPGU_MODE_XRGB8888	BIT(2)
 #define ARCPGU_STAT_BUSY_MASK	0x02
 
 #endif
-- 
2.21.0


_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 4/4] DRM: ARC: PGU: add ARGB8888 format to supported format list
  2019-11-19 14:41 [PATCH 0/4] DRM: PGU: ARC: fixies related to framebuffer format Eugeniy Paltsev
                   ` (2 preceding siblings ...)
  2019-11-19 14:41 ` [PATCH 3/4] DRM: ARC: PGU: replace unsupported by HW RGB888 format by XRGB888 Eugeniy Paltsev
@ 2019-11-19 14:41 ` Eugeniy Paltsev
  3 siblings, 0 replies; 5+ messages in thread
From: Eugeniy Paltsev @ 2019-11-19 14:41 UTC (permalink / raw)
  To: dri-devel, Alexey Brodkin
  Cc: David Airlie, linux-snps-arc, Eugeniy Paltsev, linux-kernel,
	Daniel Vetter

As we ignore first 8 bit of 32 bit pixel value we can add ARGB8888
format as alias of XRGB8888.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
---
 drivers/gpu/drm/arc/arcpgu_crtc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/arc/arcpgu_crtc.c b/drivers/gpu/drm/arc/arcpgu_crtc.c
index 980e00180e6f..8ae1e1f97a73 100644
--- a/drivers/gpu/drm/arc/arcpgu_crtc.c
+++ b/drivers/gpu/drm/arc/arcpgu_crtc.c
@@ -23,6 +23,7 @@
 static const u32 arc_pgu_supported_formats[] = {
 	DRM_FORMAT_RGB565,
 	DRM_FORMAT_XRGB8888,
+	DRM_FORMAT_ARGB8888,
 };
 
 static void arc_pgu_set_pxl_fmt(struct drm_crtc *crtc)
-- 
2.21.0


_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-11-19 14:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-19 14:41 [PATCH 0/4] DRM: PGU: ARC: fixies related to framebuffer format Eugeniy Paltsev
2019-11-19 14:41 ` [PATCH 1/4] DRM: ARC: PGU: fix framebuffer format switching Eugeniy Paltsev
2019-11-19 14:41 ` [PATCH 2/4] DRM: ARC: PGU: cleanup supported format list code Eugeniy Paltsev
2019-11-19 14:41 ` [PATCH 3/4] DRM: ARC: PGU: replace unsupported by HW RGB888 format by XRGB888 Eugeniy Paltsev
2019-11-19 14:41 ` [PATCH 4/4] DRM: ARC: PGU: add ARGB8888 format to supported format list Eugeniy Paltsev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).