dedicated video blitter

git-svn-id: svn://kolibrios.org@2175 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2011-09-12 19:51:02 +00:00
parent de6e26f7d9
commit 37f3ab9eca
9 changed files with 48 additions and 2314 deletions

View File

@ -52,6 +52,9 @@ NAME_SRC= \
$(DRM_TOPDIR)/drm_dp_i2c_helper.c \
$(DRM_TOPDIR)/i2c/i2c-core.c \
$(DRM_TOPDIR)/i2c/i2c-algo-bit.c \
tracker/bitmap.c \
r700_vs.c \
r600_video.c \
radeon_device.c \
evergreen.c \
evergreen_blit_shaders.c \
@ -102,7 +105,6 @@ NAME_SRC= \
rdisplay_kms.c \
cmdline.c \
fwblob.asm
# cursor.S
FW_BINS= \
firmware/R100_cp.bin \

View File

@ -52,6 +52,9 @@ NAME_SRC= \
$(DRM_TOPDIR)/drm_dp_i2c_helper.c \
$(DRM_TOPDIR)/i2c/i2c-core.c \
$(DRM_TOPDIR)/i2c/i2c-algo-bit.c \
tracker/bitmap.c \
r700_vs.c \
r600_video.c \
radeon_device.c \
evergreen.c \
evergreen_blit_shaders.c \
@ -102,7 +105,6 @@ NAME_SRC= \
rdisplay_kms.c \
cmdline.c \
fwblob.asm
# cursor.S
FW_BINS= \
firmware/R100_cp.bin \

View File

@ -2734,6 +2734,9 @@ int evergreen_irq_process(struct radeon_device *rdev)
return IRQ_NONE;
}
restart_ih:
/* Order reading of wptr vs. reading of IH ring data */
rmb();
/* display interrupts */
evergreen_irq_ack(rdev);

View File

@ -1934,6 +1934,13 @@ int r600_startup(struct radeon_device *rdev)
dev_warn(rdev->dev, "failed blitter (%d) falling back to memcpy\n", r);
}
r = r600_video_init(rdev);
if (r) {
// r600_video_fini(rdev);
// rdev->asic->copy = NULL;
dev_warn(rdev->dev, "failed video blitter (%d) falling back to memcpy\n", r);
}
/* allocate wb buffer */
r = radeon_wb_init(rdev);
if (r)

View File

@ -841,154 +841,4 @@ void r600_kms_blit_copy(struct radeon_device *rdev,
}
void r600_kms_video_blit(struct radeon_device *rdev,
u64 src_gpu_addr, int dstx, int dsty, int w, int h, int pitch)
{
u64 vb_gpu_addr;
u32 *vb;
// DRM_DEBUG("emitting video copy\n");
vb = (u32 *)(rdev->r600_blit.vb_ib->ptr + rdev->r600_blit.vb_used);
if ((rdev->r600_blit.vb_used + 48) > rdev->r600_blit.vb_total) {
// WARN_ON(1);
}
vb[0] = i2f(dstx);
vb[1] = i2f(dsty);
vb[2] = 0;
vb[3] = 0;
vb[4] = i2f(dstx);
vb[5] = i2f(dsty+h);
vb[6] = 0;
vb[7] = i2f(h);
vb[8] = i2f(dstx + w);
vb[9] = i2f(dsty + h);
vb[10] = i2f(w);
vb[11] = i2f(h);
/* src 9 */
set_tex_resource(rdev, FMT_8_8_8_8,
w, h, pitch/4, src_gpu_addr);
/* 5 */
cp_set_surface_sync(rdev,
PACKET3_TC_ACTION_ENA, pitch * h, src_gpu_addr);
/* dst 23 */
set_render_target(rdev, COLOR_8_8_8_8,
1024, 768, rdev->mc.vram_start);
/* scissors 12 */
set_scissors(rdev, 0, 0, 1024, 768);
/* Vertex buffer setup 14 */
vb_gpu_addr = rdev->r600_blit.vb_ib->gpu_addr + rdev->r600_blit.vb_used;
set_vtx_resource(rdev, vb_gpu_addr);
/* draw 10 */
draw_auto(rdev);
/* 5 */
cp_set_surface_sync(rdev,
PACKET3_CB_ACTION_ENA | PACKET3_CB0_DEST_BASE_ENA,
1024*4*768, rdev->mc.vram_start);
/* 78 ring dwords per loop */
vb += 12;
rdev->r600_blit.vb_used += 12 * 4;
}
extern struct radeon_device *main_device;
int r600_video_blit(uint64_t src_offset, int x, int y,
int w, int h, int pitch)
{
struct radeon_device *rdev = main_device;
static struct radeon_fence *fence;
unsigned long irq_flags;
int r;
if(fence == NULL)
{
r = radeon_fence_create(rdev, &fence);
if (r) {
printf("%s epic fail", __FUNCTION__);
return r;
}
};
fence->evnt = CreateEvent(NULL, 0);
mutex_lock(&rdev->r600_blit.mutex);
rdev->r600_blit.vb_ib = NULL;
r = r600_blit_prepare_copy(rdev, h*pitch);
if (r) {
// if (rdev->r600_blit.vb_ib)
// radeon_ib_free(rdev, &rdev->r600_blit.vb_ib);
mutex_unlock(&rdev->r600_blit.mutex);
return r;
}
r600_kms_video_blit(rdev, src_offset,x,y,w,h,pitch);
r600_blit_done_copy(rdev, fence);
mutex_unlock(&rdev->r600_blit.mutex);
r = radeon_fence_wait(fence, false);
write_lock_irqsave(&rdev->fence_drv.lock, irq_flags);
list_del(&fence->list);
fence->emited = false;
fence->signaled = false;
write_unlock_irqrestore(&rdev->fence_drv.lock, irq_flags);
return r;
};
int r600_create_video(int w, int h, u32_t *outp)
{
int r;
struct radeon_device *rdev = main_device;
struct radeon_bo *sobj = NULL;
uint64_t saddr;
void *uaddr;
size_t size;
size_t pitch;
pitch = radeon_align_pitch(rdev, w, 32, false) * 4;
size = pitch * h;
r = radeon_bo_create(rdev, size, PAGE_SIZE, true,
RADEON_GEM_DOMAIN_GTT, &sobj);
if (r) {
goto fail;
}
r = radeon_bo_reserve(sobj, false);
if (unlikely(r != 0))
goto fail;
r = radeon_bo_pin(sobj, RADEON_GEM_DOMAIN_GTT, &saddr);
// radeon_bo_unreserve(sobj);
if (r) {
goto fail;
}
r = radeon_bo_user_map(sobj, &uaddr);
if (r) {
goto fail;
}
((uint64_t*)outp)[0] = saddr;
outp[2] = uaddr;
outp[3] = pitch;
// dbgprintf("Create video surface %x, mapped at %x pitch %d\n",
// (uint32_t)saddr, uaddr, pitch);
return 0;
fail:
return -1;
};

