samsung-i9105p: make fbdev X work, flash userdata
SYSTEM is too small. Capri ignores boot.img cmdline. vc_fb needs a platform parent and must not free the buffer on close. Disable ShadowFB on this driver. Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/9418>
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
Section "Device"
|
||||
Identifier "vc_fb"
|
||||
Driver "fbdev"
|
||||
Option "fbdev" "/dev/fb0"
|
||||
Option "ShadowFB" "false"
|
||||
EndSection
|
||||
@@ -4,7 +4,7 @@ maintainer=""
|
||||
pkgname=device-samsung-i9105p
|
||||
pkgdesc="Samsung Galaxy S2 Plus"
|
||||
pkgver=6
|
||||
pkgrel=0
|
||||
pkgrel=1
|
||||
url="https://postmarketos.org"
|
||||
license="MIT"
|
||||
arch="armv7"
|
||||
@@ -13,13 +13,18 @@ depends="
|
||||
firmware-samsung-i9105p
|
||||
linux-samsung-i9105p
|
||||
mkbootimg
|
||||
msm-fb-refresher
|
||||
postmarketos-base
|
||||
postmarketos-base-downstream
|
||||
"
|
||||
|
||||
subpackages="$pkgname-x11"
|
||||
|
||||
makedepends="devicepkg-dev"
|
||||
source="
|
||||
deviceinfo
|
||||
kernel-cmdline.conf
|
||||
modules-load.conf
|
||||
10-vc-fb.conf
|
||||
"
|
||||
|
||||
build() {
|
||||
@@ -30,8 +35,15 @@ package() {
|
||||
devicepkg_package $startdir $pkgname
|
||||
}
|
||||
|
||||
x11() {
|
||||
pkgdesc="Xorg config for vc_fb"
|
||||
install_if="$pkgname=$pkgver-r$pkgrel xorg-server"
|
||||
install -Dm644 "$srcdir"/10-vc-fb.conf \
|
||||
"$subpkgdir"/etc/X11/xorg.conf.d/10-vc-fb.conf
|
||||
}
|
||||
|
||||
sha512sums="
|
||||
1b7e7bb99b2fb3e81d3b92f3438a629b0de759ea17c126ec777cb0defc0a91603b5f28556486de0f17e5404102bb9ffe98e9a508beb9aef4d6c5de292f145fc6 deviceinfo
|
||||
25fa984f7b83d08252e0341ec9a6b41d17d3301e0b0d25260c6ba8322279bb247efdc5b8e9e056c76713df593b99de00daaa2471426539147c6d15b914cba449 kernel-cmdline.conf
|
||||
caee5231c5c11cfaba54128d4f496a6790dab32bea03f1bcf8f5261e4dacf1d775da2d52607278abc756df5c370d61c3f24f7fc924249380dffc25c92dcfcd1f deviceinfo
|
||||
af036fe35011db078379dbb2e8c16c86546f0a4fcb3d1bcee3502bb1ea5b38f3ec5a9fa8cd1ca8ed8b89592a7f572d6072781289845303e0bf85fc2de4ead9fb modules-load.conf
|
||||
432aba13d599aef07c68055a7629c380243e4a84b65bd2a9e869de1b0563500096bfe7eb68782960ce673aa36a15204846528a74deb25d2e7812caa53d9f46b8 10-vc-fb.conf
|
||||
"
|
||||
|
||||
@@ -23,6 +23,6 @@ deviceinfo_flash_offset_kernel="0x00008000"
|
||||
deviceinfo_flash_offset_ramdisk="0x01000000"
|
||||
deviceinfo_flash_offset_second="0x00f00000"
|
||||
deviceinfo_flash_offset_tags="0x00000100"
|
||||
deviceinfo_flash_heimdall_partition_rootfs="system"
|
||||
deviceinfo_flash_heimdall_partition_rootfs="userdata"
|
||||
deviceinfo_flash_sparse="true"
|
||||
deviceinfo_create_initfs_extra="true"
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
console=ttyS0,115200n8
|
||||
mem=832M@0xA2000000
|
||||
androidboot.console=ttyS0
|
||||
vc-cma-mem=0/176M@0xCB000000
|
||||
buildvariant=userdebug
|
||||
+246
@@ -0,0 +1,246 @@
|
||||
diff --git a/drivers/char/broadcom/vc_fb/vmcs_fb.c b/drivers/char/broadcom/vc_fb/vmcs_fb.c
|
||||
index 02d7ea08eed5..111111111111 100644
|
||||
--- a/drivers/char/broadcom/vc_fb/vmcs_fb.c
|
||||
+++ b/drivers/char/broadcom/vc_fb/vmcs_fb.c
|
||||
@@ -64,6 +64,7 @@
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/platform_device.h>
|
||||
+#include <linux/io.h>
|
||||
#include <linux/fb.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/delay.h>
|
||||
@@ -99,9 +100,9 @@
|
||||
#define DEFAULT_ALPHA (255)
|
||||
#define DEFAULT_ALPHA_PER_PIXEL (0)
|
||||
#define DEFAULT_BITS_PER_PIXEL (32)
|
||||
-#define DEFAULT_KEEP_RESOURCE (0)
|
||||
+#define DEFAULT_KEEP_RESOURCE (1)
|
||||
#define DEFAULT_SCALE (1)
|
||||
-#define DEFAULT_Z_ORDER (-50)
|
||||
+#define DEFAULT_Z_ORDER (1)
|
||||
#define DEFAULT_ADJUST (0)
|
||||
#define PROC_WRITE_BUF_SIZE 128
|
||||
|
||||
@@ -117,6 +118,7 @@
|
||||
uint32_t user_cnt; /* Number of active users of this screen */
|
||||
struct mutex user_cnt_mutex; /* Mutex to protect user count */
|
||||
struct fb_info fb_info; /* Kernel framebuffer info */
|
||||
+ struct platform_device *pdev;
|
||||
uint32_t res_handle; /* Videocore resource handle */
|
||||
uint32_t cmap[16]; /* Color map */
|
||||
|
||||
@@ -167,6 +169,14 @@
|
||||
|
||||
static struct FB_STATE_T *fb_state;
|
||||
static int fb_inited;
|
||||
+static int vc_fb_pdrv_registered;
|
||||
+
|
||||
+static struct platform_driver vc_fb_platform_driver = {
|
||||
+ .driver = {
|
||||
+ .name = "vc_fb",
|
||||
+ .owner = THIS_MODULE,
|
||||
+ },
|
||||
+};
|
||||
|
||||
/* Constant strings for the proc entries */
|
||||
static const char *fb_cfg_dir_name[VC_FB_SCRN_MAX] = {
|
||||
@@ -1281,8 +1291,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if ((var->xres > fb_info->var.xres) ||
|
||||
- (var->yres > fb_info->var.yres)) {
|
||||
+ if (fb_info->var.xres && fb_info->var.yres &&
|
||||
+ ((var->xres > fb_info->var.xres) ||
|
||||
+ (var->yres > fb_info->var.yres))) {
|
||||
LOG_INFO
|
||||
("%s: request resolution %ux%u is larger than"
|
||||
" supported %ux%u",
|
||||
@@ -1516,6 +1527,31 @@
|
||||
return ret;
|
||||
}
|
||||
|
||||
+static int vc_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
|
||||
+{
|
||||
+ unsigned long start = info->fix.smem_start;
|
||||
+ unsigned long off = vma->vm_pgoff << PAGE_SHIFT;
|
||||
+ unsigned long len;
|
||||
+ int ret;
|
||||
+
|
||||
+ if (!start || !info->fix.smem_len)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ len = PAGE_ALIGN((start & ~PAGE_MASK) + info->fix.smem_len);
|
||||
+ if (off >= len)
|
||||
+ return -EINVAL;
|
||||
+ if ((vma->vm_end - vma->vm_start + off) > len)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ vma->vm_flags |= VM_IO | VM_RESERVED;
|
||||
+ vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
|
||||
+ ret = io_remap_pfn_range(vma, vma->vm_start,
|
||||
+ (start >> PAGE_SHIFT) + vma->vm_pgoff,
|
||||
+ vma->vm_end - vma->vm_start,
|
||||
+ vma->vm_page_prot);
|
||||
+ return ret ? -EAGAIN : 0;
|
||||
+}
|
||||
+
|
||||
static struct fb_ops vc_fb_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.fb_open = vc_fb_open,
|
||||
@@ -1528,6 +1564,7 @@
|
||||
.fb_copyarea = cfb_copyarea,
|
||||
.fb_imageblit = cfb_imageblit,
|
||||
.fb_read = vc_fb_read,
|
||||
+ .fb_mmap = vc_fb_mmap,
|
||||
};
|
||||
|
||||
static int vc_fb_create_per_scrn_proc_entries(struct SCRN_INFO_T *scrn_info)
|
||||
@@ -1802,13 +1839,39 @@
|
||||
scrn_info->fb_info.var.rotate = 0;
|
||||
scrn_info->fb_info.var.vmode = FB_VMODE_NONINTERLACED;
|
||||
|
||||
+ /* Defaults must be set before the first open (and before we pin). */
|
||||
+ scrn_info->alpha = DEFAULT_ALPHA;
|
||||
+ scrn_info->alpha_per_pixel = DEFAULT_ALPHA_PER_PIXEL;
|
||||
+ scrn_info->keep_resource = DEFAULT_KEEP_RESOURCE;
|
||||
+ scrn_info->scale = DEFAULT_SCALE;
|
||||
+ scrn_info->z_order = DEFAULT_Z_ORDER;
|
||||
+ scrn_info->adjust = DEFAULT_ADJUST;
|
||||
+
|
||||
+ /*
|
||||
+ * Give the fb a platform parent. Xorg 1.16+ dropped the old "fb"
|
||||
+ * bus; xf86-video-fbdev can only claim PCI or platform devices.
|
||||
+ * After this, sysfs looks like:
|
||||
+ * /sys/devices/platform/vc_fb.<n>
|
||||
+ * /sys/class/graphics/fbN/device -> .../platform/vc_fb.<n>
|
||||
+ * xorg.conf BusID "platform:vc_fb.0"
|
||||
+ */
|
||||
+ scrn_info->pdev = platform_device_register_simple("vc_fb",
|
||||
+ (int)scrn, NULL, 0);
|
||||
+ if (IS_ERR(scrn_info->pdev)) {
|
||||
+ LOG_ERR("%s: platform_device_register_simple failed (%ld)",
|
||||
+ __func__, PTR_ERR(scrn_info->pdev));
|
||||
+ scrn_info->pdev = NULL;
|
||||
+ } else {
|
||||
+ scrn_info->fb_info.device = &scrn_info->pdev->dev;
|
||||
+ }
|
||||
+
|
||||
/* Register framebuffer with the kernel */
|
||||
ret = register_framebuffer(&scrn_info->fb_info);
|
||||
if (ret != 0) {
|
||||
LOG_ERR("%s: register_framebuffer failed (ret=%d)", __func__,
|
||||
ret);
|
||||
|
||||
- goto err_free_mem;
|
||||
+ goto err_unreg_pdev;
|
||||
}
|
||||
/* Create the per screen (framebuffer device) proc entries */
|
||||
ret = vc_fb_create_per_scrn_proc_entries(scrn_info);
|
||||
@@ -1818,15 +1881,26 @@
|
||||
|
||||
goto err_unregister_framebuffer;
|
||||
}
|
||||
- /* Set the default values for the framebuffer creation
|
||||
- * modifiable parameters
|
||||
+
|
||||
+ /*
|
||||
+ * Pin the VC resource now so Xorg's probe open/close cannot
|
||||
+ * iounmap + vc_vchi_fb_free the buffer (keep_resource=1).
|
||||
+ * Screen 1 (HDMI) often has no panel; failure is non-fatal.
|
||||
*/
|
||||
- scrn_info->alpha = DEFAULT_ALPHA;
|
||||
- scrn_info->alpha_per_pixel = DEFAULT_ALPHA_PER_PIXEL;
|
||||
- scrn_info->keep_resource = DEFAULT_KEEP_RESOURCE;
|
||||
- scrn_info->scale = DEFAULT_SCALE;
|
||||
- scrn_info->z_order = DEFAULT_Z_ORDER;
|
||||
- scrn_info->adjust = DEFAULT_ADJUST;
|
||||
+ ret = vc_fb_open(&scrn_info->fb_info, 0);
|
||||
+ if (ret != 0) {
|
||||
+ LOG_ERR("%s: screen %u: initial alloc failed (ret=%d)",
|
||||
+ __func__, scrn, ret);
|
||||
+ ret = 0;
|
||||
+ } else {
|
||||
+ vc_fb_release(&scrn_info->fb_info, 0);
|
||||
+ LOG_INFO("%s: screen %u pinned %ux%u smem=0x%lx len=%u",
|
||||
+ __func__, scrn,
|
||||
+ scrn_info->fb_info.var.xres,
|
||||
+ scrn_info->fb_info.var.yres,
|
||||
+ (unsigned long)scrn_info->fb_info.fix.smem_start,
|
||||
+ scrn_info->fb_info.fix.smem_len);
|
||||
+ }
|
||||
|
||||
/* Everything is good to go! */
|
||||
fb_state->scrn_info[scrn] = scrn_info;
|
||||
@@ -1836,6 +1910,10 @@
|
||||
err_unregister_framebuffer:
|
||||
unregister_framebuffer(&scrn_info->fb_info);
|
||||
|
||||
+err_unreg_pdev:
|
||||
+ if (scrn_info->pdev)
|
||||
+ platform_device_unregister(scrn_info->pdev);
|
||||
+
|
||||
err_free_mem:
|
||||
kfree(scrn_info);
|
||||
|
||||
@@ -1861,9 +1939,20 @@
|
||||
/* Remove per screen (framebuffer device) proc entries */
|
||||
vc_fb_remove_per_scrn_proc_entries(scrn_info);
|
||||
|
||||
+ /* Drop the pinned VC resource before tearing down the fb. */
|
||||
+ if (scrn_info->res_handle) {
|
||||
+ scrn_info->keep_resource = 0;
|
||||
+ if (scrn_info->user_cnt == 0)
|
||||
+ scrn_info->user_cnt = 1;
|
||||
+ vc_fb_release(&scrn_info->fb_info, 0);
|
||||
+ }
|
||||
+
|
||||
/* Unregister framebuffer device with the system */
|
||||
unregister_framebuffer(&scrn_info->fb_info);
|
||||
|
||||
+ if (scrn_info->pdev)
|
||||
+ platform_device_unregister(scrn_info->pdev);
|
||||
+
|
||||
/* Free the memory used for the screen info */
|
||||
kfree(scrn_info);
|
||||
fb_state->scrn_info[scrn] = NULL;
|
||||
@@ -1928,6 +2017,14 @@
|
||||
ret = -EPERM;
|
||||
goto err_stop_fb_service;
|
||||
}
|
||||
+ ret = platform_driver_register(&vc_fb_platform_driver);
|
||||
+ if (ret != 0) {
|
||||
+ LOG_ERR("%s: platform_driver_register failed (ret=%d)",
|
||||
+ __func__, ret);
|
||||
+ } else {
|
||||
+ vc_fb_pdrv_registered = 1;
|
||||
+ }
|
||||
+
|
||||
/* Create a framebuffer device for each screen */
|
||||
for (i = 0; i < VC_FB_SCRN_MAX; i++) {
|
||||
ret = vc_fb_create_framebuffer(i);
|
||||
@@ -1962,6 +2059,11 @@
|
||||
for (i = 0; i < VC_FB_SCRN_MAX; i++)
|
||||
vc_fb_remove_framebuffer(i);
|
||||
|
||||
+ if (vc_fb_pdrv_registered) {
|
||||
+ platform_driver_unregister(&vc_fb_platform_driver);
|
||||
+ vc_fb_pdrv_registered = 0;
|
||||
+ }
|
||||
+
|
||||
remove_proc_entry("vc-fb", NULL);
|
||||
|
||||
err_stop_fb_service:
|
||||
@@ -1993,6 +2095,11 @@
|
||||
for (i = 0; i < VC_FB_SCRN_MAX; i++)
|
||||
vc_fb_remove_framebuffer(i);
|
||||
|
||||
+ if (vc_fb_pdrv_registered) {
|
||||
+ platform_driver_unregister(&vc_fb_platform_driver);
|
||||
+ vc_fb_pdrv_registered = 0;
|
||||
+ }
|
||||
+
|
||||
/* Remove the proc directory entry */
|
||||
remove_proc_entry("vc-fb", NULL);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
maintainer=""
|
||||
pkgname=linux-samsung-i9105p
|
||||
pkgver=3.0.101
|
||||
pkgrel=1
|
||||
pkgrel=2
|
||||
pkgdesc="Samsung Galaxy S2 Plus kernel fork"
|
||||
arch="armv7"
|
||||
_carch="arm"
|
||||
@@ -48,6 +48,7 @@ source="
|
||||
linux3.0-8933-1-replace-Sun-Solaris-style-flag-on-section.patch
|
||||
fix-check-lxdialog.patch
|
||||
vc_cam.patch
|
||||
0001-vc_fb-platform-device-and-keep-resource.patch
|
||||
"
|
||||
builddir="$srcdir/$_repository-$_commit"
|
||||
_outdir="out"
|
||||
@@ -80,7 +81,7 @@ package() {
|
||||
|
||||
sha512sums="
|
||||
3b48ad727127707a18503d1f77a5ef60de831fbbcfd4c65745ebb4e1de3419b82f42e3e9a0c0ae2d4e4d0d5349baa4364f28d6c0198463871362c470172a61f1 linux-samsung-i9105p-6625d1eba424bf57bd64f466a1c25db10cb68f26.tar.gz
|
||||
d0e6ca72932384f3548786318b7ba8bdb5e5d13d134b0b3b5c76d38282a4d4aa215a2e6cd50a3ca6aab998f8f6ca82291ab619d874d3fcb6abd81e201170d92c config-samsung-i9105p.armv7
|
||||
efaae424cb8daca4782016b561fa805ee3b8d01cd3568a769a15b20a0993f9c1473fe77f3fa947a4afb826eb609206d6ae8fa8f03a3632174baeb4f11f198748 config-samsung-i9105p.armv7
|
||||
ad0182a483791fc88e058838bc331b2f04a75ba291e763767babdb815efadfc3b4fda97e69e2e3f00a426cabea088e35297a92bd287592597d1e309be68ee92c kernel-use-the-gnu89-standard-explicitly.patch
|
||||
2b48f1bf0e3f70703d2cdafc47d5e615cc7c56c70bec56b2e3297d3fa4a7a1321d649a8679614553dde8fe52ff1051dae38d5990e3744c9ca986d92187dcdbeb gcc10-extern_YYLOC_global_declaration.patch
|
||||
df62e03666313bb03d9a455eac875f170a55d378b6e56b847c1c6ff1ce5cfafcfdf1d7605754ca3c684840ea00357f9ec4c6621f6ff77377132a484b9258f6f7 03_fix_paranoid_network_disabled.patch
|
||||
@@ -88,4 +89,5 @@ df62e03666313bb03d9a455eac875f170a55d378b6e56b847c1c6ff1ce5cfafcfdf1d7605754ca3c
|
||||
66ab793bb1fa50a07f10e2cdb0f49ea05a787c6b1fe5358e69a76e43295ac5be3b68cdf6a882e868bfe6969cac981c5545587cd57eee4b5cec26078ae0ecaa1c linux3.0-8933-1-replace-Sun-Solaris-style-flag-on-section.patch
|
||||
182be3c596b9cc267ac108d7cf03fc8c328ccc6b36770800e4dcedea8d1bb65e3f5eacf590c2948f58b1418cc60a1670ba77dde8c259e428d158c31b6e1dbaf5 fix-check-lxdialog.patch
|
||||
f6f40fccdff52ff0849b5170186ec46c5f247477b5ba3f95a4f431c81337b42df175ff6e6208df63ee3e802617b3e361690aa049f03084d42b851be850fac3b2 vc_cam.patch
|
||||
d437a0f630355c8d3ffb46b6bb6bbbbea6277fd24c338529e9205f8b98dcb7197e3add9e00ae7a58e4a30078d2294667336f2c995d70d10dd8df5b0489f9fd42 0001-vc_fb-platform-device-and-keep-resource.patch
|
||||
"
|
||||
|
||||
@@ -540,7 +540,7 @@ CONFIG_SECCOMP=y
|
||||
CONFIG_USE_OF=y
|
||||
CONFIG_ZBOOT_ROM_TEXT=0x0
|
||||
CONFIG_ZBOOT_ROM_BSS=0x0
|
||||
CONFIG_CMDLINE="console=ttyS0,115200n8 mem=128M androidboot.hardware=capri"
|
||||
CONFIG_CMDLINE="console=ttyS0,115200n8 androidboot.hardware=capri loop.max_part=8"
|
||||
# CONFIG_CMDLINE_FROM_BOOTLOADER is not set
|
||||
CONFIG_CMDLINE_EXTEND=y
|
||||
# CONFIG_CMDLINE_FORCE is not set
|
||||
@@ -656,7 +656,7 @@ CONFIG_IP_PNP_RARP=y
|
||||
# CONFIG_NET_IPGRE_DEMUX is not set
|
||||
# CONFIG_IP_MROUTE is not set
|
||||
# CONFIG_ARPD is not set
|
||||
# CONFIG_SYN_COOKIES is not set
|
||||
CONFIG_SYN_COOKIES=y
|
||||
# CONFIG_INET_AH is not set
|
||||
CONFIG_INET_ESP=y
|
||||
# CONFIG_INET_IPCOMP is not set
|
||||
@@ -2645,7 +2645,7 @@ CONFIG_NLS_CODEPAGE_437=y
|
||||
# CONFIG_NLS_ISO8859_8 is not set
|
||||
# CONFIG_NLS_CODEPAGE_1250 is not set
|
||||
# CONFIG_NLS_CODEPAGE_1251 is not set
|
||||
# CONFIG_NLS_ASCII is not set
|
||||
CONFIG_NLS_ASCII=y
|
||||
CONFIG_NLS_ISO8859_1=y
|
||||
# CONFIG_NLS_ISO8859_2 is not set
|
||||
# CONFIG_NLS_ISO8859_3 is not set
|
||||
|
||||
Reference in New Issue
Block a user