aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/radeon.h
diff options
context:
space:
mode:
authorJerome Glisse <glisse@freedesktop.org>2009-06-17 07:28:30 -0400
committerDave Airlie <airlied@redhat.com>2009-06-18 19:32:27 -0400
commit068a117ca38f27c9641db7642f24fe9270d9424e (patch)
treee1038db118114aa777312a5eae70b512fa13617b /drivers/gpu/drm/radeon/radeon.h
parent8b5c744485b75d940ccb1c83c9a358b20eb91346 (diff)
drm/radeon: command stream checker for r3xx-r5xx hardware
For security purpose we want to make sure the userspace process doesn't access memory beyond buffer it owns. To achieve this we need to check states the userspace program. For color buffer and zbuffer we check that the clipping register will discard access beyond buffers set as color or zbuffer. For vertex buffer we check that no vertex fetch will happen beyond buffer end. For texture we check various texture states (number of mipmap level, texture size, texture depth, ...) to compute the amount of memory the texture fetcher might access. The command stream checking impact the performances so far quick benchmark shows an average of 3% decrease in fps of various applications. It can be optimized a bit more by caching result of checking and thus avoid a full recheck if no states changed since last check. Note that this patch is still incomplete on checking side as it doesn't check 2d rendering states. Signed-off-by: Jerome Glisse <jglisse@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon.h')
-rw-r--r--drivers/gpu/drm/radeon/radeon.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index c3f24cc56009..d61f2fc61df5 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -51,7 +51,7 @@
51 51
52#include "radeon_mode.h" 52#include "radeon_mode.h"
53#include "radeon_reg.h" 53#include "radeon_reg.h"
54 54#include "r300.h"
55 55
56/* 56/*
57 * Modules parameters. 57 * Modules parameters.
@@ -496,6 +496,7 @@ int r100_debugfs_cp_init(struct radeon_device *rdev);
496 * ASIC specific functions. 496 * ASIC specific functions.
497 */ 497 */
498struct radeon_asic { 498struct radeon_asic {
499 int (*init)(struct radeon_device *rdev);
499 void (*errata)(struct radeon_device *rdev); 500 void (*errata)(struct radeon_device *rdev);
500 void (*vram_info)(struct radeon_device *rdev); 501 void (*vram_info)(struct radeon_device *rdev);
501 int (*gpu_reset)(struct radeon_device *rdev); 502 int (*gpu_reset)(struct radeon_device *rdev);
@@ -536,6 +537,10 @@ struct radeon_asic {
536 void (*set_clock_gating)(struct radeon_device *rdev, int enable); 537 void (*set_clock_gating)(struct radeon_device *rdev, int enable);
537}; 538};
538 539
540union radeon_asic_config {
541 struct r300_asic r300;
542};
543
539 544
540/* 545/*
541 * IOCTL. 546 * IOCTL.
@@ -573,6 +578,7 @@ struct radeon_device {
573 struct drm_device *ddev; 578 struct drm_device *ddev;
574 struct pci_dev *pdev; 579 struct pci_dev *pdev;
575 /* ASIC */ 580 /* ASIC */
581 union radeon_asic_config config;
576 enum radeon_family family; 582 enum radeon_family family;
577 unsigned long flags; 583 unsigned long flags;
578 int usec_timeout; 584 int usec_timeout;
@@ -763,6 +769,7 @@ static inline void radeon_ring_write(struct radeon_device *rdev, uint32_t v)
763/* 769/*
764 * ASICs macro. 770 * ASICs macro.
765 */ 771 */
772#define radeon_init(rdev) (rdev)->asic->init((rdev))
766#define radeon_cs_parse(p) rdev->asic->cs_parse((p)) 773#define radeon_cs_parse(p) rdev->asic->cs_parse((p))
767#define radeon_errata(rdev) (rdev)->asic->errata((rdev)) 774#define radeon_errata(rdev) (rdev)->asic->errata((rdev))
768#define radeon_vram_info(rdev) (rdev)->asic->vram_info((rdev)) 775#define radeon_vram_info(rdev) (rdev)->asic->vram_info((rdev))