summaryrefslogtreecommitdiff
authorTellen Yu <tellen.yu@amlogic.com>2017-05-23 06:29:51 (GMT)
committer Tellen Yu <tellen.yu@amlogic.com>2017-05-24 01:28:12 (GMT)
commitdf21d4b011c19e84fb1aa9d0c5a70c5db5eae489 (patch)
treed066a35413500a72f005e56b5bc9daa5419ad584
parent7dc259e7540e8a85dddbf1440c7921762b1e35d3 (diff)
downloadhwcomposer-df21d4b011c19e84fb1aa9d0c5a70c5db5eae489.zip
hwcomposer-df21d4b011c19e84fb1aa9d0c5a70c5db5eae489.tar.gz
hwcomposer-df21d4b011c19e84fb1aa9d0c5a70c5db5eae489.tar.bz2
enable mouse display for kernel 4.9
from kernel 4.9, cursor ioctl switch from FBIO_CURSOR to FBIOPUT_OSD_CURSOR Change-Id: Ibd66ca394c7c34fb0000432b481b6b88fc9a25d4
Diffstat
-rw-r--r--hwc2/common/devices/PhysicalDevice.cpp17
-rw-r--r--hwc2/include/PhysicalDevice.h1
2 files changed, 17 insertions, 1 deletions
diff --git a/hwc2/common/devices/PhysicalDevice.cpp b/hwc2/common/devices/PhysicalDevice.cpp
index 0afbb54..7311796 100644
--- a/hwc2/common/devices/PhysicalDevice.cpp
+++ b/hwc2/common/devices/PhysicalDevice.cpp
@@ -27,6 +27,8 @@
#include <HwcFenceControl.h>
#include <cutils/properties.h>
#include <tvp/OmxUtil.h>
+#include <sys/utsname.h>
+#define FBIOPUT_OSD_CURSOR 0x451a
static int Amvideo_Handle = 0;
@@ -94,6 +96,14 @@ PhysicalDevice::PhysicalDevice(hwc2_display_t id, Hwcomposer& hwc, DeviceControl
mGE2DRenderSortedLayerIds.clear();
mHwcCurReleaseFences = mHwcPriorReleaseFences = NULL;
+
+ int major = 0, minor = 0;
+ struct utsname info;
+ if (uname(&info) || sscanf(info.release, "%d.%d", &major, &minor) <= 0) {
+ ETRACE("Could not get linux version: %s", strerror(errno));
+ }
+ // from kernel 4.9 use FBIOPUT_OSD_CURSOR instead of FBIO_CURSOR
+ mUsingPutCurosr = major > 4 || (major == 4 && minor >= 9);
}
PhysicalDevice::~PhysicalDevice()
@@ -1258,7 +1268,12 @@ int32_t PhysicalDevice::setCursorPosition(hwc2_layer_t layerId, int32_t x, int32
cinfo.hot.x = x;
cinfo.hot.y = y;
DTRACE("setCursorPosition x_pos=%d, y_pos=%d", cinfo.hot.x, cinfo.hot.y);
- ioctl(cbInfo->fd, FBIO_CURSOR, &cinfo);
+
+ // from kernel 4.9 use FBIOPUT_OSD_CURSOR instead of FBIO_CURSOR
+ if (mUsingPutCurosr)
+ ioctl(cbInfo->fd, FBIOPUT_OSD_CURSOR, &cinfo);
+ else
+ ioctl(cbInfo->fd, FBIO_CURSOR, &cinfo);
}
} else {
ETRACE("setCursorPosition bad layer.");
diff --git a/hwc2/include/PhysicalDevice.h b/hwc2/include/PhysicalDevice.h
index 57e181f..07767a1 100644
--- a/hwc2/include/PhysicalDevice.h
+++ b/hwc2/include/PhysicalDevice.h
@@ -252,6 +252,7 @@ private:
// lock
Mutex mLock;
bool mInitialized;
+ bool mUsingPutCurosr;
};