View File

@ -1244,6 +1244,7 @@ struct radeon_device {
const struct firmware *rlc_fw; /* r6/700 RLC firmware */
const struct firmware *mc_fw; /* NI MC firmware */
struct r600_blit r600_blit;
struct r600_blit r600_video;
struct r700_vram_scratch vram_scratch;
int msi_enabled; /* msi enabled */
struct r600_ih ih; /* r6/700 interrupt ring */

View File

@ -987,10 +987,20 @@ static struct pci_device_id pciidlist[] = {
#define SRV_CREATE_VIDEO 9
#define SRV_BLIT_VIDEO 10
#define SRV_CREATE_BITMAP 11
int r600_video_blit(uint64_t src_offset, int x, int y,
int w, int h, int pitch);
#define check_input(size) \
if( unlikely((inp==NULL)||(io->inp_size != (size))) ) \
break;
#define check_output(size) \
if( unlikely((outp==NULL)||(io->out_size != (size))) ) \
break;
int _stdcall display_handler(ioctl_t *io)
{
int retval = -1;
@ -1003,35 +1013,26 @@ int _stdcall display_handler(ioctl_t *io)
switch(io->io_code)
{
case SRV_GETVERSION:
if(io->out_size==4)
{
check_output(4);
*outp = API_VERSION;
retval = 0;
}
break;
case SRV_ENUM_MODES:
dbgprintf("SRV_ENUM_MODES inp %x inp_size %x out_size %x\n",
inp, io->inp_size, io->out_size );
if( radeon_modeset &&
(outp != NULL) && (io->out_size == 4) &&
(io->inp_size == *outp * sizeof(videomode_t)) )
{
check_output(4);
check_input(*outp * sizeof(videomode_t));
if( radeon_modeset)
retval = get_modes((videomode_t*)inp, outp);
};
break;
case SRV_SET_MODE:
dbgprintf("SRV_SET_MODE inp %x inp_size %x\n",
inp, io->inp_size);
if( radeon_modeset &&
(inp != NULL) &&
(io->inp_size == sizeof(videomode_t)) )
{
check_input(sizeof(videomode_t));
if( radeon_modeset )
retval = set_user_mode((videomode_t*)inp);
};
break;
case SRV_CREATE_VIDEO:
@ -1045,6 +1046,12 @@ int _stdcall display_handler(ioctl_t *io)
retval = 0;
break;
case SRV_CREATE_BITMAP:
check_input(8);
check_output(4);
retval = create_bitmap(outp, inp[0], inp[1]);
break;
};
return retval;

File diff suppressed because it is too large Load Diff

View File

@ -1096,6 +1096,13 @@ static int rv770_startup(struct radeon_device *rdev)
dev_warn(rdev->dev, "failed blitter (%d) falling back to memcpy\n", r);
}
r = r600_video_init(rdev);
if (r) {
// r600_video_fini(rdev);
// rdev->asic->copy = NULL;
dev_warn(rdev->dev, "failed video blitter (%d) falling back to memcpy\n", r);
}
/* allocate wb buffer */
r = radeon_wb_init(rdev);
if (r)