Skip to content

Commit

Permalink
Run has_roi_merge() only once
Browse files Browse the repository at this point in the history
Change-Id: I0d2a8d25ecafdb647a8b1129703476125514559f
  • Loading branch information
davidepianca98 committed Apr 25, 2015
1 parent f6d08fc commit 76a9b0d
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 41 deletions.
50 changes: 9 additions & 41 deletions lib/framebuffer_qcom_overlay.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,37 +39,6 @@

#define ALIGN(x, align) (((x) + ((align)-1)) & ~((align)-1))
#define MAX_DISPLAY_DIM 2048
#define NUM_BUFFERS 3

struct fb_qcom_overlay_mem_info {
uint8_t *mem_buf;
int size;
int ion_fd;
int mem_fd;
int offset;
struct ion_handle_data handle_data;
};

struct fb_qcom_vsync {
int fb_fd;
int enabled;
volatile int _run_thread;
pthread_t thread;
pthread_mutex_t mutex;
pthread_cond_t cond;
struct timespec time;
};

struct fb_qcom_overlay_data {
struct fb_qcom_overlay_mem_info mem_info[NUM_BUFFERS];
struct fb_qcom_vsync *vsync;
int active_mem;
int overlayL_id;
int overlayR_id;
int leftSplit;
int rightSplit;
int width;
};

#define VSYNC_PREFIX "VSYNC="

Expand Down Expand Up @@ -258,7 +227,7 @@ static int isDisplaySplit(struct fb_qcom_overlay_data *data)
return 0;
}

static int has_roi_merge()
static void has_roi_merge(struct fb_qcom_overlay_data *data)
{
char temp[128];
FILE* fp;
Expand All @@ -278,7 +247,7 @@ static int has_roi_merge()
fclose(fp);
}

return found;
data->roi_merge = found;
}

static int free_ion_mem(struct fb_qcom_overlay_data *data)
Expand Down Expand Up @@ -484,7 +453,7 @@ static int allocate_overlay(struct fb_qcom_overlay_data *data, int fd, int width

static int free_overlay(struct fb_qcom_overlay_data *data, int fd)
{
int ret = 0, roi_merge;
int ret = 0;

if(!isDisplaySplit(data))
{
Expand Down Expand Up @@ -524,8 +493,7 @@ static int free_overlay(struct fb_qcom_overlay_data *data, int fd)
}
}

roi_merge = has_roi_merge();
if(roi_merge > 1)
if(data->roi_merge > 1)
{
struct mdp_display_commit_lr ext_commit_lr;

Expand All @@ -537,7 +505,7 @@ static int free_overlay(struct fb_qcom_overlay_data *data, int fd)

ret = ioctl(fd, MSMFB_DISPLAY_COMMIT_LR, &ext_commit_lr);
}
else if(roi_merge == 1)
else if(data->roi_merge == 1)
{
struct mdp_display_commit_s ext_commit_s;

Expand Down Expand Up @@ -579,6 +547,7 @@ static int impl_open(struct framebuffer *fb)
data->leftSplit = data->width / 2;

setDisplaySplit(data);
has_roi_merge(data);

#ifdef TW_SCREEN_BLANK_ON_BOOT
ioctl(fb->fd, FBIOBLANK, FB_BLANK_POWERDOWN);
Expand Down Expand Up @@ -616,7 +585,7 @@ static void impl_close(struct framebuffer *fb)

static int impl_update(struct framebuffer *fb)
{
int ret = 0, roi_merge;
int ret = 0;
struct msmfb_overlay_data ovdataL, ovdataR;
struct fb_qcom_overlay_data *data = fb->impl_data;
struct fb_qcom_overlay_mem_info *info = &data->mem_info[data->active_mem];
Expand Down Expand Up @@ -683,8 +652,7 @@ static int impl_update(struct framebuffer *fb)
}
}

roi_merge = has_roi_merge();
if(roi_merge > 1)
if(data->roi_merge > 1)
{
struct mdp_display_commit_lr ext_commit_lr;
memset(&ext_commit_lr, 0, sizeof(struct mdp_display_commit_lr));
Expand All @@ -694,7 +662,7 @@ static int impl_update(struct framebuffer *fb)

ret = ioctl(fb->fd, MSMFB_DISPLAY_COMMIT_LR, &ext_commit_lr);
}
else if(roi_merge == 1)
else if(data->roi_merge == 1)
{
struct mdp_display_commit_s ext_commit_s;
memset(&ext_commit_s, 0, sizeof(struct mdp_display_commit_s));
Expand Down
33 changes: 33 additions & 0 deletions lib/framebuffer_qcom_overlay.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#include MR_QCOM_OVERLAY_HEADER
#endif

#define NUM_BUFFERS 3

#define MSMFB_DISPLAY_COMMIT_N _IOW(MSMFB_IOCTL_MAGIC, 164, \
struct mdp_display_commit_n)
#define MSMFB_DISPLAY_COMMIT_S _IOW(MSMFB_IOCTL_MAGIC, 164, \
Expand All @@ -39,6 +41,37 @@ enum {
PARTIAL_UPDATE = 0x04
};

struct fb_qcom_overlay_mem_info {
uint8_t *mem_buf;
int size;
int ion_fd;
int mem_fd;
int offset;
struct ion_handle_data handle_data;
};

struct fb_qcom_vsync {
int fb_fd;
int enabled;
volatile int _run_thread;
pthread_t thread;
pthread_mutex_t mutex;
pthread_cond_t cond;
struct timespec time;
};

struct fb_qcom_overlay_data {
struct fb_qcom_overlay_mem_info mem_info[NUM_BUFFERS];
struct fb_qcom_vsync *vsync;
int active_mem;
int overlayL_id;
int overlayR_id;
int leftSplit;
int rightSplit;
int width;
int roi_merge;
};

struct mdp_display_commit_n {
uint32_t flags;
uint32_t wait_for_finish;
Expand Down

0 comments on commit 76a9b0d

Please sign in to comment.