[openchrome-devel] drm-openchrome: Branch 'drm-next-5.6' - 2 commits - drivers/gpu/drm
Kevin Brace
kevinbrace at kemper.freedesktop.org
Tue Feb 4 21:58:38 UTC 2020
drivers/gpu/drm/openchrome/openchrome_crtc.c | 31 ------------
drivers/gpu/drm/openchrome/openchrome_cursor.c | 62 +++++++------------------
drivers/gpu/drm/openchrome/openchrome_drv.h | 5 --
3 files changed, 20 insertions(+), 78 deletions(-)
New commits:
commit fab99d966fdd8ddc87d976b147e92e7743eb5dbf
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Tue Feb 4 13:57:14 2020 -0800
drm/openchrome: Version bumped to 3.1.26
Got rid of duplicated (wasted) hardware cursor storage.
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/openchrome_drv.h b/drivers/gpu/drm/openchrome/openchrome_drv.h
index 401bdd831b16..26edb3863b47 100644
--- a/drivers/gpu/drm/openchrome/openchrome_drv.h
+++ b/drivers/gpu/drm/openchrome/openchrome_drv.h
@@ -61,10 +61,10 @@
#define DRIVER_MAJOR 3
#define DRIVER_MINOR 1
-#define DRIVER_PATCHLEVEL 25
+#define DRIVER_PATCHLEVEL 26
#define DRIVER_NAME "openchrome"
#define DRIVER_DESC "OpenChrome DRM for VIA Technologies Chrome IGP"
-#define DRIVER_DATE "20200131"
+#define DRIVER_DATE "20200204"
#define DRIVER_AUTHOR "OpenChrome Project"
commit f2376ff3a67982adb53a7e2f47780d3e1a3e13f3
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Tue Feb 4 13:50:56 2020 -0800
drm/openchrome: Stop allocating hardware cursor storage
Let the DDX allocate storage for hardware cursor(s). This avoids duplicated
hardware cursor storage.
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/openchrome_crtc.c b/drivers/gpu/drm/openchrome/openchrome_crtc.c
index 6fc69e5ebea2..728bff2a363c 100644
--- a/drivers/gpu/drm/openchrome/openchrome_crtc.c
+++ b/drivers/gpu/drm/openchrome/openchrome_crtc.c
@@ -319,11 +319,6 @@ static void openchrome_crtc_destroy(struct drm_crtc *crtc)
{
struct via_crtc *iga = container_of(crtc, struct via_crtc, base);
- if (iga->cursor_bo) {
- openchrome_bo_destroy(iga->cursor_bo, true);
- iga->cursor_bo = NULL;
- }
-
drm_crtc_cleanup(&iga->base);
kfree(iga);
}
@@ -2082,7 +2077,6 @@ int openchrome_crtc_init(struct openchrome_drm_private *dev_private,
struct drm_plane *primary;
struct drm_plane *cursor;
uint32_t possible_crtcs;
- uint64_t cursor_size;
int ret;
possible_crtcs = 1 << index;
@@ -2143,33 +2137,8 @@ int openchrome_crtc_init(struct openchrome_drm_private *dev_private,
iga->index = index;
- if ((dev->pdev->device == PCI_DEVICE_ID_VIA_CLE266) ||
- (dev->pdev->device == PCI_DEVICE_ID_VIA_KM400)) {
- cursor_size =
- OPENCHROME_UNICHROME_CURSOR_SIZE *
- OPENCHROME_UNICHROME_CURSOR_SIZE * 4;
- } else {
- cursor_size =
- OPENCHROME_UNICHROME_PRO_CURSOR_SIZE *
- OPENCHROME_UNICHROME_PRO_CURSOR_SIZE * 4;
- }
-
- ret = openchrome_bo_create(dev,
- &dev_private->bdev,
- cursor_size,
- ttm_bo_type_kernel,
- TTM_PL_FLAG_VRAM,
- true,
- &iga->cursor_bo);
- if (ret) {
- DRM_ERROR("Failed to create cursor.\n");
- goto cleanup_crtc;
- }
-
openchrome_crtc_param_init(dev_private, &iga->base, index);
goto exit;
-cleanup_crtc:
- drm_crtc_cleanup(&iga->base);
free_crtc:
kfree(iga);
cleanup_cursor:
diff --git a/drivers/gpu/drm/openchrome/openchrome_cursor.c b/drivers/gpu/drm/openchrome/openchrome_cursor.c
index 625565f475e7..796955dcd209 100644
--- a/drivers/gpu/drm/openchrome/openchrome_cursor.c
+++ b/drivers/gpu/drm/openchrome/openchrome_cursor.c
@@ -146,16 +146,21 @@ static void openchrome_show_cursor(struct drm_crtc *crtc)
}
}
-static void openchrome_cursor_address(struct drm_crtc *crtc)
+static void openchrome_cursor_address(struct drm_crtc *crtc,
+ struct openchrome_bo *ttm_bo)
{
struct drm_device *dev = crtc->dev;
struct via_crtc *iga = container_of(crtc,
struct via_crtc, base);
struct openchrome_drm_private *dev_private =
crtc->dev->dev_private;
+ int ret;
- if (!iga->cursor_bo->kmap.bo) {
- return;
+ ret = ttm_bo_kmap(&ttm_bo->ttm_bo, 0,
+ ttm_bo->ttm_bo.num_pages,
+ &ttm_bo->kmap);
+ if (ret) {
+ goto exit;
}
switch (dev->pdev->device) {
@@ -169,17 +174,21 @@ static void openchrome_cursor_address(struct drm_crtc *crtc)
/* Program the HI offset. */
if (iga->index) {
VIA_WRITE(HI_FBOFFSET,
- iga->cursor_bo->kmap.bo->offset);
+ ttm_bo->kmap.bo->offset);
} else {
VIA_WRITE(PRIM_HI_FBOFFSET,
- iga->cursor_bo->kmap.bo->offset);
+ ttm_bo->kmap.bo->offset);
}
break;
default:
VIA_WRITE(HI_FBOFFSET,
- iga->cursor_bo->kmap.bo->offset);
+ ttm_bo->kmap.bo->offset);
break;
}
+
+ ttm_bo_kunmap(&ttm_bo->kmap);
+exit:
+ return;
}
static void openchrome_set_hi_location(struct drm_crtc *crtc,
@@ -253,15 +262,9 @@ static int openchrome_cursor_update_plane(struct drm_plane *plane,
struct drm_modeset_acquire_ctx *ctx)
{
struct drm_device *dev = plane->dev;
- struct via_crtc *iga = container_of(crtc,
- struct via_crtc, base);
struct via_framebuffer *via_fb;
- struct openchrome_bo *user_bo;
+ struct openchrome_bo *ttm_bo;
struct drm_gem_object *gem;
- uint32_t *user_bo_src, *cursor_dst;
- bool is_iomem;
- uint32_t i;
- uint32_t width, height, cursor_width;
int ret = 0;
if (!crtc) {
@@ -291,7 +294,6 @@ static int openchrome_cursor_update_plane(struct drm_plane *plane,
goto exit;
}
- cursor_width = OPENCHROME_UNICHROME_CURSOR_SIZE;
} else {
if ((fb->width != OPENCHROME_UNICHROME_PRO_CURSOR_SIZE) ||
(fb->height != OPENCHROME_UNICHROME_PRO_CURSOR_SIZE)) {
@@ -299,8 +301,6 @@ static int openchrome_cursor_update_plane(struct drm_plane *plane,
ret = -EINVAL;
goto exit;
}
-
- cursor_width = OPENCHROME_UNICHROME_PRO_CURSOR_SIZE;
}
if (fb->width != fb->height) {
@@ -311,36 +311,10 @@ static int openchrome_cursor_update_plane(struct drm_plane *plane,
}
if (fb != crtc->cursor->fb) {
- width = fb->width;
- height = fb->height;
-
via_fb = container_of(fb, struct via_framebuffer, fb);
gem = via_fb->gem;
- user_bo = container_of(gem, struct openchrome_bo, gem);
- ret = ttm_bo_kmap(&user_bo->ttm_bo, 0,
- user_bo->ttm_bo.num_pages,
- &user_bo->kmap);
- if (ret) {
- goto exit;
- }
-
- user_bo_src = ttm_kmap_obj_virtual(&user_bo->kmap,
- &is_iomem);
- cursor_dst =
- ttm_kmap_obj_virtual(&iga->cursor_bo->kmap,
- &is_iomem);
- memset_io(cursor_dst, 0x0,
- iga->cursor_bo->kmap.bo->mem.size);
- for (i = 0; i < height; i++) {
- __iowrite32_copy(cursor_dst, user_bo_src,
- width);
- user_bo_src += width;
- cursor_dst += cursor_width;
- }
-
- ttm_bo_kunmap(&user_bo->kmap);
-
- openchrome_cursor_address(crtc);
+ ttm_bo = container_of(gem, struct openchrome_bo, gem);
+ openchrome_cursor_address(crtc, ttm_bo);
} else {
crtc->cursor_x = crtc_x;
crtc->cursor_y = crtc_y;
diff --git a/drivers/gpu/drm/openchrome/openchrome_drv.h b/drivers/gpu/drm/openchrome/openchrome_drv.h
index 94686959a998..401bdd831b16 100644
--- a/drivers/gpu/drm/openchrome/openchrome_drv.h
+++ b/drivers/gpu/drm/openchrome/openchrome_drv.h
@@ -160,7 +160,6 @@ typedef struct _via_fp_info {
struct via_crtc {
struct drm_crtc base;
- struct openchrome_bo *cursor_bo;
struct crtc_timings pixel_timings;
struct crtc_timings timings;
struct vga_registers display_queue;
More information about the openchrome-devel
mailing list