Subversion Repositories Kolibri OS

Rev

Rev 813 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 813 Rev 815
Line 225... Line 225...
225
 
225
 
Line 226... Line 226...
226
  };
226
  };
227
  return 0;
227
  return 0;
228
}
228
}
-
 
229
 
-
 
230
 
-
 
231
int CreatePixmap(new_pixmap_t *io)
-
 
232
{
-
 
233
 
-
 
234
  pixmap_t *pixmap;
-
 
235
 
-
 
236
  u32_t pitch;
-
 
237
  void *raw;
-
 
238
 
-
 
239
  if( (io->width == 0) || (io->width > 2048)||
-
 
240
      (io->height == 0)|| (io->height > 2048))
-
 
241
  {
-
 
242
     dbgprintf("Invalid pixmap size w:%d h:%d\n", io->width,io->height);
-
 
243
     return 0;
-
 
244
 
-
 
245
  };
-
 
246
 
-
 
247
  pitch = ((io->width+15)&~15)*4;
-
 
248
  dbgprintf("pitch = %d\n", pitch);
-
 
249
 
-
 
250
  raw = rhd_mem_alloc(&rhd,RHD_MEM_FB,pitch*io->height) ;
-
 
251
  if (! raw)
-
 
252
  {
-
 
253
    dbgprintf("Not enough memory for pixmap\n");
-
 
254
    return 0;
-
 
255
  };
-
 
256
 
-
 
257
  pixmap = malloc(sizeof(pixmap_t));
-
 
258
  if(!pixmap)
-
 
259
  {
-
 
260
    rhd_mem_free(&rhd, RHD_MEM_FB,raw);
-
 
261
    return 0;
-
 
262
  }
-
 
263
  else
-
 
264
  {
-
 
265
    io->pixmap = (u32_t)pixmap;
-
 
266
    io->format = PICT_a8r8g8b8;
-
 
267
    io->pitch = pitch;
-
 
268
 
-
 
269
    pixmap->width  = io->width;
-
 
270
    pixmap->height = io->height;
-
 
271
    pixmap->format = PICT_a8r8g8b8;
-
 
272
    pixmap->pitch = pitch;
-
 
273
    pixmap->offset = (u32_t)raw-rhd.FbBase+rhd.FbIntAddress;
-
 
274
    pixmap->pitch_offset =  ((pitch/64)<<22)| (pixmap->offset>>10);
-
 
275
    pixmap->raw = raw;
-
 
276
 
-
 
277
    dbgprintf("pixmap.pitch_offset: %x\n", pixmap->pitch_offset);
-
 
278
    dbgprintf("width: %d height: %d\n",pixmap->width,pixmap->height );
-
 
279
    dbgprintf("pixmap.offset: %x\n", pixmap->offset);
-
 
280
 
-
 
281
  }
-
 
282
  return 1;
-
 
283
}
-
 
284
 
-
 
285
 
-
 
286
 
-
 
287
int PixBlit(pixblit_t *blit)
-
 
288
{
-
 
289
 
-
 
290
     u32 *ring, write;
-
 
291
     int w, h;
-
 
292
     u32 ifl;
-
 
293
     int x0, y0;
-
 
294
 
-
 
295
     pixmap_t *srcpixmap;
-
 
296
     pixmap_t *dstpixmap;
-
 
297
 
-
 
298
     dbgprintf("Pixblit src: %x dst: %x\n",blit->srcpix, blit->dstpix);
-
 
299
 
-
 
300
     dstpixmap = (blit->dstpix == (void*)-1) ? &scr_pixmap : blit->dstpix ;
-
 
301
     srcpixmap = (blit->srcpix == (void*)-1) ? &scr_pixmap : blit->srcpix ;
-
 
302
 
-
 
303
     dbgprintf("srcpixmap: %x dstpixmap: %x\n",srcpixmap, dstpixmap);
-
 
304
 
-
 
305
     dbgprintf("dst.width: %d dst.height: %d\n", dstpixmap->width,dstpixmap->height);
-
 
306
     dbgprintf("src.width: %d src.height: %d\n", srcpixmap->width,srcpixmap->height);
-
 
307
     dbgprintf("srcpitch: %x dstpitch: %x\n",
-
 
308
                srcpixmap->pitch_offset,dstpixmap->pitch_offset);
-
 
309
 
-
 
310
     ifl = safe_cli();
-
 
311
 
-
 
312
 
-
 
313
     BEGIN_RING();
-
 
314
       OUT_RING(CP_PACKET3(RADEON_CNTL_BITBLT, 5));
-
 
315
 
-
 
316
       OUT_RING(RADEON_GMC_SRC_PITCH_OFFSET_CNTL  |
-
 
317
                RADEON_GMC_DST_PITCH_OFFSET_CNTL  |
-
 
318
                RADEON_GMC_BRUSH_NONE             |
-
 
319
                RADEON_GMC_DST_32BPP              |
-
 
320
                RADEON_GMC_SRC_DATATYPE_COLOR     |
-
 
321
                RADEON_DP_SRC_SOURCE_MEMORY       |
-
 
322
                (1 << 28)+(1 << 30) | R5XX_ROP3_S);
-
 
323
 
-
 
324
       OUT_RING(srcpixmap->pitch_offset);
-
 
325
       OUT_RING(dstpixmap->pitch_offset);
-
 
326
 
-
 
327
  //   x0 = blit->src_x;
-
 
328
  //   y0 = blit->src_y;
-
 
329
  //   w =  blit->w;
-
 
330
  //   h =  blit->h;
-
 
331
 
-
 
332
       OUT_RING((blit->src_x<<16)|blit->src_y);
-
 
333
       OUT_RING((blit->dst_x<<16)|blit->dst_y);
-
 
334
       OUT_RING((blit->w<<16)|blit->h);
-
 
335
     COMMIT_RING();
-
 
336
 
-
 
337
     safe_sti(ifl);
-
 
338
  return 0;
-
 
339
}