How can I change resolution and move the video output on the screen without losing sharpness?

Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
KaMyKaSii
Level 1
Level 1
Posts: 11
Joined: Sun Sep 13, 2020 5:09 pm

How can I change resolution and move the video output on the screen without losing sharpness?

Post by KaMyKaSii »

I have a TV with 1366x768 resolution that I use as a monitor via HDMI on a notebook (that had its screen removed) with Intel integrated graphics. Unfortunately 25% of the left portion of the screen has gone bad and is now just white pixels all the time. Using the screenshot tool with manual area selection I could see that there are exactly 1024x768 good pixels on the screen. My intention is to change the system to this resolution in 4/3 aspect, not apply upscaling and move this entire region 342 pixels to the right of the screen, thus keeping the entire system ouput video in the good portion of the screen. After searching I found that the command

Code: Select all

xrandr --output HDMI-1 --mode 1024x768 --panning 1024x768 --transform 1.33333333,0,-342,0,1,0,0,0,1
does exactly what I want. The problem is that the image quality is very affected, it looks like the screen went from LED to CTR, with low sharpness. Could anyone tell what I'm doing wrong and how to get better video sharpness? If I just change the resolution to 1024x768 and in the settings of the TV itself force the "Aspect ratio" from "Automatic" to "4/3" I get the same sharpness than the default 1366x768 full screen, but in this case a part of the image is still hidden by the dead pixels on the left and another area of ​​good pixels on the right is replaced by a black bar. Any help is welcome, thank you very much!

"xrand" output:

Code: Select all

xrandr
Screen 0: minimum 320 x 200, current 1366 x 768, maximum 16384 x 16384
LVDS-1 connected (normal left inverted right x axis y axis)
   1024x768      60.00 +
   960x720       60.00  
   928x696       60.05  
   896x672       60.01  
   1024x576      59.95    59.96    59.90    59.82  
   960x600       59.93    60.00  
   960x540       59.96    59.99    59.63    59.82  
   800x600       60.00    60.32    56.25  
   840x525       60.01    59.88  
   864x486       59.92    59.57  
   800x512       60.17  
   700x525       59.98  
   800x450       59.95    59.82  
   640x512       60.02  
   720x450       59.89  
   700x450       59.96    59.88  
   640x480       60.00    59.94  
   720x405       59.51    58.99  
   684x384       59.88    59.85  
   680x384       59.80    59.96  
   640x400       59.88    59.98  
   576x432       60.06  
   640x360       59.86    59.83    59.84    59.32  
   512x384       60.00  
   512x288       60.00    59.92  
   480x270       59.63    59.82  
   400x300       60.32    56.34  
   432x243       59.92    59.57  
   320x240       60.05  
   360x202       59.51    59.13  
   320x180       59.84    59.32  
VGA-1 disconnected (normal left inverted right x axis y axis)
HDMI-1 connected primary 1366x768+0+0 (normal left inverted right x axis y axis) 708mm x 398mm panning 1366x768+0+0
   1280x720      60.00 +  50.00    59.94    24.00    23.98  
   1920x1080     60.00    50.00    59.94    30.00    24.00    29.97    23.98  
   1920x1080i    60.00    50.00    59.94  
   1600x1200     60.00  
   1280x1024     85.02    75.02    60.02  
   1280x960      85.00  
   1366x768      59.79* 
   1360x768      60.02  
   1152x864      75.00  
   1024x768      85.00    75.03    60.00  
   800x600       85.06    72.19    75.00    60.32    56.25  
   720x576       50.00  
   720x576i      50.00  
   720x480       60.00    59.94  
   720x480i      60.00    59.94  
   640x480       75.00    72.81    60.00    59.94  
   720x400       85.04  
DP-1 disconnected (normal left inverted right x axis y axis)
"inxi -Fxz" output:

Code: Select all

System:    Kernel: 5.11.0-40-generic x86_64 bits: 64 compiler: N/A Desktop: Cinnamon 5.0.7 Distro: Linux Mint 20.2 Uma 
           base: Ubuntu 20.04 focal 
