summaryrefslogtreecommitdiff
authorStark Li <stark.li@amlogic.com>2017-01-12 11:24:56 (GMT)
committer Stark Li <stark.li@amlogic.com>2017-01-17 05:18:22 (GMT)
commit155b5bf78464e3e510c6782e7090fff1fca64c76 (patch)
treec23272183e692296b06a22be55cd21599e5a4cbf
parent77741039ed0918e4e25d5c36b5792b106e57ebab (diff)
downloadgralloc-155b5bf78464e3e510c6782e7090fff1fca64c76.zip
gralloc-155b5bf78464e3e510c6782e7090fff1fca64c76.tar.gz
gralloc-155b5bf78464e3e510c6782e7090fff1fca64c76.tar.bz2
PD#138457: compatible with old fb post
Change-Id: Id4d19e783b5fcbb08174942fbc4b2196625f6ba6
Diffstat
-rw-r--r--alloc_ion.cpp7
-rw-r--r--framebuffer.cpp113
-rw-r--r--framebuffer.h1
3 files changed, 78 insertions, 43 deletions
diff --git a/alloc_ion.cpp b/alloc_ion.cpp
index 4a44fc5..57f0862 100644
--- a/alloc_ion.cpp
+++ b/alloc_ion.cpp
@@ -80,6 +80,7 @@ int alloc_backend_alloc(alloc_device_t* dev, size_t size, int usage, buffer_hand
bool layerAllocContinousBuf = false;
#ifdef GRALLOC_APP_ALLOC_CONTINUOUS_BUF
+#if 0
char path[256];
char comm[256];
sprintf(path, "/proc/%d/comm", getpid());
@@ -94,6 +95,12 @@ int alloc_backend_alloc(alloc_device_t* dev, size_t size, int usage, buffer_hand
fclose(fp);
fp = NULL;
}
+#else
+ if (usage & GRALLOC_USAGE_HW_COMPOSER)
+ {
+ layerAllocContinousBuf = true;
+ }
+#endif
#endif
bool allocCodecMem = false;
diff --git a/framebuffer.cpp b/framebuffer.cpp
index 95fd68f..c320fc3 100644
--- a/framebuffer.cpp
+++ b/framebuffer.cpp
@@ -502,6 +502,34 @@ int init_frame_buffer_locked(struct framebuffer_info_t* fbinfo)
return 0;
}
+int fb_post_with_fence_locked(
+ struct framebuffer_info_t* fbinfo,
+ buffer_handle_t hnd,
+ int in_fence)
+{
+#define FBIOPUT_OSD_SYNC_ADD 0x4518
+ typedef struct {
+ unsigned int xoffset;
+ unsigned int yoffset;
+ int in_fen_fd;
+ int out_fen_fd;
+ } fb_sync_request_t;
+
+ private_handle_t const* buffer = reinterpret_cast<private_handle_t const*>(hnd);
+ fb_sync_request_t sync_req;
+
+ memset(&sync_req, 0, sizeof(fb_sync_request_t));
+ sync_req.xoffset = fbinfo->info.xoffset;
+ sync_req.yoffset = buffer->offset / fbinfo->finfo.line_length;
+ // acquire fence.
+ sync_req.in_fen_fd = in_fence;
+
+ ALOGD( "req offset: %d\n", sync_req.yoffset);
+ ioctl(fbinfo->fd, FBIOPUT_OSD_SYNC_ADD, &sync_req);
+
+ return sync_req.out_fen_fd;
+}
+
uint32_t getIonPhyAddr(struct framebuffer_info_t* fbinfo,buffer_handle_t hnd)
{
private_handle_t const *pHandle = reinterpret_cast<private_handle_t const*> (hnd);
@@ -530,53 +558,52 @@ uint32_t getIonPhyAddr(struct framebuffer_info_t* fbinfo,buffer_handle_t hnd)
return phyData.phys_addr;
}
-int fb_post_with_fence_locked(
+int hwc_fb_post_with_fence_locked(
struct framebuffer_info_t* fbinfo,
buffer_handle_t hnd,
int in_fence)
{
-#define FBIOPUT_OSD_SYNC_ADD 0x4518
- typedef struct{
- unsigned int xoffset;
- unsigned int yoffset;
- int in_fen_fd;
- int out_fen_fd;
- int width;
- int height;
- int format;
- unsigned int paddr;
- unsigned int op;
- unsigned int reserve;
- } fb_sync_request_t;
-
- private_handle_t const* buffer = reinterpret_cast<private_handle_t const*>(hnd);
- fb_sync_request_t sync_req;
-
- memset(&sync_req, 0, sizeof(fb_sync_request_t));
- sync_req.xoffset = fbinfo->info.xoffset;
- sync_req.yoffset = buffer->offset / fbinfo->finfo.line_length;
- // acquire fence.
- sync_req.in_fen_fd = in_fence;
-
- if (fbinfo->renderMode == 1) { // Direct composer mode.
- sync_req.width = buffer->width;
- sync_req.height = buffer->height;
- sync_req.format = buffer->format;
- sync_req.paddr = getIonPhyAddr(fbinfo, hnd);
- } else if (fbinfo->renderMode == 2) { // GE2D composer mode.
- sync_req.width = fbinfo->info.xres;
- sync_req.height = fbinfo->info.yres;
- sync_req.format = HAL_PIXEL_FORMAT_RGBA_8888;
- unsigned int paddr = getIonPhyAddr(fbinfo, hnd);
- if (0 != paddr)
- sync_req.paddr = paddr + fbinfo->yOffset * fbinfo->finfo.line_length;
- }
- sync_req.op = fbinfo->op;
- ALOGD( "req offset: %d, width: %d, height: %d, format: %d, addr: 0x%x, op: 0x%x\n",
- sync_req.yoffset, sync_req.width, sync_req.height, sync_req.format, sync_req.paddr, sync_req.op);
- ioctl(fbinfo->fd, FBIOPUT_OSD_SYNC_ADD, &sync_req);
-
- return sync_req.out_fen_fd;
+#define FBIOPUT_OSD_SYNC_RENDER_ADD 0x4519
+ typedef struct {
+ unsigned int xoffset;
+ unsigned int yoffset;
+ int in_fen_fd;
+ int out_fen_fd;
+ int width;
+ int height;
+ int format;
+ unsigned int paddr;
+ unsigned int op;
+ unsigned int reserve;
+ } fb_sync_request_t;
+
+ private_handle_t const* buffer = reinterpret_cast<private_handle_t const*>(hnd);
+ fb_sync_request_t sync_req;
+
+ memset(&sync_req, 0, sizeof(fb_sync_request_t));
+ sync_req.xoffset = fbinfo->info.xoffset;
+ sync_req.yoffset = buffer->offset / fbinfo->finfo.line_length;
+ // acquire fence.
+ sync_req.in_fen_fd = in_fence;
+ if (fbinfo->renderMode == 1) { // Direct composer mode.
+ sync_req.width = buffer->width;
+ sync_req.height = buffer->height;
+ sync_req.format = buffer->format;
+ sync_req.paddr = getIonPhyAddr(fbinfo, hnd);
+ } else if (fbinfo->renderMode == 2) { // GE2D composer mode.
+ sync_req.width = fbinfo->info.xres;
+ sync_req.height = fbinfo->info.yres;
+ sync_req.format = HAL_PIXEL_FORMAT_RGBA_8888;
+ unsigned int paddr = getIonPhyAddr(fbinfo, hnd);
+ if (0 != paddr)
+ sync_req.paddr = paddr + fbinfo->yOffset * fbinfo->finfo.line_length;
+ }
+ sync_req.op = fbinfo->op;
+ ALOGD( "req offset: %d, width: %d, height: %d, format: %d, addr: 0x%x, op: 0x%x\n",
+ sync_req.yoffset, sync_req.width, sync_req.height, sync_req.format, sync_req.paddr, sync_req.op);
+ ioctl(fbinfo->fd, FBIOPUT_OSD_SYNC_RENDER_ADD, &sync_req);
+
+ return sync_req.out_fen_fd;
}
int fb_post_locked(struct framebuffer_info_t* fbinfo, buffer_handle_t hnd)
diff --git a/framebuffer.h b/framebuffer.h
index 0d0d9ed..7a9ffc8 100644
--- a/framebuffer.h
+++ b/framebuffer.h
@@ -59,6 +59,7 @@ int update_cursor_buffer_locked(struct framebuffer_info_t* cbinfo, int xres, int
int fb_post_locked(struct framebuffer_info_t* fbinfo,buffer_handle_t buffer);
int fb_post_with_fence_locked(struct framebuffer_info_t* fbinfo,buffer_handle_t hnd,int in_fence);
+int hwc_fb_post_with_fence_locked(struct framebuffer_info_t* fbinfo,buffer_handle_t hnd,int in_fence);
int getOsdIdx(int display_type);
int bits_per_pixel();