Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 321035
b: refs/heads/master
c: 239921e
h: refs/heads/master
i:
  321033: 5228ac0
  321031: bfc2e35
v: v3
  • Loading branch information
Laurent Pinchart committed Jul 19, 2012
1 parent a7fff38 commit 40aa406
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6e729b416b44296f5ed503b40ac58c2bffb43caf
refs/heads/master: 239921ec1d969e904676f444a92e6d68a928d98c
41 changes: 37 additions & 4 deletions trunk/drivers/video/sh_mobile_meram.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,21 @@ static inline unsigned long meram_read_reg(void __iomem *base, unsigned int off)
return ioread32(base + off);
}

/* -----------------------------------------------------------------------------
* MERAM allocation and free
*/

static unsigned long meram_alloc(struct sh_mobile_meram_priv *priv, size_t size)
{
return gen_pool_alloc(priv->pool, size);
}

static void meram_free(struct sh_mobile_meram_priv *priv, unsigned long mem,
size_t size)
{
gen_pool_free(priv->pool, mem, size);
}

/* -----------------------------------------------------------------------------
* LCDC cache planes allocation, init, cleanup and free
*/
Expand All @@ -216,7 +231,7 @@ static int meram_plane_alloc(struct sh_mobile_meram_priv *priv,
return -ENOMEM;
plane->marker = &priv->icbs[idx];

mem = gen_pool_alloc(priv->pool, size * 1024);
mem = meram_alloc(priv, size * 1024);
if (mem == 0)
return -ENOMEM;

Expand All @@ -233,8 +248,8 @@ static int meram_plane_alloc(struct sh_mobile_meram_priv *priv,
static void meram_plane_free(struct sh_mobile_meram_priv *priv,
struct sh_mobile_meram_fb_plane *plane)
{
gen_pool_free(priv->pool, priv->meram + plane->marker->offset,
plane->marker->size * 1024);
meram_free(priv, priv->meram + plane->marker->offset,
plane->marker->size * 1024);

__clear_bit(plane->marker->index, &priv->used_icb);
__clear_bit(plane->cache->index, &priv->used_icb);
Expand Down Expand Up @@ -386,9 +401,27 @@ static void meram_plane_cleanup(struct sh_mobile_meram_priv *priv,
}

/* -----------------------------------------------------------------------------
* LCDC cache operations
* MERAM operations
*/

unsigned long sh_mobile_meram_alloc(struct sh_mobile_meram_info *pdata,
size_t size)
{
struct sh_mobile_meram_priv *priv = pdata->priv;

return meram_alloc(priv, size);
}
EXPORT_SYMBOL_GPL(sh_mobile_meram_alloc);

void sh_mobile_meram_free(struct sh_mobile_meram_info *pdata, unsigned long mem,
size_t size)
{
struct sh_mobile_meram_priv *priv = pdata->priv;

meram_free(priv, mem, size);
}
EXPORT_SYMBOL_GPL(sh_mobile_meram_free);

/* Allocate memory for the ICBs and mark them as used. */
static struct sh_mobile_meram_fb_cache *
meram_cache_alloc(struct sh_mobile_meram_priv *priv,
Expand Down
16 changes: 16 additions & 0 deletions trunk/include/video/sh_mobile_meram.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ struct sh_mobile_meram_cfg {

#if defined(CONFIG_FB_SH_MOBILE_MERAM) || \
defined(CONFIG_FB_SH_MOBILE_MERAM_MODULE)
unsigned long sh_mobile_meram_alloc(struct sh_mobile_meram_info *meram_dev,
size_t size);
void sh_mobile_meram_free(struct sh_mobile_meram_info *meram_dev,
unsigned long mem, size_t size);
void *sh_mobile_meram_cache_alloc(struct sh_mobile_meram_info *dev,
const struct sh_mobile_meram_cfg *cfg,
unsigned int xres, unsigned int yres,
Expand All @@ -50,6 +54,18 @@ void sh_mobile_meram_cache_update(struct sh_mobile_meram_info *dev, void *data,
unsigned long *icb_addr_y,
unsigned long *icb_addr_c);
#else
static inline unsigned long
sh_mobile_meram_alloc(struct sh_mobile_meram_info *meram_dev, size_t size)
{
return 0;
}

static inline void
sh_mobile_meram_free(struct sh_mobile_meram_info *meram_dev,
unsigned long mem, size_t size)
{
}

static inline void *
sh_mobile_meram_cache_alloc(struct sh_mobile_meram_info *dev,
const struct sh_mobile_meram_cfg *cfg,
Expand Down

0 comments on commit 40aa406

Please sign in to comment.