Skip to contentSkip to conversation

gma500: Add 2D acceleration

PATCH In review Alan Cox 4 participants 7 messages Feb 24, 2011 – Mar 1, 2011 Staging

lore
Share & tools
lore

Alan Cox

author
#0 lore raw

PATCH 1/2 gma500: Add 2D acceleration

This is taken from Richard Purdie's previous attempt to rip the heart out of the PVR driver and stake it.

Accelerate copies and fills.

[Revised patch which disables the methods until we can finish debugging them]

---

 drivers/staging/gma500/Makefile  |    1 
 drivers/staging/gma500/psb_2d.c  |  411 ++++++++++++++++++++++++++++++++++++++
 drivers/staging/gma500/psb_drv.c |   12 +
 drivers/staging/gma500/psb_drv.h |   13 +
 drivers/staging/gma500/psb_fb.c  |    8 -
 drivers/staging/gma500/psb_irq.c |    4 
 6 files changed, 444 insertions(+), 5 deletions(-)
 create mode 100644 drivers/staging/gma500/psb_2d.c
drivers/staging/gma500/Makefile +1 -0
index dba41e3..b9a7d2e 100644
@@ -6,6 +6,7 @@ ccflags-y += -Iinclude/drm
 psb_gfx-y += psb_bl.o \
 	  psb_drv.o \
 	  psb_fb.o \
+	  psb_2d.o \
 	  psb_gtt.o \
 	  psb_intel_bios.o \
 	  psb_intel_display.o \
drivers/staging/gma500/psb_2d.c new file +411 -0

411 lines not on this page · raw message

drivers/staging/gma500/psb_drv.c +11 -1
index 6deec79..d82d544 100644
@@ -424,6 +424,7 @@ static int psb_do_init(struct drm_device *dev)
 		goto out_err;
 	}
 
+
 	stolen_gtt = (pg->stolen_size >> PAGE_SHIFT) * 4;
 	stolen_gtt = (stolen_gtt + PAGE_SIZE - 1) >> PAGE_SHIFT;
 	stolen_gtt =
@@ -449,6 +450,7 @@ static int psb_do_init(struct drm_device *dev)
 		     _PSB_CC_REVISION_DESIGNER_SHIFT);
 	}
 
+
 	spin_lock_init(&dev_priv->irqmask_lock);
 
 	tt_pages = (pg->gatt_pages < PSB_TT_PRIV0_PLIMIT) ?
@@ -457,6 +459,14 @@ static int psb_do_init(struct drm_device *dev)
 	tt_pages -= tt_start >> PAGE_SHIFT;
 	dev_priv->sizes.ta_mem_size = 0;
 
