Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2c116018 authored by Mao Flynn's avatar Mao Flynn Committed by Gerrit - the friendly Code Review server
Browse files

msm: mdss: add a fb type for fb mmap ioctl



Using fb mmap, we can get a buffer from ion handle,
or from a fixed adress physical continuous memory.
Earlier if mmap is called more than once then ion
handle won't be NULL and fb would allocate using
physical continuous memory. Fix this to ensure the
type of fb allocation is correct by storing fb map
type.

Change-Id: I2b47b08b7fcb06f8220fcfe8852f5c2e37ade628
Signed-off-by: default avatarMao Flynn <Flynn@codeaurora.org>
Signed-off-by: default avatarJayant Shekhar <jshekhar@codeaurora.org>
parent 3fff1a55
Loading
Loading
Loading
Loading
+14 −6
Original line number Diff line number Diff line
@@ -1557,9 +1557,9 @@ static int mdss_fb_fbmem_ion_mmap(struct fb_info *info,
				vma->vm_page_prot =
					pgprot_writecombine(vma->vm_page_prot);

			pr_debug("vma=%p, addr=%x len=%ld",
			pr_debug("vma=%p, addr=%x len=%ld\n",
					vma, (unsigned int)addr, len);
			pr_cont("vm_start=%x vm_end=%x vm_page_prot=%ld\n",
			pr_debug("vm_start=%x vm_end=%x vm_page_prot=%ld\n",
					(unsigned int)vma->vm_start,
					(unsigned int)vma->vm_end,
					(unsigned long int)vma->vm_page_prot);
@@ -1633,13 +1633,21 @@ static int mdss_fb_physical_mmap(struct fb_info *info,
static int mdss_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
{
	struct msm_fb_data_type *mfd = (struct msm_fb_data_type *)info->par;
	int rc = 0;
	int rc = -EINVAL;

	if (!info->fix.smem_start && !mfd->fb_ion_handle)
	if (mfd->fb_mmap_type == MDP_FB_MMAP_ION_ALLOC) {
		rc = mdss_fb_fbmem_ion_mmap(info, vma);
	else
	} else if (mfd->fb_mmap_type == MDP_FB_MMAP_PHYSICAL_ALLOC) {
		rc = mdss_fb_physical_mmap(info, vma);

	} else {
		if (!info->fix.smem_start && !mfd->fb_ion_handle) {
			rc = mdss_fb_fbmem_ion_mmap(info, vma);
			mfd->fb_mmap_type = MDP_FB_MMAP_ION_ALLOC;
		} else {
			rc = mdss_fb_physical_mmap(info, vma);
			mfd->fb_mmap_type = MDP_FB_MMAP_PHYSICAL_ALLOC;
		}
	}
	if (rc < 0)
		pr_err("fb mmap failed with rc = %d\n", rc);

+15 −0
Original line number Diff line number Diff line
@@ -95,6 +95,19 @@ enum mdp_split_mode {
	MDP_SPLIT_MODE_DST,
};

/**
 * enum mdp_mmap_type - Lists the possible mmap type in the device
 *
 * @MDP_FB_MMAP_NONE: Unknown type.
 * @MDP_FB_MMAP_ION_ALLOC:   Use ION allocate a buffer for mmap
 * @MDP_FB_MMAP_PHYSICAL_ALLOC:  Use physical buffer for mmap
 */
enum mdp_mmap_type {
	MDP_FB_MMAP_NONE,
	MDP_FB_MMAP_ION_ALLOC,
	MDP_FB_MMAP_PHYSICAL_ALLOC,
};

struct disp_info_type_suspend {
	int op_enable;
	int panel_power_state;
@@ -274,6 +287,8 @@ struct msm_fb_data_type {
	u32 wait_for_kickoff;
	u32 thermal_level;
	int doze_mode;

	int fb_mmap_type;
};

static inline void mdss_fb_update_notify_update(struct msm_fb_data_type *mfd)