drm/gma500: Add backing type and base align to psb_gem_create()
We'll need this for our gem create ioctl in a later patch. Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
This commit is contained in:
parent
ae0b931881
commit
c269c6852b
|
@ -319,7 +319,7 @@ static struct gtt_range *psbfb_alloc(struct drm_device *dev, int aligned_size)
|
||||||
{
|
{
|
||||||
struct gtt_range *backing;
|
struct gtt_range *backing;
|
||||||
/* Begin by trying to use stolen memory backing */
|
/* Begin by trying to use stolen memory backing */
|
||||||
backing = psb_gtt_alloc_range(dev, aligned_size, "fb", 1);
|
backing = psb_gtt_alloc_range(dev, aligned_size, "fb", 1, PAGE_SIZE);
|
||||||
if (backing) {
|
if (backing) {
|
||||||
drm_gem_private_object_init(dev, &backing->gem, aligned_size);
|
drm_gem_private_object_init(dev, &backing->gem, aligned_size);
|
||||||
return backing;
|
return backing;
|
||||||
|
|
|
@ -98,8 +98,8 @@ unlock:
|
||||||
* it so that userspace can speak about it. This does the core work
|
* it so that userspace can speak about it. This does the core work
|
||||||
* for the various methods that do/will create GEM objects for things
|
* for the various methods that do/will create GEM objects for things
|
||||||
*/
|
*/
|
||||||
static int psb_gem_create(struct drm_file *file,
|
int psb_gem_create(struct drm_file *file, struct drm_device *dev, u64 size,
|
||||||
struct drm_device *dev, uint64_t size, uint32_t *handlep)
|
u32 *handlep, int stolen, u32 align)
|
||||||
{
|
{
|
||||||
struct gtt_range *r;
|
struct gtt_range *r;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -109,7 +109,7 @@ static int psb_gem_create(struct drm_file *file,
|
||||||
|
|
||||||
/* Allocate our object - for now a direct gtt range which is not
|
/* Allocate our object - for now a direct gtt range which is not
|
||||||
stolen memory backed */
|
stolen memory backed */
|
||||||
r = psb_gtt_alloc_range(dev, size, "gem", 0);
|
r = psb_gtt_alloc_range(dev, size, "gem", 0, PAGE_SIZE);
|
||||||
if (r == NULL) {
|
if (r == NULL) {
|
||||||
dev_err(dev->dev, "no memory for %lld byte GEM object\n", size);
|
dev_err(dev->dev, "no memory for %lld byte GEM object\n", size);
|
||||||
return -ENOSPC;
|
return -ENOSPC;
|
||||||
|
@ -153,7 +153,8 @@ int psb_gem_dumb_create(struct drm_file *file, struct drm_device *dev,
|
||||||
{
|
{
|
||||||
args->pitch = ALIGN(args->width * ((args->bpp + 7) / 8), 64);
|
args->pitch = ALIGN(args->width * ((args->bpp + 7) / 8), 64);
|
||||||
args->size = args->pitch * args->height;
|
args->size = args->pitch * args->height;
|
||||||
return psb_gem_create(file, dev, args->size, &args->handle);
|
return psb_gem_create(file, dev, args->size, &args->handle, 0,
|
||||||
|
PAGE_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
/**************************************************************************
|
||||||
|
* Copyright (c) 2014 Patrik Jakobsson
|
||||||
|
* All Rights Reserved.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
#ifndef _GEM_H
|
||||||
|
#define _GEM_H
|
||||||
|
|
||||||
|
extern int psb_gem_create(struct drm_file *file, struct drm_device *dev,
|
||||||
|
u64 size, u32 *handlep, int stolen, u32 align);
|
||||||
|
#endif
|
|
@ -330,7 +330,7 @@ out:
|
||||||
* as in use.
|
* as in use.
|
||||||
*/
|
*/
|
||||||
struct gtt_range *psb_gtt_alloc_range(struct drm_device *dev, int len,
|
struct gtt_range *psb_gtt_alloc_range(struct drm_device *dev, int len,
|
||||||
const char *name, int backed)
|
const char *name, int backed, u32 align)
|
||||||
{
|
{
|
||||||
struct drm_psb_private *dev_priv = dev->dev_private;
|
struct drm_psb_private *dev_priv = dev->dev_private;
|
||||||
struct gtt_range *gt;
|
struct gtt_range *gt;
|
||||||
|
@ -358,7 +358,7 @@ struct gtt_range *psb_gtt_alloc_range(struct drm_device *dev, int len,
|
||||||
/* Ensure this is set for non GEM objects */
|
/* Ensure this is set for non GEM objects */
|
||||||
gt->gem.dev = dev;
|
gt->gem.dev = dev;
|
||||||
ret = allocate_resource(dev_priv->gtt_mem, >->resource,
|
ret = allocate_resource(dev_priv->gtt_mem, >->resource,
|
||||||
len, start, end, PAGE_SIZE, NULL, NULL);
|
len, start, end, align, NULL, NULL);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
gt->offset = gt->resource.start - r->start;
|
gt->offset = gt->resource.start - r->start;
|
||||||
return gt;
|
return gt;
|
||||||
|
|
|
@ -53,7 +53,8 @@ struct gtt_range {
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct gtt_range *psb_gtt_alloc_range(struct drm_device *dev, int len,
|
extern struct gtt_range *psb_gtt_alloc_range(struct drm_device *dev, int len,
|
||||||
const char *name, int backed);
|
const char *name, int backed,
|
||||||
|
u32 align);
|
||||||
extern void psb_gtt_kref_put(struct gtt_range *gt);
|
extern void psb_gtt_kref_put(struct gtt_range *gt);
|
||||||
extern void psb_gtt_free_range(struct drm_device *dev, struct gtt_range *gt);
|
extern void psb_gtt_free_range(struct drm_device *dev, struct gtt_range *gt);
|
||||||
extern int psb_gtt_pin(struct gtt_range *gt);
|
extern int psb_gtt_pin(struct gtt_range *gt);
|
||||||
|
|
|
@ -469,7 +469,8 @@ static void psb_intel_cursor_init(struct drm_device *dev,
|
||||||
/* Allocate 4 pages of stolen mem for a hardware cursor. That
|
/* Allocate 4 pages of stolen mem for a hardware cursor. That
|
||||||
* is enough for the 64 x 64 ARGB cursors we support.
|
* is enough for the 64 x 64 ARGB cursors we support.
|
||||||
*/
|
*/
|
||||||
cursor_gt = psb_gtt_alloc_range(dev, 4 * PAGE_SIZE, "cursor", 1);
|
cursor_gt = psb_gtt_alloc_range(dev, 4 * PAGE_SIZE, "cursor", 1,
|
||||||
|
PAGE_SIZE);
|
||||||
if (!cursor_gt) {
|
if (!cursor_gt) {
|
||||||
gma_crtc->cursor_gt = NULL;
|
gma_crtc->cursor_gt = NULL;
|
||||||
goto out;
|
goto out;
|
||||||
|
|
Loading…
Reference in New Issue