Score:0

Screen tearing when using xrandr and x11vnc on Ubuntu 20.04

ph flag

I am trying to use my android phone as a second monitor for my Ubuntu. I am following this blog.

This is the 20-virtual.conf in /usr/share/X11/xorg.conf.d

Section "Device"
 Identifier "intelgpu0"
Driver "intel"
Option "VirtualHeads" "1"
EndSection

and this is the script for the virtual desktop and VNC server

#!/bin/bash

W=798      # Virtual display width
H=393      # Virtual display height
O=VIRTUAL1  # The name of the virtual display (check using xrandr)
P=eDP1      # The name of your physical display (check using xrandr)
PW=$(xrandr --current | grep \* | awk '{print $1;}' | cut -d x -f 1)

# Create the virtual display
gtf $W $H 60 | sed '3q;d' | sed 's/Modeline//g' | xargs xrandr --newmode
gtf $W $H 60 | sed '3q;d' | sed 's/Modeline//g' | awk '{print $1;}' | sed 's/^.\(.*\).$/\1/' | xargs xrandr --addmode $O
gtf $W $H 60 | sed '3q;d' | sed 's/Modeline//g' | awk '{print $1;}' | sed 's/^.\(.*\).$/\1/' | xargs xrandr --output $O --right-of $P --mode
    
# Forward the VNC port to your device and start a VNC session
adb reverse tcp:5900 tcp:5900
x11vnc -localhost -clip ${W}x${H}+${PW}+0

# When the session ends, turn off the virtual display
xrandr --output $O --off

Image of the desktop after running the script

enter image description here

Also sometimes the system freezes and only the mouse works (then I have to either reboot the system or restart the gdm)

Score:0
mo flag

In the file /usr/share/X11/xorg.conf.d/20-virtual.conf change the driver to "modesetting"

This is how your 20-virtual.conf file should look

Section "Device"
    Identifier "intelgpu0"
    Driver "modesetting"
    Option "VirtualHeads" "1"
    Option "TearFree" "true"
EndSection
preIdiot avatar
ph flag
`xrandr` doesn't show VIRTUAL1 anymore and running the script gives ``xrandr: cannot find output "VIRTUAL1" warning: output VIRTUAL1 not found; ignoring``
Amit Dube avatar
mo flag
run `xrandr` and you'll see different disconnected outputs, in my case `DP-1-1 disconnected HDMI-1-1 disconnected DP-1-2 disconnected`. Now replace `VIRTUAL1` with `DP-1-1`. Also verify if `eDP1` changed to `eDP-1`. This happens when changing dirver from `intel` to `modesetting`
preIdiot avatar
ph flag
I don't have DP-* something, I only have eDP-1 and HDMI-1
Amit Dube avatar
mo flag
then just try with `HDMI-1` instead of `VIRTUAL1`, it should work
preIdiot avatar
ph flag
No, it doesn't works with HDMI-1
Amit Dube avatar
mo flag
Edit your /etc/X11/xorg.conf file(make a copy before editing) and change the section device to whats in this [link](https://gist.github.com/wangruohui/bc7b9f424e3d5deb0c0b8bba990b1bc5#2-configure-xorg) copy the second configuration from the link.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.