Jump to content


Virtual resolution with panning


25 replies to this topic

#1 dannythefool

    New member

  • Members
  • 6 posts

Posted 04 February 2008 - 10:07 PM

Hi.

I couldn't manage to get any kind of virtual resolution working with the stock Xandros OS, so I wrote my own tool. It's supposed to be used together with xrandr --fb, and will (try to) keep the visible area of the framebuffer so that the pointer is close to the centre.

Maybe I'm not the only one with this problem, so I'm making the software available on the web:
http://notabilis.org/code/?i810pan

It works like this:
$ xrandr --fb 800x600 --fbmm 200x150
$ sudo ./i810pan
i810pan: Controller 8086:2592 found, is an i915 with base 0 at 0xf7f00000
i810pan: dropped privileges to uid 1000
i810pan: screen size: 800x600
base linoffset 196608

You need to configure Virtual in your xorg.conf. You'll be able to use anything up to the resolution you configure there with xrandr --fb. You should adjust the numbers after --fbmm to sensible values, unless you want your font sizes messed up.

Drawbacks:
- KDE just doesn't understand. Kicker appears in the middle of the screen (well, you can move it to the top or left sides to make it less bad). Windows maximize to 800x480. On the other hand, the desktop works just fine. And of course you can resize windows and make them larger than 800x480.
- I realize that keeping the mouse pointer centered isn't really the best solution...

So far, I've only tried this on my eee, and I'm definitely interested in any kind of feedback. I don't really remember what I changed on my Xandros install, so don't know if this will work for everyone right out of the box...

#2 dannythefool

    New member

  • Members
  • 6 posts

Posted 05 February 2008 - 09:16 AM

Okay, I solved my problems with this. Turns out that you can set the resolution of the VGA output even if there is no device connected to it, using a newer version of the xrandr tool. I used 1.2.2, which gives me the --addmode and --newmode switches. Using this approach fixes all my KDE troubles with the virtual resolution:

/home/user/Desktop/xrandr-1.2.2> ./xrandr --newmode "1024x768_60" 64.56 1024 1056 1296 1328 768 783 791 807
/home/user/Desktop/xrandr-1.2.2> ./xrandr --addmode VGA 1024x768_60
/home/user/Desktop/xrandr-1.2.2> ./xrandr --output VGA --mode 1024x768_60
/home/user/Desktop/xrandr-1.2.2> sudo ../i810pan/i810pan
i810pan: Controller 8086:2592 found, is an i915 with base 0 at 0xf7f00000
i810pan: dropped privileges to uid 1000
i810pan: screen size: 1024x768
base linoffset 196608


If anyone is interested at all, I can put the xrandr 1.2.2 binary that I used on my web site too.

#3 bfree

    Member

  • Members
  • 10 posts

Posted 05 February 2008 - 08:40 PM

I've been trying this on a non-eee (intel 945gm in dell xps m1210) having compiled my own i810pan with panel_w=1280 and panel_h=800, on sidux with debian experimental libpciaccess. Are any of the other values in there hiding some hard-coded 800*480 values?

Once I run i810pan things seem fine until it offsets the screen at which point the mouse gets interesting ;-) When the mouse is on the bottom of the screen it reports it's position as 799 rather then the 799+224 (offset) and perhaps worse the mouse keeps going off the screen until it reaches 1023. So if you want to drag the bottom of a fullsize 1280x800 window down to 1280*1024, you have to scroll down and click about on the bottom of the screen to catch the window (which now appears an offset below the bottom) and drag the mouse below the screen out of sight to pull it down. Does i810pan not handle translating the mouse co-ordinates from display to framebuffer co-ordinates or is there something else I'm missing?

One note to anyone else playing with this, remember to put the screen back to the top left before stopping i810pan as it leaves you where you are and at least once I couldn't get back by rerunning i810pan and had to restart X.

I guess I should just try it on my eee. Good work, it got me looking and trying anyway!

#4 FaberfoX

    New member

  • Members
  • 2 posts

Posted 09 February 2008 - 12:04 AM

danny, I'd be really glad if you posted the xrandr 1.2.2, I've brought an eee home from a friends store and really need 800x600 working to justify the purchase

#5 mr.bryce

    New member

  • Members
  • 1 posts

Posted 09 February 2008 - 01:02 AM

faber, you will find the package xrandr_1.2-2 on launchpad.net/ubuntu

install the .deb package and all its dependencies/conflicting packages

i did them one by one because the packages that come with eee preinstalled are too old.

danny, thanks a lot for your posts,

i have now the same problem as bfree :

the mouse is offset to from the position displayed on screen.
i woudnt be able to give as many details as bfree but it makes the panning mode unusable :(

did anyone try the 915resolution trick ? crashed my Xserver so far...

#6 FaberfoX

    New member

  • Members
  • 2 posts

Posted 09 February 2008 - 09:27 PM

danny, as bfree and bryce posted, the mouse offset makes the machine really hard to use. What's really weird is that using an external display in clone mode, the mouse is ok on the external display while still wrong on the eee display.
If this gets fixed, you'll be a hero and not just to me ;)

Edited by FaberfoX, 09 February 2008 - 09:28 PM.


#7 cwolf

    Member

  • Members
  • 19 posts
  • Locationchicago, il, usa

Posted 12 March 2008 - 05:27 AM

Hello,

Thank you for your work Danny, it is very useful.

I've made a few changes to the i810pan.c code to give the panning a more "Windows" type of pan, where the panning only shifts if the cursor hits the edge of the currently viewable area, instead of keeping the mouse centered.

Xfce4 on Debian "Lenny" seems to work pretty well with i810pan. I am using tasmaniac's xorg.conf referred to in this post

I have yet to find a way to deal with the cursor offset issue, but I am working on it.

Here's the patch file contents if you want the "Windows" pan:

--- i810pan.c    2008-02-04 12:18:57.000000000 -0600
+++ i810pan.c    2008-03-12 09:41:46.668421600 -0600
@@ -39,6 +39,7 @@
 static void *mmio;
 static int panel_w, panel_h;
 static int tile_off_x, tile_off_y;
+static int bound_l, bound_r, bound_t, bound_b;
 static int base_linoffset;
 
 int main(int argc, char *argv[]) {
@@ -128,6 +129,12 @@
     panel_w = 800;
     panel_h = 480;
 
+    // set the initial tile boundaries
+    bound_t = 0;
+    bound_b = panel_h;
+    bound_l = 0;
+    bound_r = panel_w;
+    
     // try to open the display
     display_name = getenv("DISPLAY");
     if(!display_name) display_name = ":0.0";
@@ -157,12 +164,33 @@
 #ifdef DEBUG
             fprintf(stderr, PN "pointer is at %d,%d\n", mouse_x, mouse_y);
 #endif
-            tile_off_x = mouse_x - panel_w / 2;
-            tile_off_y = mouse_y - panel_h / 2;
-            if(tile_off_x < 0) tile_off_x = 0;
-            if(tile_off_y < 0) tile_off_y = 0;
-            if(tile_off_x + panel_w >= w) tile_off_x = w - panel_w;
-            if(tile_off_y + panel_h >= h) tile_off_y = h - panel_h;
+            if (mouse_x > bound_r && bound_r < w - 10) {
+                tile_off_x += 10;
+                bound_l = tile_off_x;
+                bound_r = bound_l + panel_w;
+            } else if (mouse_x < bound_l) {
+                tile_off_x -= 10;
+                bound_l = tile_off_x;
+                bound_r = bound_l + panel_w;
+            };
+            if (mouse_y > bound_b && bound_b < w - 10) {
+                tile_off_y += 10;
+                bound_t = tile_off_y;
+                bound_b = bound_t + panel_h;
+            } else if (mouse_y < bound_t) {
+                tile_off_y -= 10;
+                bound_t = tile_off_y;
+                bound_b = bound_t + panel_h;
+            };
+
+            if (bound_b >= h) {
+                bound_b = h;
+                bound_t = bound_b - panel_h;
+            };
+            if (bound_r >= w) {
+                bound_r = w;
+                bound_l = bound_r - panel_w;
+            };
 #ifdef DEBUG
             fprintf(stderr, PN "   -> panel tile offset %d,%d\n", tile_off_x, tile_off_y);
 #endif
Hope that helps some.

Cheers,
Cwolf

Edited by cwolf, 12 March 2008 - 04:03 PM.


#8 Dmitry.Bedrin

    Member

  • Members
  • 14 posts

Posted 17 July 2008 - 09:19 AM

Danny, cwolf, thank a lot for your efforts, guys!

I've patched the original i810pan and have pretty convenient scrolling now - I'm using it to play native Linux Heroes of Might & Magic III.

Do you have any ideas how to fix the cursor offset issue?

The other issue was already said above:
One note to anyone else playing with this, remember to put the screen back to the top left before stopping i810pan as it leaves you where you are and at least once I couldn't get back by rerunning i810pan and had to restart X.
Is there a possibility to scroll screen to top automatically before executing xrandr --fb 800x480 ?


Thanks once more, guys! Unfortunately I'm not a Linux developer and can't answer these questions myself.

#9 dannythefool

    New member

  • Members
  • 6 posts

Posted 19 July 2008 - 09:53 AM

Sorry guys, I'm too much tied up in work to check back often. I learned of the offset issue when some of you e-mailed me recently. I found one thing in my xorg.conf that could be related, and Will Ho has confirmed by e-mail that adding these two lines to the "Device" section appears to resolve the issue:

Section "Device"
...
Option "SWCursor" "true"
Option "HWCursor" "false"
...
EndSection

Cwolf, great to see this patch, I'll have to try it when I have time to play games again :-)

#10 Dmitry.Bedrin

    Member

  • Members
  • 14 posts

Posted 20 July 2008 - 01:47 PM

Danny, thanks for information.

I'd like to confirm that xorg.conf changes above solves the cursor offset issue.

Here's a list of commands I used to set 800x600 virtual resolution:
./xrandr --newmode "800x600_60" 38.22 800 832 912 1024 600 601 604 622
./xrandr --addmode VGA 800x600_60
./xrandr --output VGA --mode 800x600_60

For those of you who have no xrandr 1.2.2, you can download it from here: http://vella.erinye....dr-1.2.2/xrandr

I've one more question now: how can I restore my original resolution without restarting X ?

#11 darkstar2k77

    New member

  • Members
  • 3 posts

Posted 21 July 2008 - 06:07 AM

Hi Danny,

Thanks for your contributions.

@cwolf,

could u host your binary for "Windows" type of pan? Is there a howto for setting up development eeepc Xandros environment to compile this ?

Will Ho

#12 dannythefool

    New member

  • Members
  • 6 posts

Posted 21 July 2008 - 06:25 AM

Quote

I've one more question now: how can I restore my original resolution without restarting X ?
xrandr --output VGA --off

#13 Dmitry.Bedrin

    Member

  • Members
  • 14 posts

Posted 21 July 2008 - 10:39 AM

Quote

@cwolf,

could u host your binary for "Windows" type of pan? Is there a howto for setting up development eeepc Xandros environment to compile this ?

Will Ho
I managed to patch the original i810pan util with the patch provided by cwolf and compile it.

1) First of all you should add additional repositories - see appropriate page in wiki and install build-essential package.
2) Apply the patch to the source code. Frankly speaking I didn't manage to use the patch command, so had to apply it manually.
3) Compile the patched application by entering 'make' in your console.

