diff options
| author | Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> | 2009-06-10 00:38:48 -0400 |
|---|---|---|
| committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-06-14 23:26:20 -0400 |
| commit | d3352c9f1e8e2f2989d9686c8aa8acb4842fe75e (patch) | |
| tree | ea8a18d573a45f913d9e0669a17a0b39835e55ff | |
| parent | 56ac72dba5d24a477d281b985797d5e62d3f5c2e (diff) | |
ps3fb/vram: Extract common GPU stuff into <asm/ps3gpu.h>
Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Cc: linux-fbdev-devel@lists.sourceforge.net
Cc: Jim Paris <jim@jtan.com>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
| -rw-r--r-- | arch/powerpc/include/asm/ps3.h | 3 | ||||
| -rw-r--r-- | arch/powerpc/include/asm/ps3gpu.h | 78 | ||||
| -rw-r--r-- | arch/powerpc/platforms/ps3/setup.c | 1 | ||||
| -rw-r--r-- | drivers/block/ps3vram.c | 21 | ||||
| -rw-r--r-- | drivers/ps3/ps3av_cmd.c | 3 | ||||
| -rw-r--r-- | drivers/video/ps3fb.c | 72 |
6 files changed, 110 insertions, 68 deletions
diff --git a/arch/powerpc/include/asm/ps3.h b/arch/powerpc/include/asm/ps3.h index cdb6fd814de8..b9e4987986dd 100644 --- a/arch/powerpc/include/asm/ps3.h +++ b/arch/powerpc/include/asm/ps3.h | |||
| @@ -520,7 +520,4 @@ void ps3_sync_irq(int node); | |||
| 520 | u32 ps3_get_hw_thread_id(int cpu); | 520 | u32 ps3_get_hw_thread_id(int cpu); |
| 521 | u64 ps3_get_spe_id(void *arg); | 521 | u64 ps3_get_spe_id(void *arg); |
| 522 | 522 | ||
| 523 | /* mutex synchronizing GPU accesses and video mode changes */ | ||
| 524 | extern struct mutex ps3_gpu_mutex; | ||
| 525 | |||
| 526 | #endif | 523 | #endif |
diff --git a/arch/powerpc/include/asm/ps3gpu.h b/arch/powerpc/include/asm/ps3gpu.h new file mode 100644 index 000000000000..1037efae4a51 --- /dev/null +++ b/arch/powerpc/include/asm/ps3gpu.h | |||
| @@ -0,0 +1,78 @@ | |||
| 1 | /* | ||
| 2 | * PS3 GPU declarations. | ||
| 3 | * | ||
| 4 | * Copyright 2009 Sony Corporation | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; version 2 of the License. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License | ||
| 16 | * along with this program. | ||
| 17 | * If not, see <http://www.gnu.org/licenses/>. | ||
| 18 | */ | ||
| 19 | |||
| 20 | #ifndef _ASM_POWERPC_PS3GPU_H | ||
| 21 | #define _ASM_POWERPC_PS3GPU_H | ||
| 22 | |||
| 23 | #include <linux/mutex.h> | ||
| 24 | |||
| 25 | #include <asm/lv1call.h> | ||
| 26 | |||
| 27 | |||
| 28 | #define L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_SYNC 0x101 | ||
| 29 | #define L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_FLIP 0x102 | ||
| 30 | |||
| 31 | #define L1GPU_CONTEXT_ATTRIBUTE_FB_SETUP 0x600 | ||
| 32 | #define L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT 0x601 | ||
| 33 | #define L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT_SYNC 0x602 | ||
| 34 | |||
| 35 | #define L1GPU_FB_BLIT_WAIT_FOR_COMPLETION (1ULL << 32) | ||
| 36 | |||
| 37 | #define L1GPU_DISPLAY_SYNC_HSYNC 1 | ||
| 38 | #define L1GPU_DISPLAY_SYNC_VSYNC 2 | ||
| 39 | |||
| 40 | |||
| 41 | /* mutex synchronizing GPU accesses and video mode changes */ | ||
| 42 | extern struct mutex ps3_gpu_mutex; | ||
| 43 | |||
| 44 | |||
| 45 | static inline int lv1_gpu_display_sync(u64 context_handle, u64 head, | ||
| 46 | u64 ddr_offset) | ||
| 47 | { | ||
| 48 | return lv1_gpu_context_attribute(context_handle, | ||
| 49 | L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_SYNC, | ||
| 50 | head, ddr_offset, 0, 0); | ||
| 51 | } | ||
| 52 | |||
| 53 | static inline int lv1_gpu_display_flip(u64 context_handle, u64 head, | ||
| 54 | u64 ddr_offset) | ||
| 55 | { | ||
| 56 | return lv1_gpu_context_attribute(context_handle, | ||
| 57 | L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_FLIP, | ||
| 58 | head, ddr_offset, 0, 0); | ||
| 59 | } | ||
| 60 | |||
| 61 | static inline int lv1_gpu_fb_setup(u64 context_handle, u64 xdr_lpar, | ||
| 62 | u64 xdr_size, u64 ioif_offset) | ||
| 63 | { | ||
| 64 | return lv1_gpu_context_attribute(context_handle, | ||
| 65 | L1GPU_CONTEXT_ATTRIBUTE_FB_SETUP, | ||
| 66 | xdr_lpar, xdr_size, ioif_offset, 0); | ||
| 67 | } | ||
| 68 | |||
| 69 | static inline int lv1_gpu_fb_blit(u64 context_handle, u64 ddr_offset, | ||
| 70 | u64 ioif_offset, u64 sync_width, u64 pitch) | ||
| 71 | { | ||
| 72 | return lv1_gpu_context_attribute(context_handle, | ||
| 73 | L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT, | ||
| 74 | ddr_offset, ioif_offset, sync_width, | ||
| 75 | pitch); | ||
| 76 | } | ||
| 77 | |||
| 78 | #endif /* _ASM_POWERPC_PS3GPU_H */ | ||
diff --git a/arch/powerpc/platforms/ps3/setup.c b/arch/powerpc/platforms/ps3/setup.c index 1a7b5ae0c83e..149bea2ce583 100644 --- a/arch/powerpc/platforms/ps3/setup.c +++ b/arch/powerpc/platforms/ps3/setup.c | |||
| @@ -32,6 +32,7 @@ | |||
| 32 | #include <asm/udbg.h> | 32 | #include <asm/udbg.h> |
| 33 | #include <asm/prom.h> | 33 | #include <asm/prom.h> |
| 34 | #include <asm/lv1call.h> | 34 | #include <asm/lv1call.h> |
| 35 | #include <asm/ps3gpu.h> | ||
| 35 | 36 | ||
| 36 | #include "platform.h" | 37 | #include "platform.h" |
| 37 | 38 | ||
diff --git a/drivers/block/ps3vram.c b/drivers/block/ps3vram.c index 83c14533aea5..2c2ea9cb207b 100644 --- a/drivers/block/ps3vram.c +++ b/drivers/block/ps3vram.c | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | #include <asm/iommu.h> | 17 | #include <asm/iommu.h> |
| 18 | #include <asm/lv1call.h> | 18 | #include <asm/lv1call.h> |
| 19 | #include <asm/ps3.h> | 19 | #include <asm/ps3.h> |
| 20 | #include <asm/ps3gpu.h> | ||
| 20 | 21 | ||
| 21 | 22 | ||
| 22 | #define DEVICE_NAME "ps3vram" | 23 | #define DEVICE_NAME "ps3vram" |
| @@ -46,8 +47,6 @@ | |||
| 46 | #define NV_MEMORY_TO_MEMORY_FORMAT_OFFSET_IN 0x0000030c | 47 | #define NV_MEMORY_TO_MEMORY_FORMAT_OFFSET_IN 0x0000030c |
| 47 | #define NV_MEMORY_TO_MEMORY_FORMAT_NOTIFY 0x00000104 | 48 | #define NV_MEMORY_TO_MEMORY_FORMAT_NOTIFY 0x00000104 |
| 48 | 49 | ||
| 49 | #define L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT 0x601 | ||
| 50 | |||
| 51 | #define CACHE_PAGE_PRESENT 1 | 50 | #define CACHE_PAGE_PRESENT 1 |
| 52 | #define CACHE_PAGE_DIRTY 2 | 51 | #define CACHE_PAGE_DIRTY 2 |
| 53 | 52 | ||
| @@ -184,13 +183,10 @@ static void ps3vram_rewind_ring(struct ps3_system_bus_device *dev) | |||
| 184 | priv->ctrl[CTRL_PUT] = FIFO_BASE + FIFO_OFFSET; | 183 | priv->ctrl[CTRL_PUT] = FIFO_BASE + FIFO_OFFSET; |
| 185 | 184 | ||
| 186 | /* asking the HV for a blit will kick the FIFO */ | 185 | /* asking the HV for a blit will kick the FIFO */ |
| 187 | status = lv1_gpu_context_attribute(priv->context_handle, | 186 | status = lv1_gpu_fb_blit(priv->context_handle, 0, 0, 0, 0); |
| 188 | L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT, 0, | ||
| 189 | 0, 0, 0); | ||
| 190 | if (status) | 187 | if (status) |
| 191 | dev_err(&dev->core, | 188 | dev_err(&dev->core, "%s: lv1_gpu_fb_blit failed %d\n", |
| 192 | "%s: lv1_gpu_context_attribute failed %d\n", __func__, | 189 | __func__, status); |
| 193 | status); | ||
| 194 | 190 | ||
| 195 | priv->fifo_ptr = priv->fifo_base; | 191 | priv->fifo_ptr = priv->fifo_base; |
| 196 | } | 192 | } |
| @@ -206,13 +202,10 @@ static void ps3vram_fire_ring(struct ps3_system_bus_device *dev) | |||
| 206 | (priv->fifo_ptr - priv->fifo_base) * sizeof(u32); | 202 | (priv->fifo_ptr - priv->fifo_base) * sizeof(u32); |
| 207 | 203 | ||
| 208 | /* asking the HV for a blit will kick the FIFO */ | 204 | /* asking the HV for a blit will kick the FIFO */ |
| 209 | status = lv1_gpu_context_attribute(priv->context_handle, | 205 | status = lv1_gpu_fb_blit(priv->context_handle, 0, 0, 0, 0); |
| 210 | L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT, 0, | ||
| 211 | 0, 0, 0); | ||
| 212 | if (status) | 206 | if (status) |
| 213 | dev_err(&dev->core, | 207 | dev_err(&dev->core, "%s: lv1_gpu_fb_blit failed %d\n", |
| 214 | "%s: lv1_gpu_context_attribute failed %d\n", __func__, | 208 | __func__, status); |
| 215 | status); | ||
| 216 | 209 | ||
| 217 | if ((priv->fifo_ptr - priv->fifo_base) * sizeof(u32) > | 210 | if ((priv->fifo_ptr - priv->fifo_base) * sizeof(u32) > |
| 218 | FIFO_SIZE - 1024) { | 211 | FIFO_SIZE - 1024) { |
diff --git a/drivers/ps3/ps3av_cmd.c b/drivers/ps3/ps3av_cmd.c index 716596e8e5b0..f555fedd5073 100644 --- a/drivers/ps3/ps3av_cmd.c +++ b/drivers/ps3/ps3av_cmd.c | |||
| @@ -21,9 +21,10 @@ | |||
| 21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
| 22 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
| 23 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
| 24 | |||
| 24 | #include <asm/ps3av.h> | 25 | #include <asm/ps3av.h> |
| 25 | #include <asm/ps3fb.h> | ||
| 26 | #include <asm/ps3.h> | 26 | #include <asm/ps3.h> |
| 27 | #include <asm/ps3gpu.h> | ||
| 27 | 28 | ||
| 28 | #include "vuart.h" | 29 | #include "vuart.h" |
| 29 | 30 | ||
diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c index a61c1d89bd87..13c876c6e32c 100644 --- a/drivers/video/ps3fb.c +++ b/drivers/video/ps3fb.c | |||
| @@ -37,21 +37,11 @@ | |||
| 37 | #include <asm/ps3av.h> | 37 | #include <asm/ps3av.h> |
| 38 | #include <asm/ps3fb.h> | ||
