mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-11 07:30:16 +00:00
Remove Exynos specific framebuffer structure and
relevant functions. - it removes exynos_drm_fb structure which is a wrapper of drm_framebuffer and unnecessary two exynos specific callback functions, exynos_drm_destory() and exynos_drm_fb_create_handle() because we can reuse existing drm common callback ones instead. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJa2X/BAAoJEFc4NIkMQxK4EqkP/ji7FXdOC+K+mzilHO8ItPt2 EjSQ9zWxEKRivIuf42TgkwESORBpMYX/put4DZJPrXp3K1OBNJ1atAbSJABx6aNG NmZqxp7599QHMd5pSvk0D2PKlQWWCPiOwN8Nqid+3JemRFutz43ntPpzzhz2glz+ IUGYSUbUi8QtKhn9HW+eYPkEmxR8pfrFSGtUpqcCZame1PJBidcE5ONv5sr34qqp k9jdbjoV0aTOx4k65PD3MgZHH3cNVVPKIBCW5AtqNwUyCAaBeUoKfIvRTyW168ES d027Zx2qs+M5IYQr6QwL3Uq4sPP3QUSMhzc5Wzk/fBYn+/vF03Jq0Io0StxDBdd2 kEcTtqnvZ9NW3suXbb3OIum8S8W/ckSvIadrbB3pPQn6alTr9EOKhBn6Sd9tKeyE qT1PsTsWwupY6cTUIc3NUJd49T4XjxxpXwcaf5OHPhCmahtES6vmxsZ7xX/Ns1Io BfLGZu7/bhm2UCXh4pnV6rfo1QRMxoPG71hSHP4uoC99/HI8gsIg1RxIwH2S7M7+ Vnsh0bP3dLX/MKLsXoeJ9aGcAx+eDJWIJDxQ7Zg0ecrNFITPBB8DIRGulUW382nU HMkHaZbLAzddt6VrJiUY8ot1M0MWX1H0ytKL7csd1VNMatwSIXAQ4rT/ludv1yz2 oKPWILB0SOOnswlAJAqO =0Bb/ -----END PGP SIGNATURE----- Merge tag 'exynos-drm-fixes-for-v4.17-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos into drm-next Remove Exynos specific framebuffer structure and relevant functions. - it removes exynos_drm_fb structure which is a wrapper of drm_framebuffer and unnecessary two exynos specific callback functions, exynos_drm_destory() and exynos_drm_fb_create_handle() because we can reuse existing drm common callback ones instead. * tag 'exynos-drm-fixes-for-v4.17-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos: drm/exynos: exynos_drm_fb -> drm_framebuffer drm/exynos: Move dma_addr out of exynos_drm_fb drm/exynos: Move GEM BOs to drm_framebuffer drm/amdkfd: Deallocate SDMA queues correctly drm/amdkfd: Fix scratch memory with HWS enabled
This commit is contained in:
commit
2e1d6eab50
@ -1058,13 +1058,13 @@ static int create_queue_cpsch(struct device_queue_manager *dqm, struct queue *q,
|
|||||||
pr_warn("Can't create new usermode queue because %d queues were already created\n",
|
pr_warn("Can't create new usermode queue because %d queues were already created\n",
|
||||||
dqm->total_queue_count);
|
dqm->total_queue_count);
|
||||||
retval = -EPERM;
|
retval = -EPERM;
|
||||||
goto out;
|
goto out_unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (q->properties.type == KFD_QUEUE_TYPE_SDMA) {
|
if (q->properties.type == KFD_QUEUE_TYPE_SDMA) {
|
||||||
retval = allocate_sdma_queue(dqm, &q->sdma_id);
|
retval = allocate_sdma_queue(dqm, &q->sdma_id);
|
||||||
if (retval)
|
if (retval)
|
||||||
goto out;
|
goto out_unlock;
|
||||||
q->properties.sdma_queue_id =
|
q->properties.sdma_queue_id =
|
||||||
q->sdma_id / CIK_SDMA_QUEUES_PER_ENGINE;
|
q->sdma_id / CIK_SDMA_QUEUES_PER_ENGINE;
|
||||||
q->properties.sdma_engine_id =
|
q->properties.sdma_engine_id =
|
||||||
@ -1075,7 +1075,7 @@ static int create_queue_cpsch(struct device_queue_manager *dqm, struct queue *q,
|
|||||||
|
|
||||||
if (!mqd) {
|
if (!mqd) {
|
||||||
retval = -ENOMEM;
|
retval = -ENOMEM;
|
||||||
goto out;
|
goto out_deallocate_sdma_queue;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Eviction state logic: we only mark active queues as evicted
|
* Eviction state logic: we only mark active queues as evicted
|
||||||
@ -1093,7 +1093,7 @@ static int create_queue_cpsch(struct device_queue_manager *dqm, struct queue *q,
|
|||||||
retval = mqd->init_mqd(mqd, &q->mqd, &q->mqd_mem_obj,
|
retval = mqd->init_mqd(mqd, &q->mqd, &q->mqd_mem_obj,
|
||||||
&q->gart_mqd_addr, &q->properties);
|
&q->gart_mqd_addr, &q->properties);
|
||||||
if (retval)
|
if (retval)
|
||||||
goto out;
|
goto out_deallocate_sdma_queue;
|
||||||
|
|
||||||
list_add(&q->list, &qpd->queues_list);
|
list_add(&q->list, &qpd->queues_list);
|
||||||
qpd->queue_count++;
|
qpd->queue_count++;
|
||||||
@ -1114,7 +1114,13 @@ static int create_queue_cpsch(struct device_queue_manager *dqm, struct queue *q,
|
|||||||
pr_debug("Total of %d queues are accountable so far\n",
|
pr_debug("Total of %d queues are accountable so far\n",
|
||||||
dqm->total_queue_count);
|
dqm->total_queue_count);
|
||||||
|
|
||||||
out:
|
mutex_unlock(&dqm->lock);
|
||||||
|
return retval;
|
||||||
|
|
||||||
|
out_deallocate_sdma_queue:
|
||||||
|
if (q->properties.type == KFD_QUEUE_TYPE_SDMA)
|
||||||
|
deallocate_sdma_queue(dqm, q->sdma_id);
|
||||||
|
out_unlock:
|
||||||
mutex_unlock(&dqm->lock);
|
mutex_unlock(&dqm->lock);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
@ -1433,8 +1439,10 @@ static int process_termination_cpsch(struct device_queue_manager *dqm,
|
|||||||
|
|
||||||
/* Clear all user mode queues */
|
/* Clear all user mode queues */
|
||||||
list_for_each_entry(q, &qpd->queues_list, list) {
|
list_for_each_entry(q, &qpd->queues_list, list) {
|
||||||
if (q->properties.type == KFD_QUEUE_TYPE_SDMA)
|
if (q->properties.type == KFD_QUEUE_TYPE_SDMA) {
|
||||||
dqm->sdma_queue_count--;
|
dqm->sdma_queue_count--;
|
||||||
|
deallocate_sdma_queue(dqm, q->sdma_id);
|
||||||
|
}
|
||||||
|
|
||||||
if (q->properties.is_active)
|
if (q->properties.is_active)
|
||||||
dqm->queue_count--;
|
dqm->queue_count--;
|
||||||
|
@ -188,8 +188,7 @@ static int pm_create_map_process(struct packet_manager *pm, uint32_t *buffer,
|
|||||||
packet->sh_mem_ape1_base = qpd->sh_mem_ape1_base;
|
packet->sh_mem_ape1_base = qpd->sh_mem_ape1_base;
|
||||||
packet->sh_mem_ape1_limit = qpd->sh_mem_ape1_limit;
|
packet->sh_mem_ape1_limit = qpd->sh_mem_ape1_limit;
|
||||||
|
|
||||||
/* TODO: scratch support */
|
packet->sh_hidden_private_base_vmid = qpd->sh_hidden_private_base;
|
||||||
packet->sh_hidden_private_base_vmid = 0;
|
|
||||||
|
|
||||||
packet->gds_addr_lo = lower_32_bits(qpd->gds_context_area);
|
packet->gds_addr_lo = lower_32_bits(qpd->gds_context_area);
|
||||||
packet->gds_addr_hi = upper_32_bits(qpd->gds_context_area);
|
packet->gds_addr_hi = upper_32_bits(qpd->gds_context_area);
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include <drm/drm_fb_helper.h>
|
#include <drm/drm_fb_helper.h>
|
||||||
#include <drm/drm_atomic.h>
|
#include <drm/drm_atomic.h>
|
||||||
#include <drm/drm_atomic_helper.h>
|
#include <drm/drm_atomic_helper.h>
|
||||||
|
#include <drm/drm_gem_framebuffer_helper.h>
|
||||||
#include <uapi/drm/exynos_drm.h>
|
#include <uapi/drm/exynos_drm.h>
|
||||||
|
|
||||||
#include "exynos_drm_drv.h"
|
#include "exynos_drm_drv.h"
|
||||||
@ -26,20 +27,6 @@
|
|||||||
#include "exynos_drm_iommu.h"
|
#include "exynos_drm_iommu.h"
|
||||||
#include "exynos_drm_crtc.h"
|
#include "exynos_drm_crtc.h"
|
||||||
|
|
||||||
#define to_exynos_fb(x) container_of(x, struct exynos_drm_fb, fb)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* exynos specific framebuffer structure.
|
|
||||||
*
|
|
||||||
* @fb: drm framebuffer obejct.
|
|
||||||
* @exynos_gem: array of exynos specific gem object containing a gem object.
|
|
||||||
*/
|
|
||||||
struct exynos_drm_fb {
|
|
||||||
struct drm_framebuffer fb;
|
|
||||||
struct exynos_drm_gem *exynos_gem[MAX_FB_BUFFER];
|
|
||||||
dma_addr_t dma_addr[MAX_FB_BUFFER];
|
|
||||||
};
|
|
||||||
|
|
||||||
static int check_fb_gem_memory_type(struct drm_device *drm_dev,
|
static int check_fb_gem_memory_type(struct drm_device *drm_dev,
|
||||||
struct exynos_drm_gem *exynos_gem)
|
struct exynos_drm_gem *exynos_gem)
|
||||||
{
|
{
|
||||||
@ -66,40 +53,9 @@ static int check_fb_gem_memory_type(struct drm_device *drm_dev,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void exynos_drm_fb_destroy(struct drm_framebuffer *fb)
|
|
||||||
{
|
|
||||||
struct exynos_drm_fb *exynos_fb = to_exynos_fb(fb);
|
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
drm_framebuffer_cleanup(fb);
|
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(exynos_fb->exynos_gem); i++) {
|
|
||||||
struct drm_gem_object *obj;
|
|
||||||
|
|
||||||
if (exynos_fb->exynos_gem[i] == NULL)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
obj = &exynos_fb->exynos_gem[i]->base;
|
|
||||||
drm_gem_object_unreference_unlocked(obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
kfree(exynos_fb);
|
|
||||||
exynos_fb = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int exynos_drm_fb_create_handle(struct drm_framebuffer *fb,
|
|
||||||
struct drm_file *file_priv,
|
|
||||||
unsigned int *handle)
|
|
||||||
{
|
|
||||||
struct exynos_drm_fb *exynos_fb = to_exynos_fb(fb);
|
|
||||||
|
|
||||||
return drm_gem_handle_create(file_priv,
|
|
||||||
&exynos_fb->exynos_gem[0]->base, handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct drm_framebuffer_funcs exynos_drm_fb_funcs = {
|
static const struct drm_framebuffer_funcs exynos_drm_fb_funcs = {
|
||||||
.destroy = exynos_drm_fb_destroy,
|
.destroy = drm_gem_fb_destroy,
|
||||||
.create_handle = exynos_drm_fb_create_handle,
|
.create_handle = drm_gem_fb_create_handle,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct drm_framebuffer *
|
struct drm_framebuffer *
|
||||||
@ -108,12 +64,12 @@ exynos_drm_framebuffer_init(struct drm_device *dev,
|
|||||||
struct exynos_drm_gem **exynos_gem,
|
struct exynos_drm_gem **exynos_gem,
|
||||||
int count)
|
int count)
|
||||||
{
|
{
|
||||||
struct exynos_drm_fb *exynos_fb;
|
struct drm_framebuffer *fb;
|
||||||
int i;
|
int i;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
exynos_fb = kzalloc(sizeof(*exynos_fb), GFP_KERNEL);
|
fb = kzalloc(sizeof(*fb), GFP_KERNEL);
|
||||||
if (!exynos_fb)
|
if (!fb)
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
@ -121,23 +77,21 @@ exynos_drm_framebuffer_init(struct drm_device *dev,
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
exynos_fb->exynos_gem[i] = exynos_gem[i];
|
fb->obj[i] = &exynos_gem[i]->base;
|
||||||
exynos_fb->dma_addr[i] = exynos_gem[i]->dma_addr
|
|
||||||
+ mode_cmd->offsets[i];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
drm_helper_mode_fill_fb_struct(dev, &exynos_fb->fb, mode_cmd);
|
drm_helper_mode_fill_fb_struct(dev, fb, mode_cmd);
|
||||||
|
|
||||||
ret = drm_framebuffer_init(dev, &exynos_fb->fb, &exynos_drm_fb_funcs);
|
ret = drm_framebuffer_init(dev, fb, &exynos_drm_fb_funcs);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
DRM_ERROR("failed to initialize framebuffer\n");
|
DRM_ERROR("failed to initialize framebuffer\n");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
return &exynos_fb->fb;
|
return fb;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
kfree(exynos_fb);
|
kfree(fb);
|
||||||
return ERR_PTR(ret);
|
return ERR_PTR(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,12 +145,13 @@ err:
|
|||||||
|
|
||||||
dma_addr_t exynos_drm_fb_dma_addr(struct drm_framebuffer *fb, int index)
|
dma_addr_t exynos_drm_fb_dma_addr(struct drm_framebuffer *fb, int index)
|
||||||
{
|
{
|
||||||
struct exynos_drm_fb *exynos_fb = to_exynos_fb(fb);
|
struct exynos_drm_gem *exynos_gem;
|
||||||
|
|
||||||
if (WARN_ON_ONCE(index >= MAX_FB_BUFFER))
|
if (WARN_ON_ONCE(index >= MAX_FB_BUFFER))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return exynos_fb->dma_addr[index];
|
exynos_gem = to_exynos_gem(fb->obj[index]);
|
||||||
|
return exynos_gem->dma_addr + fb->offsets[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct drm_mode_config_helper_funcs exynos_drm_mode_config_helpers = {
|
static struct drm_mode_config_helper_funcs exynos_drm_mode_config_helpers = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user