Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/gma500: Add first piece of blitter code

Right now, all we need to know about the blitter is that it's not doing
anything that can be messed up when fiddling with MMU mappings.

Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>

+74
+1
drivers/gpu/drm/gma500/Makefile
··· 13 13 intel_i2c.o \ 14 14 intel_gmbus.o \ 15 15 mmu.o \ 16 + blitter.o \ 16 17 power.o \ 17 18 psb_drv.o \ 18 19 gma_display.o \
+51
drivers/gpu/drm/gma500/blitter.c
··· 1 + /* 2 + * Copyright (c) 2014, Patrik Jakobsson 3 + * All Rights Reserved. 4 + * 5 + * This program is free software; you can redistribute it and/or modify it 6 + * under the terms and conditions of the GNU General Public License, 7 + * version 2, as published by the Free Software Foundation. 8 + * 9 + * This program is distributed in the hope it will be useful, but WITHOUT 10 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 + * more details. 13 + * 14 + * Authors: Patrik Jakobsson <patrik.r.jakobsson@gmail.com> 15 + */ 16 + 17 + #include "psb_drv.h" 18 + 19 + #include "blitter.h" 20 + #include "psb_reg.h" 21 + 22 + /* Wait for the blitter to be completely idle */ 23 + int gma_blt_wait_idle(struct drm_psb_private *dev_priv) 24 + { 25 + unsigned long stop = jiffies + HZ; 26 + int busy = 1; 27 + 28 + /* NOP for Cedarview */ 29 + if (IS_CDV(dev_priv->dev)) 30 + return 0; 31 + 32 + /* First do a quick check */ 33 + if ((PSB_RSGX32(PSB_CR_2D_SOCIF) == _PSB_C2_SOCIF_EMPTY) && 34 + ((PSB_RSGX32(PSB_CR_2D_BLIT_STATUS) & _PSB_C2B_STATUS_BUSY) == 0)) 35 + return 0; 36 + 37 + do { 38 + busy = (PSB_RSGX32(PSB_CR_2D_SOCIF) != _PSB_C2_SOCIF_EMPTY); 39 + } while (busy && !time_after_eq(jiffies, stop)); 40 + 41 + if (busy) 42 + return -EBUSY; 43 + 44 + do { 45 + busy = ((PSB_RSGX32(PSB_CR_2D_BLIT_STATUS) & 46 + _PSB_C2B_STATUS_BUSY) != 0); 47 + } while (busy && !time_after_eq(jiffies, stop)); 48 + 49 + /* If still busy, we probably have a hang */ 50 + return (busy) ? -EBUSY : 0; 51 + }
+22
drivers/gpu/drm/gma500/blitter.h
··· 1 + /* 2 + * Copyright (c) 2014, Patrik Jakobsson 3 + * All Rights Reserved. 4 + * 5 + * This program is free software; you can redistribute it and/or modify it 6 + * under the terms and conditions of the GNU General Public License, 7 + * version 2, as published by the Free Software Foundation. 8 + * 9 + * This program is distributed in the hope it will be useful, but WITHOUT 10 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 + * more details. 13 + * 14 + * Authors: Patrik Jakobsson <patrik.r.jakobsson@gmail.com> 15 + */ 16 + 17 + #ifndef __BLITTER_H 18 + #define __BLITTER_H 19 + 20 + extern int gma_blt_wait_idle(struct drm_psb_private *dev_priv); 21 + 22 + #endif