diff options
author | Dave Airlie <airlied@redhat.com> | 2008-11-27 23:22:24 -0500 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2008-12-29 02:47:22 -0500 |
commit | 7c1c2871a6a3a114853ec6836e9035ac1c0c7f7a (patch) | |
tree | 1b5debcc86ff20bd5e11b42ea5c52da42214e376 /drivers/gpu/drm/radeon/r300_cmdbuf.c | |
parent | e7f7ab45ebcb54fd5f814ea15ea079e079662f67 (diff) |
drm: move to kref per-master structures.
This is step one towards having multiple masters sharing a drm
device in order to get fast-user-switching to work.
It splits out the information associated with the drm master
into a separate kref counted structure, and allocates this when
a master opens the device node. It also allows the current master
to abdicate (say while VT switched), and a new master to take over
the hardware.
It moves the Intel and radeon drivers to using the sarea from
within the new master structures.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/r300_cmdbuf.c')
-rw-r--r-- | drivers/gpu/drm/radeon/r300_cmdbuf.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/gpu/drm/radeon/r300_cmdbuf.c b/drivers/gpu/drm/radeon/r300_cmdbuf.c index 4b27d9abb7bc..cace3964feeb 100644 --- a/drivers/gpu/drm/radeon/r300_cmdbuf.c +++ b/drivers/gpu/drm/radeon/r300_cmdbuf.c | |||
@@ -860,12 +860,12 @@ static __inline__ void r300_pacify(drm_radeon_private_t *dev_priv) | |||
860 | * The actual age emit is done by r300_do_cp_cmdbuf, which is why you must | 860 | * The actual age emit is done by r300_do_cp_cmdbuf, which is why you must |
861 | * be careful about how this function is called. | 861 | * be careful about how this function is called. |
862 | */ | 862 | */ |
863 | static void r300_discard_buffer(struct drm_device * dev, struct drm_buf * buf) | 863 | static void r300_discard_buffer(struct drm_device *dev, struct drm_master *master, struct drm_buf *buf) |
864 | { | 864 | { |
865 | drm_radeon_private_t *dev_priv = dev->dev_private; | ||
866 | drm_radeon_buf_priv_t *buf_priv = buf->dev_private; | 865 | drm_radeon_buf_priv_t *buf_priv = buf->dev_private; |
866 | struct drm_radeon_master_private *master_priv = master->driver_priv; | ||
867 | 867 | ||
868 | buf_priv->age = ++dev_priv->sarea_priv->last_dispatch; | 868 | buf_priv->age = ++master_priv->sarea_priv->last_dispatch; |
869 | buf->pending = 1; | 869 | buf->pending = 1; |
870 | buf->used = 0; | 870 | buf->used = 0; |
871 | } | 871 | } |
@@ -1027,6 +1027,7 @@ int r300_do_cp_cmdbuf(struct drm_device *dev, | |||
1027 | drm_radeon_kcmd_buffer_t *cmdbuf) | 1027 | drm_radeon_kcmd_buffer_t *cmdbuf) |
1028 | { | 1028 | { |
1029 | drm_radeon_private_t *dev_priv = dev->dev_private; | 1029 | drm_radeon_private_t *dev_priv = dev->dev_private; |
1030 | struct drm_radeon_master_private *master_priv = file_priv->master->driver_priv; | ||
1030 | struct drm_device_dma *dma = dev->dma; | 1031 | struct drm_device_dma *dma = dev->dma; |
1031 | struct drm_buf *buf = NULL; | 1032 | struct drm_buf *buf = NULL; |
1032 | int emit_dispatch_age = 0; | 1033 | int emit_dispatch_age = 0; |
@@ -1134,7 +1135,7 @@ int r300_do_cp_cmdbuf(struct drm_device *dev, | |||
1134 | } | 1135 | } |
1135 | 1136 | ||
1136 | emit_dispatch_age = 1; | 1137 | emit_dispatch_age = 1; |
1137 | r300_discard_buffer(dev, buf); | 1138 | r300_discard_buffer(dev, file_priv->master, buf); |
1138 | break; | 1139 | break; |
1139 | 1140 | ||
1140 | case R300_CMD_WAIT: | 1141 | case R300_CMD_WAIT: |
@@ -1189,7 +1190,7 @@ int r300_do_cp_cmdbuf(struct drm_device *dev, | |||
1189 | 1190 | ||
1190 | /* Emit the vertex buffer age */ | 1191 | /* Emit the vertex buffer age */ |
1191 | BEGIN_RING(2); | 1192 | BEGIN_RING(2); |
1192 | RADEON_DISPATCH_AGE(dev_priv->sarea_priv->last_dispatch); | 1193 | RADEON_DISPATCH_AGE(master_priv->sarea_priv->last_dispatch); |
1193 | ADVANCE_RING(); | 1194 | ADVANCE_RING(); |
1194 | } | 1195 | } |
1195 | 1196 | ||