I'd like to confirm that it gives you 'windows style' panning.

If you like, I can send you the compiled patched binary or perhaps publish it somewhere on the web.

Cheers,
Dmitry.

#14 darkstar2k77

    New member

  • Members
  • 3 posts

Posted 21 July 2008 - 02:08 PM

Hi Dmitry,

Could you post your binary? I tried compilation but couldn't get past error:

X11/X.h: No such file or directory

#15 Dmitry.Bedrin

    Member

  • Members
  • 14 posts

Posted 21 July 2008 - 02:13 PM

darkstar2k77,

Actually I expected you will face some problems - I was installing some additional packages (their names contained two words "X" and "-dev") but unfortunately I can't say which exactly helped me to sort this issue out.

I'll mail you the binary once I'm at home (in approx. 3 hours).
Please PM me your email, since this forum doesn't allow to send messages with attachments.

Cheers,
Dmitry.

#16 Karoly

    Member

  • Members
  • 13 posts
  • LocationHungary

Posted 21 July 2008 - 06:56 PM

I could not get the patch applied, too. I could compile with "make static" without any problem.

#17 Dmitry.Bedrin

    Member

  • Members
  • 14 posts

Posted 21 July 2008 - 08:58 PM

Hi, folks!

You can download patched sources together with new binary here:

http://rapidshare.co...atched.tgz.html


Hope it helps,
Dmitry

#18 darkstar2k77

    New member

  • Members
  • 3 posts

Posted 22 July 2008 - 06:30 AM

Dmitry,


Thanks for posting the patched binary. Works great!

Will

#19 Dmitry.Bedrin

    Member

  • Members
  • 14 posts

Posted 22 July 2008 - 11:21 AM

darkstar2k77, glad it works for you!

I'm thinking about creating a simple gui for this tool and xrandr manipulations.
Do you think it can be interesting?


Dmitry.

#20 alanbcohen

    Senior Member

  • Members
  • 505 posts
  • LocationBaltimore, MD, USA

Posted 22 July 2008 - 12:00 PM

Quote

I'm thinking about creating a simple gui for this tool and xrandr manipulations.
Do you think it can be interesting?
Yes!
Is there a step-by-step HOWTO for this? In the wiki?? (Sorry, running off to a doctor's appt, no time to search) I downloaded the patched version, but don't know where to put the files.
BTW, using XEPC Recovery of the Xandros on a 4G 701.
All opinions, information etc in this forum post is copyrighted by me (alanbcohen) unless indicated otherwise.
You are free to reuse whatever you want to, provided that:
1) you give credit to me and eeeuser.com whenever you reuse anything for all things you reused.
2) you do not pretend or create the illusion that your modifications are mine. I'll be responsible for my junk, you for yours.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users