From: Jan Altensen Date: Sun, 4 Aug 2019 01:55:22 +0000 (+0200) Subject: fix gralloc compilation X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1733faf4657f8fbf5b52cc3c1cd75abe40daaf6b;p=GitHub%2FLineageOS%2Fandroid_hardware_samsung_slsi_exynos.git fix gralloc compilation Change-Id: Icb6cf0490f23f4934bcc751dd68c5de6621ac624 --- diff --git a/gralloc/framebuffer.cpp b/gralloc/framebuffer.cpp index 2ba4b68..0a77741 100644 --- a/gralloc/framebuffer.cpp +++ b/gralloc/framebuffer.cpp @@ -66,24 +66,14 @@ struct fb_context_t { /*****************************************************************************/ -static int fb_setSwapInterval(struct framebuffer_device_t* dev, - int interval) -{ - fb_context_t* ctx = (fb_context_t*)dev; - if (interval < dev->minSwapInterval || interval > dev->maxSwapInterval) - return -EINVAL; - // FIXME: implement fb_setSwapInterval - return 0; -} - static int fb_post(struct framebuffer_device_t* dev, buffer_handle_t buffer) { if (private_handle_t::validate(buffer) < 0) return -EINVAL; - private_handle_t const* hnd = reinterpret_cast(buffer); private_module_t* m = reinterpret_cast(dev->common.module); #if HWC_EXIST + private_handle_t const* hnd = reinterpret_cast(buffer); hwc_callback_queue_t *queue = reinterpret_cast(m->queue); pthread_mutex_lock(&m->queue_lock); if(queue->isEmpty()) @@ -132,14 +122,7 @@ static int fb_close(struct hw_device_t *dev) int init_fb(struct private_module_t* module) { - char const * const device_template[] = { - "/dev/graphics/fb%u", - "/dev/fb%u", - NULL - }; - int fd = -1; - int i = 0; fd = open("/dev/graphics/fb0", O_RDWR); if (fd < 0) { @@ -212,7 +195,7 @@ int init_fb(struct private_module_t* module) return 0; } -int fb_device_open(hw_module_t const* module, const char* name, +int fb_device_open(hw_module_t const* module, const char* name __unused, hw_device_t** device) { int status = -EINVAL; diff --git a/gralloc/gralloc.cpp b/gralloc/gralloc.cpp index 5b1bc0d..7e27974 100644 --- a/gralloc/gralloc.cpp +++ b/gralloc/gralloc.cpp @@ -64,9 +64,6 @@ struct gralloc_context_t { /* our private data here */ }; -static int gralloc_alloc_buffer(alloc_device_t* dev, - size_t size, int usage, buffer_handle_t* pHandle); - /*****************************************************************************/ int fb_device_open(const hw_module_t* module, const char* name, @@ -103,37 +100,37 @@ extern bool gralloc_crc_allocation_check(int format, int width, int height, int /*****************************************************************************/ static struct hw_module_methods_t gralloc_module_methods = { -open: gralloc_device_open + .open = gralloc_device_open }; /* version_major is for module_api_verison * lock_ycbcr is for MODULE_API_VERSION_0_2 */ struct private_module_t HAL_MODULE_INFO_SYM = { -base: { - common: { - tag: HARDWARE_MODULE_TAG, - module_api_version: GRALLOC_MODULE_API_VERSION_0_2, - hal_api_version: 0, - id: GRALLOC_HARDWARE_MODULE_ID, - name: "Graphics Memory Allocator Module", - author: "The Android Open Source Project", - methods: &gralloc_module_methods + .base = { + .common = { + .tag = HARDWARE_MODULE_TAG, + .module_api_version = GRALLOC_MODULE_API_VERSION_0_2, + .hal_api_version = 0, + .id = GRALLOC_HARDWARE_MODULE_ID, + .name = "Graphics Memory Allocator Module", + .author = "The Android Open Source Project", + .methods = &gralloc_module_methods + }, + .registerBuffer = gralloc_register_buffer, + .unregisterBuffer = gralloc_unregister_buffer, + .lock = gralloc_lock, + .unlock = gralloc_unlock, + .perform = NULL, + .lock_ycbcr = gralloc_lock_ycbcr, }, - registerBuffer: gralloc_register_buffer, - unregisterBuffer: gralloc_unregister_buffer, - lock: gralloc_lock, - unlock: gralloc_unlock, - perform: NULL, - lock_ycbcr: gralloc_lock_ycbcr, -}, -framebuffer: 0, -flags: 0, -numBuffers: 0, -bufferMask: 0, -lock: PTHREAD_MUTEX_INITIALIZER, -currentBuffer: 0, -ionfd: -1, + .framebuffer = 0, + .flags = 0, + .numBuffers = 0, + .bufferMask = 0, + .lock = PTHREAD_MUTEX_INITIALIZER, + .currentBuffer = 0, + .ionfd = -1, }; /*****************************************************************************/ @@ -219,7 +216,7 @@ static int gralloc_alloc_rgb(int ionfd, int w, int h, int format, int usage, int h_aligned = ALIGN( h, AFBC_PIXELS_PER_BLOCK ); int nblocks = w / AFBC_PIXELS_PER_BLOCK * h_aligned / AFBC_PIXELS_PER_BLOCK; - if ( size != NULL ) + if ( size ) { size = w * h_aligned * bpp + ALIGN( nblocks * AFBC_HEADER_BUFFER_BYTES_PER_BLOCKENTRY, AFBC_BODY_BUFFER_BYTE_ALIGNMENT ); @@ -499,8 +496,6 @@ static int gralloc_alloc(alloc_device_t* dev, private_module_t* m = reinterpret_cast (dev->common.module); - gralloc_module_t* module = reinterpret_cast - (dev->common.module); err = gralloc_alloc_rgb(m->ionfd, w, h, format, usage, ion_flags, &hnd, &stride); diff --git a/gralloc/mapper.cpp b/gralloc/mapper.cpp index 7bc7004..5c3f429 100644 --- a/gralloc/mapper.cpp +++ b/gralloc/mapper.cpp @@ -175,7 +175,7 @@ static int gralloc_map(gralloc_module_t const* module, buffer_handle_t handle) return 0; } -static int gralloc_unmap(gralloc_module_t const* module, buffer_handle_t handle) +static int gralloc_unmap(gralloc_module_t const* module __unused, buffer_handle_t handle) { private_handle_t* hnd = (private_handle_t*)handle; size_t chroma_vstride = 0; @@ -262,8 +262,6 @@ int grallocUnmap(gralloc_module_t const* module, private_handle_t *hnd) return gralloc_unmap(module, hnd); } -static pthread_mutex_t sMapLock = PTHREAD_MUTEX_INITIALIZER; - /*****************************************************************************/ int gralloc_register_buffer(gralloc_module_t const* module, @@ -320,8 +318,8 @@ int gralloc_unregister_buffer(gralloc_module_t const* module, } int gralloc_lock(gralloc_module_t const* module, - buffer_handle_t handle, int usage, - int l, int t, int w, int h, + buffer_handle_t handle, int usage __unused, + int l __unused, int t __unused, int w __unused, int h __unused, void** vaddr) { // this is called when a buffer is being locked for software @@ -364,9 +362,9 @@ int gralloc_lock(gralloc_module_t const* module, *vaddr = INT_TO_PTR(hnd->base); if (hnd->format == HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SPN) - vaddr[1] = vaddr[0] + (hnd->stride * hnd->vstride) + ext_size; + vaddr[1] = (int*)vaddr[0] + (hnd->stride * hnd->vstride) + ext_size; else if (hnd->format == HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SPN_S10B) - vaddr[1] = vaddr[0] + (hnd->stride * hnd->vstride) + ext_size + (ALIGN(hnd->width / 4, 16) * hnd->vstride) + 64; + vaddr[1] = (int*)vaddr[0] + (hnd->stride * hnd->vstride) + ext_size + (ALIGN(hnd->width / 4, 16) * hnd->vstride) + 64; #ifdef USES_EXYNOS_CRC_BUFFER_ALLOC if (!gralloc_crc_allocation_check(hnd->format, hnd->width, hnd->height, hnd->flags)) @@ -431,9 +429,9 @@ int gralloc_unlock(gralloc_module_t const* module, return 0; } -int gralloc_lock_ycbcr(gralloc_module_t const* module, +int gralloc_lock_ycbcr(gralloc_module_t const* module __unused, buffer_handle_t handle, int usage, - int l, int t, int w, int h, + int l __unused, int t __unused, int w __unused, int h __unused, android_ycbcr *ycbcr) { if (private_handle_t::validate(handle) < 0) diff --git a/include/exynos_ion.h b/include/exynos_ion.h index 2dd8d5c..1b71428 100644 --- a/include/exynos_ion.h +++ b/include/exynos_ion.h @@ -17,7 +17,9 @@ #ifndef _LIB_ION_H_ #define _LIB_ION_H_ +#ifndef ION_HEAP_SYSTEM_MASK #define ION_HEAP_SYSTEM_MASK (1 << 0) +#endif #define ION_HEAP_EXYNOS_CONTIG_MASK (1 << 4) #define ION_EXYNOS_VIDEO_EXT_MASK (1 << 31) #define ION_EXYNOS_VIDEO_EXT2_MASK (1 << 29) diff --git a/include/gralloc_priv.h b/include/gralloc_priv.h index 9379e98..f34db3a 100644 --- a/include/gralloc_priv.h +++ b/include/gralloc_priv.h @@ -115,8 +115,11 @@ struct private_handle_t { private_handle_t(int fd, int size, int flags) : fd(fd), fd1(-1), fd2(-1), magic(sMagic), flags(flags), size(size), - offset(0), format(0), internal_format(0), frameworkFormat(0), width(0), height(0), stride(0), - vstride(0), is_compressible(0), compressed_out(0), handle(0), handle1(0), handle2(0), base(0), base1(0), base2(0), prefer_compression(PREFER_COMPRESSION_NO_CHANGE), dssRatio(0) + offset(0), format(0), width(0), height(0), stride(0), vstride(0), frameworkFormat(0), + handle(0), handle1(0), handle2(0), base(0), base1(0), base2(0), + dssRatio(0), prefer_compression(PREFER_COMPRESSION_NO_CHANGE), + internal_format(0), is_compressible(0), compressed_out(0) + { version = sizeof(native_handle); numInts = sNumInts() + 2; @@ -126,8 +129,11 @@ struct private_handle_t { private_handle_t(int fd, int size, int flags, int w, int h, int format, uint64_t internal_format, int frameworkFormat, int stride, int vstride, int is_compressible) : fd(fd), fd1(-1), fd2(-1), magic(sMagic), flags(flags), size(size), - offset(0), format(format), internal_format(internal_format), frameworkFormat(frameworkFormat), width(w), height(h), stride(stride), - vstride(vstride), is_compressible(is_compressible), compressed_out(0), handle(0), handle1(0), handle2(0), base(0), base1(0), base2(0), prefer_compression(PREFER_COMPRESSION_NO_CHANGE), dssRatio(0) + offset(0), format(format), width(w), height(h), stride(stride), vstride(vstride), frameworkFormat(frameworkFormat), + handle(0), handle1(0), handle2(0), base(0), base1(0), base2(0), + dssRatio(0), prefer_compression(PREFER_COMPRESSION_NO_CHANGE), + internal_format(internal_format), is_compressible(is_compressible), compressed_out(0) + { version = sizeof(native_handle); numInts = sNumInts() + 2; @@ -137,8 +143,11 @@ struct private_handle_t { private_handle_t(int fd, int fd1, int size, int flags, int w, int h, int format, uint64_t internal_format, int frameworkFormat, int stride, int vstride, int is_compressible) : fd(fd), fd1(fd1), fd2(-1), magic(sMagic), flags(flags), size(size), - offset(0), format(format), internal_format(internal_format), frameworkFormat(frameworkFormat), width(w), height(h), stride(stride), - vstride(vstride), is_compressible(is_compressible), compressed_out(0), handle(0), handle1(0), handle2(0), base(0), base1(0), base2(0), prefer_compression(PREFER_COMPRESSION_NO_CHANGE), dssRatio(0) + offset(0), format(format), width(w), height(h), stride(stride), vstride(vstride), frameworkFormat(frameworkFormat), + handle(0), handle1(0), handle2(0), base(0), base1(0), base2(0), + dssRatio(0), prefer_compression(PREFER_COMPRESSION_NO_CHANGE), + internal_format(internal_format), is_compressible(is_compressible), compressed_out(0) + { version = sizeof(native_handle); numInts = sNumInts() + 1; @@ -148,8 +157,11 @@ struct private_handle_t { private_handle_t(int fd, int fd1, int fd2, int size, int flags, int w, int h, int format, uint64_t internal_format, int frameworkFormat, int stride, int vstride, int is_compressible) : fd(fd), fd1(fd1), fd2(fd2), magic(sMagic), flags(flags), size(size), - offset(0), format(format), internal_format(internal_format), frameworkFormat(frameworkFormat), width(w), height(h), stride(stride), - vstride(vstride), is_compressible(is_compressible), compressed_out(0), handle(0), handle1(0), handle2(0), base(0), base1(0), base2(0), prefer_compression(PREFER_COMPRESSION_NO_CHANGE), dssRatio(0) + offset(0), format(format), width(w), height(h), stride(stride), vstride(vstride), frameworkFormat(frameworkFormat), + handle(0), handle1(0), handle2(0), base(0), base1(0), base2(0), + dssRatio(0), prefer_compression(PREFER_COMPRESSION_NO_CHANGE), + internal_format(internal_format), is_compressible(is_compressible), compressed_out(0) + { version = sizeof(native_handle); numInts = sNumInts();