Machine:   Type: Laptop System: Digibras product: CL341 v: 0.1 serial: <filter> 
           Mobo: Intel model: Emerald Lake 2 v: FAB1 serial: <filter> UEFI: Phoenix v: 3.08_ date: 04/07/2013 
Battery:   ID-1: BAT0 charge: 8.3 Wh condition: 8.9/25.5 Wh (35%) model: TPS S10 status: Unknown 
CPU:       Topology: Dual Core model: Intel Core i3-3217U bits: 64 type: MT MCP arch: Ivy Bridge rev: 9 
           L2 cache: 3072 KiB 
           flags: avx lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 14366 
           Speed: 929 MHz min/max: 800/1800 MHz Core speeds (MHz): 1: 929 2: 1105 3: 874 4: 947 
Graphics:  Device-1: Intel 3rd Gen Core processor Graphics driver: i915 v: kernel bus ID: 00:02.0 
           Display: x11 server: X.Org 1.20.11 driver: modesetting unloaded: fbdev,vesa resolution: 1366x768~60Hz 
           OpenGL: renderer: Mesa DRI Intel HD Graphics 4000 (IVB GT2) v: 4.2 Mesa 21.0.3 direct render: Yes 
Audio:     Device-1: Intel 7 Series/C216 Family High Definition Audio driver: snd_hda_intel v: kernel bus ID: 00:1b.0 
           Sound Server: ALSA v: k5.11.0-40-generic 
Network:   Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: Elite Systems driver: r8169 v: kernel 
           port: 3000 bus ID: 01:00.0 
           IF: enp1s0 state: up speed: 1000 Mbps duplex: full mac: <filter> 
           Device-2: Realtek RTL8188CE 802.11b/g/n WiFi Adapter driver: rtl8192ce v: kernel port: 2000 bus ID: 02:00.0 
           IF: wlp2s0 state: down mac: <filter> 
Drives:    Local Storage: total: 223.57 GiB used: 52.39 GiB (23.4%) 
           ID-1: /dev/sda vendor: A-Data model: SU650 size: 223.57 GiB 
Partition: ID-1: / size: 83.51 GiB used: 52.36 GiB (62.7%) fs: xfs dev: /dev/sda4 
Sensors:   System Temperatures: cpu: 61.0 C mobo: N/A 
           Fan Speeds (RPM): N/A 
Info:      Processes: 263 Uptime: 43m Memory: 3.68 GiB used: 2.11 GiB (57.4%) Init: systemd runlevel: 5 Compilers: 
           gcc: 9.3.0 Shell: bash v: 5.0.17 inxi: 3.0.38
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
SMG
Level 25
Level 25
Posts: 31333
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: How can I change resolution and move the video output on the screen without losing sharpness?

Post by SMG »

KaMyKaSii wrote: Wed Dec 01, 2021 6:15 pm I have a TV with 1366x768 resolution
While that is the resolution you are using (*= current resolution), that is not the preferred resolution of the TV. According to the xrandr output += preferred resolution which means 1280x720 at 60Hz is preferred. Maybe that is why the sharpness is not as good.

Given the age of your laptop, I would have thought the 5.4 LTS kernel would work well. Did you notice a difference between using the 5.4 and 5.11 kernels?
Image
A woman typing on a laptop with LM20.3 Cinnamon.
KaMyKaSii
Level 1
Level 1
Posts: 11
Joined: Sun Sep 13, 2020 5:09 pm

Re: How can I change resolution and move the video output on the screen without losing sharpness?

Post by KaMyKaSii »

SMG wrote: Wed Dec 01, 2021 11:07 pm
KaMyKaSii wrote: Wed Dec 01, 2021 6:15 pm I have a TV with 1366x768 resolution
While that is the resolution you are using (*= current resolution), that is not the preferred resolution of the TV. According to the xrandr output += preferred resolution which means 1280x720 at 60Hz is preferred. Maybe that is why the sharpness is not as good.