+	PSB_WSGX32(0x00000000, PSB_CR_BIF_BANK0);
+	PSB_WSGX32(0x00000000, PSB_CR_BIF_BANK1);
+	PSB_RSGX32(PSB_CR_BIF_BANK1);
+        PSB_WSGX32(PSB_RSGX32(PSB_CR_BIF_CTRL) | _PSB_MMU_ER_MASK,
+							PSB_CR_BIF_CTRL);
+	psb_spank(dev_priv);
+       
+      	PSB_WSGX32(pg->mmu_gatt_start, PSB_CR_BIF_TWOD_REQ_BASE);
 
 	/* TT region managed by TTM. */
 	if (!ttm_bo_init_mm(bdev, TTM_PL_TT,
@@ -478,7 +488,6 @@ static int psb_do_init(struct drm_device *dev)
 			PSB_MEM_TT_START / (1024*1024);
 	}
 
-
 	PSB_DEBUG_INIT("Init MSVDX\n");
 	return 0;
 out_err:
@@ -763,6 +772,7 @@ static int psb_driver_load(struct drm_device *dev, unsigned long chipset)
 	dev_priv->pipestat[1] = 0;
 	dev_priv->pipestat[2] = 0;
 	spin_lock_irqsave(&dev_priv->irqmask_lock, irqflags);
+	PSB_WVDC32(0xFFFFFFFF, PSB_HWSTAM);
 	PSB_WVDC32(0x00000000, PSB_INT_ENABLE_R);
 	PSB_WVDC32(0xFFFFFFFF, PSB_INT_MASK_R);
 	spin_unlock_irqrestore(&dev_priv->irqmask_lock, irqflags);
drivers/staging/gma500/psb_drv.h +13 -0
index cbc18ad..80b5c8d 100644
@@ -901,6 +901,19 @@ extern int psbfb_kms_on_ioctl(struct drm_device *dev, void *data,
 extern void *psbfb_vdc_reg(struct drm_device* dev);
 
 /*
+ * psb_2d.c
+ */
+extern void psbfb_fillrect(struct fb_info *info,
+					const struct fb_fillrect *rect);
+extern void psbfb_copyarea(struct fb_info *info,
+					const struct fb_copyarea *region);
+extern void psbfb_imageblit(struct fb_info *info,
+					const struct fb_image *image);
+extern int psbfb_sync(struct fb_info *info);
+
+extern void psb_spank(struct drm_psb_private *dev_priv);
+
+/*
  *psb_reset.c
  */
 
drivers/staging/gma500/psb_fb.c +5 -3
index 6585e88..94d8457 100644
@@ -279,10 +279,11 @@ static struct fb_ops psbfb_ops = {
 	.fb_set_par = drm_fb_helper_set_par,
 	.fb_blank = drm_fb_helper_blank,
 	.fb_setcolreg = psbfb_setcolreg,
-	.fb_fillrect = cfb_fillrect,
-	.fb_copyarea = cfb_copyarea,
-	.fb_imageblit = cfb_imageblit,
+	.fb_fillrect = psbfb_fillrect,
+	.fb_copyarea = psbfb_copyarea,
+	.fb_imageblit = psbfb_imageblit,
 	.fb_mmap = psbfb_mmap,
+	.fb_sync = psbfb_sync,
 };
 
 static struct drm_framebuffer *psb_framebuffer_create
@@ -394,6 +395,7 @@ static struct drm_framebuffer *psb_user_framebuffer_create
 	strcpy(info->fix.id, "psbfb");
 
 	info->flags = FBINFO_DEFAULT;
+	info->fix.accel = FB_ACCEL_I830;	/*FIXMEAC*/
 	info->fbops = &psbfb_ops;
 
 	info->fix.smem_start = dev->mode_config.fb_base;
drivers/staging/gma500/psb_irq.c +3 -1
index a0ef4bb..4597c88 100644
@@ -256,6 +256,7 @@ irqreturn_t psb_irq_handler(DRM_IRQ_ARGS)
 		PSB_WSGX32(s2, PSB_CR_EVENT_HOST_CLEAR2);
 		/* if s & _PSB_CE_TWOD_COMPLETE we have 2D done but
 		   we may as well poll even if we add that ! */
+		handled = 1;
 	}
 
 	PSB_WVDC32(vdc_stat, PSB_INT_IDENTITY_R);
@@ -300,9 +301,10 @@ void psb_irq_preinstall_islands(struct drm_device *dev, int hw_islands)
 						_MDFLD_PIPEC_EVENT_FLAG;
 		}
 	}
+/* NO I DONT WANT ANY IRQS GRRR FIXMEAC */
 	if (hw_islands & OSPM_GRAPHICS_ISLAND)
 		dev_priv->vdc_irq_mask |= _PSB_IRQ_SGX_FLAG;
-
+/* */
 	/*This register is safe even if display island is off*/
 	PSB_WVDC32(~dev_priv->vdc_irq_mask, PSB_INT_MASK_R);
 
author
#1 lore raw

PATCH 2/2 gma500: Rip out the memory manager

At this point we simply stuff the display at the start of the stolen memory area that the BIOS gave us. No user framebuffers no multiple framebuffers.

