Merge tag 'drm-misc-next-2019-05-24' of git://anongit.freedesktop.org/drm/drm-misc into drm-next
drm-misc-next for v5.3, try #2: UAPI Changes: - Add HDR source metadata property. - Make drm.h compile on GNU/kFreeBSD by including stdint.h - Clarify how the userspace reviewer has to review new kernel UAPI. - Clarify that for using new UAPI, merging to drm-next or drm-misc-next should be enough. Cross-subsystem Changes: - video/hdmi: Add unpack function for DRM infoframes. - Device tree bindings: * Updating a property for Mali Midgard GPUs * Updating a property for STM32 DSI panel * Adding support for FriendlyELEC HD702E 800x1280 panel * Adding support for Evervision VGG804821 800x480 5.0" WVGA TFT panel * Adding support for the EDT ET035012DM6 3.5" 320x240 QVGA 24-bit RGB TFT. * Adding support for Three Five displays TFC S9700RTWV43TR-01B 800x480 panel with resistive touch found on TI's AM335X-EVM. * Adding support for EDT ETM0430G0DH6 480x272 panel. - Add OSD101T2587-53TS driver with DT bindings. - Add Samsung S6E63M0 panel driver with DT bindings. - Add VXT VL050-8048NT-C01 800x480 panel with DT bindings. - Dma-buf: - Make mmap callback actually optional. - Documentation updates. - Fix debugfs refcount inbalance. - Remove unused sync_dump function. - Fix device tree bindings in drm-misc-next after a botched merge. Core Changes: - Add support for HDR infoframes and related EDID parsing. - Remove prime sg_table caching, now done inside dma-buf. - Add shiny new drm_gem_vram helpers for simple VRAM drivers; with some fixes to the new API on top. - Small fix to job cleanup without timeout handler. - Documentation fixes to drm_fourcc. - Replace lookups of drm_format with struct drm_format_info; remove functions that become obsolete by this conversion. - Remove double include in bridge/panel.c and some drivers. - Remove drmP.h include from drm/edid and drm/dp. - Fix null pointer deref in drm_fb_helper_hotplug_event(). - Remove most members from drm_fb_helper_crtc, only mode_set is kept. - Remove race of fb helpers with userspace; only restore mode when userspace is not master. - Move legacy setup from drm_file.c to drm_legacy_misc.c - Rework scheduler job destruction. - drm/bus was removed, remove from TODO. - Add __drm_atomic_helper_crtc_reset() to subclass crtc_state, and convert some drivers to use it (conversion is not complete yet). - Bump vblank timeout wait to 100 ms for atomic. - Docbook fix for drm_hdmi_infoframe_set_hdr_metadata. Driver Changes: - sun4i: Use DRM_GEM_CMA_VMAP_DRIVER_OPS instead of definining manually. - v3d: Small cleanups, adding support for compute shaders, reservation/synchronization fixes and job management refactoring, fixes MMU and debugfs. - lima: Fix null pointer in irq handler on startup, set default timeout for scheduled jobs. - stm/ltdc: Assorted fixes and adding FB modifier support. - amdgpu: Avoid hw reset if guilty job was already signaled. - virtio: Add seqno to fences, add trace events, use correct flags for fence allocation. - Convert AST, bochs, mgag200, vboxvideo, hisilicon to the new drm_gem_vram API. - sun6i_mipi_dsi: Support DSI GENERIC_SHORT_WRITE_2 transfers. - bochs: Small fix to use PTR_RET_OR_ZERO and driver unload. - gma500: header fixes - cirrus: Remove unused files. - mediatek: Fix compiler warning after merging the HDR series. - vc4: Rework binner bo handling. Signed-off-by: Dave Airlie <airlied@redhat.com> From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/052875a5-27ba-3832-60c2-193d950afdff@linux.intel.com
This commit is contained in:
@@ -3,7 +3,7 @@ config DRM_MGAG200
|
||||
tristate "Kernel modesetting driver for MGA G200 server engines"
|
||||
depends on DRM && PCI && MMU
|
||||
select DRM_KMS_HELPER
|
||||
select DRM_TTM
|
||||
select DRM_VRAM_HELPER
|
||||
help
|
||||
This is a KMS driver for the MGA G200 server chips, it
|
||||
does not support the original MGA G200 or any of the desktop
|
||||
|
@@ -23,9 +23,9 @@ static void mga_hide_cursor(struct mga_device *mdev)
|
||||
WREG8(MGA_CURPOSXL, 0);
|
||||
WREG8(MGA_CURPOSXH, 0);
|
||||
if (mdev->cursor.pixels_1->pin_count)
|
||||
mgag200_bo_unpin(mdev->cursor.pixels_1);
|
||||
drm_gem_vram_unpin_locked(mdev->cursor.pixels_1);
|
||||
if (mdev->cursor.pixels_2->pin_count)
|
||||
mgag200_bo_unpin(mdev->cursor.pixels_2);
|
||||
drm_gem_vram_unpin_locked(mdev->cursor.pixels_2);
|
||||
}
|
||||
|
||||
int mga_crtc_cursor_set(struct drm_crtc *crtc,
|
||||
@@ -36,13 +36,14 @@ int mga_crtc_cursor_set(struct drm_crtc *crtc,
|
||||
{
|
||||
struct drm_device *dev = crtc->dev;
|
||||
struct mga_device *mdev = (struct mga_device *)dev->dev_private;
|
||||
struct mgag200_bo *pixels_1 = mdev->cursor.pixels_1;
|
||||
struct mgag200_bo *pixels_2 = mdev->cursor.pixels_2;
|
||||
struct mgag200_bo *pixels_current = mdev->cursor.pixels_current;
|
||||
struct mgag200_bo *pixels_prev = mdev->cursor.pixels_prev;
|
||||
struct drm_gem_vram_object *pixels_1 = mdev->cursor.pixels_1;
|
||||
struct drm_gem_vram_object *pixels_2 = mdev->cursor.pixels_2;
|
||||
struct drm_gem_vram_object *pixels_current = mdev->cursor.pixels_current;
|
||||
struct drm_gem_vram_object *pixels_prev = mdev->cursor.pixels_prev;
|
||||
struct drm_gem_object *obj;
|
||||
struct mgag200_bo *bo = NULL;
|
||||
struct drm_gem_vram_object *gbo = NULL;
|
||||
int ret = 0;
|
||||
u8 *src, *dst;
|
||||
unsigned int i, row, col;
|
||||
uint32_t colour_set[16];
|
||||
uint32_t *next_space = &colour_set[0];
|
||||
@@ -50,7 +51,7 @@ int mga_crtc_cursor_set(struct drm_crtc *crtc,
|
||||
uint32_t this_colour;
|
||||
bool found = false;
|
||||
int colour_count = 0;
|
||||
u64 gpu_addr;
|
||||
s64 gpu_addr;
|
||||
u8 reg_index;
|
||||
u8 this_row[48];
|
||||
|
||||
@@ -79,54 +80,66 @@ int mga_crtc_cursor_set(struct drm_crtc *crtc,
|
||||
if (!obj)
|
||||
return -ENOENT;
|
||||
|
||||
ret = mgag200_bo_reserve(pixels_1, true);
|
||||
ret = drm_gem_vram_lock(pixels_1, true);
|
||||
if (ret) {
|
||||
WREG8(MGA_CURPOSXL, 0);
|
||||
WREG8(MGA_CURPOSXH, 0);
|
||||
goto out_unref;
|
||||
}
|
||||
ret = mgag200_bo_reserve(pixels_2, true);
|
||||
ret = drm_gem_vram_lock(pixels_2, true);
|
||||
if (ret) {
|
||||
WREG8(MGA_CURPOSXL, 0);
|
||||
WREG8(MGA_CURPOSXH, 0);
|
||||
mgag200_bo_unreserve(pixels_1);
|
||||
goto out_unreserve1;
|
||||
drm_gem_vram_unlock(pixels_1);
|
||||
goto out_unlock1;
|
||||
}
|
||||
|
||||
/* Move cursor buffers into VRAM if they aren't already */
|
||||
if (!pixels_1->pin_count) {
|
||||
ret = mgag200_bo_pin(pixels_1, TTM_PL_FLAG_VRAM,
|
||||
&mdev->cursor.pixels_1_gpu_addr);
|
||||
ret = drm_gem_vram_pin_locked(pixels_1,
|
||||
DRM_GEM_VRAM_PL_FLAG_VRAM);
|
||||
if (ret)
|
||||
goto out1;
|
||||
}
|
||||
if (!pixels_2->pin_count) {
|
||||
ret = mgag200_bo_pin(pixels_2, TTM_PL_FLAG_VRAM,
|
||||
&mdev->cursor.pixels_2_gpu_addr);
|
||||
if (ret) {
|
||||
mgag200_bo_unpin(pixels_1);
|
||||
gpu_addr = drm_gem_vram_offset(pixels_1);
|
||||
if (gpu_addr < 0) {
|
||||
drm_gem_vram_unpin_locked(pixels_1);
|
||||
goto out1;
|
||||
}
|
||||
mdev->cursor.pixels_1_gpu_addr = gpu_addr;
|
||||
}
|
||||
if (!pixels_2->pin_count) {
|
||||
ret = drm_gem_vram_pin_locked(pixels_2,
|
||||
DRM_GEM_VRAM_PL_FLAG_VRAM);
|
||||
if (ret) {
|
||||
drm_gem_vram_unpin_locked(pixels_1);
|
||||
goto out1;
|
||||
}
|
||||
gpu_addr = drm_gem_vram_offset(pixels_2);
|
||||
if (gpu_addr < 0) {
|
||||
drm_gem_vram_unpin_locked(pixels_1);
|
||||
drm_gem_vram_unpin_locked(pixels_2);
|
||||
goto out1;
|
||||
}
|
||||
mdev->cursor.pixels_2_gpu_addr = gpu_addr;
|
||||
}
|
||||
|
||||
bo = gem_to_mga_bo(obj);
|
||||
ret = mgag200_bo_reserve(bo, true);
|
||||
gbo = drm_gem_vram_of_gem(obj);
|
||||
ret = drm_gem_vram_lock(gbo, true);
|
||||
if (ret) {
|
||||
dev_err(&dev->pdev->dev, "failed to reserve user bo\n");
|
||||
dev_err(&dev->pdev->dev, "failed to lock user bo\n");
|
||||
goto out1;
|
||||
}
|
||||
if (!bo->kmap.virtual) {
|
||||
ret = ttm_bo_kmap(&bo->bo, 0, bo->bo.num_pages, &bo->kmap);
|
||||
if (ret) {
|
||||
dev_err(&dev->pdev->dev, "failed to kmap user buffer updates\n");
|
||||
goto out2;
|
||||
}
|
||||
src = drm_gem_vram_kmap(gbo, true, NULL);
|
||||
if (IS_ERR(src)) {
|
||||
ret = PTR_ERR(src);
|
||||
dev_err(&dev->pdev->dev, "failed to kmap user buffer updates\n");
|
||||
goto out2;
|
||||
}
|
||||
|
||||
memset(&colour_set[0], 0, sizeof(uint32_t)*16);
|
||||
/* width*height*4 = 16384 */
|
||||
for (i = 0; i < 16384; i += 4) {
|
||||
this_colour = ioread32(bo->kmap.virtual + i);
|
||||
this_colour = ioread32(src + i);
|
||||
/* No transparency */
|
||||
if (this_colour>>24 != 0xff &&
|
||||
this_colour>>24 != 0x0) {
|
||||
@@ -178,21 +191,18 @@ int mga_crtc_cursor_set(struct drm_crtc *crtc,
|
||||
}
|
||||
|
||||
/* Map up-coming buffer to write colour indices */
|
||||
if (!pixels_prev->kmap.virtual) {
|
||||
ret = ttm_bo_kmap(&pixels_prev->bo, 0,
|
||||
pixels_prev->bo.num_pages,
|
||||
&pixels_prev->kmap);
|
||||
if (ret) {
|
||||
dev_err(&dev->pdev->dev, "failed to kmap cursor updates\n");
|
||||
goto out3;
|
||||
}
|
||||
dst = drm_gem_vram_kmap(pixels_prev, true, NULL);
|
||||
if (IS_ERR(dst)) {
|
||||
ret = PTR_ERR(dst);
|
||||
dev_err(&dev->pdev->dev, "failed to kmap cursor updates\n");
|
||||
goto out3;
|
||||
}
|
||||
|
||||
/* now write colour indices into hardware cursor buffer */
|
||||
for (row = 0; row < 64; row++) {
|
||||
memset(&this_row[0], 0, 48);
|
||||
for (col = 0; col < 64; col++) {
|
||||
this_colour = ioread32(bo->kmap.virtual + 4*(col + 64*row));
|
||||
this_colour = ioread32(src + 4*(col + 64*row));
|
||||
/* write transparent pixels */
|
||||
if (this_colour>>24 == 0x0) {
|
||||
this_row[47 - col/8] |= 0x80>>(col%8);
|
||||
@@ -210,7 +220,7 @@ int mga_crtc_cursor_set(struct drm_crtc *crtc,
|
||||
}
|
||||
}
|
||||
}
|
||||
memcpy_toio(pixels_prev->kmap.virtual + row*48, &this_row[0], 48);
|
||||
memcpy_toio(dst + row*48, &this_row[0], 48);
|
||||
}
|
||||
|
||||
/* Program gpu address of cursor buffer */
|
||||
@@ -236,17 +246,17 @@ int mga_crtc_cursor_set(struct drm_crtc *crtc,
|
||||
}
|
||||
ret = 0;
|
||||
|
||||
ttm_bo_kunmap(&pixels_prev->kmap);
|
||||
drm_gem_vram_kunmap(pixels_prev);
|
||||
out3:
|
||||
ttm_bo_kunmap(&bo->kmap);
|
||||
drm_gem_vram_kunmap(gbo);
|
||||
out2:
|
||||
mgag200_bo_unreserve(bo);
|
||||
drm_gem_vram_unlock(gbo);
|
||||
out1:
|
||||
if (ret)
|
||||
mga_hide_cursor(mdev);
|
||||
mgag200_bo_unreserve(pixels_1);
|
||||
out_unreserve1:
|
||||
mgag200_bo_unreserve(pixels_2);
|
||||
drm_gem_vram_unlock(pixels_1);
|
||||
out_unlock1:
|
||||
drm_gem_vram_unlock(pixels_2);
|
||||
out_unref:
|
||||
drm_gem_object_put_unlocked(obj);
|
||||
|
||||
|
@@ -59,13 +59,7 @@ static void mga_pci_remove(struct pci_dev *pdev)
|
||||
|
||||
static const struct file_operations mgag200_driver_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = drm_open,
|
||||
.release = drm_release,
|
||||
.unlocked_ioctl = drm_ioctl,
|
||||
.mmap = mgag200_mmap,
|
||||
.poll = drm_poll,
|
||||
.compat_ioctl = drm_compat_ioctl,
|
||||
.read = drm_read,
|
||||
DRM_VRAM_MM_FILE_OPERATIONS
|
||||
};
|
||||
|
||||
static struct drm_driver driver = {
|
||||
@@ -79,10 +73,7 @@ static struct drm_driver driver = {
|
||||
.major = DRIVER_MAJOR,
|
||||
.minor = DRIVER_MINOR,
|
||||
.patchlevel = DRIVER_PATCHLEVEL,
|
||||
|
||||
.gem_free_object_unlocked = mgag200_gem_free_object,
|
||||
.dumb_create = mgag200_dumb_create,
|
||||
.dumb_map_offset = mgag200_dumb_mmap_offset,
|
||||
DRM_GEM_VRAM_DRIVER
|
||||
};
|
||||
|
||||
static struct pci_driver mgag200_pci_driver = {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2010 Matt Turner.
|
||||
* Copyright 2012 Red Hat
|
||||
* Copyright 2012 Red Hat
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU General
|
||||
* Public License version 2. See the file COPYING in the main
|
||||
@@ -17,13 +17,11 @@
|
||||
|
||||
#include <drm/drm_encoder.h>
|
||||
#include <drm/drm_fb_helper.h>
|
||||
#include <drm/ttm/ttm_bo_api.h>
|
||||
#include <drm/ttm/ttm_bo_driver.h>
|
||||
#include <drm/ttm/ttm_placement.h>
|
||||
#include <drm/ttm/ttm_memory.h>
|
||||
#include <drm/ttm/ttm_module.h>
|
||||
|
||||
#include <drm/drm_gem.h>
|
||||
#include <drm/drm_gem_vram_helper.h>
|
||||
|
||||
#include <drm/drm_vram_mm_helper.h>
|
||||
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/i2c-algo-bit.h>
|
||||
@@ -117,7 +115,6 @@ struct mga_fbdev {
|
||||
struct mga_framebuffer mfb;
|
||||
void *sysram;
|
||||
int size;
|
||||
struct ttm_bo_kmap_obj mapping;
|
||||
int x1, y1, x2, y2; /* dirty rect */
|
||||
spinlock_t dirty_lock;
|
||||
};
|
||||
@@ -159,13 +156,13 @@ struct mga_cursor {
|
||||
If either of these is NULL, then don't do hardware cursors, and
|
||||
fall back to software.
|
||||
*/
|
||||
struct mgag200_bo *pixels_1;
|
||||
struct mgag200_bo *pixels_2;
|
||||
struct drm_gem_vram_object *pixels_1;
|
||||
struct drm_gem_vram_object *pixels_2;
|
||||
u64 pixels_1_gpu_addr, pixels_2_gpu_addr;
|
||||
/* The currently displayed icon, this points to one of pixels_1, or pixels_2 */
|
||||
struct mgag200_bo *pixels_current;
|
||||
struct drm_gem_vram_object *pixels_current;
|
||||
/* The previously displayed icon */
|
||||
struct mgag200_bo *pixels_prev;
|
||||
struct drm_gem_vram_object *pixels_prev;
|
||||
};
|
||||
|
||||
struct mga_mc {
|
||||
@@ -211,31 +208,10 @@ struct mga_device {
|
||||
|
||||
int fb_mtrr;
|
||||
|
||||
struct {
|
||||
struct ttm_bo_device bdev;
|
||||
} ttm;
|
||||
|
||||
/* SE model number stored in reg 0x1e24 */
|
||||
u32 unique_rev_id;
|
||||
};
|
||||
|
||||
|
||||
struct mgag200_bo {
|
||||
struct ttm_buffer_object bo;
|
||||
struct ttm_placement placement;
|
||||
struct ttm_bo_kmap_obj kmap;
|
||||
struct drm_gem_object gem;
|
||||
struct ttm_place placements[3];
|
||||
int pin_count;
|
||||
};
|
||||
#define gem_to_mga_bo(gobj) container_of((gobj), struct mgag200_bo, gem)
|
||||
|
||||
static inline struct mgag200_bo *
|
||||
mgag200_bo(struct ttm_buffer_object *bo)
|
||||
{
|
||||
return container_of(bo, struct mgag200_bo, bo);
|
||||
}
|
||||
|
||||
/* mgag200_mode.c */
|
||||
int mgag200_modeset_init(struct mga_device *mdev);
|
||||
void mgag200_modeset_fini(struct mga_device *mdev);
|
||||
@@ -259,45 +235,15 @@ int mgag200_gem_create(struct drm_device *dev,
|
||||
int mgag200_dumb_create(struct drm_file *file,
|
||||
struct drm_device *dev,
|
||||
struct drm_mode_create_dumb *args);
|
||||
void mgag200_gem_free_object(struct drm_gem_object *obj);
|
||||
int
|
||||
mgag200_dumb_mmap_offset(struct drm_file *file,
|
||||
struct drm_device *dev,
|
||||
uint32_t handle,
|
||||
uint64_t *offset);
|
||||
|
||||
/* mgag200_i2c.c */
|
||||
struct mga_i2c_chan *mgag200_i2c_create(struct drm_device *dev);
|
||||
void mgag200_i2c_destroy(struct mga_i2c_chan *i2c);
|
||||
|
||||
void mgag200_ttm_placement(struct mgag200_bo *bo, int domain);
|
||||
|
||||
static inline int mgag200_bo_reserve(struct mgag200_bo *bo, bool no_wait)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = ttm_bo_reserve(&bo->bo, true, no_wait, NULL);
|
||||
if (ret) {
|
||||
if (ret != -ERESTARTSYS && ret != -EBUSY)
|
||||
DRM_ERROR("reserve failed %p\n", bo);
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void mgag200_bo_unreserve(struct mgag200_bo *bo)
|
||||
{
|
||||
ttm_bo_unreserve(&bo->bo);
|
||||
}
|
||||
|
||||
int mgag200_bo_create(struct drm_device *dev, int size, int align,
|
||||
uint32_t flags, struct mgag200_bo **pastbo);
|
||||
int mgag200_mm_init(struct mga_device *mdev);
|
||||
void mgag200_mm_fini(struct mga_device *mdev);
|
||||
int mgag200_mmap(struct file *filp, struct vm_area_struct *vma);
|
||||
int mgag200_bo_pin(struct mgag200_bo *bo, u32 pl_flag, u64 *gpu_addr);
|
||||
int mgag200_bo_unpin(struct mgag200_bo *bo);
|
||||
int mgag200_bo_push_sysram(struct mgag200_bo *bo);
|
||||
/* mgag200_cursor.c */
|
||||
|
||||
int mga_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv,
|
||||
uint32_t handle, uint32_t width, uint32_t height);
|
||||
int mga_crtc_cursor_move(struct drm_crtc *crtc, int x, int y);
|
||||
|
@@ -23,25 +23,25 @@ static void mga_dirty_update(struct mga_fbdev *mfbdev,
|
||||
{
|
||||
int i;
|
||||
struct drm_gem_object *obj;
|
||||
struct mgag200_bo *bo;
|
||||
struct drm_gem_vram_object *gbo;
|
||||
int src_offset, dst_offset;
|
||||
int bpp = mfbdev->mfb.base.format->cpp[0];
|
||||
int ret = -EBUSY;
|
||||
u8 *dst;
|
||||
bool unmap = false;
|
||||
bool store_for_later = false;
|
||||
int x2, y2;
|
||||
unsigned long flags;
|
||||
|
||||
obj = mfbdev->mfb.obj;
|
||||
bo = gem_to_mga_bo(obj);
|
||||
gbo = drm_gem_vram_of_gem(obj);
|
||||
|
||||
/*
|
||||
* try and reserve the BO, if we fail with busy
|
||||
* then the BO is being moved and we should
|
||||
* store up the damage until later.
|
||||
/* Try to lock the BO. If we fail with -EBUSY then
|
||||
* the BO is being moved and we should store up the
|
||||
* damage until later.
|
||||
*/
|
||||
if (drm_can_sleep())
|
||||
ret = mgag200_bo_reserve(bo, true);
|
||||
ret = drm_gem_vram_lock(gbo, true);
|
||||
if (ret) {
|
||||
if (ret != -EBUSY)
|
||||
return;
|
||||
@@ -75,25 +75,32 @@ static void mga_dirty_update(struct mga_fbdev *mfbdev,
|
||||
mfbdev->x2 = mfbdev->y2 = 0;
|
||||
spin_unlock_irqrestore(&mfbdev->dirty_lock, flags);
|
||||
|
||||
if (!bo->kmap.virtual) {
|
||||
ret = ttm_bo_kmap(&bo->bo, 0, bo->bo.num_pages, &bo->kmap);
|
||||
if (ret) {
|
||||
dst = drm_gem_vram_kmap(gbo, false, NULL);
|
||||
if (IS_ERR(dst)) {
|
||||
DRM_ERROR("failed to kmap fb updates\n");
|
||||
goto out;
|
||||
} else if (!dst) {
|
||||
dst = drm_gem_vram_kmap(gbo, true, NULL);
|
||||
if (IS_ERR(dst)) {
|
||||
DRM_ERROR("failed to kmap fb updates\n");
|
||||
mgag200_bo_unreserve(bo);
|
||||
return;
|
||||
goto out;
|
||||
}
|
||||
unmap = true;
|
||||
}
|
||||
|
||||
for (i = y; i <= y2; i++) {
|
||||
/* assume equal stride for now */
|
||||
src_offset = dst_offset = i * mfbdev->mfb.base.pitches[0] + (x * bpp);
|
||||
memcpy_toio(bo->kmap.virtual + src_offset, mfbdev->sysram + src_offset, (x2 - x + 1) * bpp);
|
||||
|
||||
src_offset = dst_offset =
|
||||
i * mfbdev->mfb.base.pitches[0] + (x * bpp);
|
||||
memcpy_toio(dst + dst_offset, mfbdev->sysram + src_offset,
|
||||
(x2 - x + 1) * bpp);
|
||||
}
|
||||
if (unmap)
|
||||
ttm_bo_kunmap(&bo->kmap);
|
||||
|
||||
mgag200_bo_unreserve(bo);
|
||||
if (unmap)
|
||||
drm_gem_vram_kunmap(gbo);
|
||||
|
||||
out:
|
||||
drm_gem_vram_unlock(gbo);
|
||||
}
|
||||
|
||||
static void mga_fillrect(struct fb_info *info,
|
||||
|
@@ -230,11 +230,13 @@ int mgag200_driver_load(struct drm_device *dev, unsigned long flags)
|
||||
}
|
||||
|
||||
/* Make small buffers to store a hardware cursor (double buffered icon updates) */
|
||||
mgag200_bo_create(dev, roundup(48*64, PAGE_SIZE), 0, 0,
|
||||
&mdev->cursor.pixels_1);
|
||||
mgag200_bo_create(dev, roundup(48*64, PAGE_SIZE), 0, 0,
|
||||
&mdev->cursor.pixels_2);
|
||||
if (!mdev->cursor.pixels_2 || !mdev->cursor.pixels_1) {
|
||||
mdev->cursor.pixels_1 = drm_gem_vram_create(dev, &dev->vram_mm->bdev,
|
||||
roundup(48*64, PAGE_SIZE),
|
||||
0, 0);
|
||||
mdev->cursor.pixels_2 = drm_gem_vram_create(dev, &dev->vram_mm->bdev,
|
||||
roundup(48*64, PAGE_SIZE),
|
||||
0, 0);
|
||||
if (IS_ERR(mdev->cursor.pixels_2) || IS_ERR(mdev->cursor.pixels_1)) {
|
||||
mdev->cursor.pixels_1 = NULL;
|
||||
mdev->cursor.pixels_2 = NULL;
|
||||
dev_warn(&dev->pdev->dev,
|
||||
@@ -272,7 +274,7 @@ int mgag200_gem_create(struct drm_device *dev,
|
||||
u32 size, bool iskernel,
|
||||
struct drm_gem_object **obj)
|
||||
{
|
||||
struct mgag200_bo *astbo;
|
||||
struct drm_gem_vram_object *gbo;
|
||||
int ret;
|
||||
|
||||
*obj = NULL;
|
||||
@@ -281,78 +283,13 @@ int mgag200_gem_create(struct drm_device *dev,
|
||||
if (size == 0)
|
||||
return -EINVAL;
|
||||
|
||||
ret = mgag200_bo_create(dev, size, 0, 0, &astbo);
|
||||
if (ret) {
|
||||
gbo = drm_gem_vram_create(dev, &dev->vram_mm->bdev, size, 0, false);
|
||||
if (IS_ERR(gbo)) {
|
||||
ret = PTR_ERR(gbo);
|
||||
if (ret != -ERESTARTSYS)
|
||||
DRM_ERROR("failed to allocate GEM object\n");
|
||||
return ret;
|
||||
}
|
||||
*obj = &astbo->gem;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mgag200_dumb_create(struct drm_file *file,
|
||||
struct drm_device *dev,
|
||||
struct drm_mode_create_dumb *args)
|
||||
{
|
||||
int ret;
|
||||
struct drm_gem_object *gobj;
|
||||
u32 handle;
|
||||
|
||||
args->pitch = args->width * ((args->bpp + 7) / 8);
|
||||
args->size = args->pitch * args->height;
|
||||
|
||||
ret = mgag200_gem_create(dev, args->size, false,
|
||||
&gobj);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = drm_gem_handle_create(file, gobj, &handle);
|
||||
drm_gem_object_put_unlocked(gobj);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
args->handle = handle;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void mgag200_bo_unref(struct mgag200_bo **bo)
|
||||
{
|
||||
if ((*bo) == NULL)
|
||||
return;
|
||||
ttm_bo_put(&((*bo)->bo));
|
||||
*bo = NULL;
|
||||
}
|
||||
|
||||
void mgag200_gem_free_object(struct drm_gem_object *obj)
|
||||
{
|
||||
struct mgag200_bo *mgag200_bo = gem_to_mga_bo(obj);
|
||||
|
||||
mgag200_bo_unref(&mgag200_bo);
|
||||
}
|
||||
|
||||
|
||||
static inline u64 mgag200_bo_mmap_offset(struct mgag200_bo *bo)
|
||||
{
|
||||
return drm_vma_node_offset_addr(&bo->bo.vma_node);
|
||||
}
|
||||
|
||||
int
|
||||
mgag200_dumb_mmap_offset(struct drm_file *file,
|
||||
struct drm_device *dev,
|
||||
uint32_t handle,
|
||||
uint64_t *offset)
|
||||
{
|
||||
struct drm_gem_object *obj;
|
||||
struct mgag200_bo *bo;
|
||||
|
||||
obj = drm_gem_object_lookup(file, handle);
|
||||
if (obj == NULL)
|
||||
return -ENOENT;
|
||||
|
||||
bo = gem_to_mga_bo(obj);
|
||||
*offset = mgag200_bo_mmap_offset(bo);
|
||||
|
||||
drm_gem_object_put_unlocked(obj);
|
||||
*obj = &gbo->gem;
|
||||
return 0;
|
||||
}
|
||||
|
@@ -858,8 +858,6 @@ static void mga_set_start_address(struct drm_crtc *crtc, unsigned offset)
|
||||
WREG_ECRT(0x0, ((u8)(addr >> 16) & 0xf) | crtcext0);
|
||||
}
|
||||
|
||||
|
||||
/* ast is different - we will force move buffers out of VRAM */
|
||||
static int mga_crtc_do_set_base(struct drm_crtc *crtc,
|
||||
struct drm_framebuffer *fb,
|
||||
int x, int y, int atomic)
|
||||
@@ -867,48 +865,51 @@ static int mga_crtc_do_set_base(struct drm_crtc *crtc,
|
||||
struct mga_device *mdev = crtc->dev->dev_private;
|
||||
struct drm_gem_object *obj;
|
||||
struct mga_framebuffer *mga_fb;
|
||||
struct mgag200_bo *bo;
|
||||
struct drm_gem_vram_object *gbo;
|
||||
int ret;
|
||||
u64 gpu_addr;
|
||||
s64 gpu_addr;
|
||||
void *base;
|
||||
|
||||
/* push the previous fb to system ram */
|
||||
if (!atomic && fb) {
|
||||
mga_fb = to_mga_framebuffer(fb);
|
||||
obj = mga_fb->obj;
|
||||
bo = gem_to_mga_bo(obj);
|
||||
ret = mgag200_bo_reserve(bo, false);
|
||||
if (ret)
|
||||
return ret;
|
||||
mgag200_bo_push_sysram(bo);
|
||||
mgag200_bo_unreserve(bo);
|
||||
gbo = drm_gem_vram_of_gem(obj);
|
||||
|
||||
/* unmap if console */
|
||||
if (&mdev->mfbdev->mfb == mga_fb)
|
||||
drm_gem_vram_kunmap(gbo);
|
||||
drm_gem_vram_unpin(gbo);
|
||||
}
|
||||
|
||||
mga_fb = to_mga_framebuffer(crtc->primary->fb);
|
||||
obj = mga_fb->obj;
|
||||
bo = gem_to_mga_bo(obj);
|
||||
gbo = drm_gem_vram_of_gem(obj);
|
||||
|
||||
ret = mgag200_bo_reserve(bo, false);
|
||||
ret = drm_gem_vram_pin(gbo, DRM_GEM_VRAM_PL_FLAG_VRAM);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = mgag200_bo_pin(bo, TTM_PL_FLAG_VRAM, &gpu_addr);
|
||||
if (ret) {
|
||||
mgag200_bo_unreserve(bo);
|
||||
return ret;
|
||||
gpu_addr = drm_gem_vram_offset(gbo);
|
||||
if (gpu_addr < 0) {
|
||||
ret = (int)gpu_addr;
|
||||
goto err_drm_gem_vram_unpin;
|
||||
}
|
||||
|
||||
if (&mdev->mfbdev->mfb == mga_fb) {
|
||||
/* if pushing console in kmap it */
|
||||
ret = ttm_bo_kmap(&bo->bo, 0, bo->bo.num_pages, &bo->kmap);
|
||||
if (ret)
|
||||
base = drm_gem_vram_kmap(gbo, true, NULL);
|
||||
if (IS_ERR(base)) {
|
||||
ret = PTR_ERR(base);
|
||||
DRM_ERROR("failed to kmap fbcon\n");
|
||||
|
||||
}
|
||||
}
|
||||
mgag200_bo_unreserve(bo);
|
||||
|
||||
mga_set_start_address(crtc, (u32)gpu_addr);
|
||||
|
||||
return 0;
|
||||
|
||||
err_drm_gem_vram_unpin:
|
||||
drm_gem_vram_unpin(gbo);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int mga_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
|
||||
@@ -1422,18 +1423,18 @@ static void mga_crtc_destroy(struct drm_crtc *crtc)
|
||||
|
||||
static void mga_crtc_disable(struct drm_crtc *crtc)
|
||||
{
|
||||
int ret;
|
||||
DRM_DEBUG_KMS("\n");
|
||||
mga_crtc_dpms(crtc, DRM_MODE_DPMS_OFF);
|
||||
if (crtc->primary->fb) {
|
||||
struct mga_device *mdev = crtc->dev->dev_private;
|
||||
struct mga_framebuffer *mga_fb = to_mga_framebuffer(crtc->primary->fb);
|
||||
struct drm_gem_object *obj = mga_fb->obj;
|
||||
struct mgag200_bo *bo = gem_to_mga_bo(obj);
|
||||
ret = mgag200_bo_reserve(bo, false);
|
||||
if (ret)
|
||||
return;
|
||||
mgag200_bo_push_sysram(bo);
|
||||
mgag200_bo_unreserve(bo);
|
||||
struct drm_gem_vram_object *gbo = drm_gem_vram_of_gem(obj);
|
||||
|
||||
/* unmap if console */
|
||||
if (&mdev->mfbdev->mfb == mga_fb)
|
||||
drm_gem_vram_kunmap(gbo);
|
||||
drm_gem_vram_unpin(gbo);
|
||||
}
|
||||
crtc->primary->fb = NULL;
|
||||
}
|
||||
|
@@ -26,167 +26,21 @@
|
||||
* Authors: Dave Airlie <airlied@redhat.com>
|
||||
*/
|
||||
#include <drm/drmP.h>
|
||||
#include <drm/ttm/ttm_page_alloc.h>
|
||||
|
||||
#include "mgag200_drv.h"
|
||||
|
||||
static inline struct mga_device *
|
||||
mgag200_bdev(struct ttm_bo_device *bd)
|
||||
{
|
||||
return container_of(bd, struct mga_device, ttm.bdev);
|
||||
}
|
||||
|
||||
static void mgag200_bo_ttm_destroy(struct ttm_buffer_object *tbo)
|
||||
{
|
||||
struct mgag200_bo *bo;
|
||||
|
||||
bo = container_of(tbo, struct mgag200_bo, bo);
|
||||
|
||||
drm_gem_object_release(&bo->gem);
|
||||
kfree(bo);
|
||||
}
|
||||
|
||||
static bool mgag200_ttm_bo_is_mgag200_bo(struct ttm_buffer_object *bo)
|
||||
{
|
||||
if (bo->destroy == &mgag200_bo_ttm_destroy)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
static int
|
||||
mgag200_bo_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,
|
||||
struct ttm_mem_type_manager *man)
|
||||
{
|
||||
switch (type) {
|
||||
case TTM_PL_SYSTEM:
|
||||
man->flags = TTM_MEMTYPE_FLAG_MAPPABLE;
|
||||
man->available_caching = TTM_PL_MASK_CACHING;
|
||||
man->default_caching = TTM_PL_FLAG_CACHED;
|
||||
break;
|
||||
case TTM_PL_VRAM:
|
||||
man->func = &ttm_bo_manager_func;
|
||||
man->flags = TTM_MEMTYPE_FLAG_FIXED |
|
||||
TTM_MEMTYPE_FLAG_MAPPABLE;
|
||||
man->available_caching = TTM_PL_FLAG_UNCACHED |
|
||||
TTM_PL_FLAG_WC;
|
||||
man->default_caching = TTM_PL_FLAG_WC;
|
||||
break;
|
||||
default:
|
||||
DRM_ERROR("Unsupported memory type %u\n", (unsigned)type);
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
mgag200_bo_evict_flags(struct ttm_buffer_object *bo, struct ttm_placement *pl)
|
||||
{
|
||||
struct mgag200_bo *mgabo = mgag200_bo(bo);
|
||||
|
||||
if (!mgag200_ttm_bo_is_mgag200_bo(bo))
|
||||
return;
|
||||
|
||||
mgag200_ttm_placement(mgabo, TTM_PL_FLAG_SYSTEM);
|
||||
*pl = mgabo->placement;
|
||||
}
|
||||
|
||||
static int mgag200_bo_verify_access(struct ttm_buffer_object *bo, struct file *filp)
|
||||
{
|
||||
struct mgag200_bo *mgabo = mgag200_bo(bo);
|
||||
|
||||
return drm_vma_node_verify_access(&mgabo->gem.vma_node,
|
||||
filp->private_data);
|
||||
}
|
||||
|
||||
static int mgag200_ttm_io_mem_reserve(struct ttm_bo_device *bdev,
|
||||
struct ttm_mem_reg *mem)
|
||||
{
|
||||
struct ttm_mem_type_manager *man = &bdev->man[mem->mem_type];
|
||||
struct mga_device *mdev = mgag200_bdev(bdev);
|
||||
|
||||
mem->bus.addr = NULL;
|
||||
mem->bus.offset = 0;
|
||||
mem->bus.size = mem->num_pages << PAGE_SHIFT;
|
||||
mem->bus.base = 0;
|
||||
mem->bus.is_iomem = false;
|
||||
if (!(man->flags & TTM_MEMTYPE_FLAG_MAPPABLE))
|
||||
return -EINVAL;
|
||||
switch (mem->mem_type) {
|
||||
case TTM_PL_SYSTEM:
|
||||
/* system memory */
|
||||
return 0;
|
||||
case TTM_PL_VRAM:
|
||||
mem->bus.offset = mem->start << PAGE_SHIFT;
|
||||
mem->bus.base = pci_resource_start(mdev->dev->pdev, 0);
|
||||
mem->bus.is_iomem = true;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void mgag200_ttm_io_mem_free(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem)
|
||||
{
|
||||
}
|
||||
|
||||
static void mgag200_ttm_backend_destroy(struct ttm_tt *tt)
|
||||
{
|
||||
ttm_tt_fini(tt);
|
||||
kfree(tt);
|
||||
}
|
||||
|
||||
static struct ttm_backend_func mgag200_tt_backend_func = {
|
||||
.destroy = &mgag200_ttm_backend_destroy,
|
||||
};
|
||||
|
||||
|
||||
static struct ttm_tt *mgag200_ttm_tt_create(struct ttm_buffer_object *bo,
|
||||
uint32_t page_flags)
|
||||
{
|
||||
struct ttm_tt *tt;
|
||||
|
||||
tt = kzalloc(sizeof(struct ttm_tt), GFP_KERNEL);
|
||||
if (tt == NULL)
|
||||
return NULL;
|
||||
tt->func = &mgag200_tt_backend_func;
|
||||
if (ttm_tt_init(tt, bo, page_flags)) {
|
||||
kfree(tt);
|
||||
return NULL;
|
||||
}
|
||||
return tt;
|
||||
}
|
||||
|
||||
struct ttm_bo_driver mgag200_bo_driver = {
|
||||
.ttm_tt_create = mgag200_ttm_tt_create,
|
||||
.init_mem_type = mgag200_bo_init_mem_type,
|
||||
.eviction_valuable = ttm_bo_eviction_valuable,
|
||||
.evict_flags = mgag200_bo_evict_flags,
|
||||
.move = NULL,
|
||||
.verify_access = mgag200_bo_verify_access,
|
||||
.io_mem_reserve = &mgag200_ttm_io_mem_reserve,
|
||||
.io_mem_free = &mgag200_ttm_io_mem_free,
|
||||
};
|
||||
|
||||
int mgag200_mm_init(struct mga_device *mdev)
|
||||
{
|
||||
struct drm_vram_mm *vmm;
|
||||
int ret;
|
||||
struct drm_device *dev = mdev->dev;
|
||||
struct ttm_bo_device *bdev = &mdev->ttm.bdev;
|
||||
|
||||
ret = ttm_bo_device_init(&mdev->ttm.bdev,
|
||||
&mgag200_bo_driver,
|
||||
dev->anon_inode->i_mapping,
|
||||
true);
|
||||
if (ret) {
|
||||
DRM_ERROR("Error initialising bo driver; %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = ttm_bo_init_mm(bdev, TTM_PL_VRAM, mdev->mc.vram_size >> PAGE_SHIFT);
|
||||
if (ret) {
|
||||
DRM_ERROR("Failed ttm VRAM init: %d\n", ret);
|
||||
vmm = drm_vram_helper_alloc_mm(dev, pci_resource_start(dev->pdev, 0),
|
||||
mdev->mc.vram_size,
|
||||
&drm_gem_vram_mm_funcs);
|
||||
if (IS_ERR(vmm)) {
|
||||
ret = PTR_ERR(vmm);
|
||||
DRM_ERROR("Error initializing VRAM MM; %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -203,149 +57,10 @@ void mgag200_mm_fini(struct mga_device *mdev)
|
||||
{
|
||||
struct drm_device *dev = mdev->dev;
|
||||
|
||||
ttm_bo_device_release(&mdev->ttm.bdev);
|
||||
drm_vram_helper_release_mm(dev);
|
||||
|
||||
arch_io_free_memtype_wc(pci_resource_start(dev->pdev, 0),
|
||||
pci_resource_len(dev->pdev, 0));
|
||||
arch_phys_wc_del(mdev->fb_mtrr);
|
||||
mdev->fb_mtrr = 0;
|
||||
}
|
||||
|
||||
void mgag200_ttm_placement(struct mgag200_bo *bo, int domain)
|
||||
{
|
||||
u32 c = 0;
|
||||
unsigned i;
|
||||
|
||||
bo->placement.placement = bo->placements;
|
||||
bo->placement.busy_placement = bo->placements;
|
||||
if (domain & TTM_PL_FLAG_VRAM)
|
||||
bo->placements[c++].flags = TTM_PL_FLAG_WC | TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_VRAM;
|
||||
if (domain & TTM_PL_FLAG_SYSTEM)
|
||||
bo->placements[c++].flags = TTM_PL_MASK_CACHING | TTM_PL_FLAG_SYSTEM;
|
||||
if (!c)
|
||||
bo->placements[c++].flags = TTM_PL_MASK_CACHING | TTM_PL_FLAG_SYSTEM;
|
||||
bo->placement.num_placement = c;
|
||||
bo->placement.num_busy_placement = c;
|
||||
for (i = 0; i < c; ++i) {
|
||||
bo->placements[i].fpfn = 0;
|
||||
bo->placements[i].lpfn = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int mgag200_bo_create(struct drm_device *dev, int size, int align,
|
||||
uint32_t flags, struct mgag200_bo **pmgabo)
|
||||
{
|
||||
struct mga_device *mdev = dev->dev_private;
|
||||
struct mgag200_bo *mgabo;
|
||||
size_t acc_size;
|
||||
int ret;
|
||||
|
||||
mgabo = kzalloc(sizeof(struct mgag200_bo), GFP_KERNEL);
|
||||
if (!mgabo)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = drm_gem_object_init(dev, &mgabo->gem, size);
|
||||
if (ret) {
|
||||
kfree(mgabo);
|
||||
return ret;
|
||||
}
|
||||
|
||||
mgabo->bo.bdev = &mdev->ttm.bdev;
|
||||
|
||||
mgag200_ttm_placement(mgabo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM);
|
||||
|
||||
acc_size = ttm_bo_dma_acc_size(&mdev->ttm.bdev, size,
|
||||
sizeof(struct mgag200_bo));
|
||||
|
||||
ret = ttm_bo_init(&mdev->ttm.bdev, &mgabo->bo, size,
|
||||
ttm_bo_type_device, &mgabo->placement,
|
||||
align >> PAGE_SHIFT, false, acc_size,
|
||||
NULL, NULL, mgag200_bo_ttm_destroy);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
*pmgabo = mgabo;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline u64 mgag200_bo_gpu_offset(struct mgag200_bo *bo)
|
||||
{
|
||||
return bo->bo.offset;
|
||||
}
|
||||
|
||||
int mgag200_bo_pin(struct mgag200_bo *bo, u32 pl_flag, u64 *gpu_addr)
|
||||
{
|
||||
struct ttm_operation_ctx ctx = { false, false };
|
||||
int i, ret;
|
||||
|
||||
if (bo->pin_count) {
|
||||
bo->pin_count++;
|
||||
if (gpu_addr)
|
||||
*gpu_addr = mgag200_bo_gpu_offset(bo);
|
||||
return 0;
|
||||
}
|
||||
|
||||
mgag200_ttm_placement(bo, pl_flag);
|
||||
for (i = 0; i < bo->placement.num_placement; i++)
|
||||
bo->placements[i].flags |= TTM_PL_FLAG_NO_EVICT;
|
||||
ret = ttm_bo_validate(&bo->bo, &bo->placement, &ctx);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
bo->pin_count = 1;
|
||||
if (gpu_addr)
|
||||
*gpu_addr = mgag200_bo_gpu_offset(bo);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mgag200_bo_unpin(struct mgag200_bo *bo)
|
||||
{
|
||||
struct ttm_operation_ctx ctx = { false, false };
|
||||
int i;
|
||||
if (!bo->pin_count) {
|
||||
DRM_ERROR("unpin bad %p\n", bo);
|
||||
return 0;
|
||||
}
|
||||
bo->pin_count--;
|
||||
if (bo->pin_count)
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < bo->placement.num_placement ; i++)
|
||||
bo->placements[i].flags &= ~TTM_PL_FLAG_NO_EVICT;
|
||||
return ttm_bo_validate(&bo->bo, &bo->placement, &ctx);
|
||||
}
|
||||
|
||||
int mgag200_bo_push_sysram(struct mgag200_bo *bo)
|
||||
{
|
||||
struct ttm_operation_ctx ctx = { false, false };
|
||||
int i, ret;
|
||||
if (!bo->pin_count) {
|
||||
DRM_ERROR("unpin bad %p\n", bo);
|
||||
return 0;
|
||||
}
|
||||
bo->pin_count--;
|
||||
if (bo->pin_count)
|
||||
return 0;
|
||||
|
||||
if (bo->kmap.virtual)
|
||||
ttm_bo_kunmap(&bo->kmap);
|
||||
|
||||
mgag200_ttm_placement(bo, TTM_PL_FLAG_SYSTEM);
|
||||
for (i = 0; i < bo->placement.num_placement ; i++)
|
||||
bo->placements[i].flags |= TTM_PL_FLAG_NO_EVICT;
|
||||
|
||||
ret = ttm_bo_validate(&bo->bo, &bo->placement, &ctx);
|
||||
if (ret) {
|
||||
DRM_ERROR("pushing to VRAM failed\n");
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mgag200_mmap(struct file *filp, struct vm_area_struct *vma)
|
||||
{
|
||||
struct drm_file *file_priv = filp->private_data;
|
||||
struct mga_device *mdev = file_priv->minor->dev->dev_private;
|
||||
|
||||
return ttm_bo_mmap(filp, vma, &mdev->ttm.bdev);
|
||||
}
|
||||
|
Reference in New Issue
Block a user