Given the age of your laptop, I would have thought the 5.4 LTS kernel would work well. Did you notice a difference between using the 5.4 and 5.11 kernels?
I switch to 5.4.0-91-generic kernel but still the same behavior. Do you know why the preferred resolution is 720p if the screen itself is 768p? Also I noted that when I run my custom xrandr command and then force again the TV in 4/3 format I get the sharpness that I want, but the video output becomes 1/1, now with a larger black bar on the right and a new visible black bar on the left (in the right of the white pixels).
User avatar
SMG
Level 25
Level 25
Posts: 31333
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: How can I change resolution and move the video output on the screen without losing sharpness?

Post by SMG »

KaMyKaSii wrote: Thu Dec 02, 2021 11:29 amDo you know why the preferred resolution is 720p if the screen itself is 768p?
What is 768p? I have never heard that term.

You have not provided any information about your TV (such as make and model), so I can only go by the xrandr output.
Image
A woman typing on a laptop with LM20.3 Cinnamon.
KaMyKaSii
Level 1
Level 1
Posts: 11
Joined: Sun Sep 13, 2020 5:09 pm

Re: How can I change resolution and move the video output on the screen without losing sharpness?

Post by KaMyKaSii »

SMG wrote: Thu Dec 02, 2021 3:35 pm
KaMyKaSii wrote: Thu Dec 02, 2021 11:29 amDo you know why the preferred resolution is 720p if the screen itself is 768p?
What is 768p? I have never heard that term.

You have not provided any information about your TV (such as make and model), so I can only go by the xrandr output.
768p means 1366x768. I think my TV brand is Brazilian so it will probably be unknown to you. But I think the behavior is the same as any TV/monitor connected via HDMI. I noticed that when I run my custom xrandr command the TV says that the received resolution is really 1024x768@60, maybe to achieve my goal the TV has to receive 1366x768 output but while the system and apps run at 1024x768 on the right portion of the screen. Do you have any idea how to do this? When I simply change "--mode 1024x768" to "--mode 1366x768" xrandr gives me an error
User avatar
SMG
Level 25
Level 25
Posts: 31333
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: How can I change resolution and move the video output on the screen without losing sharpness?

Post by SMG »

KaMyKaSii wrote: Fri Dec 03, 2021 9:45 am768p means 1366x768. I think my TV brand is Brazilian so it will probably be unknown to you. But I think the behavior is the same as any TV/monitor connected via HDMI.
Actually, they do not act all the same. That is why I asked. Older TVs tend to act differently than newer TVs, and TVs tend to act differently than monitors.

What is happening for any external monitor is the EDID information from the monitor is passed to the computer. Then the graphics driver decides how to use that information to make what you see on the screen. The EDID is going to be different for different hardware.
KaMyKaSii wrote: Fri Dec 03, 2021 9:45 am I noticed that when I run my custom xrandr command the TV says that the received resolution is really 1024x768@60
I do not understand what you mean by "the received resolution".

Instead of assuming the TV is 1366x768, start with the assumption the TV is 1280x720 like xrandr indicates it is and then do the transforms based on that resolution. That is the only idea I have to try. I have not really done much work with this type of issue so my ability to help is limited.
Image
A woman typing on a laptop with LM20.3 Cinnamon.
JJones
Level 1
Level 1
Posts: 1
Joined: Mon Feb 07, 2022 6:24 pm

Re: How can I change resolution and move the video output on the screen without losing sharpness?

Post by JJones »

I went through this recently and posted my solution over at Linux unix stackexchange: https://unix.stackexchange.com/question ... 123#686123

There's a bit more information there ( by myself as well as a good description of the problem ) but here's the script.
Note that you need to change the ORIG_X, ORIG_Y and NEW_X,NEW_Y ( these are the overall dimensions) and don't miss the X_DIFF=0 and Y_DIFF=0
lines.. uncomment one or both to 'set justification'.
A little clarification on the multiple of 8 requirement - without it the window manager won't work properly - going fullscreen will use the original dimensions and part of your window will be offscreen.

Code: Select all

#!/bin/bash

# (if using as a KDE autostart script)
# sleep 10