However from here we have a better chance of seeing what is going on and writing an actual gem manager for the driver.

---

 drivers/staging/gma500/Makefile                 |    7 
 drivers/staging/gma500/psb_buffer.c             |  450 ----------------
 drivers/staging/gma500/psb_drm.h                |    3 
 drivers/staging/gma500/psb_drv.c                |  170 +-----
 drivers/staging/gma500/psb_drv.h                |   37 -
 drivers/staging/gma500/psb_fb.c                 |  112 ----
 drivers/staging/gma500/psb_fence.c              |  122 ----
 drivers/staging/gma500/psb_gtt.c                |   84 ---
 drivers/staging/gma500/psb_sgx.c                |  238 ---------
 drivers/staging/gma500/psb_sgx.h                |    6 
 drivers/staging/gma500/psb_ttm_fence.c          |  605 ----------------------
 drivers/staging/gma500/psb_ttm_fence_api.h      |  272 ----------
 drivers/staging/gma500/psb_ttm_fence_driver.h   |  302 -----------
 drivers/staging/gma500/psb_ttm_fence_user.c     |  237 ---------
 drivers/staging/gma500/psb_ttm_fence_user.h     |  140 -----
 drivers/staging/gma500/psb_ttm_glue.c           |  349 -------------
 drivers/staging/gma500/psb_ttm_placement_user.c |  628 -----------------------
 drivers/staging/gma500/psb_ttm_placement_user.h |  252 ---------
 drivers/staging/gma500/psb_ttm_userobj_api.h    |   85 ---
 19 files changed, 32 insertions(+), 4067 deletions(-)
 delete mode 100644 drivers/staging/gma500/psb_buffer.c
 delete mode 100644 drivers/staging/gma500/psb_fence.c
 delete mode 100644 drivers/staging/gma500/psb_sgx.c
 delete mode 100644 drivers/staging/gma500/psb_ttm_fence.c
 delete mode 100644 drivers/staging/gma500/psb_ttm_fence_api.h
 delete mode 100644 drivers/staging/gma500/psb_ttm_fence_driver.h
 delete mode 100644 drivers/staging/gma500/psb_ttm_fence_user.c
 delete mode 100644 drivers/staging/gma500/psb_ttm_fence_user.h
 delete mode 100644 drivers/staging/gma500/psb_ttm_glue.c
 delete mode 100644 drivers/staging/gma500/psb_ttm_placement_user.c
 delete mode 100644 drivers/staging/gma500/psb_ttm_placement_user.h
 delete mode 100644 drivers/staging/gma500/psb_ttm_userobj_api.h
drivers/staging/gma500/Makefile +0 -7
index b9a7d2e..4469616 100644
@@ -15,15 +15,8 @@ psb_gfx-y += psb_bl.o \
 	  psb_intel_modes.o \
 	  psb_intel_sdvo.o \
 	  psb_reset.o \
-	  psb_sgx.o \
 	  psb_pvr_glue.o \
-	  psb_buffer.o \
-	  psb_fence.o \
 	  psb_mmu.o \
-	  psb_ttm_glue.o \
-	  psb_ttm_fence.o \
-	  psb_ttm_fence_user.o \
-	  psb_ttm_placement_user.o \
 	  psb_powermgmt.o \
 	  psb_irq.o
 
drivers/staging/gma500/psb_buffer.c deleted +0 -450

450 lines not on this page · raw message

drivers/staging/gma500/psb_drm.h +0 -3
index fb9b424..2fb9f24 100644
@@ -28,9 +28,6 @@
 #include "drm_mode.h"
 #endif
 
-#include "psb_ttm_fence_user.h"
-#include "psb_ttm_placement_user.h"
-
 #define DRM_PSB_SAREA_MAJOR 0
 #define DRM_PSB_SAREA_MINOR 2
 #define PSB_FIXED_SHIFT 16
drivers/staging/gma500/psb_drv.c +23 -147

283 lines not on this page · raw message

