sdm/hwc/gralloc: Move fb_id lifecycle to DAL
--Move fb_id creation/deletion from gralloc to DAL and make it per cycle --Make Gralloc/HWC/SDM structures independent of libdrmutils and fb_id / gemhandles --Pass BufferAllocator pointer to Display* and HWDevice* --Add new GetBufferLayout API to BufferAllocator that can be called by DAL before creating fb_id Change-Id: I102f432cccee912ad4bcce622764938fa3d36ed3 CRs-fixed: 1114808
This commit is contained in:
@@ -21,12 +21,7 @@
|
||||
#include <cutils/properties.h>
|
||||
#include <sys/mman.h>
|
||||
#include <linux/msm_ion.h>
|
||||
#ifdef COMPILE_DRM
|
||||
#include <drm_master.h>
|
||||
#endif
|
||||
#include <qdMetaData.h>
|
||||
#include <qd_utils.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "gr.h"
|
||||
@@ -34,10 +29,6 @@
|
||||
#include "memalloc.h"
|
||||
#include "alloc_controller.h"
|
||||
|
||||
#ifdef COMPILE_DRM
|
||||
using namespace drm_utils;
|
||||
#endif
|
||||
|
||||
using namespace gralloc;
|
||||
|
||||
gpu_context_t::gpu_context_t(const private_module_t* module,
|
||||
@@ -178,43 +169,6 @@ int gpu_context_t::gralloc_alloc_buffer(unsigned int size, int usage,
|
||||
hnd->gpuaddr = 0;
|
||||
ColorSpace_t colorSpace = ITU_R_601;
|
||||
setMetaData(hnd, UPDATE_COLOR_SPACE, (void*) &colorSpace);
|
||||
|
||||
#ifdef COMPILE_DRM
|
||||
if (qdutils::getDriverType() == qdutils::DriverType::DRM &&
|
||||
usage & GRALLOC_USAGE_HW_COMPOSER) {
|
||||
DRMBuffer buf = {};
|
||||
int ret = getPlaneStrideOffset(hnd, buf.stride, buf.offset,
|
||||
&buf.num_planes);
|
||||
if (ret < 0) {
|
||||
ALOGE("%s failed", __FUNCTION__);
|
||||
return ret;
|
||||
}
|
||||
|
||||
buf.fd = hnd->fd;
|
||||
buf.width = hnd->width;
|
||||
buf.height = hnd->height;
|
||||
getDRMFormat(hnd->format, flags, &buf.drm_format,
|
||||
&buf.drm_format_modifier);
|
||||
|
||||
DRMMaster *master = nullptr;
|
||||
ret = DRMMaster::GetInstance(&master);
|
||||
if (ret < 0) {
|
||||
ALOGE("%s Failed to acquire DRMMaster instance", __FUNCTION__);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = master->CreateFbId(buf, &hnd->gem_handle, &hnd->fb_id);
|
||||
if (ret < 0) {
|
||||
ALOGE("%s: CreateFbId failed. width %d, height %d, " \
|
||||
"format: %s, stride %u, error %d", __FUNCTION__,
|
||||
buf.width, buf.height,
|
||||
qdutils::GetHALPixelFormatString(hnd->format),
|
||||
buf.stride[0], errno);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
*pHandle = hnd;
|
||||
}
|
||||
|
||||
@@ -415,22 +369,6 @@ int gpu_context_t::free_impl(private_handle_t const* hnd) {
|
||||
return err;
|
||||
}
|
||||
|
||||
#ifdef COMPILE_DRM
|
||||
if (hnd->fb_id) {
|
||||
DRMMaster *master = nullptr;
|
||||
int ret = DRMMaster::GetInstance(&master);
|
||||
if (ret < 0) {
|
||||
ALOGE("%s Failed to acquire DRMMaster instance", __FUNCTION__);
|
||||
return ret;
|
||||
}
|
||||
ret = master->RemoveFbId(hnd->gem_handle, hnd->fb_id);
|
||||
if (ret < 0) {
|
||||
ALOGE("%s: Removing fb_id %d failed with error %d", __FUNCTION__,
|
||||
hnd->fb_id, errno);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
delete hnd;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user