# change these 4 variables accordingly
ORIG_X=2880
ORIG_Y=1800
NEW_X=2810
NEW_Y=1800
###
#Modify to multiple of 8. Issues with window sizing etc without these next two lines.
NEW_X=$(($NEW_X/8*8))
NEW_Y=$(($NEW_Y/8*8))
X_DIFF=$(($NEW_X - $ORIG_X))
Y_DIFF=$(($NEW_Y - $ORIG_Y))
# Uncomment the next line to use left portion of screen:
#X_DIFF=0
# Uncomment the next line to use upper portion of screen:
#Y_DIFF=0

ORIG_RES="$ORIG_X"x"$ORIG_Y"
NEW_RES="$NEW_X"x"$NEW_Y"
ACTIVEOUTPUT=$(xrandr | grep -e " connected [^(]" | sed -e "s/\([A-z0-9]\+\) connected.*/\1/")
MODELINE=$(cvt $NEW_X $NEW_Y | grep Modeline | cut -d' ' -f3-)

xrandr --newmode $NEW_RES $MODELINE
xrandr --addmode $ACTIVEOUTPUT $NEW_RES
xrandr --output $ACTIVEOUTPUT --fb $NEW_RES --panning $NEW_RES --mode $NEW_RES
xrandr --fb $NEW_RES --output $ACTIVEOUTPUT --mode $ORIG_RES --transform 1,0,$X_DIFF,0,1,$Y_DIFF,0,0,1

# KDE specific -- restart shell so that icon tray is properly sized
# kquitapp5 plasmashell
# kstart5 plasmashell
KaMyKaSii
Level 1
Level 1
Posts: 11
Joined: Sun Sep 13, 2020 5:09 pm

Re: How can I change resolution and move the video output on the screen without losing sharpness?

Post by KaMyKaSii »

JJones wrote: Mon Feb 07, 2022 6:47 pm I went through this recently and posted my solution over at Linux unix stackexchange: https://unix.stackexchange.com/question ... 123#686123

There's a bit more information there ( by myself as well as a good description of the problem ) but here's the script.
Note that you need to change the ORIG_X, ORIG_Y and NEW_X,NEW_Y ( these are the overall dimensions) and don't miss the X_DIFF=0 and Y_DIFF=0
lines.. uncomment one or both to 'set justification'.
A little clarification on the multiple of 8 requirement - without it the window manager won't work properly - going fullscreen will use the original dimensions and part of your window will be offscreen.

Code: Select all

#!/bin/bash

# (if using as a KDE autostart script)
# sleep 10

# change these 4 variables accordingly
ORIG_X=2880
ORIG_Y=1800
NEW_X=2810
NEW_Y=1800
###
#Modify to multiple of 8. Issues with window sizing etc without these next two lines.
NEW_X=$(($NEW_X/8*8))
NEW_Y=$(($NEW_Y/8*8))
X_DIFF=$(($NEW_X - $ORIG_X))
Y_DIFF=$(($NEW_Y - $ORIG_Y))
# Uncomment the next line to use left portion of screen:
#X_DIFF=0
# Uncomment the next line to use upper portion of screen:
#Y_DIFF=0

ORIG_RES="$ORIG_X"x"$ORIG_Y"
NEW_RES="$NEW_X"x"$NEW_Y"
ACTIVEOUTPUT=$(xrandr | grep -e " connected [^(]" | sed -e "s/\([A-z0-9]\+\) connected.*/\1/")
MODELINE=$(cvt $NEW_X $NEW_Y | grep Modeline | cut -d' ' -f3-)

xrandr --newmode $NEW_RES $MODELINE
xrandr --addmode $ACTIVEOUTPUT $NEW_RES
xrandr --output $ACTIVEOUTPUT --fb $NEW_RES --panning $NEW_RES --mode $NEW_RES
xrandr --fb $NEW_RES --output $ACTIVEOUTPUT --mode $ORIG_RES --transform 1,0,$X_DIFF,0,1,$Y_DIFF,0,0,1

# KDE specific -- restart shell so that icon tray is properly sized
# kquitapp5 plasmashell
# kstart5 plasmashell
After so much research and so many commands tested I ended up with the same solution as you to configure the lower resolution and the portion of the screen used. I didn't post it here just because of the xrandr output that looks more like an error and that I realized that screen tearing is much more visible after using this solution. Did you experience this?
Locked

Return to “Graphics Cards & Monitors”