Skip to content
Snippets Groups Projects
Commit a4b9f05f authored by Diego Wilson's avatar Diego Wilson
Browse files

Support RGB565 framebuffer in mdp_ppp_solid_fill()

There was an assumption that the frambuffer would always be 32 bit

Change-Id: I5a0db2025f6c0bb93d94a183013e778b42e3b7df
parent ce6ef38e
No related branches found
No related tags found
No related merge requests found
diff --git a/drivers/video/msm/mdp_ppp.c b/drivers/video/msm/mdp_ppp.c
index 4009ffc..d6a4113 100644
index 4009ffc..2bd09db 100644
--- a/drivers/video/msm/mdp_ppp.c
+++ b/drivers/video/msm/mdp_ppp.c
@@ -1140,6 +1140,7 @@ struct mdp_blit_req *req, struct file *p_src_file, struct file *p_dst_file)
/* setup for rgb 565 */
MDP_OUTP(MDP_CMD_DEBUG_ACCESS_BASE + 0x0124, ppp_src_cfg_reg);
MDP_OUTP(MDP_CMD_DEBUG_ACCESS_BASE + 0x0128, packPattern);
+
/*
* 0x0138: PPP destination operation register
* 0x014c: constant_alpha|transparent_color
@@ -1357,7 +1358,6 @@ static int mdp_ppp_blit_addr(struct fb_info *info, struct mdp_blit_req *req,
iBuf.mdpImg.width = req->src.width;
iBuf.mdpImg.imgType = req->src.format;
-
iBuf.mdpImg.bmy_addr = (uint32 *) (srcp0_start + req->src.offset);
if (iBuf.mdpImg.imgType == MDP_Y_CBCR_H2V2_ADRENO)
iBuf.mdpImg.cbcr_addr =
@@ -1572,6 +1572,109 @@ static int mdp_ppp_blit_addr(struct fb_info *info, struct mdp_blit_req *req,
@@ -1572,6 +1572,167 @@ static int mdp_ppp_blit_addr(struct fb_info *info, struct mdp_blit_req *req,
return 0;
}
......@@ -32,6 +16,7 @@ index 4009ffc..d6a4113 100644
+ uint32 dst_roi_width;
+ uint32 dst_roi_height;
+ uint32 dst_packPattern, ppp_dst_cfg_reg;
+ uint32 packPattern, ppp_src_cfg_reg;
+ struct msm_fb_data_type *mfd = info->par;
+ dest1 = NULL;
+
......@@ -49,34 +34,60 @@ index 4009ffc..d6a4113 100644
+ iBuf.roi.dst_width = req->dst_rect.w;
+ iBuf.roi.dst_height = req->dst_rect.h;
+
+ if (iBuf.ibuf_type == MDP_BGRA_8888)
+ dst_packPattern =
+ MDP_GET_PACK_PATTERN(CLR_ALPHA, CLR_R, CLR_G, CLR_B,
+ 8);
+ else if (iBuf.ibuf_type == MDP_RGBA_8888 ||
+ iBuf.ibuf_type == MDP_RGBX_8888)
+ dst_packPattern =
+ MDP_GET_PACK_PATTERN(CLR_ALPHA, CLR_B, CLR_G, CLR_R,
+ 8);
+ else if (iBuf.ibuf_type == MDP_XRGB_8888)
+ dst_packPattern =
+ MDP_GET_PACK_PATTERN(CLR_ALPHA, CLR_R, CLR_G, CLR_B,
+ 8);
+ else
+ dst_packPattern =
+ MDP_GET_PACK_PATTERN(CLR_ALPHA, CLR_R, CLR_G, CLR_B,
+ 8);
+
+ ppp_dst_cfg_reg = PPP_DST_C0G_8BIT |
+ PPP_DST_C1B_8BIT |
+ PPP_DST_C2R_8BIT |
+ PPP_DST_C3A_8BIT |
+ PPP_DST_C3ALPHA_EN |
+ PPP_DST_PACKET_CNT_INTERLVD_4ELEM |
+ PPP_DST_PACK_TIGHT |
+ PPP_DST_PACK_ALIGN_LSB |
+ PPP_DST_OUT_SEL_AXI |
+ PPP_DST_BPP_4BYTES | PPP_DST_PLANE_INTERLVD;
+ switch (iBuf.ibuf_type) {
+ case MDP_BGRA_8888:
+ case MDP_XRGB_8888:
+ case MDP_ARGB_8888:
+ case MDP_RGBA_8888:
+ case MDP_RGBX_8888:
+ if (iBuf.ibuf_type == MDP_BGRA_8888)
+ dst_packPattern =
+ MDP_GET_PACK_PATTERN(CLR_ALPHA, CLR_R, CLR_G, CLR_B,
+ 8);
+ else if (iBuf.ibuf_type == MDP_RGBA_8888 ||
+ iBuf.ibuf_type == MDP_RGBX_8888)
+ dst_packPattern =
+ MDP_GET_PACK_PATTERN(CLR_ALPHA, CLR_B, CLR_G, CLR_R,
+ 8);
+ else if (iBuf.ibuf_type == MDP_XRGB_8888)
+ dst_packPattern =
+ MDP_GET_PACK_PATTERN(CLR_ALPHA, CLR_R, CLR_G, CLR_B,
+ 8);
+ else
+ dst_packPattern =
+ MDP_GET_PACK_PATTERN(CLR_ALPHA, CLR_R, CLR_G, CLR_B,
+ 8);
+
+ ppp_dst_cfg_reg = PPP_DST_C0G_8BIT |
+ PPP_DST_C1B_8BIT |
+ PPP_DST_C2R_8BIT |
+ PPP_DST_C3A_8BIT |
+ PPP_DST_C3ALPHA_EN |
+ PPP_DST_PACKET_CNT_INTERLVD_4ELEM |
+ PPP_DST_PACK_TIGHT |
+ PPP_DST_PACK_ALIGN_LSB |
+ PPP_DST_OUT_SEL_AXI |
+ PPP_DST_BPP_4BYTES | PPP_DST_PLANE_INTERLVD;
+ break;
+ case MDP_BGR_565:
+ case MDP_RGB_565:
+ default:
+ if (iBuf.ibuf_type == MDP_RGB_565)
+ dst_packPattern =
+ MDP_GET_PACK_PATTERN(0, CLR_R, CLR_G, CLR_B, 8);
+ else
+ dst_packPattern =
+ MDP_GET_PACK_PATTERN(0, CLR_B, CLR_G, CLR_R, 8);
+
+ ppp_dst_cfg_reg = PPP_DST_C0G_6BIT |
+ PPP_DST_C1B_5BIT |
+ PPP_DST_C2R_5BIT |
+ PPP_DST_PACKET_CNT_INTERLVD_3ELEM |
+ PPP_DST_PACK_TIGHT |
+ PPP_DST_PACK_ALIGN_LSB |
+ PPP_DST_OUT_SEL_AXI |
+ PPP_DST_BPP_2BYTES | PPP_DST_PLANE_INTERLVD;
+ }
+
+ dest0_ystride = iBuf.ibuf_width * iBuf.bpp;
+ dst_roi_width = iBuf.roi.dst_width;
......@@ -89,24 +100,55 @@ index 4009ffc..d6a4113 100644
+ iBuf.ibuf_width, iBuf.ibuf_height, iBuf.bpp,
+ &iBuf, 2);
+
+ // Source color is MDP_BGRA_8888
+ packPattern =
+ MDP_GET_PACK_PATTERN(CLR_ALPHA, CLR_R, CLR_G, CLR_B,
+ 8);
+ ppp_src_cfg_reg = PPP_SRC_C2R_8BITS | PPP_SRC_C0G_8BITS |
+ PPP_SRC_C1B_8BITS | PPP_SRC_C3A_8BITS |
+ PPP_SRC_C3_ALPHA_EN | PPP_SRC_BPP_INTERLVD_4BYTES |
+ PPP_SRC_INTERLVD_4COMPONENTS | PPP_SRC_UNPACK_TIGHT |
+ PPP_SRC_UNPACK_ALIGN_LSB |
+ PPP_SRC_FETCH_PLANES_INTERLVD;
+
+
+ /*
+ * 0x0138: PPP destination operation register
+ * 0x014c: constant_alpha|transparent_color
+ * 0x0150: PPP destination config register
+ * 0x0154: PPP packing pattern
+ * 0x0108: src pixel size
+ * 0x0124: PPP source config register
+ * 0x0128: unpacked pattern from lsb to msb (eg. RGB->BGR)
+ */
+ MDP_OUTP(MDP_CMD_DEBUG_ACCESS_BASE + 0x0138, 0x10000000);
+ MDP_OUTP(MDP_CMD_DEBUG_ACCESS_BASE + 0x0108, (dst_roi_height << 16 |
+ dst_roi_width));
+ MDP_OUTP(MDP_CMD_DEBUG_ACCESS_BASE + 0x0124, ppp_dst_cfg_reg);
+ MDP_OUTP(MDP_CMD_DEBUG_ACCESS_BASE + 0x0128, dst_packPattern);
+ MDP_OUTP(MDP_CMD_DEBUG_ACCESS_BASE + 0x0124, ppp_src_cfg_reg);
+ MDP_OUTP(MDP_CMD_DEBUG_ACCESS_BASE + 0x0128, packPattern);
+ MDP_OUTP(MDP_CMD_DEBUG_ACCESS_BASE + 0x014c, 0xffffffff);
+ MDP_OUTP(MDP_CMD_DEBUG_ACCESS_BASE + 0x0150, ppp_dst_cfg_reg);
+ MDP_OUTP(MDP_CMD_DEBUG_ACCESS_BASE + 0x0154, dst_packPattern);
+
+
+ MDP_OUTP(MDP_BASE + 0x20004, 0x2);
+ MDP_OUTP(MDP_BASE + 0x20040, req->const_color.g |
+ req->const_color.b << 8 | req->const_color.r << 16 |
+ req->const_color.alpha << 24);
+ /*
+ * 0x0164: ROI height and width
+ * 0x0168: Component Plane 0 starting addr
+ * 0x016c: Component Plane 1 starting addr
+ * 0x0178: Component Plane 1/0 y stride
+ */
+ MDP_OUTP(MDP_CMD_DEBUG_ACCESS_BASE + 0x0164,
+ (dst_roi_height << 16 | dst_roi_width));
+ MDP_OUTP(MDP_CMD_DEBUG_ACCESS_BASE + 0x0168, dest0);
+ MDP_OUTP(MDP_CMD_DEBUG_ACCESS_BASE + 0x016c, dest1);
+ MDP_OUTP(MDP_CMD_DEBUG_ACCESS_BASE + 0x0178,
+ (dest0_ystride << 16 | dest0_ystride));
+
+
+ MDP_OUTP(MDP_CMD_DEBUG_ACCESS_BASE + 0x01b8, 0);
+ MDP_OUTP(MDP_CMD_DEBUG_ACCESS_BASE + 0x01bc, 0);
+ MDP_OUTP(MDP_CMD_DEBUG_ACCESS_BASE + 0x013c, 0);
......@@ -128,7 +170,7 @@ index 4009ffc..d6a4113 100644
int mdp_ppp_blit(struct fb_info *info, struct mdp_blit_req *req)
{
unsigned long src_start, dst_start;
@@ -1579,14 +1682,16 @@ int mdp_ppp_blit(struct fb_info *info, struct mdp_blit_req *req)
@@ -1579,14 +1740,16 @@ int mdp_ppp_blit(struct fb_info *info, struct mdp_blit_req *req)
unsigned long dst_len = 0;
struct file *p_src_file = 0 , *p_dst_file = 0;
......@@ -152,7 +194,7 @@ index 4009ffc..d6a4113 100644
}
if (req->flags & MDP_BLIT_DST_GEM)
get_gem_img(&req->dst, &dst_start, &dst_len);
@@ -1599,6 +1704,10 @@ int mdp_ppp_blit(struct fb_info *info, struct mdp_blit_req *req)
@@ -1599,6 +1762,10 @@ int mdp_ppp_blit(struct fb_info *info, struct mdp_blit_req *req)
return -EINVAL;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment