* updated kollision (21.12.1 -> 21.12.2), untested
[t2-trunk.git] / architecture / powerpc64 / package / linux / 0666-ps3fb-vram.patch.disabled
bloba59f9d06d07f33c8ff694eca30948d87dad72a11
1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by scripts/Create-CopyPatch.
3
4 # T2 SDE: architecture/powerpc64/package/*/0666-ps3fb-vram.patch
5 # Copyright (C) 2021 The T2 SDE Project
6
7 # More information can be found in the files COPYING and README.
8
9 # This patch file is dual-licensed. It is available under the license the
10 # patched project is licensed under, as long as it is an OpenSource license
11 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
12 # of the GNU General Public License as published by the Free Software
13 # Foundation; either version 2 of the License, or (at your option) any later
14 # version.
15 # --- T2-COPYRIGHT-NOTE-END ---
18 Free system memory, bandwidth and simply the code by drawing into the
19 RSX DDR frame-buffer directly. Read-back is very slow, so just don't
20 do that, and use RSX accelerated X anyway ;-)
22 Signed-off-by: Ren<C3><A9> Rebe <rene@exactcode.de>
24 --- linux-5.8/drivers/video/fbdev/ps3fb.c.vanilla       2020-11-07 23:22:58.116092178 +0100
25 +++ linux-5.8/drivers/video/fbdev/ps3fb.c       2020-11-08 11:21:34.232138765 +0100
26 @@ -37,7 +37,6 @@
27  #include <linux/interrupt.h>
28  #include <linux/console.h>
29  #include <linux/ioctl.h>
30 -#include <linux/kthread.h>
31  #include <linux/freezer.h>
32  #include <linux/uaccess.h>
33  #include <linux/fb.h>
34 @@ -166,8 +165,6 @@
35         atomic_t ext_flip;      /* on/off flip with vsync */
36         atomic_t f_count;       /* fb_open count */
37         int is_blanked;
38 -       int is_kicked;
39 -       struct task_struct *task;
40  };
41  static struct ps3fb_priv ps3fb;
42  static int ps3fb_gpu_major;
43 @@ -751,27 +748,10 @@
44         return id;
45  }
47 -static void ps3fb_sync_image(struct device *dev, u64 frame_offset,
48 -                            u64 dst_offset, u64 src_offset, u32 width,
49 -                            u32 height, u32 dst_line_length,
50 -                            u32 src_line_length)
51 +static void ps3fb_sync_image(struct device *dev, u64 frame_offset)
52  {
53         int status;
55 -       src_offset += GPU_FB_START;
57 -       mutex_lock(&ps3_gpu_mutex);
58 -       status = ps3fb_fb_blit(&ps3fb.fifo,
59 -                              dst_offset,
60 -                              GPU_IOIF + src_offset,
61 -                              width, height,
62 -                              dst_line_length, src_line_length,
63 -                              L1GPU_FB_BLIT_WAIT_FOR_COMPLETION);
64 -       mutex_unlock(&ps3_gpu_mutex);
66 -       if (status)
67 -               dev_err(dev, "%s: ps3fb_fb_blit failed: %d\n", __func__,
68 -                       status);
69  #ifdef HEAD_A
70         status = lv1_gpu_display_flip(ps3fb.context_handle, 0, frame_offset);
71         if (status)
72 @@ -792,6 +772,8 @@
73         int error = 0;
74         u64 ddr_base, xdr_base;
76 +       goto out;
78         if (frame > par->num_frames - 1) {
79                 dev_dbg(info->device, "%s: invalid frame number (%u)\n",
80                         __func__, frame);
81 @@ -799,13 +781,9 @@
82                 goto out;
83         }
85 -       xdr_base = frame * par->xdr_frame_size;
86         ddr_base = frame * par->ddr_frame_size;
88 -       ps3fb_sync_image(info->device, ddr_base + par->full_offset,
89 -                        ddr_base + par->fb_offset, xdr_base + par->pan_offset,
90 -                        par->width, par->height, par->ddr_line_length,
91 -                        info->fix.line_length);
92 +       ps3fb_sync_image(info->device, ddr_base + par->full_offset);
94  out:
95         return error;
96 @@ -936,20 +936,9 @@
97                 par->mode_id = par->new_mode_id;
98         }
100 -       /* Clear XDR frame buffer memory */
101         memset((void __force *)info->screen_base, 0, info->fix.smem_len);
103 -       /* Clear DDR frame buffer memory */
104 -       lines = vmode->yres * par->num_frames;
105 -       if (par->full_offset)
106 -               lines++;
107 -       maxlines = info->fix.smem_len / ddr_line_length;
108 -       for (dst = 0; lines; dst += maxlines * ddr_line_length) {
109 -               unsigned int l = min(lines, maxlines);
110 -               ps3fb_sync_image(info->device, 0, dst, 0, vmode->xres, l,
111 -                                ddr_line_length, ddr_line_length);
112 -               lines -= l;
113 -       }
114 +       ps3fb_sync_image(info->device, 0);
116         return 0;
118 @@ -1275,25 +1242,6 @@
119         return retval;
122 -static int ps3fbd(void *arg)
124 -       struct fb_info *info = arg;
126 -       set_freezable();
127 -       while (!kthread_should_stop()) {
128 -               try_to_freeze();
129 -               set_current_state(TASK_INTERRUPTIBLE);
130 -               if (ps3fb.is_kicked) {
131 -                       ps3fb.is_kicked = 0;
132 -                       console_lock();
133 -                       ps3fb_sync(info, 0);    /* single buffer */
134 -                       console_unlock();
135 -               }
136 -               schedule();
137 -       }
138 -       return 0;
141  static void ps3fb_print_graph_exception_info(struct device *dev,
142                                              struct gpu_graph_exception_info *info)
144 @@ -1344,11 +1292,6 @@
145         if (v1 & (1 << GPU_INTR_STATUS_VSYNC_1)) {
146                 /* VSYNC */
147                 ps3fb.vblank_count = head->vblank_count;
148 -               if (ps3fb.task && !ps3fb.is_blanked &&
149 -                   !atomic_read(&ps3fb.ext_flip)) {
150 -                       ps3fb.is_kicked = 1;
151 -                       wake_up_process(ps3fb.task);
152 -               }
153                 wake_up_interruptible(&ps3fb.wait_vsync);
154         }
156 @@ -1470,7 +1413,6 @@
157         struct gpu_driver_info *dinfo;
158         void *fb_start;
159         int status;
160 -       struct task_struct *task;
161         unsigned long max_ps3fb_size;
163         if (ps3fb_videomemory.size < GPU_CMD_BUF_SIZE) {
164 @@ -1659,13 +1601,13 @@
165          * frame buffer at offset GPU_FB_START and save some precious XDR
166          * memory
167          */
168 -       fb_start = ps3fb_videomemory.address + GPU_FB_START;
169 +       fb_start = ioremap_wc(ps3fb.vram_lpar, 16*1024*1024); //ps3fb_videomemory.address + GPU_FB_START;
170         info->screen_base = (char __force __iomem *)fb_start;
171 -       info->fix.smem_start = __pa(fb_start);
172 -       info->fix.smem_len = ps3fb_videomemory.size - GPU_FB_START;
173 +       info->fix.smem_start = ps3fb.vram_lpar; //__pa(fb_start);
174 +       info->fix.smem_len = 16*1024*1024; // ps3fb_videomemory.size - GPU_FB_START;
176         info->pseudo_palette = par->pseudo_palette;
177 -       info->flags = FBINFO_DEFAULT | FBINFO_READS_FAST |
178 +       info->flags = FBINFO_DEFAULT | // FBINFO_READS_FAST |
179                       FBINFO_HWACCEL_XPAN | FBINFO_HWACCEL_YPAN;
181         retval = fb_alloc_cmap(&info->cmap, 256, 0);
182 @@ -1692,14 +1634,6 @@
183                  dev_driver_string(info->dev), dev_name(info->dev),
184                  info->fix.smem_len >> 10);
186 -       task = kthread_run(ps3fbd, info, DEVICE_NAME);
187 -       if (IS_ERR(task)) {
188 -               retval = PTR_ERR(task);
189 -               goto err_unregister_framebuffer;
190 -       }
192 -       ps3fb.task = task;
194         /* FIFO access */
195         status = register_chrdev(ps3fb_gpu_major, DEVICE_NAME, &ps3fb_gpu_fops);
196         if (status < 0) {
197 @@ -1756,11 +1690,6 @@
198         atomic_inc(&ps3fb.ext_flip);    /* flip off */
199         ps3fb.dinfo->irq.mask = 0;
201 -       if (ps3fb.task) {
202 -               struct task_struct *task = ps3fb.task;
203 -               ps3fb.task = NULL;
204 -               kthread_stop(task);
205 -       }
206         if (ps3fb.irq_no) {
207                 free_irq(ps3fb.irq_no, &dev->core);
208                 ps3_irq_plug_destroy(ps3fb.irq_no);