Subject: [PATCH 1/4] viafb: yet another dead code removal

viafb: yet another dead code removal

Remove some functions that were never executed and a related
undocumented module paramater.

Signed-off-by: Florian Tobias Schandinat <[email protected]>
---
drivers/video/via/Makefile | 2 +-
drivers/video/via/global.c | 1 -
drivers/video/via/global.h | 1 -
drivers/video/via/iface.c | 78 ------------------------------------------
drivers/video/via/iface.h | 38 --------------------
drivers/video/via/viafbdev.c | 2 -
drivers/video/via/viafbdev.h | 1 -
7 files changed, 1 insertions(+), 122 deletions(-)
delete mode 100644 drivers/video/via/iface.c
delete mode 100644 drivers/video/via/iface.h

diff --git a/drivers/video/via/Makefile b/drivers/video/via/Makefile
index e533b4b..eeed238 100644
--- a/drivers/video/via/Makefile
+++ b/drivers/video/via/Makefile
@@ -4,4 +4,4 @@

obj-$(CONFIG_FB_VIA) += viafb.o

-viafb-y :=viafbdev.o hw.o iface.o via_i2c.o dvi.o lcd.o ioctl.o accel.o via_utility.o vt1636.o global.o tblDPASetting.o viamode.o tbl1636.o
+viafb-y :=viafbdev.o hw.o via_i2c.o dvi.o lcd.o ioctl.o accel.o via_utility.o vt1636.o global.o tblDPASetting.o viamode.o tbl1636.o
diff --git a/drivers/video/via/global.c b/drivers/video/via/global.c
index b675cdb..7fbc618 100644
--- a/drivers/video/via/global.c
+++ b/drivers/video/via/global.c
@@ -23,7 +23,6 @@ int viafb_platform_epia_dvi = STATE_OFF;
int viafb_device_lcd_dualedge = STATE_OFF;
int viafb_bus_width = 12;
int viafb_display_hardware_layout = HW_LAYOUT_LCD_DVI;
-int viafb_memsize;
int viafb_DeviceStatus = CRT_Device;
int viafb_hotplug;
int viafb_refresh = 60;
diff --git a/drivers/video/via/global.h b/drivers/video/via/global.h
index d69d0ca..865b050 100644
--- a/drivers/video/via/global.h
+++ b/drivers/video/via/global.h
@@ -35,7 +35,6 @@

#include "debug.h"

-#include "iface.h"
#include "viafbdev.h"
#include "chip.h"
#include "accel.h"
diff --git a/drivers/video/via/iface.c b/drivers/video/via/iface.c
deleted file mode 100644
index 1570636..0000000
--- a/drivers/video/via/iface.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright 1998-2008 VIA Technologies, Inc. All Rights Reserved.
- * Copyright 2001-2008 S3 Graphics, Inc. All Rights Reserved.
-
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation;
- * either version 2, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTIES OR REPRESENTATIONS; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR
- * A PARTICULAR PURPOSE.See the GNU General Public License
- * for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc.,
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include "global.h"
-
-/* Get frame buffer size from VGA BIOS */
-
-unsigned int viafb_get_memsize(void)
-{
- unsigned int m;
-
- /* If memory size provided by user */
- if (viafb_memsize)
- m = viafb_memsize * Mb;
- else {
- m = (unsigned int)viafb_read_reg(VIASR, SR39);
- m = m * (4 * Mb);
-
- if ((m < (16 * Mb)) || (m > (64 * Mb)))
- m = 16 * Mb;
- }
- DEBUG_MSG(KERN_INFO "framebuffer size = %d Mb\n", m / Mb);
- return m;
-}
-
-/* Get Video Buffer Starting Physical Address(back door)*/
-
-unsigned long viafb_get_videobuf_addr(void)
-{
- struct pci_dev *pdev = NULL;
- unsigned char sys_mem;
- unsigned char video_mem;
- unsigned long sys_mem_size;
- unsigned long video_mem_size;
- /*system memory = 256 MB, video memory 64 MB */
- unsigned long vmem_starting_adr = 0x0C000000;
-
- pdev =
- (struct pci_dev *)pci_get_device(VIA_K800_BRIDGE_VID,
- VIA_K800_BRIDGE_DID, NULL);
- if (pdev != NULL) {
- pci_read_config_byte(pdev, VIA_K800_SYSTEM_MEMORY_REG,
- &sys_mem);
- pci_read_config_byte(pdev, VIA_K800_VIDEO_MEMORY_REG,
- &video_mem);
- video_mem = (video_mem & 0x70) >> 4;
- sys_mem_size = ((unsigned long)sys_mem) << 24;
- if (video_mem != 0)
- video_mem_size = (1 << (video_mem)) * 1024 * 1024;
- else
- video_mem_size = 0;
-
- vmem_starting_adr = sys_mem_size - video_mem_size;
- pci_dev_put(pdev);
- }
-
- DEBUG_MSG(KERN_INFO "Video Memory Starting Address = %lx \n",
- vmem_starting_adr);
- return vmem_starting_adr;
-}
diff --git a/drivers/video/via/iface.h b/drivers/video/via/iface.h
deleted file mode 100644
index 790ec3e..0000000
--- a/drivers/video/via/iface.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 1998-2008 VIA Technologies, Inc. All Rights Reserved.
- * Copyright 2001-2008 S3 Graphics, Inc. All Rights Reserved.
-
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation;
- * either version 2, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTIES OR REPRESENTATIONS; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR
- * A PARTICULAR PURPOSE.See the GNU General Public License
- * for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc.,
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef __IFACE_H__
-#define __IFACE_H__
-
-#define Kb (1024)
-#define Mb (Kb*Kb)
-
-#define VIA_K800_BRIDGE_VID 0x1106
-#define VIA_K800_BRIDGE_DID 0x3204
-
-#define VIA_K800_SYSTEM_MEMORY_REG 0x47
-#define VIA_K800_VIDEO_MEMORY_REG 0xA1
-
-extern int viafb_memsize;
-unsigned int viafb_get_memsize(void);
-unsigned long viafb_get_videobuf_addr(void);
-
-#endif /* __IFACE_H__ */
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index 6e1955f..02ed2f6 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -2214,8 +2214,6 @@ module_init(viafb_init);
module_exit(viafb_exit);

#ifdef MODULE
-module_param(viafb_memsize, int, S_IRUSR);
-
module_param(viafb_mode, charp, S_IRUSR);
MODULE_PARM_DESC(viafb_mode, "Set resolution (default=640x480)");

diff --git a/drivers/video/via/viafbdev.h b/drivers/video/via/viafbdev.h
index 85aa20e..ecdaed8 100644
--- a/drivers/video/via/viafbdev.h
+++ b/drivers/video/via/viafbdev.h
@@ -91,7 +91,6 @@ extern int viafb_LCD2_ON;
extern int viafb_LCD_ON;
extern int viafb_DVI_ON;
extern int viafb_hotplug;
-extern int viafb_memsize;

extern int strict_strtoul(const char *cp, unsigned int base,
unsigned long *res);
--
1.6.3.2


Subject: [PATCH 3/4] viafb: do modesetting after updating variables

viafb: do modesetting after updating variables

Reorder viafb_set_par to allow using the updated variables in
viafb_setmode. This fixes a regression that prevented proper
runtime mode changes.

Signed-off-by: Erik-Jan Post <[email protected]>
Signed-off-by: Florian Tobias Schandinat <[email protected]>
---
drivers/video/via/viafbdev.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index e16df84..f7ff4ea 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -174,15 +174,15 @@ static int viafb_set_par(struct fb_info *info)
}

if (vmode_entry) {
- viafb_setmode(vmode_entry, info->var.bits_per_pixel,
- vmode_entry1, viafb_bpp1);
-
viafb_update_fix(info);
viafb_bpp = info->var.bits_per_pixel;
if (info->var.accel_flags & FB_ACCELF_TEXT)
info->flags &= ~FBINFO_HWACCEL_DISABLED;
else
info->flags |= FBINFO_HWACCEL_DISABLED;
+
+ viafb_setmode(vmode_entry, info->var.bits_per_pixel,
+ vmode_entry1, viafb_bpp1);
}

return 0;
--
1.6.3.2

Subject: [PATCH 4/4] viafb: fix acceleration for some chips

From: Erik-Jan Post <[email protected]>

viafb: fix acceleration for some chips

This patch fixes a regression in hardware acceleration which made the
accelerated framebuffer unusable on some chips. These need extra
initialization and an extra flag which is no longer needed/available
on current chips.

Signed-off-by: Erik-Jan Post <[email protected]>
Signed-off-by: Florian Tobias Schandinat <[email protected]>
---
drivers/video/via/accel.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/video/via/accel.c b/drivers/video/via/accel.c
index 9d4f3a4..d5077df 100644
--- a/drivers/video/via/accel.c
+++ b/drivers/video/via/accel.c
@@ -137,7 +137,7 @@ static int hw_bitblt_1(void __iomem *engine, u8 op, u32 width, u32 height,
tmp, dst_pitch);
return -EINVAL;
}
- tmp = (tmp >> 3) | (dst_pitch << (16 - 3));
+ tmp = VIA_PITCH_ENABLE | (tmp >> 3) | (dst_pitch << (16 - 3));
writel(tmp, engine + 0x38);

if (op == VIA_BITBLT_FILL)
@@ -352,6 +352,9 @@ int viafb_init_engine(struct fb_info *info)
viapar->shared->vq_vram_addr = viapar->fbmem_free;
viapar->fbmem_used += VQ_SIZE;

+ /* Init 2D engine reg to reset 2D engine */
+ writel(0x0, engine + VIA_REG_KEYCONTROL);
+
/* Init AGP and VQ regs */
switch (chip_name) {
case UNICHROME_K8M890:
--
1.6.3.2

Subject: [PATCH 2/4] viafb: fix LCD hardware cursor regression

viafb: fix LCD hardware cursor regression

Although I'd consider this a hardware bug, as there is hardware out
that for whatever reason does not support hardware cursors on LCD
output we have to care about it in the driver.
This fixes a regression (invisible cursor) introduced by:
viafb: cleanup viafb_cursor

Signed-off-by: Florian Tobias Schandinat <[email protected]>
Reported-by: Julian Wollrath <[email protected]>
Tested-by: Julian Wollrath <[email protected]>
---
drivers/video/via/viafbdev.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index 02ed2f6..e16df84 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -869,7 +869,9 @@ static int viafb_cursor(struct fb_info *info, struct fb_cursor *cursor)
if (info->flags & FBINFO_HWACCEL_DISABLED || info != viafbinfo)
return -ENODEV;

- if (chip_name == UNICHROME_CLE266 && viapar->iga_path == IGA2)
+ /* LCD ouput does not support hw cursors (at least on VN896) */
+ if ((chip_name == UNICHROME_CLE266 && viapar->iga_path == IGA2) ||
+ viafb_LCD_ON)
return -ENODEV;

viafb_show_hw_cursor(info, HW_Cursor_OFF);
--
1.6.3.2

2010-01-11 21:47:11

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH 3/4] viafb: do modesetting after updating variables

On Tue, 5 Jan 2010 22:59:58 +0000
Florian Tobias Schandinat <[email protected]> wrote:

> viafb: do modesetting after updating variables
>
> Reorder viafb_set_par to allow using the updated variables in
> viafb_setmode. This fixes a regression that prevented proper
> runtime mode changes.
>
> Signed-off-by: Erik-Jan Post <[email protected]>
> Signed-off-by: Florian Tobias Schandinat <[email protected]>
> ---
> drivers/video/via/viafbdev.c | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
> index e16df84..f7ff4ea 100644
> --- a/drivers/video/via/viafbdev.c
> +++ b/drivers/video/via/viafbdev.c
> @@ -174,15 +174,15 @@ static int viafb_set_par(struct fb_info *info)
> }
>
> if (vmode_entry) {
> - viafb_setmode(vmode_entry, info->var.bits_per_pixel,
> - vmode_entry1, viafb_bpp1);
> -
> viafb_update_fix(info);
> viafb_bpp = info->var.bits_per_pixel;
> if (info->var.accel_flags & FB_ACCELF_TEXT)
> info->flags &= ~FBINFO_HWACCEL_DISABLED;
> else
> info->flags |= FBINFO_HWACCEL_DISABLED;
> +
> + viafb_setmode(vmode_entry, info->var.bits_per_pixel,
> + vmode_entry1, viafb_bpp1);
> }
>
> return 0;

Problem.

Patches 2, 3 and 4 are appropriate to 2.6.33 - they fix regressions.
But all four patches are dependent upon patches which we already have
queued for 2.6.34!

I redid patches 2, 3 and 4 so they apply to current mainline. This
particular patch (3/4) needed fixing - please check the result.

--- a/drivers/video/via/viafbdev.c~viafb-do-modesetting-after-updating-variables
+++ a/drivers/video/via/viafbdev.c
@@ -177,16 +177,15 @@ static int viafb_set_par(struct fb_info
}

if (vmode_index != VIA_RES_INVALID) {
- viafb_setmode(vmode_index, info->var.xres, info->var.yres,
- info->var.bits_per_pixel, vmode_index1,
- viafb_second_xres, viafb_second_yres, viafb_bpp1);
-
viafb_update_fix(info);
viafb_bpp = info->var.bits_per_pixel;
if (info->var.accel_flags & FB_ACCELF_TEXT)
info->flags &= ~FBINFO_HWACCEL_DISABLED;
else
info->flags |= FBINFO_HWACCEL_DISABLED;
+ viafb_setmode(vmode_index, info->var.xres, info->var.yres,
+ info->var.bits_per_pixel, vmode_index1,
+ viafb_second_xres, viafb_second_yres, viafb_bpp1);
}

return 0;
_


This reordering broke viafb-split-global-index-up.patch, which I fixed up.

Subject: Re: [PATCH 3/4] viafb: do modesetting after updating variables

Hi Andrew,

Andrew Morton schrieb:
> On Tue, 5 Jan 2010 22:59:58 +0000
> Florian Tobias Schandinat <[email protected]> wrote:
>
>> viafb: do modesetting after updating variables
>>
>> Reorder viafb_set_par to allow using the updated variables in
>> viafb_setmode. This fixes a regression that prevented proper
>> runtime mode changes.
>>
>> Signed-off-by: Erik-Jan Post <[email protected]>
>> Signed-off-by: Florian Tobias Schandinat <[email protected]>
>> ---
>> drivers/video/via/viafbdev.c | 6 +++---
>> 1 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
>> index e16df84..f7ff4ea 100644
>> --- a/drivers/video/via/viafbdev.c
>> +++ b/drivers/video/via/viafbdev.c
>> @@ -174,15 +174,15 @@ static int viafb_set_par(struct fb_info *info)
>> }
>>
>> if (vmode_entry) {
>> - viafb_setmode(vmode_entry, info->var.bits_per_pixel,
>> - vmode_entry1, viafb_bpp1);
>> -
>> viafb_update_fix(info);
>> viafb_bpp = info->var.bits_per_pixel;
>> if (info->var.accel_flags & FB_ACCELF_TEXT)
>> info->flags &= ~FBINFO_HWACCEL_DISABLED;
>> else
>> info->flags |= FBINFO_HWACCEL_DISABLED;
>> +
>> + viafb_setmode(vmode_entry, info->var.bits_per_pixel,
>> + vmode_entry1, viafb_bpp1);
>> }
>>
>> return 0;
>
> Problem.
>
> Patches 2, 3 and 4 are appropriate to 2.6.33 - they fix regressions.
> But all four patches are dependent upon patches which we already have
> queued for 2.6.34!

That are good news.

> I redid patches 2, 3 and 4 so they apply to current mainline. This
> particular patch (3/4) needed fixing - please check the result.
>
> --- a/drivers/video/via/viafbdev.c~viafb-do-modesetting-after-updating-variables
> +++ a/drivers/video/via/viafbdev.c
> @@ -177,16 +177,15 @@ static int viafb_set_par(struct fb_info
> }
>
> if (vmode_index != VIA_RES_INVALID) {
> - viafb_setmode(vmode_index, info->var.xres, info->var.yres,
> - info->var.bits_per_pixel, vmode_index1,
> - viafb_second_xres, viafb_second_yres, viafb_bpp1);
> -
> viafb_update_fix(info);
> viafb_bpp = info->var.bits_per_pixel;
> if (info->var.accel_flags & FB_ACCELF_TEXT)
> info->flags &= ~FBINFO_HWACCEL_DISABLED;
> else
> info->flags |= FBINFO_HWACCEL_DISABLED;
> + viafb_setmode(vmode_index, info->var.xres, info->var.yres,
> + info->var.bits_per_pixel, vmode_index1,
> + viafb_second_xres, viafb_second_yres, viafb_bpp1);
> }
>
> return 0;
> _

This is correct.

> This reordering broke viafb-split-global-index-up.patch, which I fixed up.

Thanks,


Florian Tobias Schandinat

2010-01-12 21:05:06

by Erik-Jan

[permalink] [raw]
Subject: Re: [PATCH 3/4] viafb: do modesetting after updating variables



Florian Tobias Schandinat wrote:
> Hi Andrew,
>
> Andrew Morton schrieb:
>> On Tue, 5 Jan 2010 22:59:58 +0000
>> Florian Tobias Schandinat <[email protected]> wrote:
>>
>>> viafb: do modesetting after updating variables
>>>
>>> Reorder viafb_set_par to allow using the updated variables in
>>> viafb_setmode. This fixes a regression that prevented proper
>>> runtime mode changes.
>>>
>>> Signed-off-by: Erik-Jan Post <[email protected]>
>>> Signed-off-by: Florian Tobias Schandinat <[email protected]>
>>> ---
>>> drivers/video/via/viafbdev.c | 6 +++---
>>> 1 files changed, 3 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
>>> index e16df84..f7ff4ea 100644
>>> --- a/drivers/video/via/viafbdev.c
>>> +++ b/drivers/video/via/viafbdev.c
>>> @@ -174,15 +174,15 @@ static int viafb_set_par(struct fb_info *info)
>>> }
>>>
>>> if (vmode_entry) {
>>> - viafb_setmode(vmode_entry, info->var.bits_per_pixel,
>>> - vmode_entry1, viafb_bpp1);
>>> -
>>> viafb_update_fix(info);
>>> viafb_bpp = info->var.bits_per_pixel;
>>> if (info->var.accel_flags & FB_ACCELF_TEXT)
>>> info->flags &= ~FBINFO_HWACCEL_DISABLED;
>>> else
>>> info->flags |= FBINFO_HWACCEL_DISABLED;
>>> +
>>> + viafb_setmode(vmode_entry, info->var.bits_per_pixel,
>>> + vmode_entry1, viafb_bpp1);
>>> }
>>>
>>> return 0;
>>
>> Problem.
>>
>> Patches 2, 3 and 4 are appropriate to 2.6.33 - they fix regressions.
>> But all four patches are dependent upon patches which we already have
>> queued for 2.6.34!
>
> That are good news.
>
>> I redid patches 2, 3 and 4 so they apply to current mainline. This
>> particular patch (3/4) needed fixing - please check the result.
>> ---
>> a/drivers/video/via/viafbdev.c~viafb-do-modesetting-after-updating-variables
>>
>> +++ a/drivers/video/via/viafbdev.c
>> @@ -177,16 +177,15 @@ static int viafb_set_par(struct fb_info }
>>
>> if (vmode_index != VIA_RES_INVALID) {
>> - viafb_setmode(vmode_index, info->var.xres, info->var.yres,
>> - info->var.bits_per_pixel, vmode_index1,
>> - viafb_second_xres, viafb_second_yres, viafb_bpp1);
>> -
>> viafb_update_fix(info);
>> viafb_bpp = info->var.bits_per_pixel;
>> if (info->var.accel_flags & FB_ACCELF_TEXT)
>> info->flags &= ~FBINFO_HWACCEL_DISABLED;
>> else
>> info->flags |= FBINFO_HWACCEL_DISABLED;
>> + viafb_setmode(vmode_index, info->var.xres, info->var.yres,
>> + info->var.bits_per_pixel, vmode_index1,
>> + viafb_second_xres, viafb_second_yres, viafb_bpp1);
>> }
>>
>> return 0;
>> _
>
> This is correct.

Yep, it is correct.

Bye,
Erik-Jan

>
>> This reordering broke viafb-split-global-index-up.patch, which I fixed
>> up.
>
> Thanks,
>
>
> Florian Tobias Schandinat
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>