drivers/staging/gma500/psb_drv.h +7 -30
index 80b5c8d..b81b544 100644
@@ -30,17 +30,10 @@
 #include "psb_intel_drv.h"
 #include "psb_gtt.h"
 #include "psb_powermgmt.h"
-#include "ttm/ttm_object.h"
-#include "psb_ttm_fence_driver.h"
-#include "psb_ttm_userobj_api.h"
-#include "ttm/ttm_bo_driver.h"
-#include "ttm/ttm_lock.h"
 
 /*Append new drm mode definition here, align with libdrm definition*/
 #define DRM_MODE_SCALE_NO_SCALE   2
 
-extern struct ttm_bo_driver psb_ttm_bo_driver;
-
 enum {
 	CHIP_PSB_8108 = 0,
 	CHIP_PSB_8109 = 1,
@@ -337,20 +330,7 @@ struct drm_psb_private {
 	void * dbi_dsr_info;
 	void * dsi_configs[2];
 
-	/*
-	 *TTM Glue.
-	 */
-
-	struct drm_global_reference mem_global_ref;
-	struct ttm_bo_global_ref bo_global_ref;
-	int has_global;
-
 	struct drm_device *dev;
-	struct ttm_object_device *tdev;
-	struct ttm_fence_device fdev;
-	struct ttm_bo_device bdev;
-	struct ttm_lock ttm_lock;
-	struct vm_operations_struct *ttm_vm_ops;
 	int has_fence_device;
 	int has_bo_device;
 
@@ -710,7 +690,7 @@ struct psb_file_data {	/* TODO: Audit this, remove the indirection and set
 };
 
 struct psb_fpriv {
-	struct ttm_object_file *tfile;
+	void *tfile;
 };
 
 struct psb_mmu_driver;
@@ -730,6 +710,7 @@ static inline struct drm_psb_private *psb_priv(struct drm_device *dev)
 	return (struct drm_psb_private *) dev->dev_private;
 }
 
+#if 0
 /*
  *TTM glue. psb_ttm_glue.c
  */
@@ -770,6 +751,7 @@ extern int psb_ttm_global_init(struct drm_psb_private *dev_priv);
 extern void psb_ttm_global_release(struct drm_psb_private *dev_priv);
 extern int psb_getpageaddrs_ioctl(struct drm_device *dev, void *data,
 				struct drm_file *file_priv);
+#endif				
 /*
  *MMU stuff.
  */
@@ -823,7 +805,7 @@ extern int psb_cmdbuf_ioctl(struct drm_device *dev, void *data,
 extern int psb_reg_submit(struct drm_psb_private *dev_priv,
 			  uint32_t *regs, unsigned int cmds);
 
-
+#if 0
 extern void psb_fence_or_sync(struct drm_file *file_priv,
 			      uint32_t engine,
 			      uint32_t fence_types,
@@ -836,7 +818,7 @@ extern int psb_validate_kernel_buffer(struct psb_context *context,
 				      uint32_t fence_class,
 				      uint64_t set_flags,
 				      uint64_t clr_flags);
-
+#endif
 /*
  *psb_irq.c
  */
@@ -865,6 +847,7 @@ psb_disable_pipestat(struct drm_psb_private *dev_priv, int pipe, u32 mask);
 
 extern u32 psb_get_vblank_counter(struct drm_device *dev, int crtc);
 
+#if 0
 /*
  *psb_fence.c
  */
@@ -880,13 +863,7 @@ extern void psb_fence_error(struct drm_device *dev,
 			    uint32_t sequence, uint32_t type, int error);
 extern int psb_ttm_fence_device_init(struct ttm_fence_device *fdev);
 
-/* MSVDX/Topaz stuff */
-extern int psb_remove_videoctx(struct drm_psb_private *dev_priv, struct file *filp);
-
-extern int lnc_video_frameskip(struct drm_device *dev,
-			       uint64_t user_pointer);
-extern int lnc_video_getparam(struct drm_device *dev, void *data,
-			      struct drm_file *file_priv);
+#endif
 
 /*
  *psb_fb.c
drivers/staging/gma500/psb_fb.c +2 -110

130 lines not on this page · raw message

drivers/staging/gma500/psb_fence.c deleted +0 -122

122 lines not on this page · raw message

drivers/staging/gma500/psb_gtt.c +0 -84

90 lines not on this page · raw message

drivers/staging/gma500/psb_sgx.c deleted +0 -238

238 lines not on this page · raw message

drivers/staging/gma500/psb_sgx.h +0 -6
index 9300e2d..71455a0 100644
@@ -21,12 +21,6 @@
 #ifndef _PSB_SGX_H_
 #define _PSB_SGX_H_
 
-extern int psb_submit_video_cmdbuf(struct drm_device *dev,
-			       struct ttm_buffer_object *cmd_buffer,
-			       unsigned long cmd_offset,
-			       unsigned long cmd_size,
-			       struct ttm_fence_object *fence);
-
 extern int drm_idle_check_interval;
 
 #endif
drivers/staging/gma500/psb_ttm_fence.c deleted +0 -605

605 lines not on this page · raw message

drivers/staging/gma500/psb_ttm_fence_api.h deleted +0 -272

272 lines not on this page · raw message

drivers/staging/gma500/psb_ttm_fence_driver.h deleted +0 -302

302 lines not on this page · raw message

drivers/staging/gma500/psb_ttm_fence_user.c deleted +0 -237

237 lines not on this page · raw message

drivers/staging/gma500/psb_ttm_fence_user.h deleted +0 -140

139 lines not on this page · raw message

drivers/staging/gma500/psb_ttm_glue.c deleted +0 -349

349 lines not on this page · raw message

drivers/staging/gma500/psb_ttm_placement_user.c deleted +0 -628

628 lines not on this page · raw message

drivers/staging/gma500/psb_ttm_placement_user.h deleted +0 -252

252 lines not on this page · raw message

drivers/staging/gma500/psb_ttm_userobj_api.h deleted +0 -85

85 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.

#2 lore raw

Re: [PATCH 2/2] staging: gma500: Rip out the memory manager

Quoted 7 lines · Alan Cox

At this point we simply stuff the display at the start of the stolen memory area that the BIOS gave us. No user framebuffers no multiple framebuffers.

However from here we have a better chance of seeing what is going on and writing an actual gem manager for the driver.

This doesn't apply.

The 1/2 patch had some fuzz in the Makefile, which I fixed up by hand, but it makes me think that you are diffing this against some different tree.

Care to redo it and resend?

thanks,

greg k-h

#3 lore raw

Re: [PATCH 2/2] staging: gma500: Rip out the memory manager

Quoted 8 lines · On Mon, 28 Feb 2011 18:03:02 -0800 Greg KH <[email protected]> wrote:
Quoted 7 lines · Alan Cox

At this point we simply stuff the display at the start of the stolen memory area that the BIOS gave us. No user framebuffers no multiple framebuffers.

However from here we have a better chance of seeing what is going on and writing an actual gem manager for the driver.

Quoted 7 lines
Quoted 1 line

This doesn't apply.

The 1/2 patch had some fuzz in the Makefile, which I fixed up by hand, but it makes me think that you are diffing this against some different tree.

I've investigated this. The cause seems to be a patch

commit 5352161fc449d7a7573b2e13bd02162aae7aeb69

applied by yourself which cleaned up all sorts of random whitespace noise and broke further patch application. Given that this is staging and random whitespace is less important than actually fixing the code I think the fix is to revert that commit and then apply mine.

Alan

#4 lore raw

Re: [PATCH 2/2] staging: gma500: Rip out the memory manager

Quoted 19 lines · Alan Cox
Quoted 8 lines · On Mon, 28 Feb 2011 18:03:02 -0800 Greg KH <[email protected]> wrote:
Quoted 7 lines · Alan Cox

At this point we simply stuff the display at the start of the stolen memory area that the BIOS gave us. No user framebuffers no multiple framebuffers.

However from here we have a better chance of seeing what is going on and writing an actual gem manager for the driver.

Quoted 7 lines
Quoted 1 line

This doesn't apply.

The 1/2 patch had some fuzz in the Makefile, which I fixed up by hand, but it makes me think that you are diffing this against some different tree.

Quoted 8 lines

I've investigated this. The cause seems to be a patch

commit 5352161fc449d7a7573b2e13bd02162aae7aeb69

applied by yourself which cleaned up all sorts of random whitespace noise and broke further patch application. Given that this is staging and random whitespace is less important than actually fixing the code I think the fix is to revert that commit and then apply mine.

Well, I did copy you on that patch, and let you know I made it, so this type of thing wouldn't happen. I'll go fix it by just stripping out the trailing whitespace from your patch :)

This doesn't seem to explain the Makefile difference in the 1/2 patch though...

thanks,

greg k-h

#5 lore raw

Re: [PATCH 2/2] staging: gma500: Rip out the memory manager

Quoted 29 lines · Greg KH
Quoted 19 lines · Alan Cox
Quoted 8 lines · On Mon, 28 Feb 2011 18:03:02 -0800 Greg KH <[email protected]> wrote:
Quoted 7 lines · Alan Cox

At this point we simply stuff the display at the start of the stolen memory area that the BIOS gave us. No user framebuffers no multiple framebuffers.

However from here we have a better chance of seeing what is going on and writing an actual gem manager for the driver.

Quoted 7 lines
Quoted 1 line

This doesn't apply.

The 1/2 patch had some fuzz in the Makefile, which I fixed up by hand, but it makes me think that you are diffing this against some different tree.

Quoted 8 lines

I've investigated this. The cause seems to be a patch

commit 5352161fc449d7a7573b2e13bd02162aae7aeb69

applied by yourself which cleaned up all sorts of random whitespace noise and broke further patch application. Given that this is staging and random whitespace is less important than actually fixing the code I think the fix is to revert that commit and then apply mine.

Quoted 6 lines

Well, I did copy you on that patch, and let you know I made it, so this type of thing wouldn't happen. I'll go fix it by just stripping out the trailing whitespace from your patch :)

This doesn't seem to explain the Makefile difference in the 1/2 patch though...

And I still don't think this is the issue.

Your patch removes two lines from drivers/staging/gma500/psb_drm.h with the following diff:

drivers/staging/gma500/psb_drm.h +0 -3
@@ -28,9 +28,6 @@
 #include "drm_mode.h"
 #endif
 
-#include "psb_ttm_fence_user.h"
-#include "psb_ttm_placement_user.h"
-
 #define DRM_PSB_SAREA_MAJOR 0
 #define DRM_PSB_SAREA_MINOR 2
 #define PSB_FIXED_SHIFT 16

Yet those #defines are not present in this file right now. That's not a whitespace change...

Still confused,

greg k-h

#6 lore raw

Re: [PATCH 2/2] staging: gma500: Rip out the memory manager

Quoted 16 lines

Your patch removes two lines from drivers/staging/gma500/psb_drm.h with the following diff:

drivers/staging/gma500/psb_drm.h +0 -3
@@ -28,9 +28,6 @@
 #include "drm_mode.h"
 #endif
 
-#include "psb_ttm_fence_user.h"
-#include "psb_ttm_placement_user.h"
-
 #define DRM_PSB_SAREA_MAJOR 0
 #define DRM_PSB_SAREA_MINOR 2
 #define PSB_FIXED_SHIFT 16
Quoted 2 lines

Yet those #defines are not present in this file right now. That's not a whitespace change...

Need to sort some other drivers out but I'll send you the regenerated patches in a bit once I'e pulled todays -next and see what is up. Makefile one does seem odd as nothing else should be touching that area.

Missed the spaces patch first time around dunno where it went.

Alan