* [PATCH 1/4] drm/i915: Clearing buffer objects via CPU/GTT
2015-07-22 13:51 [PATCH v5 " ankitprasad.r.sharma
@ 2015-07-22 13:51 ` ankitprasad.r.sharma
2015-07-22 15:01 ` Tvrtko Ursulin
0 siblings, 1 reply; 26+ messages in thread
From: ankitprasad.r.sharma @ 2015-07-22 13:51 UTC (permalink / raw)
To: intel-gfx; +Cc: Ankitprasad Sharma, akash.goel, shashidhar.hiremath
From: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
This patch adds support for clearing buffer objects via CPU/GTT. This
is particularly useful for clearing out the non shmem backed objects.
Currently intend to use this only for buffers allocated from stolen
region.
Testcase: igt/gem_stolen
Signed-off-by: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
---
drivers/gpu/drm/i915/i915_drv.h | 1 +
drivers/gpu/drm/i915/i915_gem.c | 34 ++++++++++++++++++++++++++++++++++
2 files changed, 35 insertions(+)
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index ea9caf2..f6af9c0 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2764,6 +2764,7 @@ int i915_gem_obj_prepare_shmem_read(struct drm_i915_gem_object *obj,
int *needs_clflush);
int __must_check i915_gem_object_get_pages(struct drm_i915_gem_object *obj);
+int i915_gem_clear_object(struct drm_i915_gem_object *obj);
static inline int __sg_page_count(struct scatterlist *sg)
{
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index a2a4a27..fc434ae 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -5469,3 +5469,37 @@ bool i915_gem_obj_is_pinned(struct drm_i915_gem_object *obj)
return false;
}
+int i915_gem_clear_object(struct drm_i915_gem_object *obj)
+{
+ int ret = 0;
+ char __iomem *base;
+ int size = obj->base.size;
+ struct drm_i915_private *dev_priv = obj->base.dev->dev_private;
+ unsigned alignment = 0;
+
+ ret = i915_gem_obj_ggtt_pin(obj, alignment, PIN_MAPPABLE);
+ if (ret) {
+ DRM_ERROR("Mapping of gem object to GTT failed\n");
+ return ret;
+ }
+
+ ret = i915_gem_object_put_fence(obj);
+ if (ret)
+ goto unpin;
+
+ /* Get the CPU virtual address of the buffer */
+ base = ioremap_wc(dev_priv->gtt.mappable_base +
+ i915_gem_obj_ggtt_offset(obj), size);
+ if (base == NULL) {
+ DRM_ERROR("Mapping of gem object to CPU failed\n");
+ ret = -ENOSPC;
+ goto unpin;
+ }
+
+ memset_io(base, 0, size);
+
+ iounmap(base);
+unpin:
+ i915_gem_object_ggtt_unpin(obj);
+ return ret;
+}
--
1.9.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 26+ messages in thread
* Re: [PATCH 1/4] drm/i915: Clearing buffer objects via CPU/GTT
2015-07-22 13:51 ` [PATCH 1/4] drm/i915: Clearing buffer objects via CPU/GTT ankitprasad.r.sharma
@ 2015-07-22 15:01 ` Tvrtko Ursulin
2015-07-22 15:05 ` Chris Wilson
2015-07-22 15:06 ` Chris Wilson
0 siblings, 2 replies; 26+ messages in thread
From: Tvrtko Ursulin @ 2015-07-22 15:01 UTC (permalink / raw)
To: ankitprasad.r.sharma, intel-gfx; +Cc: akash.goel, shashidhar.hiremath
Hi,
On 07/22/2015 02:51 PM, ankitprasad.r.sharma@intel.com wrote:
> From: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
>
> This patch adds support for clearing buffer objects via CPU/GTT. This
> is particularly useful for clearing out the non shmem backed objects.
> Currently intend to use this only for buffers allocated from stolen
> region.
>
> Testcase: igt/gem_stolen
>
> Signed-off-by: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
> ---
> drivers/gpu/drm/i915/i915_drv.h | 1 +
> drivers/gpu/drm/i915/i915_gem.c | 34 ++++++++++++++++++++++++++++++++++
> 2 files changed, 35 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index ea9caf2..f6af9c0 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -2764,6 +2764,7 @@ int i915_gem_obj_prepare_shmem_read(struct drm_i915_gem_object *obj,
> int *needs_clflush);
>
> int __must_check i915_gem_object_get_pages(struct drm_i915_gem_object *obj);
> +int i915_gem_clear_object(struct drm_i915_gem_object *obj);
>
> static inline int __sg_page_count(struct scatterlist *sg)
> {
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index a2a4a27..fc434ae 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -5469,3 +5469,37 @@ bool i915_gem_obj_is_pinned(struct drm_i915_gem_object *obj)
> return false;
> }
>
> +int i915_gem_clear_object(struct drm_i915_gem_object *obj)
Please add kernel doc for the function.
> +{
> + int ret = 0;
No need to set to zero.
> + char __iomem *base;
> + int size = obj->base.size;
I think obj->base.size is a size_t at the moment so this could cause
compiler to warn?
> + struct drm_i915_private *dev_priv = obj->base.dev->dev_private;
Again compiler should warn here due implicit pointer casting? I think
correct is "dev_priv = to_i915(obj->base.dev)".
> + unsigned alignment = 0;
Don't even need this as variable since it is used only once.
> +
> + ret = i915_gem_obj_ggtt_pin(obj, alignment, PIN_MAPPABLE);
> + if (ret) {
> + DRM_ERROR("Mapping of gem object to GTT failed\n");
Maybe end the sentence with "!" ?
> + return ret;
> + }
> +
> + ret = i915_gem_object_put_fence(obj);
> + if (ret)
> + goto unpin;
This I don't understand. Why it is OK to release a fence and never
re-establish it? Could that surprise some callers?
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 1/4] drm/i915: Clearing buffer objects via CPU/GTT
2015-07-22 15:01 ` Tvrtko Ursulin
@ 2015-07-22 15:05 ` Chris Wilson
2015-07-22 15:06 ` Chris Wilson
1 sibling, 0 replies; 26+ messages in thread
From: Chris Wilson @ 2015-07-22 15:05 UTC (permalink / raw)
To: Tvrtko Ursulin
Cc: ankitprasad.r.sharma, intel-gfx, akash.goel, shashidhar.hiremath
On Wed, Jul 22, 2015 at 04:01:33PM +0100, Tvrtko Ursulin wrote:
> >+ ret = i915_gem_obj_ggtt_pin(obj, alignment, PIN_MAPPABLE);
> >+ if (ret) {
> >+ DRM_ERROR("Mapping of gem object to GTT failed\n");
>
> Maybe end the sentence with "!" ?
Or better yet, don't do anything. The error is propagate back to the
user, and is going to be -EINTR.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 1/4] drm/i915: Clearing buffer objects via CPU/GTT
2015-07-22 15:01 ` Tvrtko Ursulin
2015-07-22 15:05 ` Chris Wilson
@ 2015-07-22 15:06 ` Chris Wilson
2015-07-22 15:16 ` Tvrtko Ursulin
1 sibling, 1 reply; 26+ messages in thread
From: Chris Wilson @ 2015-07-22 15:06 UTC (permalink / raw)
To: Tvrtko Ursulin
Cc: ankitprasad.r.sharma, intel-gfx, akash.goel, shashidhar.hiremath
On Wed, Jul 22, 2015 at 04:01:33PM +0100, Tvrtko Ursulin wrote:
> This I don't understand. Why it is OK to release a fence and never
> re-establish it? Could that surprise some callers?
We always call get_fence() before we need it (and pin it as required),
because it can be revoked at anytime as they are a scarce resource.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 1/4] drm/i915: Clearing buffer objects via CPU/GTT
2015-07-22 15:06 ` Chris Wilson
@ 2015-07-22 15:16 ` Tvrtko Ursulin
2015-07-22 15:23 ` Chris Wilson
0 siblings, 1 reply; 26+ messages in thread
From: Tvrtko Ursulin @ 2015-07-22 15:16 UTC (permalink / raw)
To: Chris Wilson, ankitprasad.r.sharma, intel-gfx, akash.goel,
shashidhar.hiremath
On 07/22/2015 04:06 PM, Chris Wilson wrote:
> On Wed, Jul 22, 2015 at 04:01:33PM +0100, Tvrtko Ursulin wrote:
>> This I don't understand. Why it is OK to release a fence and never
>> re-establish it? Could that surprise some callers?
>
> We always call get_fence() before we need it (and pin it as required),
> because it can be revoked at anytime as they are a scarce resource.
Oookay, and why it is important to release it here? Does it warrant a
comment or everyone knows this?
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 1/4] drm/i915: Clearing buffer objects via CPU/GTT
2015-07-22 15:16 ` Tvrtko Ursulin
@ 2015-07-22 15:23 ` Chris Wilson
0 siblings, 0 replies; 26+ messages in thread
From: Chris Wilson @ 2015-07-22 15:23 UTC (permalink / raw)
To: Tvrtko Ursulin
Cc: ankitprasad.r.sharma, intel-gfx, akash.goel, shashidhar.hiremath
On Wed, Jul 22, 2015 at 04:16:20PM +0100, Tvrtko Ursulin wrote:
>
> On 07/22/2015 04:06 PM, Chris Wilson wrote:
> >On Wed, Jul 22, 2015 at 04:01:33PM +0100, Tvrtko Ursulin wrote:
> >>This I don't understand. Why it is OK to release a fence and never
> >>re-establish it? Could that surprise some callers?
> >
> >We always call get_fence() before we need it (and pin it as required),
> >because it can be revoked at anytime as they are a scarce resource.
>
> Oookay, and why it is important to release it here? Does it warrant
> a comment or everyone knows this?
There is fun to be had as the destination address is detiled by the
hardware meaning that it is possible for the writes into the last tile
row to be after the GTT address of the object. We should have allocated
sufficient space in the GTT to cover all fenced writes, but that is
actually only true on gen2/3.
There is also the fun that avoiding the fence (besides being a resource
that we may have to wait for and cause pagefaults elsewhere) is a bit
faster than writing through one.
So not using a fence is faster and less error prone.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 26+ messages in thread
* [PATCH v6 0/4] Support for creating/using Stolen memory backed objects
@ 2015-09-15 8:33 ankitprasad.r.sharma
2015-09-15 8:33 ` [PATCH 1/4] drm/i915: Clearing buffer objects via CPU/GTT ankitprasad.r.sharma
` (4 more replies)
0 siblings, 5 replies; 26+ messages in thread
From: ankitprasad.r.sharma @ 2015-09-15 8:33 UTC (permalink / raw)
To: intel-gfx; +Cc: Ankitprasad Sharma, akash.goel, shashidhar.hiremath
From: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
This patch series adds support for creating/using Stolen memory backed
objects.
Despite being a unified memory architecture (UMA) some bits of memory
are more equal than others. In particular we have the thorny issue of
stolen memory, memory stolen from the system by the BIOS and reserved
for igfx use. Stolen memory is required for some functions of the GPU
and display engine, but in general it goes wasted. Whilst we cannot
return it back to the system, we need to find some other method for
utilising it. As we do not support direct access to the physical address
in the stolen region, it behaves like a different class of memory,
closer in kin to local GPU memory. This strongly suggests that we need a
placement model like TTM if we are to fully utilize these discrete
chunks of differing memory.
To add support for creating Stolen memory backed objects, we extend the
drm_i915_gem_create structure, by adding a new flag through which user
can specify the preference to allocate the object from stolen memory,
which if set, an attempt will be made to allocate the object from stolen
memory subject to the availability of free space in the stolen region.
This patch series adds support for clearing buffer objects via CPU/GTT.
This is particularly useful for clearing out the memory from stolen
region, but can also be used for other shmem allocated objects. Currently
being used for buffers allocated in the stolen region. Also adding support
for stealing purgable stolen pages, if we run out of stolen memory when
trying to allocate an object.
v2: Added support for read/write from/to objects not backed by
shmem using the pread/pwrite interface.
Also extended the current get_aperture ioctl to retrieve the
total and available size of the stolen region
v3: Removed the extended get_aperture ioctl patch 5 (to be submitted as
part of other patch series), addressed comments by Chris about pread/pwrite
for non shmem backed objects
v4: Rebased to the latest drm-intel-nightly
v5: Addressed comments, replaced patch 1/4 "Clearing buffers via blitter
engine" by "Clearing buffers via CPU/GTT"
v6: Rebased to the latest drm-intel-nightly, Addressed comments, updated
stolen memory purging logic by maintaining a list for purgable stolen
memory objects, enabled pread/pwrite for all non-shmem backed objects
without tiling restrictions
This can be verified using IGT tests: igt/gem_stolen, igt/gem_create
Ankitprasad Sharma (3):
drm/i915: Clearing buffer objects via CPU/GTT
drm/i915: Support for creating Stolen memory backed objects
drm/i915: Support for pread/pwrite from/to non shmem backed objects
Chris Wilson (1):
drm/i915: Add support for stealing purgable stolen pages
drivers/gpu/drm/i915/i915_debugfs.c | 4 +-
drivers/gpu/drm/i915/i915_dma.c | 3 +
drivers/gpu/drm/i915/i915_drv.h | 20 +++-
drivers/gpu/drm/i915/i915_gem.c | 213 +++++++++++++++++++++++++++++----
drivers/gpu/drm/i915/i915_gem_stolen.c | 176 +++++++++++++++++++++++----
drivers/gpu/drm/i915/intel_pm.c | 4 +-
include/uapi/drm/i915_drm.h | 16 +++
7 files changed, 385 insertions(+), 51 deletions(-)
--
1.9.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 26+ messages in thread
* [PATCH 1/4] drm/i915: Clearing buffer objects via CPU/GTT
2015-09-15 8:33 [PATCH v6 0/4] Support for creating/using Stolen memory backed objects ankitprasad.r.sharma
@ 2015-09-15 8:33 ` ankitprasad.r.sharma
2015-09-15 14:00 ` Tvrtko Ursulin
2015-09-15 8:33 ` [PATCH 2/4] drm/i915: Support for creating Stolen memory backed objects ankitprasad.r.sharma
` (3 subsequent siblings)
4 siblings, 1 reply; 26+ messages in thread
From: ankitprasad.r.sharma @ 2015-09-15 8:33 UTC (permalink / raw)
To: intel-gfx; +Cc: Ankitprasad Sharma, akash.goel, shashidhar.hiremath
From: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
This patch adds support for clearing buffer objects via CPU/GTT. This
is particularly useful for clearing out the non shmem backed objects.
Currently intend to use this only for buffers allocated from stolen
region.
v2: Added kernel doc for i915_gem_clear_object(), corrected/removed
variable assignments (Tvrtko)
Testcase: igt/gem_stolen
Signed-off-by: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
---
drivers/gpu/drm/i915/i915_drv.h | 1 +
drivers/gpu/drm/i915/i915_gem.c | 39 +++++++++++++++++++++++++++++++++++++++
2 files changed, 40 insertions(+)
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index e0f3f05..8db905a 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2820,6 +2820,7 @@ int i915_gem_obj_prepare_shmem_read(struct drm_i915_gem_object *obj,
int *needs_clflush);
int __must_check i915_gem_object_get_pages(struct drm_i915_gem_object *obj);
+int i915_gem_clear_object(struct drm_i915_gem_object *obj);
static inline int __sg_page_count(struct scatterlist *sg)
{
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 1ac57ec..94533bf 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -5139,3 +5139,42 @@ fail:
drm_gem_object_unreference(&obj->base);
return ERR_PTR(ret);
}
+
+/**
+ * i915_gem_clear_object() - Clear buffer object via CPU/GTT
+ * @obj: Buffer object to be cleared
+ *
+ * Return: 0 - success, non-zero - failure
+ */
+int i915_gem_clear_object(struct drm_i915_gem_object *obj)
+{
+ int ret;
+ char __iomem *base;
+ size_t size = obj->base.size;
+ struct drm_i915_private *dev_priv = to_i915(obj->base.dev);
+
+ WARN_ON(!mutex_is_locked(&obj->base.dev->struct_mutex));
+ ret = i915_gem_obj_ggtt_pin(obj, 0, PIN_MAPPABLE);
+ if (ret)
+ return ret;
+
+ ret = i915_gem_object_put_fence(obj);
+ if (ret)
+ goto unpin;
+
+ /* Get the CPU virtual address of the buffer */
+ base = ioremap_wc(dev_priv->gtt.mappable_base +
+ i915_gem_obj_ggtt_offset(obj), size);
+ if (base == NULL) {
+ DRM_ERROR("Mapping of gem object to CPU failed!\n");
+ ret = -ENOSPC;
+ goto unpin;
+ }
+
+ memset_io(base, 0, size);
+
+ iounmap(base);
+unpin:
+ i915_gem_object_ggtt_unpin(obj);
+ return ret;
+}
--
1.9.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 2/4] drm/i915: Support for creating Stolen memory backed objects
2015-09-15 8:33 [PATCH v6 0/4] Support for creating/using Stolen memory backed objects ankitprasad.r.sharma
2015-09-15 8:33 ` [PATCH 1/4] drm/i915: Clearing buffer objects via CPU/GTT ankitprasad.r.sharma
@ 2015-09-15 8:33 ` ankitprasad.r.sharma
2015-09-15 9:49 ` Chris Wilson
2015-09-15 14:11 ` Tvrtko Ursulin
2015-09-15 8:33 ` [PATCH 3/4] drm/i915: Add support for stealing purgable stolen pages ankitprasad.r.sharma
` (2 subsequent siblings)
4 siblings, 2 replies; 26+ messages in thread
From: ankitprasad.r.sharma @ 2015-09-15 8:33 UTC (permalink / raw)
To: intel-gfx; +Cc: Ankitprasad Sharma, akash.goel, shashidhar.hiremath
From: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
Extend the drm_i915_gem_create structure to add support for
creating Stolen memory backed objects. Added a new flag through
which user can specify the preference to allocate the object from
stolen memory, which if set, an attempt will be made to allocate
the object from stolen memory subject to the availability of
free space in the stolen region.
v2: Rebased to the latest drm-intel-nightly (Ankit)
v3: Changed versioning of GEM_CREATE param, added new comments (Tvrtko)
v4: Changed size from 32b to 64b to prevent userspace overflow (Tvrtko)
Corrected function arguments ordering (Chris)
Testcase: igt/gem_stolen
Signed-off-by: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
---
drivers/gpu/drm/i915/i915_dma.c | 3 +++
drivers/gpu/drm/i915/i915_drv.h | 2 +-
drivers/gpu/drm/i915/i915_gem.c | 30 +++++++++++++++++++++++++++---
drivers/gpu/drm/i915/i915_gem_stolen.c | 4 ++--
include/uapi/drm/i915_drm.h | 16 ++++++++++++++++
5 files changed, 49 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 2193cc2..8319e07 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -170,6 +170,9 @@ static int i915_getparam(struct drm_device *dev, void *data,
case I915_PARAM_HAS_RESOURCE_STREAMER:
value = HAS_RESOURCE_STREAMER(dev);
break;
+ case I915_PARAM_CREATE_VERSION:
+ value = 2;
+ break;
default:
DRM_DEBUG("Unknown parameter %d\n", param->param);
return -EINVAL;
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 8db905a..e6ef083 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -3159,7 +3159,7 @@ void i915_gem_stolen_remove_node(struct drm_i915_private *dev_priv,
int i915_gem_init_stolen(struct drm_device *dev);
void i915_gem_cleanup_stolen(struct drm_device *dev);
struct drm_i915_gem_object *
-i915_gem_object_create_stolen(struct drm_device *dev, u32 size);
+i915_gem_object_create_stolen(struct drm_device *dev, u64 size);
struct drm_i915_gem_object *
i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev,
u32 stolen_offset,
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 94533bf..6568a7f 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -375,6 +375,7 @@ static int
i915_gem_create(struct drm_file *file,
struct drm_device *dev,
uint64_t size,
+ uint32_t flags,
uint32_t *handle_p)
{
struct drm_i915_gem_object *obj;
@@ -385,8 +386,31 @@ i915_gem_create(struct drm_file *file,
if (size == 0)
return -EINVAL;
+ if (flags & __I915_CREATE_UNKNOWN_FLAGS)
+ return -EINVAL;
+
/* Allocate the new object */
- obj = i915_gem_alloc_object(dev, size);
+ if (flags & I915_CREATE_PLACEMENT_STOLEN) {
+ mutex_lock(&dev->struct_mutex);
+ obj = i915_gem_object_create_stolen(dev, size);
+ if (!obj) {
+ mutex_unlock(&dev->struct_mutex);
+ return -ENOMEM;
+ }
+
+ /* Always clear fresh buffers before handing to userspace */
+ ret = i915_gem_clear_object(obj);
+ if (ret) {
+ drm_gem_object_unreference(&obj->base);
+ mutex_unlock(&dev->struct_mutex);
+ return ret;
+ }
+
+ mutex_unlock(&dev->struct_mutex);
+ } else {
+ obj = i915_gem_alloc_object(dev, size);
+ }
+
if (obj == NULL)
return -ENOMEM;
@@ -409,7 +433,7 @@ i915_gem_dumb_create(struct drm_file *file,
args->pitch = ALIGN(args->width * DIV_ROUND_UP(args->bpp, 8), 64);
args->size = args->pitch * args->height;
return i915_gem_create(file, dev,
- args->size, &args->handle);
+ args->size, 0, &args->handle);
}
/**
@@ -422,7 +446,7 @@ i915_gem_create_ioctl(struct drm_device *dev, void *data,
struct drm_i915_gem_create *args = data;
return i915_gem_create(file, dev,
- args->size, &args->handle);
+ args->size, args->flags, &args->handle);
}
static inline int
diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
index a36cb95..99f2bce 100644
--- a/drivers/gpu/drm/i915/i915_gem_stolen.c
+++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
@@ -457,7 +457,7 @@ cleanup:
}
struct drm_i915_gem_object *
-i915_gem_object_create_stolen(struct drm_device *dev, u32 size)
+i915_gem_object_create_stolen(struct drm_device *dev, u64 size)
{
struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_i915_gem_object *obj;
@@ -467,7 +467,7 @@ i915_gem_object_create_stolen(struct drm_device *dev, u32 size)
if (!drm_mm_initialized(&dev_priv->mm.stolen))
return NULL;
- DRM_DEBUG_KMS("creating stolen object: size=%x\n", size);
+ DRM_DEBUG_KMS("creating stolen object: size=%llx\n", size);
if (size == 0)
return NULL;
diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
index dbd16a2..f71f75c 100644
--- a/include/uapi/drm/i915_drm.h
+++ b/include/uapi/drm/i915_drm.h
@@ -356,6 +356,7 @@ typedef struct drm_i915_irq_wait {
#define I915_PARAM_EU_TOTAL 34
#define I915_PARAM_HAS_GPU_RESET 35
#define I915_PARAM_HAS_RESOURCE_STREAMER 36
+#define I915_PARAM_CREATE_VERSION 37
typedef struct drm_i915_getparam {
s32 param;
@@ -455,6 +456,21 @@ struct drm_i915_gem_create {
*/
__u32 handle;
__u32 pad;
+ /**
+ * Requested flags (currently used for placement
+ * (which memory domain))
+ *
+ * You can request that the object be created from special memory
+ * rather than regular system pages using this parameter. Such
+ * irregular objects may have certain restrictions (such as CPU
+ * access to a stolen object is verboten).
+ *
+ * This can be used in the future for other purposes too
+ * e.g. specifying tiling/caching/madvise
+ */
+ __u32 flags;
+#define I915_CREATE_PLACEMENT_STOLEN (1<<0) /* Cannot use CPU mmaps */
+#define __I915_CREATE_UNKNOWN_FLAGS -(I915_CREATE_PLACEMENT_STOLEN << 1)
};
struct drm_i915_gem_pread {
--
1.9.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 3/4] drm/i915: Add support for stealing purgable stolen pages
2015-09-15 8:33 [PATCH v6 0/4] Support for creating/using Stolen memory backed objects ankitprasad.r.sharma
2015-09-15 8:33 ` [PATCH 1/4] drm/i915: Clearing buffer objects via CPU/GTT ankitprasad.r.sharma
2015-09-15 8:33 ` [PATCH 2/4] drm/i915: Support for creating Stolen memory backed objects ankitprasad.r.sharma
@ 2015-09-15 8:33 ` ankitprasad.r.sharma
2015-09-15 9:37 ` Chris Wilson
2015-09-15 15:14 ` Tvrtko Ursulin
2015-09-15 8:33 ` [PATCH 4/4] drm/i915: Support for pread/pwrite from/to non shmem backed objects ankitprasad.r.sharma
2015-09-23 14:35 ` [PATCH v6 0/4] Support for creating/using Stolen memory " Chris Wilson
4 siblings, 2 replies; 26+ messages in thread
From: ankitprasad.r.sharma @ 2015-09-15 8:33 UTC (permalink / raw)
To: intel-gfx; +Cc: Ankitprasad Sharma, akash.goel, shashidhar.hiremath
From: Chris Wilson <chris at chris-wilson.co.uk>
If we run out of stolen memory when trying to allocate an object, see if
we can reap enough purgeable objects to free up enough contiguous free
space for the allocation. This is in principle very much like evicting
objects to free up enough contiguous space in the vma when binding
a new object - and you will be forgiven for thinking that the code looks
very similar.
At the moment, we do not allow userspace to allocate objects in stolen,
so there is neither the memory pressure to trigger stolen eviction nor
any purgeable objects inside the stolen arena. However, this will change
in the near future, and so better management and defragmentation of
stolen memory will become a real issue.
v2: Remember to remove the drm_mm_node.
v3: Rebased to the latest drm-intel-nightly (Ankit)
v4: corrected if-else braces format (Tvrtko/kerneldoc)
v5: Rebased to the latest drm-intel-nightly (Ankit)
Added a seperate list to maintain purgable objects from stolen memory
region (Chris/Daniel)
Testcase: igt/gem_stolen
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Signed-off-by: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
---
drivers/gpu/drm/i915/i915_debugfs.c | 4 +-
drivers/gpu/drm/i915/i915_drv.h | 17 +++-
drivers/gpu/drm/i915/i915_gem.c | 16 +++
drivers/gpu/drm/i915/i915_gem_stolen.c | 176 ++++++++++++++++++++++++++++-----
drivers/gpu/drm/i915/intel_pm.c | 4 +-
5 files changed, 187 insertions(+), 30 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 7a28de5..0db8c47 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -179,7 +179,7 @@ describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj)
seq_puts(m, ")");
}
if (obj->stolen)
- seq_printf(m, " (stolen: %08llx)", obj->stolen->start);
+ seq_printf(m, " (stolen: %08llx)", obj->stolen->base.start);
if (obj->pin_display || obj->fault_mappable) {
char s[3], *t = s;
if (obj->pin_display)
@@ -258,7 +258,7 @@ static int obj_rank_by_stolen(void *priv,
struct drm_i915_gem_object *b =
container_of(B, struct drm_i915_gem_object, obj_exec_link);
- return a->stolen->start - b->stolen->start;
+ return a->stolen->base.start - b->stolen->base.start;
}
static int i915_gem_stolen_list_info(struct seq_file *m, void *data)
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index e6ef083..37ee32d 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -841,6 +841,12 @@ struct i915_ctx_hang_stats {
bool banned;
};
+struct i915_stolen_node {
+ struct drm_mm_node base;
+ struct list_head mm_link;
+ struct drm_i915_gem_object *obj;
+};
+
/* This must match up with the value previously used for execbuf2.rsvd1. */
#define DEFAULT_CONTEXT_HANDLE 0
@@ -1268,6 +1274,13 @@ struct i915_gem_mm {
*/
struct list_head unbound_list;
+ /**
+ * List of stolen objects that have been marked as purgeable and
+ * thus available for reaping if we need more space for a new
+ * allocation. Ordered by time of marking purgeable.
+ */
+ struct list_head stolen_list;
+
/** Usable portion of the GTT for GEM */
unsigned long stolen_base; /* limited to low memory (32-bit) */
@@ -2026,7 +2039,7 @@ struct drm_i915_gem_object {
struct list_head vma_list;
/** Stolen memory for this object, instead of being backed by shmem. */
- struct drm_mm_node *stolen;
+ struct i915_stolen_node *stolen;
struct list_head global_list;
struct list_head ring_list[I915_NUM_RINGS];
@@ -2034,6 +2047,7 @@ struct drm_i915_gem_object {
struct list_head obj_exec_link;
struct list_head batch_pool_link;
+ struct list_head tmp_link;
/**
* This is set if the object is on the active lists (has pending
@@ -2150,6 +2164,7 @@ struct drm_i915_gem_object {
};
};
#define to_intel_bo(x) container_of(x, struct drm_i915_gem_object, base)
+#define I915_BO_IS_ACTIVE(__obj) (__obj->active)
void i915_gem_track_fb(struct drm_i915_gem_object *old,
struct drm_i915_gem_object *new,
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 6568a7f..85025b1 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -4228,6 +4228,20 @@ i915_gem_madvise_ioctl(struct drm_device *dev, void *data,
if (obj->madv == I915_MADV_DONTNEED && obj->pages == NULL)
i915_gem_object_truncate(obj);
+ if (obj->stolen) {
+ switch (obj->madv) {
+ case I915_MADV_WILLNEED:
+ list_del_init(&obj->stolen->mm_link);
+ break;
+ case I915_MADV_DONTNEED:
+ list_move(&obj->stolen->mm_link,
+ &dev_priv->mm.stolen_list);
+ break;
+ default:
+ break;
+ }
+ }
+
args->retained = obj->madv != __I915_MADV_PURGED;
out:
@@ -4248,6 +4262,7 @@ void i915_gem_object_init(struct drm_i915_gem_object *obj,
INIT_LIST_HEAD(&obj->obj_exec_link);
INIT_LIST_HEAD(&obj->vma_list);
INIT_LIST_HEAD(&obj->batch_pool_link);
+ INIT_LIST_HEAD(&obj->tmp_link);
obj->ops = ops;
@@ -4898,6 +4913,7 @@ i915_gem_load(struct drm_device *dev)
INIT_LIST_HEAD(&dev_priv->context_list);
INIT_LIST_HEAD(&dev_priv->mm.unbound_list);
INIT_LIST_HEAD(&dev_priv->mm.bound_list);
+ INIT_LIST_HEAD(&dev_priv->mm.stolen_list);
INIT_LIST_HEAD(&dev_priv->mm.fence_list);
for (i = 0; i < I915_NUM_RINGS; i++)
init_ring_lists(&dev_priv->ring[i]);
diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
index 99f2bce..430e0b0 100644
--- a/drivers/gpu/drm/i915/i915_gem_stolen.c
+++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
@@ -52,8 +52,8 @@ int i915_gem_stolen_insert_node(struct drm_i915_private *dev_priv,
return -ENODEV;
mutex_lock(&dev_priv->mm.stolen_lock);
- ret = drm_mm_insert_node(&dev_priv->mm.stolen, node, size, alignment,
- DRM_MM_SEARCH_DEFAULT);
+ ret = drm_mm_insert_node(&dev_priv->mm.stolen, node,
+ size, alignment, DRM_MM_SEARCH_DEFAULT);
mutex_unlock(&dev_priv->mm.stolen_lock);
return ret;
@@ -407,18 +407,19 @@ static void i915_gem_object_put_pages_stolen(struct drm_i915_gem_object *obj)
kfree(obj->pages);
}
-
static void
i915_gem_object_release_stolen(struct drm_i915_gem_object *obj)
{
struct drm_i915_private *dev_priv = obj->base.dev->dev_private;
if (obj->stolen) {
- i915_gem_stolen_remove_node(dev_priv, obj->stolen);
+ list_del(&obj->stolen->mm_link);
+ i915_gem_stolen_remove_node(dev_priv, &obj->stolen->base);
kfree(obj->stolen);
obj->stolen = NULL;
}
}
+
static const struct drm_i915_gem_object_ops i915_gem_object_stolen_ops = {
.get_pages = i915_gem_object_get_pages_stolen,
.put_pages = i915_gem_object_put_pages_stolen,
@@ -427,7 +428,7 @@ static const struct drm_i915_gem_object_ops i915_gem_object_stolen_ops = {
static struct drm_i915_gem_object *
_i915_gem_object_create_stolen(struct drm_device *dev,
- struct drm_mm_node *stolen)
+ struct i915_stolen_node *stolen)
{
struct drm_i915_gem_object *obj;
@@ -435,17 +436,21 @@ _i915_gem_object_create_stolen(struct drm_device *dev,
if (obj == NULL)
return NULL;
- drm_gem_private_object_init(dev, &obj->base, stolen->size);
+ drm_gem_private_object_init(dev, &obj->base, stolen->base.size);
i915_gem_object_init(obj, &i915_gem_object_stolen_ops);
obj->pages = i915_pages_create_for_stolen(dev,
- stolen->start, stolen->size);
+ stolen->base.start,
+ stolen->base.size);
if (obj->pages == NULL)
goto cleanup;
i915_gem_object_pin_pages(obj);
obj->stolen = stolen;
+ stolen->obj = obj;
+ INIT_LIST_HEAD(&stolen->mm_link);
+
obj->base.read_domains = I915_GEM_DOMAIN_CPU | I915_GEM_DOMAIN_GTT;
obj->cache_level = HAS_LLC(dev) ? I915_CACHE_LLC : I915_CACHE_NONE;
@@ -456,36 +461,157 @@ cleanup:
return NULL;
}
-struct drm_i915_gem_object *
-i915_gem_object_create_stolen(struct drm_device *dev, u64 size)
+static bool mark_free(struct drm_i915_gem_object *obj, struct list_head *unwind)
+{
+ if (obj->stolen == NULL)
+ return false;
+
+ if (obj->madv != I915_MADV_DONTNEED)
+ return false;
+
+ if (obj->pin_display)
+ return false;
+
+ if (I915_BO_IS_ACTIVE(obj))
+ return false;
+
+ list_add(&obj->tmp_link, unwind);
+ return drm_mm_scan_add_block(&obj->stolen->base);
+}
+
+static int
+stolen_evict(struct drm_i915_private *dev_priv, u64 size)
{
- struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_i915_gem_object *obj;
- struct drm_mm_node *stolen;
+ struct list_head unwind, evict;
+ struct i915_stolen_node *iter;
int ret;
- if (!drm_mm_initialized(&dev_priv->mm.stolen))
- return NULL;
+ drm_mm_init_scan(&dev_priv->mm.stolen, size, 0, 0);
+ INIT_LIST_HEAD(&unwind);
+
+ list_for_each_entry(iter, &dev_priv->mm.stolen_list, mm_link) {
+ if (I915_BO_IS_ACTIVE(iter->obj))
+ continue;
+
+ if (mark_free(iter->obj, &unwind))
+ goto found;
+ }
+
+ list_for_each_entry(iter, &dev_priv->mm.stolen_list, mm_link) {
+ if (!I915_BO_IS_ACTIVE(iter->obj))
+ continue;
+
+ if (mark_free(iter->obj, &unwind))
+ goto found;
+ }
+
+found:
+ INIT_LIST_HEAD(&evict);
+ while (!list_empty(&unwind)) {
+ obj = list_first_entry(&unwind,
+ struct drm_i915_gem_object,
+ tmp_link);
+ list_del_init(&obj->tmp_link);
+
+ if (drm_mm_scan_remove_block(&obj->stolen->base)) {
+ list_add(&obj->tmp_link, &evict);
+ drm_gem_object_reference(&obj->base);
+ }
+ }
+
+ ret = 0;
+ while (!list_empty(&evict)) {
+ obj = list_first_entry(&evict,
+ struct drm_i915_gem_object,
+ tmp_link);
+ list_del_init(&obj->tmp_link);
+
+ if (ret == 0) {
+ struct i915_vma *vma, *vma_next;
+
+ list_for_each_entry_safe(vma, vma_next,
+ &obj->vma_list,
+ vma_link)
+ if (i915_vma_unbind(vma))
+ break;
+
+ /* Stolen pins its pages to prevent the
+ * normal shrinker from processing stolen
+ * objects.
+ */
+ i915_gem_object_unpin_pages(obj);
+
+ ret = i915_gem_object_put_pages(obj);
+ if (ret == 0) {
+ i915_gem_object_release_stolen(obj);
+ obj->madv = __I915_MADV_PURGED;
+ } else {
+ i915_gem_object_pin_pages(obj);
+ }
+ }
+
+ drm_gem_object_unreference(&obj->base);
+ }
+
+ return ret;
+}
+
+static struct i915_stolen_node *
+stolen_alloc(struct drm_i915_private *dev_priv, u64 size)
+{
+ struct i915_stolen_node *stolen;
+ int ret;
- DRM_DEBUG_KMS("creating stolen object: size=%llx\n", size);
if (size == 0)
- return NULL;
+ return ERR_PTR(-EINVAL);
stolen = kzalloc(sizeof(*stolen), GFP_KERNEL);
if (!stolen)
- return NULL;
+ return ERR_PTR(-ENOMEM);
- ret = i915_gem_stolen_insert_node(dev_priv, stolen, size, 4096);
+ ret = i915_gem_stolen_insert_node(dev_priv, &stolen->base, size, 4096);
+ if (ret == 0)
+ goto out;
+
+ /* No more stolen memory available, or too fragmented.
+ * Try evicting purgeable objects and search again.
+ */
+ ret = stolen_evict(dev_priv, size);
+
+ if (ret == 0)
+ ret = i915_gem_stolen_insert_node(dev_priv, &stolen->base,
+ size, 0);
+out:
if (ret) {
kfree(stolen);
- return NULL;
+ stolen = ERR_PTR(ret);
}
+ return stolen;
+}
+
+struct drm_i915_gem_object *
+i915_gem_object_create_stolen(struct drm_device *dev, u64 size)
+{
+ struct drm_i915_private *dev_priv = dev->dev_private;
+ struct drm_i915_gem_object *obj;
+ struct i915_stolen_node *stolen;
+
+ if (!drm_mm_initialized(&dev_priv->mm.stolen))
+ return NULL;
+
+ DRM_DEBUG_KMS("creating stolen object: size=%llx\n", size);
+
+ stolen = stolen_alloc(dev_priv, size);
+ if (IS_ERR(stolen))
+ return NULL;
+
obj = _i915_gem_object_create_stolen(dev, stolen);
if (obj)
return obj;
- i915_gem_stolen_remove_node(dev_priv, stolen);
+ i915_gem_stolen_remove_node(dev_priv, &stolen->base);
kfree(stolen);
return NULL;
}
@@ -499,7 +625,7 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev,
struct drm_i915_private *dev_priv = dev->dev_private;
struct i915_address_space *ggtt = &dev_priv->gtt.base;
struct drm_i915_gem_object *obj;
- struct drm_mm_node *stolen;
+ struct i915_stolen_node *stolen;
struct i915_vma *vma;
int ret;
@@ -518,10 +644,10 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev,
if (!stolen)
return NULL;
- stolen->start = stolen_offset;
- stolen->size = size;
+ stolen->base.start = stolen_offset;
+ stolen->base.size = size;
mutex_lock(&dev_priv->mm.stolen_lock);
- ret = drm_mm_reserve_node(&dev_priv->mm.stolen, stolen);
+ ret = drm_mm_reserve_node(&dev_priv->mm.stolen, &stolen->base);
mutex_unlock(&dev_priv->mm.stolen_lock);
if (ret) {
DRM_DEBUG_KMS("failed to allocate stolen space\n");
@@ -532,7 +658,7 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev,
obj = _i915_gem_object_create_stolen(dev, stolen);
if (obj == NULL) {
DRM_DEBUG_KMS("failed to allocate stolen object\n");
- i915_gem_stolen_remove_node(dev_priv, stolen);
+ i915_gem_stolen_remove_node(dev_priv, &stolen->base);
kfree(stolen);
return NULL;
}
@@ -573,7 +699,7 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev,
err_vma:
i915_gem_vma_destroy(vma);
err_out:
- i915_gem_stolen_remove_node(dev_priv, stolen);
+ i915_gem_stolen_remove_node(dev_priv, &stolen->base);
kfree(stolen);
drm_gem_object_unreference(&obj->base);
return NULL;
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index fff0c22..51f2f91 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -5235,7 +5235,7 @@ static void valleyview_check_pctx(struct drm_i915_private *dev_priv)
unsigned long pctx_addr = I915_READ(VLV_PCBR) & ~4095;
WARN_ON(pctx_addr != dev_priv->mm.stolen_base +
- dev_priv->vlv_pctx->stolen->start);
+ dev_priv->vlv_pctx->stolen->base.start);
}
@@ -5309,7 +5309,7 @@ static void valleyview_setup_pctx(struct drm_device *dev)
return;
}
- pctx_paddr = dev_priv->mm.stolen_base + pctx->stolen->start;
+ pctx_paddr = dev_priv->mm.stolen_base + pctx->stolen->base.start;
I915_WRITE(VLV_PCBR, pctx_paddr);
out:
--
1.9.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 4/4] drm/i915: Support for pread/pwrite from/to non shmem backed objects
2015-09-15 8:33 [PATCH v6 0/4] Support for creating/using Stolen memory backed objects ankitprasad.r.sharma
` (2 preceding siblings ...)
2015-09-15 8:33 ` [PATCH 3/4] drm/i915: Add support for stealing purgable stolen pages ankitprasad.r.sharma
@ 2015-09-15 8:33 ` ankitprasad.r.sharma
2015-09-15 9:54 ` Chris Wilson
2015-09-23 14:35 ` [PATCH v6 0/4] Support for creating/using Stolen memory " Chris Wilson
4 siblings, 1 reply; 26+ messages in thread
From: ankitprasad.r.sharma @ 2015-09-15 8:33 UTC (permalink / raw)
To: intel-gfx; +Cc: Ankitprasad Sharma, akash.goel, shashidhar.hiremath
From: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
This patch adds support for extending the pread/pwrite functionality
for objects not backed by shmem. The access will be made through
gtt interface.
This will cover prime objects as well as stolen memory backed objects
but for userptr objects it is still forbidden.
v2: Drop locks around slow_user_access, prefault the pages before
access (Chris)
v3: Rebased to the latest drm-intel-nightly (Ankit)
v4: Moved page base & offset calculations outside the copy loop,
corrected data types for size and offset variables, corrected if-else
braces format (Tvrtko/kerneldocs)
v5: Enabled pread/pwrite for all non-shmem backed objects including
without tiling restrictions (Ankit)
Testcase: igt/gem_stolen
Signed-off-by: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
---
drivers/gpu/drm/i915/i915_gem.c | 128 ++++++++++++++++++++++++++++++++++------
1 file changed, 111 insertions(+), 17 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 85025b1..2df37ac 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -614,6 +614,102 @@ shmem_pread_slow(struct page *page, int shmem_page_offset, int page_length,
return ret ? - EFAULT : 0;
}
+static inline uint64_t
+slow_user_access(struct io_mapping *mapping,
+ uint64_t page_base, int page_offset,
+ char __user *user_data,
+ int length, bool pwrite)
+{
+ void __iomem *vaddr_inatomic;
+ void *vaddr;
+ uint64_t unwritten;
+
+ vaddr_inatomic = io_mapping_map_wc(mapping, page_base);
+ /* We can use the cpu mem copy function because this is X86. */
+ vaddr = (void __force *)vaddr_inatomic + page_offset;
+ if (pwrite)
+ unwritten = __copy_from_user(vaddr, user_data, length);
+ else
+ unwritten = __copy_to_user(user_data, vaddr, length);
+
+ io_mapping_unmap(vaddr_inatomic);
+ return unwritten;
+}
+
+static int
+i915_gem_gtt_pread_pwrite(struct drm_device *dev,
+ struct drm_i915_gem_object *obj, uint64_t size,
+ uint64_t data_offset, uint64_t data_ptr, bool pwrite)
+{
+ struct drm_i915_private *dev_priv = dev->dev_private;
+ char __user *user_data;
+ uint64_t remain;
+ uint64_t offset, page_base;
+ int page_offset, page_length, ret = 0;
+
+ ret = i915_gem_obj_ggtt_pin(obj, 0, PIN_MAPPABLE);
+ if (ret)
+ goto out;
+
+ ret = i915_gem_object_set_to_gtt_domain(obj, pwrite);
+ if (ret)
+ goto out_unpin;
+
+ ret = i915_gem_object_put_fence(obj);
+ if (ret)
+ goto out_unpin;
+
+ user_data = to_user_ptr(data_ptr);
+ remain = size;
+ offset = i915_gem_obj_ggtt_offset(obj) + data_offset;
+
+ if (pwrite)
+ intel_fb_obj_invalidate(obj, ORIGIN_GTT);
+
+ mutex_unlock(&dev->struct_mutex);
+ if (!pwrite && likely(!i915.prefault_disable))
+ ret = fault_in_multipages_writeable(user_data, remain);
+
+ /*
+ * page_offset = offset within page
+ * page_base = page offset within aperture
+ */
+ page_offset = offset_in_page(offset);
+ page_base = offset & PAGE_MASK;
+
+ while (remain > 0) {
+ /* page_length = bytes to copy for this page */
+ page_length = remain;
+ if ((page_offset + remain) > PAGE_SIZE)
+ page_length = PAGE_SIZE - page_offset;
+
+ /* This is a slow read/write as it tries to read from
+ * and write to user memory which may result into page
+ * faults
+ */
+ ret = slow_user_access(dev_priv->gtt.mappable, page_base,
+ page_offset, user_data,
+ page_length, pwrite);
+
+ if (ret) {
+ ret = -EFAULT;
+ break;
+ }
+
+ remain -= page_length;
+ user_data += page_length;
+ page_base += page_length;
+ page_offset = 0;
+ }
+
+ mutex_lock(&dev->struct_mutex);
+
+out_unpin:
+ i915_gem_object_ggtt_unpin(obj);
+out:
+ return ret;
+}
+
static int
i915_gem_shmem_pread(struct drm_device *dev,
struct drm_i915_gem_object *obj,
@@ -737,17 +833,15 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data,
goto out;
}
- /* prime objects have no backing filp to GEM pread/pwrite
- * pages from.
- */
- if (!obj->base.filp) {
- ret = -EINVAL;
- goto out;
- }
-
trace_i915_gem_object_pread(obj, args->offset, args->size);
- ret = i915_gem_shmem_pread(dev, obj, args, file);
+ /* pread for non shmem backed objects */
+ if (!obj->base.filp)
+ ret = i915_gem_gtt_pread_pwrite(dev, obj, args->size,
+ args->offset, args->data_ptr,
+ false);
+ else
+ ret = i915_gem_shmem_pread(dev, obj, args, file);
out:
drm_gem_object_unreference(&obj->base);
@@ -1090,17 +1184,17 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data,
goto out;
}
- /* prime objects have no backing filp to GEM pread/pwrite
- * pages from.
- */
- if (!obj->base.filp) {
- ret = -EINVAL;
- goto out;
- }
-
trace_i915_gem_object_pwrite(obj, args->offset, args->size);
ret = -EFAULT;
+
+ /* pwrite for non shmem backed objects */
+ if (!obj->base.filp) {
+ ret = i915_gem_gtt_pread_pwrite(dev, obj, args->size,
+ args->offset, args->data_ptr,
+ true);
+ goto out;
+ }
/* We can only do the GTT pwrite on untiled buffers, as otherwise
* it would end up going through the fenced access, and we'll get
* different detiling behavior between reading and writing.
--
1.9.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 26+ messages in thread
* Re: [PATCH 3/4] drm/i915: Add support for stealing purgable stolen pages
2015-09-15 8:33 ` [PATCH 3/4] drm/i915: Add support for stealing purgable stolen pages ankitprasad.r.sharma
@ 2015-09-15 9:37 ` Chris Wilson
2015-09-15 15:14 ` Tvrtko Ursulin
1 sibling, 0 replies; 26+ messages in thread
From: Chris Wilson @ 2015-09-15 9:37 UTC (permalink / raw)
To: ankitprasad.r.sharma; +Cc: intel-gfx, akash.goel, shashidhar.hiremath
On Tue, Sep 15, 2015 at 02:03:26PM +0530, ankitprasad.r.sharma@intel.com wrote:
> -struct drm_i915_gem_object *
> -i915_gem_object_create_stolen(struct drm_device *dev, u64 size)
> +static bool mark_free(struct drm_i915_gem_object *obj, struct list_head *unwind)
> +{
> + if (obj->stolen == NULL)
> + return false;
BUG_ON(obj->stolen == NULL);
> +
> + if (obj->madv != I915_MADV_DONTNEED)
> + return false;
> +
> + if (obj->pin_display)
> + return false;
> +
> + if (I915_BO_IS_ACTIVE(obj))
> + return false;
We want to add both active/inactive objects (ordering by the caller to
prioritise inactive objects).
> + list_add(&obj->tmp_link, unwind);
> + return drm_mm_scan_add_block(&obj->stolen->base);
> +}
> +
> +static int
> +stolen_evict(struct drm_i915_private *dev_priv, u64 size)
> {
> - struct drm_i915_private *dev_priv = dev->dev_private;
> struct drm_i915_gem_object *obj;
> - struct drm_mm_node *stolen;
> + struct list_head unwind, evict;
> + struct i915_stolen_node *iter;
> int ret;
>
> - if (!drm_mm_initialized(&dev_priv->mm.stolen))
> - return NULL;
> + drm_mm_init_scan(&dev_priv->mm.stolen, size, 0, 0);
> + INIT_LIST_HEAD(&unwind);
> +
> + list_for_each_entry(iter, &dev_priv->mm.stolen_list, mm_link) {
> + if (I915_BO_IS_ACTIVE(iter->obj))
> + continue;
> +
> + if (mark_free(iter->obj, &unwind))
> + goto found;
> + }
> +
> + list_for_each_entry(iter, &dev_priv->mm.stolen_list, mm_link) {
> + if (!I915_BO_IS_ACTIVE(iter->obj))
> + continue;
> +
> + if (mark_free(iter->obj, &unwind))
> + goto found;
> + }
If I have my micro-optimising hat on, I would actually rewrite this as
soemthing like:
for (int phase = 0; phase <= 1; phase++) {
list_for_each_entry(iter, &dev_priv->mm.stolen_list, mm_link) {
if (I915_BO_IS_ACTIVE(iter->obj) != phase)
continue;
if (mark_free(iter->obj, &unwind))
goto found;
}
}
as the compiler will find that easier to perform magic with. We also
probably want to do i915_gem_retire_requests() first (so that any
recently idle objects are moved to the front queue).
> +found:
> + INIT_LIST_HEAD(&evict);
> + while (!list_empty(&unwind)) {
> + obj = list_first_entry(&unwind,
> + struct drm_i915_gem_object,
> + tmp_link);
> + list_del_init(&obj->tmp_link);
The fun thing with tmp_link is that we don't need to set it to clear
(either here or during object construction).
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 2/4] drm/i915: Support for creating Stolen memory backed objects
2015-09-15 8:33 ` [PATCH 2/4] drm/i915: Support for creating Stolen memory backed objects ankitprasad.r.sharma
@ 2015-09-15 9:49 ` Chris Wilson
2015-09-20 14:07 ` Ankitprasad Sharma
2015-09-15 14:11 ` Tvrtko Ursulin
1 sibling, 1 reply; 26+ messages in thread
From: Chris Wilson @ 2015-09-15 9:49 UTC (permalink / raw)
To: ankitprasad.r.sharma; +Cc: intel-gfx, akash.goel, shashidhar.hiremath
On Tue, Sep 15, 2015 at 02:03:25PM +0530, ankitprasad.r.sharma@intel.com wrote:
> i915_gem_create(struct drm_file *file,
> struct drm_device *dev,
> uint64_t size,
> + uint32_t flags,
> uint32_t *handle_p)
> {
> struct drm_i915_gem_object *obj;
> @@ -385,8 +386,31 @@ i915_gem_create(struct drm_file *file,
> if (size == 0)
> return -EINVAL;
>
> + if (flags & __I915_CREATE_UNKNOWN_FLAGS)
> + return -EINVAL;
> +
> /* Allocate the new object */
> - obj = i915_gem_alloc_object(dev, size);
> + if (flags & I915_CREATE_PLACEMENT_STOLEN) {
> + mutex_lock(&dev->struct_mutex);
> + obj = i915_gem_object_create_stolen(dev, size);
> + if (!obj) {
> + mutex_unlock(&dev->struct_mutex);
> + return -ENOMEM;
Note that you should change the i915_gem_object_create_stolen() to
report the precise error, as with the eviction support we may trigger
EINTR. Also ENOSPC will be preferrable for requesting a larger stolen
object than the available space (to help distinguish between true oom).
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 4/4] drm/i915: Support for pread/pwrite from/to non shmem backed objects
2015-09-15 8:33 ` [PATCH 4/4] drm/i915: Support for pread/pwrite from/to non shmem backed objects ankitprasad.r.sharma
@ 2015-09-15 9:54 ` Chris Wilson
2015-09-15 10:35 ` Ankitprasad Sharma
0 siblings, 1 reply; 26+ messages in thread
From: Chris Wilson @ 2015-09-15 9:54 UTC (permalink / raw)
To: ankitprasad.r.sharma; +Cc: intel-gfx, akash.goel, shashidhar.hiremath
On Tue, Sep 15, 2015 at 02:03:27PM +0530, ankitprasad.r.sharma@intel.com wrote:
> @@ -1090,17 +1184,17 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data,
> goto out;
> }
>
> - /* prime objects have no backing filp to GEM pread/pwrite
> - * pages from.
> - */
> - if (!obj->base.filp) {
> - ret = -EINVAL;
> - goto out;
> - }
> -
> trace_i915_gem_object_pwrite(obj, args->offset, args->size);
>
> ret = -EFAULT;
> +
> + /* pwrite for non shmem backed objects */
> + if (!obj->base.filp) {
> + ret = i915_gem_gtt_pread_pwrite(dev, obj, args->size,
> + args->offset, args->data_ptr,
> + true);
> + goto out;
> + }
There already exists a GTT write path, along with a more correct
description of its limitations.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 4/4] drm/i915: Support for pread/pwrite from/to non shmem backed objects
2015-09-15 9:54 ` Chris Wilson
@ 2015-09-15 10:35 ` Ankitprasad Sharma
0 siblings, 0 replies; 26+ messages in thread
From: Ankitprasad Sharma @ 2015-09-15 10:35 UTC (permalink / raw)
To: Chris Wilson; +Cc: intel-gfx, akash.goel, shashidhar.hiremath
On Tue, 2015-09-15 at 10:54 +0100, Chris Wilson wrote:
> On Tue, Sep 15, 2015 at 02:03:27PM +0530, ankitprasad.r.sharma@intel.com wrote:
> > @@ -1090,17 +1184,17 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data,
> > goto out;
> > }
> >
> > - /* prime objects have no backing filp to GEM pread/pwrite
> > - * pages from.
> > - */
> > - if (!obj->base.filp) {
> > - ret = -EINVAL;
> > - goto out;
> > - }
> > -
> > trace_i915_gem_object_pwrite(obj, args->offset, args->size);
> >
> > ret = -EFAULT;
> > +
> > + /* pwrite for non shmem backed objects */
> > + if (!obj->base.filp) {
> > + ret = i915_gem_gtt_pread_pwrite(dev, obj, args->size,
> > + args->offset, args->data_ptr,
> > + true);
> > + goto out;
> > + }
>
> There already exists a GTT write path, along with a more correct
> description of its limitations.
Then it would look something like this, making i915_gem_gtt_pwrite_fast
to handle pagefaults for non-shmem backed objects
@@ -831,10 +925,16 @@ i915_gem_gtt_pwrite_fast(struct drm_device *dev,
* retry in the slow path.
*/
- if (fast_user_write(dev_priv->gtt.mappable, page_base,
+ if (obj->base.filp &&
+ fast_user_write(dev_priv->gtt.mappable, page_base,
page_offset, user_data, page_length)) {
ret = -EFAULT;
goto out_flush;
+ } else if (slow_user_access(dev_priv->gtt.mappable,
+ page_base, page_offset,
+ user_data, page_length, true)) {
+ ret = -EFAULT;
+ goto out_flush;
}
Thanks
-Ankit
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 1/4] drm/i915: Clearing buffer objects via CPU/GTT
2015-09-15 8:33 ` [PATCH 1/4] drm/i915: Clearing buffer objects via CPU/GTT ankitprasad.r.sharma
@ 2015-09-15 14:00 ` Tvrtko Ursulin
0 siblings, 0 replies; 26+ messages in thread
From: Tvrtko Ursulin @ 2015-09-15 14:00 UTC (permalink / raw)
To: ankitprasad.r.sharma, intel-gfx; +Cc: akash.goel, shashidhar.hiremath
On 09/15/2015 09:33 AM, ankitprasad.r.sharma@intel.com wrote:
> From: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
>
> This patch adds support for clearing buffer objects via CPU/GTT. This
> is particularly useful for clearing out the non shmem backed objects.
> Currently intend to use this only for buffers allocated from stolen
> region.
>
> v2: Added kernel doc for i915_gem_clear_object(), corrected/removed
> variable assignments (Tvrtko)
>
> Testcase: igt/gem_stolen
>
> Signed-off-by: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
> ---
> drivers/gpu/drm/i915/i915_drv.h | 1 +
> drivers/gpu/drm/i915/i915_gem.c | 39 +++++++++++++++++++++++++++++++++++++++
> 2 files changed, 40 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index e0f3f05..8db905a 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -2820,6 +2820,7 @@ int i915_gem_obj_prepare_shmem_read(struct drm_i915_gem_object *obj,
> int *needs_clflush);
>
> int __must_check i915_gem_object_get_pages(struct drm_i915_gem_object *obj);
> +int i915_gem_clear_object(struct drm_i915_gem_object *obj);
>
> static inline int __sg_page_count(struct scatterlist *sg)
> {
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 1ac57ec..94533bf 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -5139,3 +5139,42 @@ fail:
> drm_gem_object_unreference(&obj->base);
> return ERR_PTR(ret);
> }
> +
> +/**
> + * i915_gem_clear_object() - Clear buffer object via CPU/GTT
> + * @obj: Buffer object to be cleared
> + *
> + * Return: 0 - success, non-zero - failure
> + */
> +int i915_gem_clear_object(struct drm_i915_gem_object *obj)
> +{
> + int ret;
> + char __iomem *base;
> + size_t size = obj->base.size;
> + struct drm_i915_private *dev_priv = to_i915(obj->base.dev);
> +
> + WARN_ON(!mutex_is_locked(&obj->base.dev->struct_mutex));
> + ret = i915_gem_obj_ggtt_pin(obj, 0, PIN_MAPPABLE);
> + if (ret)
> + return ret;
> +
> + ret = i915_gem_object_put_fence(obj);
> + if (ret)
> + goto unpin;
> +
> + /* Get the CPU virtual address of the buffer */
> + base = ioremap_wc(dev_priv->gtt.mappable_base +
> + i915_gem_obj_ggtt_offset(obj), size);
> + if (base == NULL) {
> + DRM_ERROR("Mapping of gem object to CPU failed!\n");
> + ret = -ENOSPC;
> + goto unpin;
> + }
> +
> + memset_io(base, 0, size);
> +
> + iounmap(base);
> +unpin:
> + i915_gem_object_ggtt_unpin(obj);
> + return ret;
> +}
>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 2/4] drm/i915: Support for creating Stolen memory backed objects
2015-09-15 8:33 ` [PATCH 2/4] drm/i915: Support for creating Stolen memory backed objects ankitprasad.r.sharma
2015-09-15 9:49 ` Chris Wilson
@ 2015-09-15 14:11 ` Tvrtko Ursulin
1 sibling, 0 replies; 26+ messages in thread
From: Tvrtko Ursulin @ 2015-09-15 14:11 UTC (permalink / raw)
To: ankitprasad.r.sharma, intel-gfx; +Cc: akash.goel, shashidhar.hiremath
On 09/15/2015 09:33 AM, ankitprasad.r.sharma@intel.com wrote:
> From: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
>
> Extend the drm_i915_gem_create structure to add support for
> creating Stolen memory backed objects. Added a new flag through
> which user can specify the preference to allocate the object from
> stolen memory, which if set, an attempt will be made to allocate
> the object from stolen memory subject to the availability of
> free space in the stolen region.
>
> v2: Rebased to the latest drm-intel-nightly (Ankit)
>
> v3: Changed versioning of GEM_CREATE param, added new comments (Tvrtko)
>
> v4: Changed size from 32b to 64b to prevent userspace overflow (Tvrtko)
> Corrected function arguments ordering (Chris)
>
> Testcase: igt/gem_stolen
>
> Signed-off-by: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
> ---
> drivers/gpu/drm/i915/i915_dma.c | 3 +++
> drivers/gpu/drm/i915/i915_drv.h | 2 +-
> drivers/gpu/drm/i915/i915_gem.c | 30 +++++++++++++++++++++++++++---
> drivers/gpu/drm/i915/i915_gem_stolen.c | 4 ++--
> include/uapi/drm/i915_drm.h | 16 ++++++++++++++++
> 5 files changed, 49 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
> index 2193cc2..8319e07 100644
> --- a/drivers/gpu/drm/i915/i915_dma.c
> +++ b/drivers/gpu/drm/i915/i915_dma.c
> @@ -170,6 +170,9 @@ static int i915_getparam(struct drm_device *dev, void *data,
> case I915_PARAM_HAS_RESOURCE_STREAMER:
> value = HAS_RESOURCE_STREAMER(dev);
> break;
> + case I915_PARAM_CREATE_VERSION:
> + value = 2;
> + break;
> default:
> DRM_DEBUG("Unknown parameter %d\n", param->param);
> return -EINVAL;
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 8db905a..e6ef083 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -3159,7 +3159,7 @@ void i915_gem_stolen_remove_node(struct drm_i915_private *dev_priv,
> int i915_gem_init_stolen(struct drm_device *dev);
> void i915_gem_cleanup_stolen(struct drm_device *dev);
> struct drm_i915_gem_object *
> -i915_gem_object_create_stolen(struct drm_device *dev, u32 size);
> +i915_gem_object_create_stolen(struct drm_device *dev, u64 size);
This leave the 32-bit size argument to i915_pages_create_for_stolen(),
but that is only a theoretical problem until larger than 4GB stolen
setup appears. :)
> struct drm_i915_gem_object *
> i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev,
> u32 stolen_offset,
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 94533bf..6568a7f 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -375,6 +375,7 @@ static int
> i915_gem_create(struct drm_file *file,
> struct drm_device *dev,
> uint64_t size,
> + uint32_t flags,
> uint32_t *handle_p)
> {
> struct drm_i915_gem_object *obj;
> @@ -385,8 +386,31 @@ i915_gem_create(struct drm_file *file,
> if (size == 0)
> return -EINVAL;
>
> + if (flags & __I915_CREATE_UNKNOWN_FLAGS)
> + return -EINVAL;
> +
> /* Allocate the new object */
> - obj = i915_gem_alloc_object(dev, size);
> + if (flags & I915_CREATE_PLACEMENT_STOLEN) {
> + mutex_lock(&dev->struct_mutex);
> + obj = i915_gem_object_create_stolen(dev, size);
> + if (!obj) {
> + mutex_unlock(&dev->struct_mutex);
> + return -ENOMEM;
> + }
> +
> + /* Always clear fresh buffers before handing to userspace */
> + ret = i915_gem_clear_object(obj);
> + if (ret) {
> + drm_gem_object_unreference(&obj->base);
> + mutex_unlock(&dev->struct_mutex);
> + return ret;
> + }
> +
> + mutex_unlock(&dev->struct_mutex);
> + } else {
> + obj = i915_gem_alloc_object(dev, size);
> + }
> +
> if (obj == NULL)
> return -ENOMEM;
>
> @@ -409,7 +433,7 @@ i915_gem_dumb_create(struct drm_file *file,
> args->pitch = ALIGN(args->width * DIV_ROUND_UP(args->bpp, 8), 64);
> args->size = args->pitch * args->height;
> return i915_gem_create(file, dev,
> - args->size, &args->handle);
> + args->size, 0, &args->handle);
> }
>
> /**
> @@ -422,7 +446,7 @@ i915_gem_create_ioctl(struct drm_device *dev, void *data,
> struct drm_i915_gem_create *args = data;
>
> return i915_gem_create(file, dev,
> - args->size, &args->handle);
> + args->size, args->flags, &args->handle);
> }
>
> static inline int
> diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
> index a36cb95..99f2bce 100644
> --- a/drivers/gpu/drm/i915/i915_gem_stolen.c
> +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
> @@ -457,7 +457,7 @@ cleanup:
> }
>
> struct drm_i915_gem_object *
> -i915_gem_object_create_stolen(struct drm_device *dev, u32 size)
> +i915_gem_object_create_stolen(struct drm_device *dev, u64 size)
> {
> struct drm_i915_private *dev_priv = dev->dev_private;
> struct drm_i915_gem_object *obj;
> @@ -467,7 +467,7 @@ i915_gem_object_create_stolen(struct drm_device *dev, u32 size)
> if (!drm_mm_initialized(&dev_priv->mm.stolen))
> return NULL;
>
> - DRM_DEBUG_KMS("creating stolen object: size=%x\n", size);
> + DRM_DEBUG_KMS("creating stolen object: size=%llx\n", size);
> if (size == 0)
> return NULL;
>
> diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
> index dbd16a2..f71f75c 100644
> --- a/include/uapi/drm/i915_drm.h
> +++ b/include/uapi/drm/i915_drm.h
> @@ -356,6 +356,7 @@ typedef struct drm_i915_irq_wait {
> #define I915_PARAM_EU_TOTAL 34
> #define I915_PARAM_HAS_GPU_RESET 35
> #define I915_PARAM_HAS_RESOURCE_STREAMER 36
> +#define I915_PARAM_CREATE_VERSION 37
>
> typedef struct drm_i915_getparam {
> s32 param;
> @@ -455,6 +456,21 @@ struct drm_i915_gem_create {
> */
> __u32 handle;
> __u32 pad;
> + /**
> + * Requested flags (currently used for placement
> + * (which memory domain))
> + *
> + * You can request that the object be created from special memory
> + * rather than regular system pages using this parameter. Such
> + * irregular objects may have certain restrictions (such as CPU
> + * access to a stolen object is verboten).
> + *
> + * This can be used in the future for other purposes too
> + * e.g. specifying tiling/caching/madvise
> + */
> + __u32 flags;
> +#define I915_CREATE_PLACEMENT_STOLEN (1<<0) /* Cannot use CPU mmaps */
> +#define __I915_CREATE_UNKNOWN_FLAGS -(I915_CREATE_PLACEMENT_STOLEN << 1)
> };
>
> struct drm_i915_gem_pread {
>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 3/4] drm/i915: Add support for stealing purgable stolen pages
2015-09-15 8:33 ` [PATCH 3/4] drm/i915: Add support for stealing purgable stolen pages ankitprasad.r.sharma
2015-09-15 9:37 ` Chris Wilson
@ 2015-09-15 15:14 ` Tvrtko Ursulin
2015-09-16 9:01 ` Ankitprasad Sharma
1 sibling, 1 reply; 26+ messages in thread
From: Tvrtko Ursulin @ 2015-09-15 15:14 UTC (permalink / raw)
To: ankitprasad.r.sharma, intel-gfx; +Cc: akash.goel, shashidhar.hiremath
On 09/15/2015 09:33 AM, ankitprasad.r.sharma@intel.com wrote:
> From: Chris Wilson <chris at chris-wilson.co.uk>
>
> If we run out of stolen memory when trying to allocate an object, see if
> we can reap enough purgeable objects to free up enough contiguous free
> space for the allocation. This is in principle very much like evicting
> objects to free up enough contiguous space in the vma when binding
> a new object - and you will be forgiven for thinking that the code looks
> very similar.
>
> At the moment, we do not allow userspace to allocate objects in stolen,
> so there is neither the memory pressure to trigger stolen eviction nor
> any purgeable objects inside the stolen arena. However, this will change
> in the near future, and so better management and defragmentation of
> stolen memory will become a real issue.
>
> v2: Remember to remove the drm_mm_node.
>
> v3: Rebased to the latest drm-intel-nightly (Ankit)
>
> v4: corrected if-else braces format (Tvrtko/kerneldoc)
>
> v5: Rebased to the latest drm-intel-nightly (Ankit)
> Added a seperate list to maintain purgable objects from stolen memory
> region (Chris/Daniel)
>
> Testcase: igt/gem_stolen
>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Signed-off-by: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
> ---
> drivers/gpu/drm/i915/i915_debugfs.c | 4 +-
> drivers/gpu/drm/i915/i915_drv.h | 17 +++-
> drivers/gpu/drm/i915/i915_gem.c | 16 +++
> drivers/gpu/drm/i915/i915_gem_stolen.c | 176 ++++++++++++++++++++++++++++-----
> drivers/gpu/drm/i915/intel_pm.c | 4 +-
> 5 files changed, 187 insertions(+), 30 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 7a28de5..0db8c47 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -179,7 +179,7 @@ describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj)
> seq_puts(m, ")");
> }
> if (obj->stolen)
> - seq_printf(m, " (stolen: %08llx)", obj->stolen->start);
> + seq_printf(m, " (stolen: %08llx)", obj->stolen->base.start);
> if (obj->pin_display || obj->fault_mappable) {
> char s[3], *t = s;
> if (obj->pin_display)
> @@ -258,7 +258,7 @@ static int obj_rank_by_stolen(void *priv,
> struct drm_i915_gem_object *b =
> container_of(B, struct drm_i915_gem_object, obj_exec_link);
>
> - return a->stolen->start - b->stolen->start;
> + return a->stolen->base.start - b->stolen->base.start;
> }
>
> static int i915_gem_stolen_list_info(struct seq_file *m, void *data)
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index e6ef083..37ee32d 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -841,6 +841,12 @@ struct i915_ctx_hang_stats {
> bool banned;
> };
>
> +struct i915_stolen_node {
> + struct drm_mm_node base;
> + struct list_head mm_link;
> + struct drm_i915_gem_object *obj;
> +};
> +
> /* This must match up with the value previously used for execbuf2.rsvd1. */
> #define DEFAULT_CONTEXT_HANDLE 0
>
> @@ -1268,6 +1274,13 @@ struct i915_gem_mm {
> */
> struct list_head unbound_list;
>
> + /**
> + * List of stolen objects that have been marked as purgeable and
> + * thus available for reaping if we need more space for a new
> + * allocation. Ordered by time of marking purgeable.
> + */
> + struct list_head stolen_list;
> +
> /** Usable portion of the GTT for GEM */
> unsigned long stolen_base; /* limited to low memory (32-bit) */
>
> @@ -2026,7 +2039,7 @@ struct drm_i915_gem_object {
> struct list_head vma_list;
>
> /** Stolen memory for this object, instead of being backed by shmem. */
> - struct drm_mm_node *stolen;
> + struct i915_stolen_node *stolen;
> struct list_head global_list;
>
> struct list_head ring_list[I915_NUM_RINGS];
> @@ -2034,6 +2047,7 @@ struct drm_i915_gem_object {
> struct list_head obj_exec_link;
>
> struct list_head batch_pool_link;
> + struct list_head tmp_link;
>
> /**
> * This is set if the object is on the active lists (has pending
> @@ -2150,6 +2164,7 @@ struct drm_i915_gem_object {
> };
> };
> #define to_intel_bo(x) container_of(x, struct drm_i915_gem_object, base)
> +#define I915_BO_IS_ACTIVE(__obj) (__obj->active)
>
> void i915_gem_track_fb(struct drm_i915_gem_object *old,
> struct drm_i915_gem_object *new,
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 6568a7f..85025b1 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -4228,6 +4228,20 @@ i915_gem_madvise_ioctl(struct drm_device *dev, void *data,
> if (obj->madv == I915_MADV_DONTNEED && obj->pages == NULL)
> i915_gem_object_truncate(obj);
>
> + if (obj->stolen) {
> + switch (obj->madv) {
> + case I915_MADV_WILLNEED:
> + list_del_init(&obj->stolen->mm_link);
> + break;
> + case I915_MADV_DONTNEED:
> + list_move(&obj->stolen->mm_link,
> + &dev_priv->mm.stolen_list);
> + break;
> + default:
> + break;
> + }
> + }
> +
> args->retained = obj->madv != __I915_MADV_PURGED;
>
> out:
> @@ -4248,6 +4262,7 @@ void i915_gem_object_init(struct drm_i915_gem_object *obj,
> INIT_LIST_HEAD(&obj->obj_exec_link);
> INIT_LIST_HEAD(&obj->vma_list);
> INIT_LIST_HEAD(&obj->batch_pool_link);
> + INIT_LIST_HEAD(&obj->tmp_link);
>
> obj->ops = ops;
>
> @@ -4898,6 +4913,7 @@ i915_gem_load(struct drm_device *dev)
> INIT_LIST_HEAD(&dev_priv->context_list);
> INIT_LIST_HEAD(&dev_priv->mm.unbound_list);
> INIT_LIST_HEAD(&dev_priv->mm.bound_list);
> + INIT_LIST_HEAD(&dev_priv->mm.stolen_list);
> INIT_LIST_HEAD(&dev_priv->mm.fence_list);
> for (i = 0; i < I915_NUM_RINGS; i++)
> init_ring_lists(&dev_priv->ring[i]);
> diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
> index 99f2bce..430e0b0 100644
> --- a/drivers/gpu/drm/i915/i915_gem_stolen.c
> +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
> @@ -52,8 +52,8 @@ int i915_gem_stolen_insert_node(struct drm_i915_private *dev_priv,
> return -ENODEV;
>
> mutex_lock(&dev_priv->mm.stolen_lock);
> - ret = drm_mm_insert_node(&dev_priv->mm.stolen, node, size, alignment,
> - DRM_MM_SEARCH_DEFAULT);
> + ret = drm_mm_insert_node(&dev_priv->mm.stolen, node,
> + size, alignment, DRM_MM_SEARCH_DEFAULT);
There is no change here.
> mutex_unlock(&dev_priv->mm.stolen_lock);
>
> return ret;
> @@ -407,18 +407,19 @@ static void i915_gem_object_put_pages_stolen(struct drm_i915_gem_object *obj)
> kfree(obj->pages);
> }
>
> -
>
> static void
> i915_gem_object_release_stolen(struct drm_i915_gem_object *obj)
> {
> struct drm_i915_private *dev_priv = obj->base.dev->dev_private;
>
> if (obj->stolen) {
> - i915_gem_stolen_remove_node(dev_priv, obj->stolen);
> + list_del(&obj->stolen->mm_link);
> + i915_gem_stolen_remove_node(dev_priv, &obj->stolen->base);
> kfree(obj->stolen);
> obj->stolen = NULL;
> }
> }
> +
> static const struct drm_i915_gem_object_ops i915_gem_object_stolen_ops = {
> .get_pages = i915_gem_object_get_pages_stolen,
> .put_pages = i915_gem_object_put_pages_stolen,
> @@ -427,7 +428,7 @@ static const struct drm_i915_gem_object_ops i915_gem_object_stolen_ops = {
>
> static struct drm_i915_gem_object *
> _i915_gem_object_create_stolen(struct drm_device *dev,
> - struct drm_mm_node *stolen)
> + struct i915_stolen_node *stolen)
> {
> struct drm_i915_gem_object *obj;
>
> @@ -435,17 +436,21 @@ _i915_gem_object_create_stolen(struct drm_device *dev,
> if (obj == NULL)
> return NULL;
>
> - drm_gem_private_object_init(dev, &obj->base, stolen->size);
> + drm_gem_private_object_init(dev, &obj->base, stolen->base.size);
> i915_gem_object_init(obj, &i915_gem_object_stolen_ops);
>
> obj->pages = i915_pages_create_for_stolen(dev,
> - stolen->start, stolen->size);
> + stolen->base.start,
> + stolen->base.size);
> if (obj->pages == NULL)
> goto cleanup;
>
> i915_gem_object_pin_pages(obj);
> obj->stolen = stolen;
>
> + stolen->obj = obj;
> + INIT_LIST_HEAD(&stolen->mm_link);
> +
> obj->base.read_domains = I915_GEM_DOMAIN_CPU | I915_GEM_DOMAIN_GTT;
> obj->cache_level = HAS_LLC(dev) ? I915_CACHE_LLC : I915_CACHE_NONE;
>
> @@ -456,36 +461,157 @@ cleanup:
> return NULL;
> }
>
> -struct drm_i915_gem_object *
> -i915_gem_object_create_stolen(struct drm_device *dev, u64 size)
> +static bool mark_free(struct drm_i915_gem_object *obj, struct list_head *unwind)
> +{
> + if (obj->stolen == NULL)
> + return false;
As Chris said, just WARN_ON instead of BUG_ON please.
> + if (obj->madv != I915_MADV_DONTNEED)
> + return false;
> +
> + if (obj->pin_display)
> + return false;
> +
> + if (I915_BO_IS_ACTIVE(obj))
> + return false;
Chris already spotted this will prevent callers from working as they expect.
> + list_add(&obj->tmp_link, unwind);
> + return drm_mm_scan_add_block(&obj->stolen->base);
> +}
> +
> +static int
> +stolen_evict(struct drm_i915_private *dev_priv, u64 size)
> {
> - struct drm_i915_private *dev_priv = dev->dev_private;
> struct drm_i915_gem_object *obj;
> - struct drm_mm_node *stolen;
> + struct list_head unwind, evict;
> + struct i915_stolen_node *iter;
> int ret;
>
> - if (!drm_mm_initialized(&dev_priv->mm.stolen))
> - return NULL;
> + drm_mm_init_scan(&dev_priv->mm.stolen, size, 0, 0);
> + INIT_LIST_HEAD(&unwind);
> +
> + list_for_each_entry(iter, &dev_priv->mm.stolen_list, mm_link) {
> + if (I915_BO_IS_ACTIVE(iter->obj))
> + continue;
> +
> + if (mark_free(iter->obj, &unwind))
> + goto found;
> + }
> +
> + list_for_each_entry(iter, &dev_priv->mm.stolen_list, mm_link) {
> + if (!I915_BO_IS_ACTIVE(iter->obj))
> + continue;
> +
> + if (mark_free(iter->obj, &unwind))
> + goto found;
> + }
> +
> +found:
> + INIT_LIST_HEAD(&evict);
> + while (!list_empty(&unwind)) {
> + obj = list_first_entry(&unwind,
> + struct drm_i915_gem_object,
> + tmp_link);
> + list_del_init(&obj->tmp_link);
> +
> + if (drm_mm_scan_remove_block(&obj->stolen->base)) {
> + list_add(&obj->tmp_link, &evict);
> + drm_gem_object_reference(&obj->base);
> + }
In what circumstances can drm_mm_scan_remove_block fail?
> + }
> +
> + ret = 0;
> + while (!list_empty(&evict)) {
> + obj = list_first_entry(&evict,
> + struct drm_i915_gem_object,
> + tmp_link);
> + list_del_init(&obj->tmp_link);
> +
> + if (ret == 0) {
> + struct i915_vma *vma, *vma_next;
> +
> + list_for_each_entry_safe(vma, vma_next,
> + &obj->vma_list,
> + vma_link)
> + if (i915_vma_unbind(vma))
> + break;
Because of VMA unbinding stolen creation now again needs struct_mutex. I
think putting held assertion somewhere in the call chain is now appropriate.
The rest looked good to me.
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 3/4] drm/i915: Add support for stealing purgable stolen pages
2015-09-15 15:14 ` Tvrtko Ursulin
@ 2015-09-16 9:01 ` Ankitprasad Sharma
2015-09-23 9:28 ` Daniel Vetter
0 siblings, 1 reply; 26+ messages in thread
From: Ankitprasad Sharma @ 2015-09-16 9:01 UTC (permalink / raw)
To: Tvrtko Ursulin; +Cc: intel-gfx, akash.goel, shashidhar.hiremath
On Tue, 2015-09-15 at 16:14 +0100, Tvrtko Ursulin wrote:
> On 09/15/2015 09:33 AM, ankitprasad.r.sharma@intel.com wrote:
> > From: Chris Wilson <chris at chris-wilson.co.uk>
> >
> > If we run out of stolen memory when trying to allocate an object, see if
> > we can reap enough purgeable objects to free up enough contiguous free
> > space for the allocation. This is in principle very much like evicting
> > objects to free up enough contiguous space in the vma when binding
> > a new object - and you will be forgiven for thinking that the code looks
> > very similar.
> >
> > At the moment, we do not allow userspace to allocate objects in stolen,
> > so there is neither the memory pressure to trigger stolen eviction nor
> > any purgeable objects inside the stolen arena. However, this will change
> > in the near future, and so better management and defragmentation of
> > stolen memory will become a real issue.
> >
> > v2: Remember to remove the drm_mm_node.
> >
> > v3: Rebased to the latest drm-intel-nightly (Ankit)
> >
> > v4: corrected if-else braces format (Tvrtko/kerneldoc)
> >
> > v5: Rebased to the latest drm-intel-nightly (Ankit)
> > Added a seperate list to maintain purgable objects from stolen memory
> > region (Chris/Daniel)
> >
> > Testcase: igt/gem_stolen
> >
> > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> > Signed-off-by: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
> > ---
> > drivers/gpu/drm/i915/i915_debugfs.c | 4 +-
> > drivers/gpu/drm/i915/i915_drv.h | 17 +++-
> > drivers/gpu/drm/i915/i915_gem.c | 16 +++
> > drivers/gpu/drm/i915/i915_gem_stolen.c | 176 ++++++++++++++++++++++++++++-----
> > drivers/gpu/drm/i915/intel_pm.c | 4 +-
> > 5 files changed, 187 insertions(+), 30 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> > index 7a28de5..0db8c47 100644
> > --- a/drivers/gpu/drm/i915/i915_debugfs.c
> > +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> > @@ -179,7 +179,7 @@ describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj)
> > seq_puts(m, ")");
> > }
> > if (obj->stolen)
> > - seq_printf(m, " (stolen: %08llx)", obj->stolen->start);
> > + seq_printf(m, " (stolen: %08llx)", obj->stolen->base.start);
> > if (obj->pin_display || obj->fault_mappable) {
> > char s[3], *t = s;
> > if (obj->pin_display)
> > @@ -258,7 +258,7 @@ static int obj_rank_by_stolen(void *priv,
> > struct drm_i915_gem_object *b =
> > container_of(B, struct drm_i915_gem_object, obj_exec_link);
> >
> > - return a->stolen->start - b->stolen->start;
> > + return a->stolen->base.start - b->stolen->base.start;
> > }
> >
> > static int i915_gem_stolen_list_info(struct seq_file *m, void *data)
> > diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> > index e6ef083..37ee32d 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.h
> > +++ b/drivers/gpu/drm/i915/i915_drv.h
> > @@ -841,6 +841,12 @@ struct i915_ctx_hang_stats {
> > bool banned;
> > };
> >
> > +struct i915_stolen_node {
> > + struct drm_mm_node base;
> > + struct list_head mm_link;
> > + struct drm_i915_gem_object *obj;
> > +};
> > +
> > /* This must match up with the value previously used for execbuf2.rsvd1. */
> > #define DEFAULT_CONTEXT_HANDLE 0
> >
> > @@ -1268,6 +1274,13 @@ struct i915_gem_mm {
> > */
> > struct list_head unbound_list;
> >
> > + /**
> > + * List of stolen objects that have been marked as purgeable and
> > + * thus available for reaping if we need more space for a new
> > + * allocation. Ordered by time of marking purgeable.
> > + */
> > + struct list_head stolen_list;
> > +
> > /** Usable portion of the GTT for GEM */
> > unsigned long stolen_base; /* limited to low memory (32-bit) */
> >
> > @@ -2026,7 +2039,7 @@ struct drm_i915_gem_object {
> > struct list_head vma_list;
> >
> > /** Stolen memory for this object, instead of being backed by shmem. */
> > - struct drm_mm_node *stolen;
> > + struct i915_stolen_node *stolen;
> > struct list_head global_list;
> >
> > struct list_head ring_list[I915_NUM_RINGS];
> > @@ -2034,6 +2047,7 @@ struct drm_i915_gem_object {
> > struct list_head obj_exec_link;
> >
> > struct list_head batch_pool_link;
> > + struct list_head tmp_link;
> >
> > /**
> > * This is set if the object is on the active lists (has pending
> > @@ -2150,6 +2164,7 @@ struct drm_i915_gem_object {
> > };
> > };
> > #define to_intel_bo(x) container_of(x, struct drm_i915_gem_object, base)
> > +#define I915_BO_IS_ACTIVE(__obj) (__obj->active)
> >
> > void i915_gem_track_fb(struct drm_i915_gem_object *old,
> > struct drm_i915_gem_object *new,
> > diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> > index 6568a7f..85025b1 100644
> > --- a/drivers/gpu/drm/i915/i915_gem.c
> > +++ b/drivers/gpu/drm/i915/i915_gem.c
> > @@ -4228,6 +4228,20 @@ i915_gem_madvise_ioctl(struct drm_device *dev, void *data,
> > if (obj->madv == I915_MADV_DONTNEED && obj->pages == NULL)
> > i915_gem_object_truncate(obj);
> >
> > + if (obj->stolen) {
> > + switch (obj->madv) {
> > + case I915_MADV_WILLNEED:
> > + list_del_init(&obj->stolen->mm_link);
> > + break;
> > + case I915_MADV_DONTNEED:
> > + list_move(&obj->stolen->mm_link,
> > + &dev_priv->mm.stolen_list);
> > + break;
> > + default:
> > + break;
> > + }
> > + }
> > +
> > args->retained = obj->madv != __I915_MADV_PURGED;
> >
> > out:
> > @@ -4248,6 +4262,7 @@ void i915_gem_object_init(struct drm_i915_gem_object *obj,
> > INIT_LIST_HEAD(&obj->obj_exec_link);
> > INIT_LIST_HEAD(&obj->vma_list);
> > INIT_LIST_HEAD(&obj->batch_pool_link);
> > + INIT_LIST_HEAD(&obj->tmp_link);
> >
> > obj->ops = ops;
> >
> > @@ -4898,6 +4913,7 @@ i915_gem_load(struct drm_device *dev)
> > INIT_LIST_HEAD(&dev_priv->context_list);
> > INIT_LIST_HEAD(&dev_priv->mm.unbound_list);
> > INIT_LIST_HEAD(&dev_priv->mm.bound_list);
> > + INIT_LIST_HEAD(&dev_priv->mm.stolen_list);
> > INIT_LIST_HEAD(&dev_priv->mm.fence_list);
> > for (i = 0; i < I915_NUM_RINGS; i++)
> > init_ring_lists(&dev_priv->ring[i]);
> > diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
> > index 99f2bce..430e0b0 100644
> > --- a/drivers/gpu/drm/i915/i915_gem_stolen.c
> > +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
> > @@ -52,8 +52,8 @@ int i915_gem_stolen_insert_node(struct drm_i915_private *dev_priv,
> > return -ENODEV;
> >
> > mutex_lock(&dev_priv->mm.stolen_lock);
> > - ret = drm_mm_insert_node(&dev_priv->mm.stolen, node, size, alignment,
> > - DRM_MM_SEARCH_DEFAULT);
> > + ret = drm_mm_insert_node(&dev_priv->mm.stolen, node,
> > + size, alignment, DRM_MM_SEARCH_DEFAULT);
>
> There is no change here.
>
> > mutex_unlock(&dev_priv->mm.stolen_lock);
> >
> > return ret;
> > @@ -407,18 +407,19 @@ static void i915_gem_object_put_pages_stolen(struct drm_i915_gem_object *obj)
> > kfree(obj->pages);
> > }
> >
> > -
> >
> > static void
> > i915_gem_object_release_stolen(struct drm_i915_gem_object *obj)
> > {
> > struct drm_i915_private *dev_priv = obj->base.dev->dev_private;
> >
> > if (obj->stolen) {
> > - i915_gem_stolen_remove_node(dev_priv, obj->stolen);
> > + list_del(&obj->stolen->mm_link);
> > + i915_gem_stolen_remove_node(dev_priv, &obj->stolen->base);
> > kfree(obj->stolen);
> > obj->stolen = NULL;
> > }
> > }
> > +
> > static const struct drm_i915_gem_object_ops i915_gem_object_stolen_ops = {
> > .get_pages = i915_gem_object_get_pages_stolen,
> > .put_pages = i915_gem_object_put_pages_stolen,
> > @@ -427,7 +428,7 @@ static const struct drm_i915_gem_object_ops i915_gem_object_stolen_ops = {
> >
> > static struct drm_i915_gem_object *
> > _i915_gem_object_create_stolen(struct drm_device *dev,
> > - struct drm_mm_node *stolen)
> > + struct i915_stolen_node *stolen)
> > {
> > struct drm_i915_gem_object *obj;
> >
> > @@ -435,17 +436,21 @@ _i915_gem_object_create_stolen(struct drm_device *dev,
> > if (obj == NULL)
> > return NULL;
> >
> > - drm_gem_private_object_init(dev, &obj->base, stolen->size);
> > + drm_gem_private_object_init(dev, &obj->base, stolen->base.size);
> > i915_gem_object_init(obj, &i915_gem_object_stolen_ops);
> >
> > obj->pages = i915_pages_create_for_stolen(dev,
> > - stolen->start, stolen->size);
> > + stolen->base.start,
> > + stolen->base.size);
> > if (obj->pages == NULL)
> > goto cleanup;
> >
> > i915_gem_object_pin_pages(obj);
> > obj->stolen = stolen;
> >
> > + stolen->obj = obj;
> > + INIT_LIST_HEAD(&stolen->mm_link);
> > +
> > obj->base.read_domains = I915_GEM_DOMAIN_CPU | I915_GEM_DOMAIN_GTT;
> > obj->cache_level = HAS_LLC(dev) ? I915_CACHE_LLC : I915_CACHE_NONE;
> >
> > @@ -456,36 +461,157 @@ cleanup:
> > return NULL;
> > }
> >
> > -struct drm_i915_gem_object *
> > -i915_gem_object_create_stolen(struct drm_device *dev, u64 size)
> > +static bool mark_free(struct drm_i915_gem_object *obj, struct list_head *unwind)
> > +{
> > + if (obj->stolen == NULL)
> > + return false;
>
> As Chris said, just WARN_ON instead of BUG_ON please.
>
> > + if (obj->madv != I915_MADV_DONTNEED)
> > + return false;
> > +
> > + if (obj->pin_display)
> > + return false;
> > +
> > + if (I915_BO_IS_ACTIVE(obj))
> > + return false;
>
> Chris already spotted this will prevent callers from working as they expect.
>
> > + list_add(&obj->tmp_link, unwind);
> > + return drm_mm_scan_add_block(&obj->stolen->base);
> > +}
> > +
> > +static int
> > +stolen_evict(struct drm_i915_private *dev_priv, u64 size)
> > {
> > - struct drm_i915_private *dev_priv = dev->dev_private;
> > struct drm_i915_gem_object *obj;
> > - struct drm_mm_node *stolen;
> > + struct list_head unwind, evict;
> > + struct i915_stolen_node *iter;
> > int ret;
> >
> > - if (!drm_mm_initialized(&dev_priv->mm.stolen))
> > - return NULL;
> > + drm_mm_init_scan(&dev_priv->mm.stolen, size, 0, 0);
> > + INIT_LIST_HEAD(&unwind);
> > +
> > + list_for_each_entry(iter, &dev_priv->mm.stolen_list, mm_link) {
> > + if (I915_BO_IS_ACTIVE(iter->obj))
> > + continue;
> > +
> > + if (mark_free(iter->obj, &unwind))
> > + goto found;
> > + }
> > +
> > + list_for_each_entry(iter, &dev_priv->mm.stolen_list, mm_link) {
> > + if (!I915_BO_IS_ACTIVE(iter->obj))
> > + continue;
> > +
> > + if (mark_free(iter->obj, &unwind))
> > + goto found;
> > + }
> > +
> > +found:
> > + INIT_LIST_HEAD(&evict);
> > + while (!list_empty(&unwind)) {
> > + obj = list_first_entry(&unwind,
> > + struct drm_i915_gem_object,
> > + tmp_link);
> > + list_del_init(&obj->tmp_link);
> > +
> > + if (drm_mm_scan_remove_block(&obj->stolen->base)) {
> > + list_add(&obj->tmp_link, &evict);
> > + drm_gem_object_reference(&obj->base);
> > + }
>
> In what circumstances can drm_mm_scan_remove_block fail?
It works some thing like this:
If there are 10 purgable nodes in the unwind list and 4 of them are
positioned in a way to reap enough contiguous space for the new object
(not necessarily purging all nodes will give us the amount of space we
need), then for the remaining 6 nodes drm_mm_scan_remove_block will
fail, while the rest will be removed to make space for the new object.
Thanks,
Ankit
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 2/4] drm/i915: Support for creating Stolen memory backed objects
2015-09-15 9:49 ` Chris Wilson
@ 2015-09-20 14:07 ` Ankitprasad Sharma
2015-09-23 9:26 ` Daniel Vetter
0 siblings, 1 reply; 26+ messages in thread
From: Ankitprasad Sharma @ 2015-09-20 14:07 UTC (permalink / raw)
To: Chris Wilson; +Cc: intel-gfx, akash.goel, shashidhar.hiremath
On Tue, 2015-09-15 at 10:49 +0100, Chris Wilson wrote:
> On Tue, Sep 15, 2015 at 02:03:25PM +0530, ankitprasad.r.sharma@intel.com wrote:
> > i915_gem_create(struct drm_file *file,
> > struct drm_device *dev,
> > uint64_t size,
> > + uint32_t flags,
> > uint32_t *handle_p)
> > {
> > struct drm_i915_gem_object *obj;
> > @@ -385,8 +386,31 @@ i915_gem_create(struct drm_file *file,
> > if (size == 0)
> > return -EINVAL;
> >
> > + if (flags & __I915_CREATE_UNKNOWN_FLAGS)
> > + return -EINVAL;
> > +
> > /* Allocate the new object */
> > - obj = i915_gem_alloc_object(dev, size);
> > + if (flags & I915_CREATE_PLACEMENT_STOLEN) {
> > + mutex_lock(&dev->struct_mutex);
> > + obj = i915_gem_object_create_stolen(dev, size);
> > + if (!obj) {
> > + mutex_unlock(&dev->struct_mutex);
> > + return -ENOMEM;
>
> Note that you should change the i915_gem_object_create_stolen() to
> report the precise error, as with the eviction support we may trigger
> EINTR. Also ENOSPC will be preferrable for requesting a larger stolen
> object than the available space (to help distinguish between true oom).
> -Chris
I would prefer to do this as a separate patch, as this might require a
restructuring of the gem_stolen.c to some extent, something like this:
@@ -465,29 +467,29 @@ i915_gem_object_create_stolen(struct drm_device
*dev, u64 size)
int ret;
if (!drm_mm_initialized(&dev_priv->mm.stolen))
- return NULL;
+ return ERR_PTR(-EINVAL);
DRM_DEBUG_KMS("creating stolen object: size=%llx\n", size);
if (size == 0)
- return NULL;
+ return ERR_PTR(-EINVAL);
stolen = kzalloc(sizeof(*stolen), GFP_KERNEL);
if (!stolen)
- return NULL;
+ return ERR_PTR(-ENOMEM);
ret = i915_gem_stolen_insert_node(dev_priv, stolen, size, 4096);
if (ret) {
kfree(stolen);
- return NULL;
+ return ERR_PTR(-ENOSPC);
}
obj = _i915_gem_object_create_stolen(dev, stolen);
- if (obj)
+ if (!IS_ERR(obj))
return obj;
i915_gem_stolen_remove_node(dev_priv, stolen);
kfree(stolen);
- return NULL;
+ return obj;
}
Thanks,
Ankit
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 2/4] drm/i915: Support for creating Stolen memory backed objects
2015-09-20 14:07 ` Ankitprasad Sharma
@ 2015-09-23 9:26 ` Daniel Vetter
0 siblings, 0 replies; 26+ messages in thread
From: Daniel Vetter @ 2015-09-23 9:26 UTC (permalink / raw)
To: Ankitprasad Sharma; +Cc: intel-gfx, shashidhar.hiremath, akash.goel
On Sun, Sep 20, 2015 at 07:37:46PM +0530, Ankitprasad Sharma wrote:
> On Tue, 2015-09-15 at 10:49 +0100, Chris Wilson wrote:
> > On Tue, Sep 15, 2015 at 02:03:25PM +0530, ankitprasad.r.sharma@intel.com wrote:
> > > i915_gem_create(struct drm_file *file,
> > > struct drm_device *dev,
> > > uint64_t size,
> > > + uint32_t flags,
> > > uint32_t *handle_p)
> > > {
> > > struct drm_i915_gem_object *obj;
> > > @@ -385,8 +386,31 @@ i915_gem_create(struct drm_file *file,
> > > if (size == 0)
> > > return -EINVAL;
> > >
> > > + if (flags & __I915_CREATE_UNKNOWN_FLAGS)
> > > + return -EINVAL;
> > > +
> > > /* Allocate the new object */
> > > - obj = i915_gem_alloc_object(dev, size);
> > > + if (flags & I915_CREATE_PLACEMENT_STOLEN) {
> > > + mutex_lock(&dev->struct_mutex);
> > > + obj = i915_gem_object_create_stolen(dev, size);
> > > + if (!obj) {
> > > + mutex_unlock(&dev->struct_mutex);
> > > + return -ENOMEM;
> >
> > Note that you should change the i915_gem_object_create_stolen() to
> > report the precise error, as with the eviction support we may trigger
> > EINTR. Also ENOSPC will be preferrable for requesting a larger stolen
> > object than the available space (to help distinguish between true oom).
> > -Chris
> I would prefer to do this as a separate patch, as this might require a
> restructuring of the gem_stolen.c to some extent, something like this:
Yeah makes sense to have that split out, but I agree with Chris that we'll
need that error reporting. Follow-up patch on top of your series if fine
with me.
-Daniel
>
> @@ -465,29 +467,29 @@ i915_gem_object_create_stolen(struct drm_device
> *dev, u64 size)
> int ret;
>
> if (!drm_mm_initialized(&dev_priv->mm.stolen))
> - return NULL;
> + return ERR_PTR(-EINVAL);
>
> DRM_DEBUG_KMS("creating stolen object: size=%llx\n", size);
> if (size == 0)
> - return NULL;
> + return ERR_PTR(-EINVAL);
>
> stolen = kzalloc(sizeof(*stolen), GFP_KERNEL);
> if (!stolen)
> - return NULL;
> + return ERR_PTR(-ENOMEM);
>
> ret = i915_gem_stolen_insert_node(dev_priv, stolen, size, 4096);
> if (ret) {
> kfree(stolen);
> - return NULL;
> + return ERR_PTR(-ENOSPC);
> }
>
> obj = _i915_gem_object_create_stolen(dev, stolen);
> - if (obj)
> + if (!IS_ERR(obj))
> return obj;
>
> i915_gem_stolen_remove_node(dev_priv, stolen);
> kfree(stolen);
> - return NULL;
> + return obj;
> }
>
>
> Thanks,
> Ankit
>
>
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 3/4] drm/i915: Add support for stealing purgable stolen pages
2015-09-16 9:01 ` Ankitprasad Sharma
@ 2015-09-23 9:28 ` Daniel Vetter
2015-09-23 9:30 ` Tvrtko Ursulin
0 siblings, 1 reply; 26+ messages in thread
From: Daniel Vetter @ 2015-09-23 9:28 UTC (permalink / raw)
To: Ankitprasad Sharma; +Cc: intel-gfx, akash.goel, shashidhar.hiremath
On Wed, Sep 16, 2015 at 02:31:38PM +0530, Ankitprasad Sharma wrote:
> On Tue, 2015-09-15 at 16:14 +0100, Tvrtko Ursulin wrote:
> > On 09/15/2015 09:33 AM, ankitprasad.r.sharma@intel.com wrote:
> > In what circumstances can drm_mm_scan_remove_block fail?
> It works some thing like this:
> If there are 10 purgable nodes in the unwind list and 4 of them are
> positioned in a way to reap enough contiguous space for the new object
> (not necessarily purging all nodes will give us the amount of space we
> need), then for the remaining 6 nodes drm_mm_scan_remove_block will
> fail, while the rest will be removed to make space for the new object.
Quoting the nice kerneldoc we have:
* Returns:
* True if this block should be evicted, false otherwise. Will always
* return false when no hole has been found.
Was that not clear enough or did you simply not bother to read the docs?
If it's not clear (together with the obligatory DOC: overview section) we
need to improve them ...
Thanks, Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 3/4] drm/i915: Add support for stealing purgable stolen pages
2015-09-23 9:28 ` Daniel Vetter
@ 2015-09-23 9:30 ` Tvrtko Ursulin
2015-09-23 12:12 ` Daniel Vetter
0 siblings, 1 reply; 26+ messages in thread
From: Tvrtko Ursulin @ 2015-09-23 9:30 UTC (permalink / raw)
To: Daniel Vetter, Ankitprasad Sharma
Cc: intel-gfx, akash.goel, shashidhar.hiremath
On 09/23/2015 10:28 AM, Daniel Vetter wrote:
> On Wed, Sep 16, 2015 at 02:31:38PM +0530, Ankitprasad Sharma wrote:
>> On Tue, 2015-09-15 at 16:14 +0100, Tvrtko Ursulin wrote:
>>> On 09/15/2015 09:33 AM, ankitprasad.r.sharma@intel.com wrote:
>>> In what circumstances can drm_mm_scan_remove_block fail?
>> It works some thing like this:
>> If there are 10 purgable nodes in the unwind list and 4 of them are
>> positioned in a way to reap enough contiguous space for the new object
>> (not necessarily purging all nodes will give us the amount of space we
>> need), then for the remaining 6 nodes drm_mm_scan_remove_block will
>> fail, while the rest will be removed to make space for the new object.
>
> Quoting the nice kerneldoc we have:
>
> * Returns:
> * True if this block should be evicted, false otherwise. Will always
> * return false when no hole has been found.
>
> Was that not clear enough or did you simply not bother to read the docs?
> If it's not clear (together with the obligatory DOC: overview section) we
> need to improve them ...
Not sure to whom you are addressing this? I did not read the docs, after
years of no docs the notion that there aren't any is kind of hard
embedded in me at least. :)
Ankit's explanation is also more detailed, answers the interesting
question, again for me at least.
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 3/4] drm/i915: Add support for stealing purgable stolen pages
2015-09-23 9:30 ` Tvrtko Ursulin
@ 2015-09-23 12:12 ` Daniel Vetter
0 siblings, 0 replies; 26+ messages in thread
From: Daniel Vetter @ 2015-09-23 12:12 UTC (permalink / raw)
To: Tvrtko Ursulin
Cc: Ankitprasad Sharma, intel-gfx, akash.goel, shashidhar.hiremath
On Wed, Sep 23, 2015 at 10:30:51AM +0100, Tvrtko Ursulin wrote:
>
> On 09/23/2015 10:28 AM, Daniel Vetter wrote:
> >On Wed, Sep 16, 2015 at 02:31:38PM +0530, Ankitprasad Sharma wrote:
> >>On Tue, 2015-09-15 at 16:14 +0100, Tvrtko Ursulin wrote:
> >>>On 09/15/2015 09:33 AM, ankitprasad.r.sharma@intel.com wrote:
> >>>In what circumstances can drm_mm_scan_remove_block fail?
> >>It works some thing like this:
> >>If there are 10 purgable nodes in the unwind list and 4 of them are
> >>positioned in a way to reap enough contiguous space for the new object
> >>(not necessarily purging all nodes will give us the amount of space we
> >>need), then for the remaining 6 nodes drm_mm_scan_remove_block will
> >>fail, while the rest will be removed to make space for the new object.
> >
> >Quoting the nice kerneldoc we have:
> >
> > * Returns:
> > * True if this block should be evicted, false otherwise. Will always
> > * return false when no hole has been found.
> >
> >Was that not clear enough or did you simply not bother to read the docs?
> >If it's not clear (together with the obligatory DOC: overview section) we
> >need to improve them ...
>
> Not sure to whom you are addressing this? I did not read the docs, after
> years of no docs the notion that there aren't any is kind of hard embedded
> in me at least. :)
>
> Ankit's explanation is also more detailed, answers the interesting question,
> again for me at least.
Question was to you, and looks like the answer is "didn't read the docs".
They do explain (in more detail) pretty much everything what Ankitprasad
said, just wanted to make sure we are covered there.
Which reminds me: Do we have kerneldoc for stolen (and this new feature
here) too? Ankitprasad?
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v6 0/4] Support for creating/using Stolen memory backed objects
2015-09-15 8:33 [PATCH v6 0/4] Support for creating/using Stolen memory backed objects ankitprasad.r.sharma
` (3 preceding siblings ...)
2015-09-15 8:33 ` [PATCH 4/4] drm/i915: Support for pread/pwrite from/to non shmem backed objects ankitprasad.r.sharma
@ 2015-09-23 14:35 ` Chris Wilson
2015-09-30 10:35 ` Ankitprasad Sharma
4 siblings, 1 reply; 26+ messages in thread
From: Chris Wilson @ 2015-09-23 14:35 UTC (permalink / raw)
To: ankitprasad.r.sharma; +Cc: intel-gfx, akash.goel, shashidhar.hiremath
On Tue, Sep 15, 2015 at 02:03:23PM +0530, ankitprasad.r.sharma@intel.com wrote:
> From: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
>
> This patch series adds support for creating/using Stolen memory backed
> objects.
Note that we still need something like
http://cgit.freedesktop.org/~ickle/linux-2.6/commit/?h=nightly&id=1b44b8eb761f79bac258ca8da9cf266c7ae3a998
before we can have user data in stolen objects that survive across
hibernation.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v6 0/4] Support for creating/using Stolen memory backed objects
2015-09-23 14:35 ` [PATCH v6 0/4] Support for creating/using Stolen memory " Chris Wilson
@ 2015-09-30 10:35 ` Ankitprasad Sharma
0 siblings, 0 replies; 26+ messages in thread
From: Ankitprasad Sharma @ 2015-09-30 10:35 UTC (permalink / raw)
To: Chris Wilson; +Cc: intel-gfx, akash.goel, shashidhar.hiremath
On Wed, 2015-09-23 at 15:35 +0100, Chris Wilson wrote:
> On Tue, Sep 15, 2015 at 02:03:23PM +0530, ankitprasad.r.sharma@intel.com wrote:
> > From: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
> >
> > This patch series adds support for creating/using Stolen memory backed
> > objects.
>
> Note that we still need something like
>
> http://cgit.freedesktop.org/~ickle/linux-2.6/commit/?h=nightly&id=1b44b8eb761f79bac258ca8da9cf266c7ae3a998
>
Hi Chris, there are quite a few undefined variables and functions in the
snippet. like obj->vmapping, i915_gem_obj_get_dma_address()
Do you have any prototypes for the usage of those? (or base patches that
I should have in my local tree before using the patch?)
Thanks,
Ankit
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 26+ messages in thread
end of thread, other threads:[~2015-09-30 10:52 UTC | newest]
Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-15 8:33 [PATCH v6 0/4] Support for creating/using Stolen memory backed objects ankitprasad.r.sharma
2015-09-15 8:33 ` [PATCH 1/4] drm/i915: Clearing buffer objects via CPU/GTT ankitprasad.r.sharma
2015-09-15 14:00 ` Tvrtko Ursulin
2015-09-15 8:33 ` [PATCH 2/4] drm/i915: Support for creating Stolen memory backed objects ankitprasad.r.sharma
2015-09-15 9:49 ` Chris Wilson
2015-09-20 14:07 ` Ankitprasad Sharma
2015-09-23 9:26 ` Daniel Vetter
2015-09-15 14:11 ` Tvrtko Ursulin
2015-09-15 8:33 ` [PATCH 3/4] drm/i915: Add support for stealing purgable stolen pages ankitprasad.r.sharma
2015-09-15 9:37 ` Chris Wilson
2015-09-15 15:14 ` Tvrtko Ursulin
2015-09-16 9:01 ` Ankitprasad Sharma
2015-09-23 9:28 ` Daniel Vetter
2015-09-23 9:30 ` Tvrtko Ursulin
2015-09-23 12:12 ` Daniel Vetter
2015-09-15 8:33 ` [PATCH 4/4] drm/i915: Support for pread/pwrite from/to non shmem backed objects ankitprasad.r.sharma
2015-09-15 9:54 ` Chris Wilson
2015-09-15 10:35 ` Ankitprasad Sharma
2015-09-23 14:35 ` [PATCH v6 0/4] Support for creating/using Stolen memory " Chris Wilson
2015-09-30 10:35 ` Ankitprasad Sharma
-- strict thread matches above, loose matches on Subject: below --
2015-07-22 13:51 [PATCH v5 " ankitprasad.r.sharma
2015-07-22 13:51 ` [PATCH 1/4] drm/i915: Clearing buffer objects via CPU/GTT ankitprasad.r.sharma
2015-07-22 15:01 ` Tvrtko Ursulin
2015-07-22 15:05 ` Chris Wilson
2015-07-22 15:06 ` Chris Wilson
2015-07-22 15:16 ` Tvrtko Ursulin
2015-07-22 15:23 ` Chris Wilson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).