radeon_ms: fix fence
parent
a7e6ca62ad
commit
6ef119abf5
|
@ -0,0 +1 @@
|
||||||
|
../shared-core/amd_legacy_fence.h
|
|
@ -0,0 +1,39 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2007 Jérôme Glisse
|
||||||
|
* All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
* to deal in the Software without restriction, including without limitation
|
||||||
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
* and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
* Software is furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice (including the next
|
||||||
|
* paragraph) shall be included in all copies or substantial portions of the
|
||||||
|
* Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
* PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||||
|
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||||
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
* DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Dave Airlie
|
||||||
|
* Jerome Glisse <glisse@freedesktop.org>
|
||||||
|
*/
|
||||||
|
#ifndef __AMD_LEGACY_FENCE_H__
|
||||||
|
#define __AMD_LEGACY_FENCE_H__
|
||||||
|
|
||||||
|
struct legacy_fence
|
||||||
|
{
|
||||||
|
uint32_t sequence;
|
||||||
|
uint32_t sequence_last_reported;
|
||||||
|
uint32_t sequence_last_flush;
|
||||||
|
uint32_t fence_reg;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -31,7 +31,6 @@
|
||||||
#define __RADEON_MS_H__
|
#define __RADEON_MS_H__
|
||||||
|
|
||||||
#include "radeon_ms_drv.h"
|
#include "radeon_ms_drv.h"
|
||||||
#include "amd_r3xx_fence.h"
|
|
||||||
#include "radeon_ms_reg.h"
|
#include "radeon_ms_reg.h"
|
||||||
#include "radeon_ms_drm.h"
|
#include "radeon_ms_drm.h"
|
||||||
#include "radeon_ms_rom.h"
|
#include "radeon_ms_rom.h"
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
*/
|
*/
|
||||||
#include "drm_pciids.h"
|
#include "drm_pciids.h"
|
||||||
#include "radeon_ms.h"
|
#include "radeon_ms.h"
|
||||||
|
#include "amd_legacy_fence.h"
|
||||||
|
|
||||||
|
|
||||||
static uint32_t radeon_ms_mem_prios[] = {
|
static uint32_t radeon_ms_mem_prios[] = {
|
||||||
|
@ -116,12 +117,12 @@ int radeon_ms_driver_load(struct drm_device *dev, unsigned long flags)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
dev_priv->fence = drm_alloc(sizeof(struct r3xx_fence), DRM_MEM_DRIVER);
|
dev_priv->fence = drm_alloc(sizeof(struct legacy_fence), DRM_MEM_DRIVER);
|
||||||
if (dev_priv->fence == NULL) {
|
if (dev_priv->fence == NULL) {
|
||||||
radeon_ms_driver_unload(dev);
|
radeon_ms_driver_unload(dev);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
memset(dev_priv->fence, 0, sizeof(struct r3xx_fence));
|
memset(dev_priv->fence, 0, sizeof(struct legacy_fence));
|
||||||
|
|
||||||
/* we don't want userspace to be able to map this so don't use
|
/* we don't want userspace to be able to map this so don't use
|
||||||
* drm_addmap */
|
* drm_addmap */
|
||||||
|
@ -305,7 +306,7 @@ int radeon_ms_driver_unload(struct drm_device *dev)
|
||||||
drm_core_ioremapfree(&dev_priv->vram, dev);
|
drm_core_ioremapfree(&dev_priv->vram, dev);
|
||||||
}
|
}
|
||||||
DRM_INFO("[radeon_ms] map released\n");
|
DRM_INFO("[radeon_ms] map released\n");
|
||||||
drm_free(dev_priv->fence, sizeof(struct r3xx_fence), DRM_MEM_DRIVER);
|
drm_free(dev_priv->fence, sizeof(struct legacy_fence), DRM_MEM_DRIVER);
|
||||||
drm_free(dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER);
|
drm_free(dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER);
|
||||||
dev->dev_private = NULL;
|
dev->dev_private = NULL;
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
* Jerome Glisse <glisse@freedesktop.org>
|
* Jerome Glisse <glisse@freedesktop.org>
|
||||||
*/
|
*/
|
||||||
#include "radeon_ms.h"
|
#include "radeon_ms.h"
|
||||||
#include "amd_r3xx_fence.h"
|
#include "amd_legacy_fence.h"
|
||||||
|
|
||||||
#define R3XX_FENCE_SEQUENCE_RW_FLUSH 0x80000000u
|
#define R3XX_FENCE_SEQUENCE_RW_FLUSH 0x80000000u
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ static inline int r3xx_fence_emit_sequence(struct drm_device *dev,
|
||||||
struct drm_radeon_private *dev_priv,
|
struct drm_radeon_private *dev_priv,
|
||||||
uint32_t sequence)
|
uint32_t sequence)
|
||||||
{
|
{
|
||||||
struct r3xx_fence *r3xx_fence = dev_priv->fence;
|
struct legacy_fence *r3xx_fence = dev_priv->fence;
|
||||||
uint32_t cmd[2];
|
uint32_t cmd[2];
|
||||||
int i, r;
|
int i, r;
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ static inline int r3xx_fence_emit_sequence(struct drm_device *dev,
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint32_t r3xx_fence_sequence(struct r3xx_fence *r3xx_fence)
|
static inline uint32_t r3xx_fence_sequence(struct legacy_fence *r3xx_fence)
|
||||||
{
|
{
|
||||||
r3xx_fence->sequence += 1;
|
r3xx_fence->sequence += 1;
|
||||||
if (unlikely(r3xx_fence->sequence > 0x7fffffffu)) {
|
if (unlikely(r3xx_fence->sequence > 0x7fffffffu)) {
|
||||||
|
@ -69,7 +69,7 @@ static inline uint32_t r3xx_fence_sequence(struct r3xx_fence *r3xx_fence)
|
||||||
|
|
||||||
static inline void r3xx_fence_report(struct drm_device *dev,
|
static inline void r3xx_fence_report(struct drm_device *dev,
|
||||||
struct drm_radeon_private *dev_priv,
|
struct drm_radeon_private *dev_priv,
|
||||||
struct r3xx_fence *r3xx_fence)
|
struct legacy_fence *r3xx_fence)
|
||||||
{
|
{
|
||||||
uint32_t fence_types = DRM_FENCE_TYPE_EXE;
|
uint32_t fence_types = DRM_FENCE_TYPE_EXE;
|
||||||
uint32_t sequence;
|
uint32_t sequence;
|
||||||
|
@ -95,7 +95,7 @@ static inline void r3xx_fence_report(struct drm_device *dev,
|
||||||
static void r3xx_fence_flush(struct drm_device *dev, uint32_t class)
|
static void r3xx_fence_flush(struct drm_device *dev, uint32_t class)
|
||||||
{
|
{
|
||||||
struct drm_radeon_private *dev_priv = dev->dev_private;
|
struct drm_radeon_private *dev_priv = dev->dev_private;
|
||||||
struct r3xx_fence *r3xx_fence = dev_priv->fence;
|
struct legacy_fence *r3xx_fence = dev_priv->fence;
|
||||||
uint32_t sequence;
|
uint32_t sequence;
|
||||||
|
|
||||||
sequence = r3xx_fence_sequence(r3xx_fence);
|
sequence = r3xx_fence_sequence(r3xx_fence);
|
||||||
|
@ -109,7 +109,7 @@ static void r3xx_fence_poll(struct drm_device *dev, uint32_t fence_class,
|
||||||
struct drm_radeon_private *dev_priv = dev->dev_private;
|
struct drm_radeon_private *dev_priv = dev->dev_private;
|
||||||
struct drm_fence_manager *fm = &dev->fm;
|
struct drm_fence_manager *fm = &dev->fm;
|
||||||
struct drm_fence_class_manager *fc = &fm->fence_class[fence_class];
|
struct drm_fence_class_manager *fc = &fm->fence_class[fence_class];
|
||||||
struct r3xx_fence *r3xx_fence = dev_priv->fence;
|
struct legacy_fence *r3xx_fence = dev_priv->fence;
|
||||||
|
|
||||||
if (unlikely(!dev_priv)) {
|
if (unlikely(!dev_priv)) {
|
||||||
return;
|
return;
|
||||||
|
@ -129,7 +129,7 @@ static int r3xx_fence_emit(struct drm_device *dev, uint32_t class,
|
||||||
uint32_t *native_type)
|
uint32_t *native_type)
|
||||||
{
|
{
|
||||||
struct drm_radeon_private *dev_priv = dev->dev_private;
|
struct drm_radeon_private *dev_priv = dev->dev_private;
|
||||||
struct r3xx_fence *r3xx_fence = dev_priv->fence;
|
struct legacy_fence *r3xx_fence = dev_priv->fence;
|
||||||
uint32_t tmp;
|
uint32_t tmp;
|
||||||
|
|
||||||
if (!dev_priv || dev_priv->cp_ready != 1) {
|
if (!dev_priv || dev_priv->cp_ready != 1) {
|
||||||
|
@ -162,7 +162,7 @@ static uint32_t r3xx_fence_needed_flush(struct drm_fence_object *fence)
|
||||||
{
|
{
|
||||||
struct drm_device *dev = fence->dev;
|
struct drm_device *dev = fence->dev;
|
||||||
struct drm_radeon_private *dev_priv = dev->dev_private;
|
struct drm_radeon_private *dev_priv = dev->dev_private;
|
||||||
struct r3xx_fence *r3xx_fence = dev_priv->fence;
|
struct legacy_fence *r3xx_fence = dev_priv->fence;
|
||||||
struct drm_fence_driver *driver = dev->driver->fence_driver;
|
struct drm_fence_driver *driver = dev->driver->fence_driver;
|
||||||
uint32_t flush_types, diff;
|
uint32_t flush_types, diff;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue