Displaying 20 results from an estimated 27 matches for "drm_gem_vram_placement".
2019 May 06
2
[PATCH v4 01/19] drm: Add |struct drm_gem_vram_object| and helpers
...et;
> + struct ttm_operation_ctx ctx = { false, false };
> +
> + if (!gbo->pin_count)
> + return 0;
Likewise.
> + --gbo->pin_count;
> + if (gbo->pin_count)
> + return 0;
> +
> + if (gbo->kmap.virtual)
> + ttm_bo_kunmap(&gbo->kmap);
> +
> + drm_gem_vram_placement(gbo, TTM_PL_FLAG_SYSTEM);
> + for (i = 0; i < gbo->placement.num_placement ; ++i)
> + gbo->placements[i].flags |= TTM_PL_FLAG_NO_EVICT;
> +
> + ret = ttm_bo_validate(&gbo->bo, &gbo->placement, &ctx);
> + if (ret)
> + return ret;
> +
> + return 0;...
2019 May 06
2
[PATCH v4 01/19] drm: Add |struct drm_gem_vram_object| and helpers
...et;
> + struct ttm_operation_ctx ctx = { false, false };
> +
> + if (!gbo->pin_count)
> + return 0;
Likewise.
> + --gbo->pin_count;
> + if (gbo->pin_count)
> + return 0;
> +
> + if (gbo->kmap.virtual)
> + ttm_bo_kunmap(&gbo->kmap);
> +
> + drm_gem_vram_placement(gbo, TTM_PL_FLAG_SYSTEM);
> + for (i = 0; i < gbo->placement.num_placement ; ++i)
> + gbo->placements[i].flags |= TTM_PL_FLAG_NO_EVICT;
> +
> + ret = ttm_bo_validate(&gbo->bo, &gbo->placement, &ctx);
> + if (ret)
> + return ret;
> +
> + return 0;...
2019 May 06
1
[PATCH v4 01/19] drm: Add |struct drm_gem_vram_object| and helpers
Hi,
> This misses the call to drm_gem_vram_placement(), where
> drm_gem_vram_push_to_system() enforces placement in system memory.
Ah, missed that detail.
> We
> could build a common implementation out of both interfaces, but that
> would obfuscate the code IMHO. I'd just leave it as it is.
Ok.
> >> +struct drm_gem_vram_o...
2019 May 06
0
[PATCH v4 01/19] drm: Add |struct drm_gem_vram_object| and helpers
Hi
thanks for reviewing the patches.
Am 06.05.19 um 14:31 schrieb Gerd Hoffmann:
>> + --gbo->pin_count;
>> + if (gbo->pin_count)
>> + return 0;
>> +
>> + if (gbo->kmap.virtual)
>> + ttm_bo_kunmap(&gbo->kmap);
>> +
>> + drm_gem_vram_placement(gbo, TTM_PL_FLAG_SYSTEM);
>> + for (i = 0; i < gbo->placement.num_placement ; ++i)
>> + gbo->placements[i].flags |= TTM_PL_FLAG_NO_EVICT;
>> +
>> + ret = ttm_bo_validate(&gbo->bo, &gbo->placement, &ctx);
>> + if (ret)
>> + return ret;...
2019 Apr 24
1
[PATCH v2 02/17] drm: Add |struct drm_gem_vram_object| callbacks for |struct ttm_bo_driver|
...o_driver_evict_flags(struct ttm_buffer_object *bo,
> + struct ttm_placement *pl)
> +{
> + struct drm_gem_vram_object *gbo;
> +
> + /* TTM may pass BOs that are not GEM VRAM BOs. */
> + if (!drm_is_gem_vram(bo))
> + return;
> +
> + gbo = drm_gem_vram_of_bo(bo);
> + drm_gem_vram_placement(gbo, TTM_PL_FLAG_SYSTEM);
> + *pl = gbo->placement;
> +}
For drm_is_gem_vram(), I'm not quite sure what else to test for. So
there are still a few things I'd like to discuss.
1) If this test is about the placement flags, then it's unrelated to
the actual DRM driver. All buff...
2019 Apr 29
4
[PATCH v3 01/19] drm: Add |struct drm_gem_vram_object| and helpers
...ect *gbo)
> +{
> + drm_gem_vram_cleanup(gbo);
> + kfree(gbo);
> +}
> +
> +static void ttm_buffer_object_destroy(struct ttm_buffer_object *bo)
> +{
> + struct drm_gem_vram_object *gbo = drm_gem_vram_of_bo(bo);
> + drm_gem_vram_destroy(gbo);
> +}
> +
> +static void drm_gem_vram_placement(struct drm_gem_vram_object *gbo, int pl_flag)
> +{
> + unsigned int i;
> + unsigned int c = 0;
> +
> + gbo->placement.placement = gbo->placements;
> + gbo->placement.busy_placement = gbo->placements;
> +
> + if (pl_flag & TTM_PL_FLAG_VRAM)
> + gbo->pla...
2019 Apr 29
4
[PATCH v3 01/19] drm: Add |struct drm_gem_vram_object| and helpers
...ect *gbo)
> +{
> + drm_gem_vram_cleanup(gbo);
> + kfree(gbo);
> +}
> +
> +static void ttm_buffer_object_destroy(struct ttm_buffer_object *bo)
> +{
> + struct drm_gem_vram_object *gbo = drm_gem_vram_of_bo(bo);
> + drm_gem_vram_destroy(gbo);
> +}
> +
> +static void drm_gem_vram_placement(struct drm_gem_vram_object *gbo, int pl_flag)
> +{
> + unsigned int i;
> + unsigned int c = 0;
> +
> + gbo->placement.placement = gbo->placements;
> + gbo->placement.busy_placement = gbo->placements;
> +
> + if (pl_flag & TTM_PL_FLAG_VRAM)
> + gbo->pla...
2019 May 06
0
[PATCH v4 01/19] drm: Add |struct drm_gem_vram_object| and helpers
...+static void drm_gem_vram_destroy(struct drm_gem_vram_object *gbo)
+{
+ drm_gem_vram_cleanup(gbo);
+ kfree(gbo);
+}
+
+static void ttm_buffer_object_destroy(struct ttm_buffer_object *bo)
+{
+ struct drm_gem_vram_object *gbo = drm_gem_vram_of_bo(bo);
+
+ drm_gem_vram_destroy(gbo);
+}
+
+static void drm_gem_vram_placement(struct drm_gem_vram_object *gbo,
+ unsigned long pl_flag)
+{
+ unsigned int i;
+ unsigned int c = 0;
+
+ gbo->placement.placement = gbo->placements;
+ gbo->placement.busy_placement = gbo->placements;
+
+ if (pl_flag & TTM_PL_FLAG_VRAM)
+ gbo->placements[c++].flags = TTM_PL...
2019 Apr 29
0
[PATCH v3 01/19] drm: Add |struct drm_gem_vram_object| and helpers
...+
+static void drm_gem_vram_destroy(struct drm_gem_vram_object *gbo)
+{
+ drm_gem_vram_cleanup(gbo);
+ kfree(gbo);
+}
+
+static void ttm_buffer_object_destroy(struct ttm_buffer_object *bo)
+{
+ struct drm_gem_vram_object *gbo = drm_gem_vram_of_bo(bo);
+ drm_gem_vram_destroy(gbo);
+}
+
+static void drm_gem_vram_placement(struct drm_gem_vram_object *gbo, int pl_flag)
+{
+ unsigned int i;
+ unsigned int c = 0;
+
+ gbo->placement.placement = gbo->placements;
+ gbo->placement.busy_placement = gbo->placements;
+
+ if (pl_flag & TTM_PL_FLAG_VRAM)
+ gbo->placements[c++].flags = TTM_PL_FLAG_WC |
+...
2019 Apr 24
0
[PATCH v2 02/17] drm: Add |struct drm_gem_vram_object| callbacks for |struct ttm_bo_driver|
...M placement information.
+ */
+void drm_gem_vram_bo_driver_evict_flags(struct ttm_buffer_object *bo,
+ struct ttm_placement *pl)
+{
+ struct drm_gem_vram_object *gbo;
+
+ /* TTM may pass BOs that are not GEM VRAM BOs. */
+ if (!drm_is_gem_vram(bo))
+ return;
+
+ gbo = drm_gem_vram_of_bo(bo);
+ drm_gem_vram_placement(gbo, TTM_PL_FLAG_SYSTEM);
+ *pl = gbo->placement;
+}
+EXPORT_SYMBOL(drm_gem_vram_bo_driver_evict_flags);
+
+/**
+ * drm_gem_vram_bo_driver_verify_access() - \
+ Implements &struct ttm_bo_driver.verify_access
+ * @bo: TTM buffer object. Refers to &struct drm_gem_vram_object.bo
+ * @filp:...
2019 Apr 29
0
[PATCH v3 02/19] drm: Add |struct drm_gem_vram_object| callbacks for |struct ttm_bo_driver|
...M placement information.
+ */
+void drm_gem_vram_bo_driver_evict_flags(struct ttm_buffer_object *bo,
+ struct ttm_placement *pl)
+{
+ struct drm_gem_vram_object *gbo;
+
+ /* TTM may pass BOs that are not GEM VRAM BOs. */
+ if (!drm_is_gem_vram(bo))
+ return;
+
+ gbo = drm_gem_vram_of_bo(bo);
+ drm_gem_vram_placement(gbo, TTM_PL_FLAG_SYSTEM);
+ *pl = gbo->placement;
+}
+EXPORT_SYMBOL(drm_gem_vram_bo_driver_evict_flags);
+
+/**
+ * drm_gem_vram_bo_driver_verify_access() - \
+ Implements &struct ttm_bo_driver.verify_access
+ * @bo: TTM buffer object. Refers to &struct drm_gem_vram_object.bo
+ * @filp:...
2019 May 06
0
[PATCH v4 02/19] drm: Add |struct drm_gem_vram_object| callbacks for |struct ttm_bo_driver|
...M placement information.
+ */
+void drm_gem_vram_bo_driver_evict_flags(struct ttm_buffer_object *bo,
+ struct ttm_placement *pl)
+{
+ struct drm_gem_vram_object *gbo;
+
+ /* TTM may pass BOs that are not GEM VRAM BOs. */
+ if (!drm_is_gem_vram(bo))
+ return;
+
+ gbo = drm_gem_vram_of_bo(bo);
+ drm_gem_vram_placement(gbo, TTM_PL_FLAG_SYSTEM);
+ *pl = gbo->placement;
+}
+EXPORT_SYMBOL(drm_gem_vram_bo_driver_evict_flags);
+
+/**
+ * drm_gem_vram_bo_driver_verify_access() - \
+ Implements &struct ttm_bo_driver.verify_access
+ * @bo: TTM buffer object. Refers to &struct drm_gem_vram_object.bo
+ * @filp:...
2019 May 20
1
[PATCH 1/2] drm: Add drm_gem_vram_{pin/unpin}_reserved() and convert mgag200
...replace them with tiny ttm_bo_lock() wrappers.
Christian.
> -Daniel
>
>> Cheers, Daniel
>>
>>> +
>>> + if (gbo->pin_count) {
>>> + ++gbo->pin_count;
>>> + return 0;
>>> + }
>>> +
>>> + drm_gem_vram_placement(gbo, pl_flag);
>>> + for (i = 0; i < gbo->placement.num_placement; ++i)
>>> + gbo->placements[i].flags |= TTM_PL_FLAG_NO_EVICT;
>>> +
>>> + ret = ttm_bo_validate(&gbo->bo, &gbo->placement, &ctx);
>>> + if (ret &...
2019 May 16
5
[PATCH 0/2] Add BO reservation to GEM VRAM pin/unpin/push_to_system
A kernel test bot reported a problem with the locktorture testcase that
was triggered by the GEM VRAM helpers.
...
[ 10.004734] RIP: 0010:ttm_bo_validate+0x41/0x141 [ttm]
...
[ 10.015669] ? kvm_sched_clock_read+0x5/0xd
[ 10.016157] ? get_lock_stats+0x11/0x3f
[ 10.016607] drm_gem_vram_pin+0x77/0xa2 [drm_vram_helper]
[ 10.017229]
2019 May 16
5
[PATCH 0/2] Add BO reservation to GEM VRAM pin/unpin/push_to_system
A kernel test bot reported a problem with the locktorture testcase that
was triggered by the GEM VRAM helpers.
...
[ 10.004734] RIP: 0010:ttm_bo_validate+0x41/0x141 [ttm]
...
[ 10.015669] ? kvm_sched_clock_read+0x5/0xd
[ 10.016157] ? get_lock_stats+0x11/0x3f
[ 10.016607] drm_gem_vram_pin+0x77/0xa2 [drm_vram_helper]
[ 10.017229]
2019 May 20
5
[PATCH 1/2] drm: Add drm_gem_vram_{pin/unpin}_reserved() and convert mgag200
...;s
going to lead to less wtf moments by driver writers :-)
Maybe we should also do a large-scale s/reserve/lock/ within ttm, to align
more with what we now have in dma-buf.
Cheers, Daniel
> +
> + if (gbo->pin_count) {
> + ++gbo->pin_count;
> + return 0;
> + }
> +
> + drm_gem_vram_placement(gbo, pl_flag);
> + for (i = 0; i < gbo->placement.num_placement; ++i)
> + gbo->placements[i].flags |= TTM_PL_FLAG_NO_EVICT;
> +
> + ret = ttm_bo_validate(&gbo->bo, &gbo->placement, &ctx);
> + if (ret < 0)
> + return ret;
> +
> + gbo->pin_co...
2019 May 20
5
[PATCH 1/2] drm: Add drm_gem_vram_{pin/unpin}_reserved() and convert mgag200
...;s
going to lead to less wtf moments by driver writers :-)
Maybe we should also do a large-scale s/reserve/lock/ within ttm, to align
more with what we now have in dma-buf.
Cheers, Daniel
> +
> + if (gbo->pin_count) {
> + ++gbo->pin_count;
> + return 0;
> + }
> +
> + drm_gem_vram_placement(gbo, pl_flag);
> + for (i = 0; i < gbo->placement.num_placement; ++i)
> + gbo->placements[i].flags |= TTM_PL_FLAG_NO_EVICT;
> +
> + ret = ttm_bo_validate(&gbo->bo, &gbo->placement, &ctx);
> + if (ret < 0)
> + return ret;
> +
> + gbo->pin_co...
2019 May 16
0
[PATCH 1/2] drm: Add drm_gem_vram_{pin/unpin}_reserved() and convert mgag200
...* 0 on success, or
+ * a negative error code otherwise.
+ */
+int drm_gem_vram_pin_reserved(struct drm_gem_vram_object *gbo,
+ unsigned long pl_flag)
+{
+ int i, ret;
+ struct ttm_operation_ctx ctx = { false, false };
+
+ if (gbo->pin_count) {
+ ++gbo->pin_count;
+ return 0;
+ }
+
+ drm_gem_vram_placement(gbo, pl_flag);
+ for (i = 0; i < gbo->placement.num_placement; ++i)
+ gbo->placements[i].flags |= TTM_PL_FLAG_NO_EVICT;
+
+ ret = ttm_bo_validate(&gbo->bo, &gbo->placement, &ctx);
+ if (ret < 0)
+ return ret;
+
+ gbo->pin_count = 1;
+
+ return 0;
+}
+EXPORT_SYMBOL...
2019 May 20
0
[PATCH 1/2] drm: Add drm_gem_vram_{pin/unpin}_reserved() and convert mgag200
...hether that aligns with Christian's plans. TODO.rst patch might be a
good step to get that discussion started.
-Daniel
>
> Cheers, Daniel
>
> > +
> > + if (gbo->pin_count) {
> > + ++gbo->pin_count;
> > + return 0;
> > + }
> > +
> > + drm_gem_vram_placement(gbo, pl_flag);
> > + for (i = 0; i < gbo->placement.num_placement; ++i)
> > + gbo->placements[i].flags |= TTM_PL_FLAG_NO_EVICT;
> > +
> > + ret = ttm_bo_validate(&gbo->bo, &gbo->placement, &ctx);
> > + if (ret < 0)
> > + return ret...
2019 Apr 29
21
[PATCH v3 00/19] Share TTM code among DRM framebuffer drivers
Several simple framebuffer drivers copy most of the TTM code from each
other. The implementation is always the same; except for the name of
some data structures.
As recently discussed, this patch set provides generic memory-management
code for simple framebuffers with dedicated video memory. It further
converts the respective drivers to the generic code. The shared code
is basically the same