#include <cutils/hwflinger_defs.h>
#include <log/Log.h>
-#include <memory>
#include <stdint.h>
+#include <memory>
#include "hwctrace.h"
#include <cutils/hwflinger.h>
#include <cutils/hwflinger_defs.h>
-#include <nativedisplay.h>
-#include <hwclayer.h>
-#include <gpudevice.h>
#include <fcntl.h>
+#include <gpudevice.h>
+#include <hwclayer.h>
+#include <nativedisplay.h>
#include <Hal.h>
HwfDevice* get_hwf_hw();
};
-}
+} // namespace hwcomposer
#endif
#ifndef OS_ALIOS_PLATFORMDEFINES_H_
#define OS_ALIOS_PLATFORMDEFINES_H_
-#include <string.h>
-#include <cstdint>
#include <hwcbuffer.h>
#include <log/Log.h>
+#include <string.h>
+#include <cstdint>
-#include "platformcommondefines.h"
#include <cutils/native_target.h>
+#include "platformcommondefines.h"
#define LOG_TAG "IAHWF"
#endif
/************ FROM MESA 17+ *************/
-#define fourcc_code(a, b, c, d) ((__u32)(a) | ((__u32)(b) << 8) | \
- ((__u32)(c) << 16) | ((__u32)(d) << 24))
+#define fourcc_code(a, b, c, d) \
+ ((__u32)(a) | ((__u32)(b) << 8) | ((__u32)(c) << 16) | ((__u32)(d) << 24))
/*
* 2 plane YCbCr MSB aligned
* index 0 = Y plane, [15:0] Y:x [10:6] little endian
* index 1 = Cr:Cb plane, [31:0] Cr:x:Cb:x [10:6:10:6] little endian
*/
-#define DRM_FORMAT_P010 fourcc_code('P', '0', '1', '0') /* 2x2 subsampled Cr:Cb plane 10 bits per channel */
+/* 2x2 subsampled Cr:Cb plane 10 bits per channel */
+#define DRM_FORMAT_P010 fourcc_code('P', '0', '1', '0')
/*
* 2 plane YCbCr MSB aligned
* index 0 = Y plane, [15:0] Y:x [12:4] little endian
* index 1 = Cr:Cb plane, [31:0] Cr:x:Cb:x [12:4:12:4] little endian
*/
-#define DRM_FORMAT_P012 fourcc_code('P', '0', '1', '2') /* 2x2 subsampled Cr:Cb plane 12 bits per channel */
+/* 2x2 subsampled Cr:Cb plane 12 bits per channel */
+#define DRM_FORMAT_P012 fourcc_code('P', '0', '1', '2')
/*
* 2 plane YCbCr MSB aligned
* index 0 = Y plane, [15:0] Y little endian
* index 1 = Cr:Cb plane, [31:0] Cr:Cb [16:16] little endian
*/
-#define DRM_FORMAT_P016 fourcc_code('P', '0', '1', '6') /* 2x2 subsampled Cr:Cb plane 16 bits per channel */
+/* 2x2 subsampled Cr:Cb plane 16 bits per channel */
+#define DRM_FORMAT_P016 fourcc_code('P', '0', '1', '6')
/* 16 bpp Red */
-#define DRM_FORMAT_R16 fourcc_code('R', '1', '6', ' ') /* [15:0] R little endian */
+/* [15:0] R little endian */
+#define DRM_FORMAT_R16 fourcc_code('R', '1', '6', ' ')
-#define DRM_MODE_ROTATE_0 (1<<0)
-#define DRM_MODE_ROTATE_90 (1<<1)
-#define DRM_MODE_ROTATE_180 (1<<2)
-#define DRM_MODE_ROTATE_270 (1<<3)
+#define DRM_MODE_ROTATE_0 (1 << 0)
+#define DRM_MODE_ROTATE_90 (1 << 1)
+#define DRM_MODE_ROTATE_180 (1 << 2)
+#define DRM_MODE_ROTATE_270 (1 << 3)
-#define DRM_MODE_REFLECT_X (1<<4)
-#define DRM_MODE_REFLECT_Y (1<<5)
+#define DRM_MODE_REFLECT_X (1 << 4)
+#define DRM_MODE_REFLECT_Y (1 << 5)
/*************************/
return id;
}
-
// _cplusplus
#ifdef _cplusplus
}
#include <stdio.h>
#include <string.h>
-#include <xf86drmMode.h>
#include <xf86drm.h>
+#include <xf86drmMode.h>
-#include <stdint.h>
#include <drm_fourcc.h>
+#include <stdint.h>
#include "platformdefines.h"
switch (format) {
case YUN_HAL_FORMAT_RGBA_8888:
case YUN_HAL_FORMAT_sRGB_A_8888:
- ret = DRM_FORMAT_ABGR8888;
- break;
+ ret = DRM_FORMAT_ABGR8888;
+ break;
case YUN_HAL_FORMAT_RGBX_8888:
case YUN_HAL_FORMAT_sRGB_X_8888:
- ret = DRM_FORMAT_XBGR8888;
- break;
+ ret = DRM_FORMAT_XBGR8888;
+ break;
case YUN_HAL_FORMAT_RGB_888:
- ret = DRM_FORMAT_BGR888;
- break;
+ ret = DRM_FORMAT_BGR888;
+ break;
case YUN_HAL_FORMAT_RGB_565:
- ret = DRM_FORMAT_RGB565;
- break;
+ ret = DRM_FORMAT_RGB565;
+ break;
case YUN_HAL_FORMAT_BGRA_8888:
case YUN_HAL_FORMAT_sBGR_A_8888:
- ret = DRM_FORMAT_ARGB8888;
- break;
+ ret = DRM_FORMAT_ARGB8888;
+ break;
case YUN_HAL_FORMAT_BGRX_8888:
case YUN_HAL_FORMAT_sBGR_X_8888:
- ret = DRM_FORMAT_XRGB8888;
- break;
+ ret = DRM_FORMAT_XRGB8888;
+ break;
case YUN_HAL_FORMAT_I420:
- ret = DRM_FORMAT_YUV420;
- break;
+ ret = DRM_FORMAT_YUV420;
+ break;
case YUN_HAL_FORMAT_YV12:
- ret = DRM_FORMAT_YVU420;
- break;
+ ret = DRM_FORMAT_YVU420;
+ break;
case YUN_HAL_FORMAT_NV12:
case YUN_HAL_FORMAT_DRM_NV12:
- ret = DRM_FORMAT_NV12;
- break;
+ ret = DRM_FORMAT_NV12;
+ break;
case YUN_HAL_FORMAT_NV21:
case YUN_HAL_FORMAT_YCrCb_420_SP:
- ret = DRM_FORMAT_NV21;
- break;
+ ret = DRM_FORMAT_NV21;
+ break;
case YUN_HAL_FORMAT_NV16:
case YUN_HAL_FORMAT_YCbCr_422_SP:
- ret = DRM_FORMAT_NV16;
- break;
+ ret = DRM_FORMAT_NV16;
+ break;
case YUN_HAL_FORMAT_NV61:
- ret = DRM_FORMAT_NV61;
- break;
+ ret = DRM_FORMAT_NV61;
+ break;
case YUN_HAL_FORMAT_UYVY:
- ret = DRM_FORMAT_UYVY;
- break;
+ ret = DRM_FORMAT_UYVY;
+ break;
case YUN_HAL_FORMAT_VYUY:
- ret = DRM_FORMAT_VYUY;
- break;
+ ret = DRM_FORMAT_VYUY;
+ break;
case YUN_HAL_FORMAT_YUYV:
case YUN_HAL_FORMAT_YCbCr_422_I:
- ret = DRM_FORMAT_YUYV;
- break;
+ ret = DRM_FORMAT_YUYV;
+ break;
case YUN_HAL_FORMAT_YVYU:
- ret = DRM_FORMAT_YVYU;
- break;
+ ret = DRM_FORMAT_YVYU;
+ break;
default:
- ETRACE("GetDrmFormatFromHALFormat --> can't get format. \n");
+ ETRACE("GetDrmFormatFromHALFormat --> can't get format. \n");
break;
}
- ITRACE("GetDrmFormatFromHALFormat --> Format: %c%c%c%c.\n", ret,
- ret >> 8, ret >> 16, ret >> 24);
+ ITRACE("GetDrmFormatFromHALFormat --> Format: %c%c%c%c.\n", ret, ret >> 8,
+ ret >> 16, ret >> 24);
return ret;
}
static uint32_t DrmFormatToHALFormat(int format) {
- ITRACE("DrmFormatToHALFormat --> Format: %c%c%c%c.\n", format,
- format >> 8, format >> 16, format >> 24);
+ ITRACE("DrmFormatToHALFormat --> Format: %c%c%c%c.\n", format, format >> 8,
+ format >> 16, format >> 24);
int ret = 0;
switch (format) {
/* Use below code validated from Yalloc. */
case DRM_FORMAT_ABGR8888:
- ret = YUN_HAL_FORMAT_RGBA_8888;
- break;
+ ret = YUN_HAL_FORMAT_RGBA_8888;
+ break;
case DRM_FORMAT_XBGR8888:
- ret = YUN_HAL_FORMAT_RGBX_8888;
- break;
+ ret = YUN_HAL_FORMAT_RGBX_8888;
+ break;
case DRM_FORMAT_BGR888:
- ret = YUN_HAL_FORMAT_RGB_888;
- break;
+ ret = YUN_HAL_FORMAT_RGB_888;
+ break;
case DRM_FORMAT_RGB565:
- ret = YUN_HAL_FORMAT_RGB_565;
- break;
+ ret = YUN_HAL_FORMAT_RGB_565;
+ break;
case DRM_FORMAT_ARGB8888:
- ret = YUN_HAL_FORMAT_BGRA_8888;
- break;
+ ret = YUN_HAL_FORMAT_BGRA_8888;
+ break;
case DRM_FORMAT_XRGB8888:
- ret = YUN_HAL_FORMAT_BGRX_8888;
- break;
+ ret = YUN_HAL_FORMAT_BGRX_8888;
+ break;
case YUN_HAL_FORMAT_I420:
- ret = DRM_FORMAT_YUV420;
- break;
+ ret = DRM_FORMAT_YUV420;
+ break;
case DRM_FORMAT_YUV420:
- ret = YUN_HAL_FORMAT_YV12;
- break;
+ ret = YUN_HAL_FORMAT_YV12;
+ break;
case DRM_FORMAT_NV12:
- ret = YUN_HAL_FORMAT_NV12;
- break;
+ ret = YUN_HAL_FORMAT_NV12;
+ break;
case DRM_FORMAT_NV21:
- ret = YUN_HAL_FORMAT_NV21;
- break;
+ ret = YUN_HAL_FORMAT_NV21;
+ break;
case DRM_FORMAT_NV16:
- ret = YUN_HAL_FORMAT_NV16;
- break;
+ ret = YUN_HAL_FORMAT_NV16;
+ break;
case DRM_FORMAT_NV61:
- ret = YUN_HAL_FORMAT_NV61;
- break;
+ ret = YUN_HAL_FORMAT_NV61;
+ break;
case DRM_FORMAT_UYVY:
- ret = YUN_HAL_FORMAT_UYVY;
- break;
+ ret = YUN_HAL_FORMAT_UYVY;
+ break;
case DRM_FORMAT_VYUY:
- ret = YUN_HAL_FORMAT_VYUY;
- break;
+ ret = YUN_HAL_FORMAT_VYUY;
+ break;
case DRM_FORMAT_YUYV:
- ret = YUN_HAL_FORMAT_YUYV;
- break;
+ ret = YUN_HAL_FORMAT_YUYV;
+ break;
case DRM_FORMAT_YVYU:
- ret = YUN_HAL_FORMAT_YVYU;
- break;
+ ret = YUN_HAL_FORMAT_YVYU;
+ break;
default:
ETRACE("DrmFormatToHALFormat --> Error Format @ line: %d.\n", __LINE__);
return ret;
}
-static native_target_t* dup_buffer_handle(gb_target_t handle) {
- native_target_t* new_handle =
+static native_target_t *dup_buffer_handle(gb_target_t handle) {
+ native_target_t *new_handle =
native_target_create(handle->fds.num, handle->attributes.num);
if (new_handle == NULL)
return NULL;
return new_handle;
}
-static void free_buffer_handle(native_target_t* handle) {
+static void free_buffer_handle(native_target_t *handle) {
int ret = native_target_close(handle);
if (ret)
ETRACE("Failed to close native target %d", ret);
#include "yallocbufferhandler.h"
-#include <unistd.h>
#include <drm.h>
-#include <xf86drm.h>
#include <drm_fourcc.h>
+#include <unistd.h>
+#include <xf86drm.h>
#include <hwcdefs.h>
#include <hwctrace.h>
}
bool YallocBufferHandler::Init() {
- VendorModule* module = (VendorModule*) LOAD_VENDOR_MODULE(YALLOC_VENDOR_MODULE_ID);
+ VendorModule *module =
+ (VendorModule *)LOAD_VENDOR_MODULE(YALLOC_VENDOR_MODULE_ID);
if (module == NULL) {
ETRACE("LOAD_VENDOR_MODULE Failed\n");
return false;
uint32_t usage = 0;
if ((layer_type == hwcomposer::kLayerNormal) || force_normal_usage) {
- usage |= YALLOC_FLAG_HW_COMPOSER |
- YALLOC_FLAG_HW_RENDER |
+ usage |= YALLOC_FLAG_HW_COMPOSER | YALLOC_FLAG_HW_RENDER |
YALLOC_FLAG_HW_TEXTURE;
} else if (layer_type == hwcomposer::kLayerVideo) {
switch (pixel_format) {
case YUN_HAL_FORMAT_YCbCr_422_I:
case YUN_HAL_FORMAT_Y8:
- usage |= YALLOC_FLAG_HW_TEXTURE |
- YALLOC_FLAG_HW_VIDEO_DECODER;
+ usage |= YALLOC_FLAG_HW_TEXTURE | YALLOC_FLAG_HW_VIDEO_DECODER;
break;
default:
- usage |= YALLOC_FLAG_HW_CAMERA_WRITE |
- YALLOC_FLAG_HW_CAMERA_READ |
- YALLOC_FLAG_HW_VIDEO_ENCODER |
- YALLOC_FLAG_HW_TEXTURE;
+ usage |= YALLOC_FLAG_HW_CAMERA_WRITE | YALLOC_FLAG_HW_CAMERA_READ |
+ YALLOC_FLAG_HW_VIDEO_ENCODER | YALLOC_FLAG_HW_TEXTURE;
}
} else if (layer_type == hwcomposer::kLayerCursor) {
usage |= YALLOC_FLAG_CURSOR;
}
void YallocBufferHandler::CopyHandle(HWCNativeHandle source,
- HWCNativeHandle *target) const {
+ HWCNativeHandle *target) const {
CopyBufferHandle(source, target);
}
}
uint32_t YallocBufferHandler::GetTotalPlanes(HWCNativeHandle handle) const {
- auto yr_handle = (struct yalloc_drm_handle_t *)handle->imported_target_->attributes.data;
+ auto yr_handle =
+ (struct yalloc_drm_handle_t *)handle->imported_target_->attributes.data;
if (!yr_handle) {
ETRACE("could not find yalloc drm handle");
return false;
}
void *YallocBufferHandler::Map(HWCNativeHandle handle, uint32_t x, uint32_t y,
- uint32_t width, uint32_t height, uint32_t *stride,
- void **map_data, size_t plane) const {
+ uint32_t width, uint32_t height,
+ uint32_t *stride, void **map_data,
+ size_t plane) const {
if (!handle->imported_target_) {
ETRACE("could not find yalloc drm handle");
return NULL;
}
- int error = device_->map(device_, handle->imported_target_,
- YALLOC_FLAG_SW_READ_OFTEN | YALLOC_FLAG_SW_WRITE_OFTEN,
- x, y, width, height, map_data);
+ int error =
+ device_->map(device_, handle->imported_target_,
+ YALLOC_FLAG_SW_READ_OFTEN | YALLOC_FLAG_SW_WRITE_OFTEN, x, y,
+ width, height, map_data);
return error ? NULL : *map_data;
}
-int32_t YallocBufferHandler::UnMap(HWCNativeHandle handle, void *map_data) const {
- if (!handle->imported_target_) {
- ETRACE("could not find gralloc drm handle");
- return -1;
- }
+int32_t YallocBufferHandler::UnMap(HWCNativeHandle handle,
+ void *map_data) const {
+ if (!handle->imported_target_) {
+ ETRACE("could not find gralloc drm handle");
+ return -1;
+ }
- return device_->unmap(device_, handle->imported_target_);
+ return device_->unmap(device_, handle->imported_target_);
}
-uint32_t YallocBufferHandler::GetFd() const
-{
+uint32_t YallocBufferHandler::GetFd() const {
return fd_;
}
-
} // namespace hwcomposer
#ifndef OS_ALIOS_YALLOCBUFFERHANDLER_H_
#define OS_ALIOS_YallocBufferHandler_H_
-#include <yalloc.h>
#include <cutils/framebuffer.h>
+#include <yalloc.h>
#include <nativebufferhandler.h>
private:
uint32_t fd_;
struct yalloc_device_t *device_;
- fb_device_t* mFbDevice;
+ fb_device_t *mFbDevice;
};
-} // namespace hardware
+} // namespace hwcomposer
#endif // OS_ALIOS_YALLOCBUFFERHANDLER_H_
#include "gralloc1bufferhandler.h"
+#include <cutils/native_handle.h>
#include <hardware/hardware.h>
#include <hardware/hwcomposer.h>
#include <ui/GraphicBuffer.h>
-#include <cutils/native_handle.h>
#include <hwcdefs.h>
#include <hwctrace.h>
#include <binder/IServiceManager.h>
#include <binder/Parcel.h>
#include <binder/ProcessState.h>
-#include "iahwc2.h"
#include "hwcdefs.h"
+#include "iahwc2.h"
#define HWC_VERSION_STRING \
"VERSION:HWC 2.0 GIT Branch & Latest Commit:" HWC_VERSION_GIT_BRANCH \
ALOGE("Failed to start %s service", IA_HWC_SERVICE_NAME);
return false;
}
- initialized_=true;
+ initialized_ = true;
return true;
}
// TO DO
}
-} // android
+} // namespace android
std::vector<Notification> mNotifications;
};
-} // android
+} // namespace android
#endif // OS_ANDROID_HWCSERVICE_H_
#include <sync/sync.h>
#include <gpudevice.h>
-#include <hwclayer.h>
-#include <platformdefines.h>
#include <hwcdefs.h>
+#include <hwclayer.h>
#include <nativedisplay.h>
+#include <platformdefines.h>
#include <hardware/hardware.h>
#include <hardware/hwcomposer.h>
extended.at(i)
.display_->RegisterVsyncCallback(std::move(extended_callback), 1);
- /* XXX/TODO Add hot plug registration for external displays */
+ /* XXX/TODO Add hot plug registration for external displays */
auto extended_refresh_callback = std::make_shared<IARefreshCallback>(procs);
extended.at(i).display_->RegisterRefreshCallback(
std::move(extended_refresh_callback), static_cast<int>(1));
return 0;
}
-}
+} // namespace android
static struct hw_module_methods_t hwc1_module_methods = {
.open = android::hwc_device_open};
#include <nativedisplay.h>
#include "mosaicdisplay.h"
-#include <string>
-#include <memory>
#include <algorithm>
+#include <memory>
+#include <string>
#include <vector>
namespace android {
namespace hwcomposer {
class GpuDevice;
class NativeDisplay;
-}
+} // namespace hwcomposer
namespace android {
class HwcService;
*/
#include "icontrols.h"
-#include <utils/String8.h>
#include <binder/IPCThreadState.h>
+#include <utils/String8.h>
// For AID_ROOT & AID_MEDIA - various vendor code and utils include this despite
// the path.
#ifndef OS_ANDROID_HWC_ICONTROLS_H_
#define OS_ANDROID_HWC_ICONTROLS_H_
-#include "hwcserviceapi.h"
#include <binder/IInterface.h>
#include <binder/Parcel.h>
+#include "hwcserviceapi.h"
namespace hwcomposer {
*/
#include "idiagnostic.h"
-#include <utils/String8.h>
-#include <binder/Parcel.h>
#include <binder/IInterface.h>
+#include <binder/Parcel.h>
+#include <utils/String8.h>
namespace hwcomposer {
status_t onTransact(uint32_t, const Parcel&, Parcel*, uint32_t) override;
};
-} // hwcomposer
+} // namespace hwcomposer
#endif // OS_ANDROID_HWC_IDIAGNOSTIC_H
#ifndef OS_ANDROID_IDISPLAY_OVERSCAN_CONTROL_H_
#define OS_ANDROID_IDISPLAY_OVERSCAN_CONTROL_H_
-#include "hwcservicehelper.h"
#include <utils/RefBase.h>
+#include "hwcservicehelper.h"
namespace hwcomposer {
#ifndef OS_ANDROID_IDISPLAY_SCALING_CONTROL_H_
#define OS_ANDROID_IDISPLAY_SCALING_CONTROL_H_
-#include "hwcservicehelper.h"
#include <utils/RefBase.h>
+#include "hwcservicehelper.h"
namespace hwcomposer {
VkFormat NativeToVkFormat(int native_format) {
switch (native_format) {
case DRM_FORMAT_R8:
- return VK_FORMAT_R8_UNORM;
+ return VK_FORMAT_R8_UNORM;
case DRM_FORMAT_GR88:
- return VK_FORMAT_R8G8_UNORM;
+ return VK_FORMAT_R8G8_UNORM;
case DRM_FORMAT_RGBA4444:
case DRM_FORMAT_RGBX4444:
- return VK_FORMAT_R4G4B4A4_UNORM_PACK16;
+ return VK_FORMAT_R4G4B4A4_UNORM_PACK16;
case DRM_FORMAT_BGRX4444:
case DRM_FORMAT_BGRA4444:
- return VK_FORMAT_B4G4R4A4_UNORM_PACK16;
+ return VK_FORMAT_B4G4R4A4_UNORM_PACK16;
case DRM_FORMAT_XRGB1555:
case DRM_FORMAT_ARGB1555:
- return VK_FORMAT_A1R5G5B5_UNORM_PACK16;
+ return VK_FORMAT_A1R5G5B5_UNORM_PACK16;
case DRM_FORMAT_RGBX5551:
case DRM_FORMAT_RGBA5551:
- return VK_FORMAT_R5G5B5A1_UNORM_PACK16;
+ return VK_FORMAT_R5G5B5A1_UNORM_PACK16;
case DRM_FORMAT_BGRX5551:
case DRM_FORMAT_BGRA5551:
- return VK_FORMAT_B5G5R5A1_UNORM_PACK16;
+ return VK_FORMAT_B5G5R5A1_UNORM_PACK16;
case DRM_FORMAT_RGB565:
- return VK_FORMAT_R5G6B5_UNORM_PACK16;
+ return VK_FORMAT_R5G6B5_UNORM_PACK16;
case DRM_FORMAT_BGR565:
- return VK_FORMAT_B5G6R5_UNORM_PACK16;
+ return VK_FORMAT_B5G6R5_UNORM_PACK16;
case DRM_FORMAT_RGB888:
- return VK_FORMAT_B8G8R8_UNORM;
+ return VK_FORMAT_B8G8R8_UNORM;
case DRM_FORMAT_BGR888:
- return VK_FORMAT_R8G8B8_UNORM;
+ return VK_FORMAT_R8G8B8_UNORM;
case DRM_FORMAT_XRGB8888:
case DRM_FORMAT_ARGB8888:
- return VK_FORMAT_B8G8R8A8_UNORM;
+ return VK_FORMAT_B8G8R8A8_UNORM;
case DRM_FORMAT_XBGR8888:
case DRM_FORMAT_ABGR8888:
- return VK_FORMAT_R8G8B8A8_UNORM;
+ return VK_FORMAT_R8G8B8A8_UNORM;
case DRM_FORMAT_XRGB2101010:
case DRM_FORMAT_ARGB2101010:
- return VK_FORMAT_A2R10G10B10_UNORM_PACK32;
+ return VK_FORMAT_A2R10G10B10_UNORM_PACK32;
case DRM_FORMAT_XBGR2101010:
case DRM_FORMAT_ABGR2101010:
- return VK_FORMAT_A2B10G10R10_UNORM_PACK32;
+ return VK_FORMAT_A2B10G10R10_UNORM_PACK32;
default:
ETRACE("drm_format %d unhandled\n", native_format);
return VK_FORMAT_UNDEFINED;
#define ATRACE_TAG ATRACE_TAG_GRAPHICS
#endif
-#include <utils/Trace.h>
#include <android/log.h>
+#include <cros_gralloc_handle.h>
#include <hardware/hardware.h>
#include <hardware/hwcomposer.h>
#include <ui/GraphicBuffer.h>
+#include <utils/Trace.h>
#include "platformcommondefines.h"
-#include <cros_gralloc_handle.h>
#define DRV_I915 1
#include <i915_private_android_types.h>
#ifndef OS_UTILS_ANDROID_H_
#define OS_UTILS_ANDROID_H_
-#include <xf86drmMode.h>
#include <xf86drm.h>
+#include <xf86drmMode.h>
-#include <stdint.h>
#include <drm_fourcc.h>
-#include <system/graphics.h>
#include <hardware/gralloc1.h>
+#include <stdint.h>
+#include <system/graphics.h>
#include "platformdefines.h"
static native_handle_t *dup_buffer_handle(buffer_handle_t handle) {
native_handle_t *new_handle = native_handle_clone(handle);
- if(new_handle == NULL)
+ if (new_handle == NULL)
ETRACE("failed to duplicate the handle");
return new_handle;
}
#include "gbmbufferhandler.h"
-#include <unistd.h>
#include <drm.h>
-#include <xf86drm.h>
#include <drm_fourcc.h>
+#include <unistd.h>
+#include <xf86drm.h>
#include <hwcdefs.h>
#include <hwctrace.h>
uint64_t preferred_cursor_height_;
};
-} // namespace hardware
+} // namespace hwcomposer
#endif // OS_LINUX_GBMBUFFERHANDLER_H_
iahwc_display_t display_handle,
iahwc_layer_t* layer_handle);
typedef int (*IAHWC_PFN_DESTROY_LAYER)(iahwc_device_t*,
- iahwc_display_t display_handle,
- iahwc_layer_t layer_handle);
+ iahwc_display_t display_handle,
+ iahwc_layer_t layer_handle);
typedef int (*IAHWC_PFN_LAYER_SET_BO)(iahwc_device_t*,
iahwc_display_t display_handle,
iahwc_layer_t layer_handle,
class IAHWCHotPlugEventCallback : public hwcomposer::HotPlugCallback {
public:
IAHWCHotPlugEventCallback(iahwc_callback_data_t data,
- iahwc_function_ptr_t hook,
- IAHWC::IAHWCDisplay *display)
+ iahwc_function_ptr_t hook,
+ IAHWC::IAHWCDisplay* display)
: data_(data), hook_(hook), display_(display) {
}
void Callback(uint32_t display, bool connected) {
-
auto hook = reinterpret_cast<IAHWC_PFN_HOTPLUG>(hook_);
uint32_t status;
if (connected) {
if (hook)
hook(data_, display, status);
-
}
private:
iahwc_callback_data_t data_;
iahwc_function_ptr_t hook_;
- IAHWC::IAHWCDisplay *display_;
+ IAHWC::IAHWCDisplay* display_;
};
IAHWC::IAHWC() {
display->RegisterPixelUploaderCallback(data, hook);
return IAHWC_ERROR_NONE;
}
- case IAHWC_CALLBACK_HOTPLUG: {
- if (display_id >= displays_.size())
- return IAHWC_ERROR_BAD_DISPLAY;
- for (auto display : displays_)
- display->RegisterHotPlugCallback(data, hook);
- return IAHWC_ERROR_NONE;
- }
+ case IAHWC_CALLBACK_HOTPLUG: {
+ if (display_id >= displays_.size())
+ return IAHWC_ERROR_BAD_DISPLAY;
+ for (auto display : displays_)
+ display->RegisterHotPlugCallback(data, hook);
+ return IAHWC_ERROR_NONE;
+ }
default:
return IAHWC_ERROR_BAD_PARAMETER;
raw_data_uploader_->Synchronize();
}
-int IAHWC::IAHWCDisplay::RegisterHotPlugCallback(
- iahwc_callback_data_t data, iahwc_function_ptr_t func) {
+int IAHWC::IAHWCDisplay::RegisterHotPlugCallback(iahwc_callback_data_t data,
+ iahwc_function_ptr_t func) {
auto callback = std::make_shared<IAHWCHotPlugEventCallback>(data, func, this);
- //TODO:XXX send proper handle
+ // TODO:XXX send proper handle
native_display_->RegisterHotPlugCallback(std::move(callback),
- static_cast<int>(0));
+ static_cast<int>(0));
return IAHWC_ERROR_NONE;
}
} // namespace hwcomposer
iahwc_module_t IAHWC_MODULE_INFO = {
- .name = "IA Hardware Composer",
- .open = hwcomposer::IAHWC::HookOpen,
+ .name = "IA Hardware Composer", .open = hwcomposer::IAHWC::HookOpen,
};
std::vector<IAHWCDisplay*> displays_;
};
-} // namespace hwcomposer
+} // namespace hwcomposer
#endif
#include "pixeluploader.h"
-#include "hwcutils.h"
+#include "displayplanemanager.h"
+#include "framebuffermanager.h"
#include "hwctrace.h"
+#include "hwcutils.h"
#include "nativegpuresource.h"
+#include "nativesurface.h"
#include "overlaylayer.h"
#include "renderer.h"
#include "resourcemanager.h"
-#include "framebuffermanager.h"
-#include "displayplanemanager.h"
-#include "nativesurface.h"
#include <nativebufferhandler.h>
#ifndef OS_LINUX_PIXELUPLOADER_H_
#define OS_LINUX_PIXELUPLOADER_H_
-#include <spinlock.h>
#include <platformdefines.h>
+#include <spinlock.h>
#include <memory>
#include <vector>
VkFormat NativeToVkFormat(int native_format) {
switch (native_format) {
case GBM_FORMAT_R8:
- return VK_FORMAT_R8_UNORM;
+ return VK_FORMAT_R8_UNORM;
case GBM_FORMAT_GR88:
- return VK_FORMAT_R8G8_UNORM;
+ return VK_FORMAT_R8G8_UNORM;
case GBM_FORMAT_RGBA4444:
case GBM_FORMAT_RGBX4444:
- return VK_FORMAT_R4G4B4A4_UNORM_PACK16;
+ return VK_FORMAT_R4G4B4A4_UNORM_PACK16;
case GBM_FORMAT_BGRX4444:
case GBM_FORMAT_BGRA4444:
- return VK_FORMAT_B4G4R4A4_UNORM_PACK16;
+ return VK_FORMAT_B4G4R4A4_UNORM_PACK16;
case GBM_FORMAT_XRGB1555:
case GBM_FORMAT_ARGB1555:
- return VK_FORMAT_A1R5G5B5_UNORM_PACK16;
+ return VK_FORMAT_A1R5G5B5_UNORM_PACK16;
case GBM_FORMAT_RGBX5551:
case GBM_FORMAT_RGBA5551:
- return VK_FORMAT_R5G5B5A1_UNORM_PACK16;
+ return VK_FORMAT_R5G5B5A1_UNORM_PACK16;
case GBM_FORMAT_BGRX5551:
case GBM_FORMAT_BGRA5551:
- return VK_FORMAT_B5G5R5A1_UNORM_PACK16;
+ return VK_FORMAT_B5G5R5A1_UNORM_PACK16;
case GBM_FORMAT_RGB565:
- return VK_FORMAT_R5G6B5_UNORM_PACK16;
+ return VK_FORMAT_R5G6B5_UNORM_PACK16;
case GBM_FORMAT_BGR565:
- return VK_FORMAT_B5G6R5_UNORM_PACK16;
+ return VK_FORMAT_B5G6R5_UNORM_PACK16;
case GBM_FORMAT_RGB888:
- return VK_FORMAT_B8G8R8_UNORM;
+ return VK_FORMAT_B8G8R8_UNORM;
case GBM_FORMAT_BGR888:
- return VK_FORMAT_R8G8B8_UNORM;
+ return VK_FORMAT_R8G8B8_UNORM;
case GBM_FORMAT_XRGB8888:
case GBM_FORMAT_ARGB8888:
- return VK_FORMAT_B8G8R8A8_UNORM;
+ return VK_FORMAT_B8G8R8A8_UNORM;
case GBM_FORMAT_XBGR8888:
case GBM_FORMAT_ABGR8888:
- return VK_FORMAT_R8G8B8A8_UNORM;
+ return VK_FORMAT_R8G8B8A8_UNORM;
case GBM_FORMAT_XRGB2101010:
case GBM_FORMAT_ARGB2101010:
- return VK_FORMAT_A2R10G10B10_UNORM_PACK32;
+ return VK_FORMAT_A2R10G10B10_UNORM_PACK32;
case GBM_FORMAT_XBGR2101010:
case GBM_FORMAT_ABGR2101010:
- return VK_FORMAT_A2B10G10R10_UNORM_PACK32;
+ return VK_FORMAT_A2B10G10R10_UNORM_PACK32;
default:
ETRACE("gbm_format %d unhandled\n", native_format);
return VK_FORMAT_UNDEFINED;
#include <va/va_drm.h>
-#include <cstring>
#include <algorithm>
#include <cstddef>
+#include <cstring>
#include <libsync.h>
WP_PRESENTATION_FEEDBACK_KIND_HW_CLOCK |
WP_PRESENTATION_FEEDBACK_KIND_VSYNC;
weston_output_finish_frame(&output->base, &ts, flags);
-
}
unlock(&output->spin_lock);
}
}
-static void
-planes_binding(struct weston_keyboard *keyboard, const struct timespec* time,
- uint32_t key, void *data) {
+static void planes_binding(struct weston_keyboard *keyboard,
+ const struct timespec *time, uint32_t key,
+ void *data) {
struct iahwc_backend *b = data;
switch (key) {
iahwc_module_t *iahwc_module;
iahwc_device_t *iahwc_device;
- const char* device = "/dev/dri/renderD128";
+ const char *device = "/dev/dri/renderD128";
const char *seat_id = default_seat;
weston_log("Initializing iahwc backend\n");
iahwc_device, IAHWC_FUNC_GET_NUM_DISPLAYS);
b->iahwc_create_layer = (IAHWC_PFN_CREATE_LAYER)iahwc_device->getFunctionPtr(
iahwc_device, IAHWC_FUNC_CREATE_LAYER);
- b->iahwc_destroy_layer = (IAHWC_PFN_DESTROY_LAYER)iahwc_device->getFunctionPtr(
- iahwc_device, IAHWC_FUNC_DESTROY_LAYER);
+ b->iahwc_destroy_layer =
+ (IAHWC_PFN_DESTROY_LAYER)iahwc_device->getFunctionPtr(
+ iahwc_device, IAHWC_FUNC_DESTROY_LAYER);
b->iahwc_get_display_info =
(IAHWC_PFN_DISPLAY_GET_INFO)iahwc_device->getFunctionPtr(
iahwc_device, IAHWC_FUNC_DISPLAY_GET_INFO);
// XXX/TODO: setup hotplugging support from IAHWC
// Nothing for now, registering the callback enables the pixel upload support
- b->iahwc_register_callback(b->iahwc_device, IAHWC_CALLBACK_HOTPLUG, NULL, NULL, NULL);
+ b->iahwc_register_callback(b->iahwc_device, IAHWC_CALLBACK_HOTPLUG, NULL,
+ NULL, NULL);
weston_setup_vt_switch_bindings(compositor);
#define HWC_UNUSED(x) ((void)&(x))
-inline void hash_combine_hwc(size_t& seed, size_t value) {
+inline void hash_combine_hwc(size_t &seed, size_t value) {
seed ^= value + 0x9e3779b9 + (seed << 6) + (seed >> 2);
}