Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[PATCH 2/3] viafb: video address setting revisited

3 views
Skip to first unread message

Florian Tobias Schandinat

unread,
Feb 9, 2010, 9:30:02 AM2/9/10
to
viafb: video address setting revisited

Set always the correct video address. Especially do panning right on
multiple IGAs.
This should have no effect on single monitor mode (no SAMM, no dual fb).
For SAMM without dual fb this might break something as I really cannot
image what we are supposed to do for different resolutions with a single
framebuffer as we can't get data out of nowhere (no, they are not set
up in something one would call "expanded"). Previously I got for that
funny colored pictures as the second IGA pointed to video memory that
was never written to. After the patch it'll work as cloning if the first
and second mode are identical (this was working already without SAMM).
Finally for dual fb this should push us a step in the right direction.

Signed-off-by: Florian Tobias Schandinat <FlorianS...@gmx.de>
---
drivers/video/via/hw.c | 2 --
drivers/video/via/viafbdev.c | 23 +++++++++++++++--------
2 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
index 1aa3bb2..400373f 100644
--- a/drivers/video/via/hw.c
+++ b/drivers/video/via/hw.c
@@ -2206,8 +2206,6 @@ int viafb_setmode(struct VideoModeTable *vmode_tbl, int video_bpp,
outb(VPIT.SR[i - 1], VIASR + 1);
}

- viafb_set_primary_address(0);
- viafb_set_secondary_address(viafb_SAMM_ON ? viafb_second_offset : 0);
viafb_set_iga_path();

/* Write CRTC */
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index 4d955ca..b417259 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -50,6 +50,8 @@ static void apply_second_mode_setting(struct fb_var_screeninfo
*sec_var);
static void retrieve_device_setting(struct viafb_ioctl_setting
*setting_info);
+static int viafb_pan_display(struct fb_var_screeninfo *var,
+ struct fb_info *info);

static struct fb_ops viafb_ops;

@@ -182,6 +184,7 @@ static int viafb_set_par(struct fb_info *info)
info->flags |= FBINFO_HWACCEL_DISABLED;
viafb_setmode(vmode_entry, info->var.bits_per_pixel,
vmode_entry1, viafb_bpp1);
+ viafb_pan_display(&info->var, info);
}

return 0;
@@ -410,15 +413,19 @@ static int viafb_setcmap(struct fb_cmap *cmap, struct fb_info *info)
static int viafb_pan_display(struct fb_var_screeninfo *var,
struct fb_info *info)
{
- unsigned int offset;
-
- DEBUG_MSG(KERN_INFO "viafb_pan_display!\n");
-
- offset = (var->xoffset + (var->yoffset * var->xres_virtual)) *
- var->bits_per_pixel / 16;
+ struct viafb_par *viapar = info->par;
+ u32 vram_addr = (var->yoffset * var->xres_virtual + var->xoffset)
+ * (var->bits_per_pixel / 8) + viapar->vram_addr;
+
+ DEBUG_MSG(KERN_DEBUG "viafb_pan_display, address = %d\n", vram_addr);
+ if (!viafb_dual_fb) {
+ viafb_set_primary_address(vram_addr);
+ viafb_set_secondary_address(vram_addr);
+ } else if (viapar->iga_path == IGA1)
+ viafb_set_primary_address(vram_addr);
+ else
+ viafb_set_secondary_address(vram_addr);

- DEBUG_MSG(KERN_INFO "\nviafb_pan_display,offset =%d ", offset);
- viafb_set_primary_address(offset);
return 0;
}

--
1.6.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majo...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Florian Tobias Schandinat

unread,
Feb 9, 2010, 9:30:02 AM2/9/10
to
viafb: make viafb_set_par more dual framebuffer compatible

This patch is an attempt to make viafb_set_par work correctly with
more than one framebuffer. As modesetting is not (yet/easily)
possible for each individual IGA it uses the (normally to be avoided)
global variables viafbinfo{,1} to ensure that each function is called
with the correct values.
This patch (finally) allows usable dual framebuffer setups and should
not affect non dual fb ones. It works in some (most?) configurations
as sometimes the driver still gets device connections wrong. It can
be worth to try the devices in reverse order (in viafb_active_dev).
The user experience is still not very nice as:
- on the second fb you'll normally have a garbled picture as long as
no application draws to it
goal: auto on/off devices depending on reference counting
- as the whole machinery is always done you can see mode changes also
in an unaffected framebuffer
goal: split modesetting up for each individual IGA

Signed-off-by: Florian Tobias Schandinat <FlorianS...@gmx.de>
---

drivers/video/via/viafbdev.c | 22 ++++++++++++++++------
1 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index b417259..b1569a7 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -160,11 +160,17 @@ static int viafb_set_par(struct fb_info *info)
DEBUG_MSG(KERN_INFO "viafb_set_par!\n");

viapar->depth = fb_get_color_depth(&info->var, &info->fix);
- viafb_update_device_setting(info->var.xres, info->var.yres,
- info->var.bits_per_pixel, viafb_refresh, 0);
+ viafb_update_device_setting(viafbinfo->var.xres, viafbinfo->var.yres,
+ viafbinfo->var.bits_per_pixel, viafb_refresh, 0);

- vmode_entry = viafb_get_mode(info->var.xres, info->var.yres);
- if (viafb_SAMM_ON == 1) {
+ vmode_entry = viafb_get_mode(viafbinfo->var.xres, viafbinfo->var.yres);
+ if (viafb_dual_fb) {
+ vmode_entry1 = viafb_get_mode(viafbinfo1->var.xres,
+ viafbinfo1->var.yres);
+ viafb_update_device_setting(viafbinfo1->var.xres,
+ viafbinfo1->var.yres, viafbinfo1->var.bits_per_pixel,
+ viafb_refresh1, 1);
+ } else if (viafb_SAMM_ON == 1) {
DEBUG_MSG(KERN_INFO
"viafb_second_xres = %d, viafb_second_yres = %d, bpp = %d\n",
viafb_second_xres, viafb_second_yres, viafb_bpp1);
@@ -177,7 +183,11 @@ static int viafb_set_par(struct fb_info *info)

if (vmode_entry) {
viafb_update_fix(info);
- viafb_bpp = info->var.bits_per_pixel;
+ if (viafb_dual_fb && viapar->iga_path == IGA2)
+ viafb_bpp1 = info->var.bits_per_pixel;
+ else
+ viafb_bpp = info->var.bits_per_pixel;
+
if (info->var.accel_flags & FB_ACCELF_TEXT)
info->flags &= ~FBINFO_HWACCEL_DISABLED;
else

0 new messages