Merged from sys/dev/syscons/scvtb.c revision 1.9.
This commit is contained in:
parent
c2733acc80
commit
a81e61d839
@ -93,7 +93,7 @@ sc_vtb_init(sc_vtb_t *vtb, int type, int cols, int rows, void *buf, int wait)
|
|||||||
vtb->vtb_cols = cols;
|
vtb->vtb_cols = cols;
|
||||||
vtb->vtb_rows = rows;
|
vtb->vtb_rows = rows;
|
||||||
vtb->vtb_size = cols*rows;
|
vtb->vtb_size = cols*rows;
|
||||||
vtb->vtb_buffer = NULL;
|
vtb->vtb_buffer = 0;
|
||||||
vtb->vtb_tail = 0;
|
vtb->vtb_tail = 0;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@ -104,7 +104,7 @@ sc_vtb_init(sc_vtb_t *vtb, int type, int cols, int rows, void *buf, int wait)
|
|||||||
(vm_offset_t)malloc(cols*rows*sizeof(u_int16_t)*2,
|
(vm_offset_t)malloc(cols*rows*sizeof(u_int16_t)*2,
|
||||||
M_DEVBUF,
|
M_DEVBUF,
|
||||||
((wait) ? M_WAITOK : M_NOWAIT) | M_ZERO);
|
((wait) ? M_WAITOK : M_NOWAIT) | M_ZERO);
|
||||||
if (vtb->vtb_buffer != NULL) {
|
if (vtb->vtb_buffer != 0) {
|
||||||
vtb->vtb_flags |= VTB_ALLOCED;
|
vtb->vtb_flags |= VTB_ALLOCED;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -132,11 +132,11 @@ sc_vtb_destroy(sc_vtb_t *vtb)
|
|||||||
vtb->vtb_tail = 0;
|
vtb->vtb_tail = 0;
|
||||||
|
|
||||||
p = vtb->vtb_buffer;
|
p = vtb->vtb_buffer;
|
||||||
vtb->vtb_buffer = NULL;
|
vtb->vtb_buffer = 0;
|
||||||
switch (vtb->vtb_type) {
|
switch (vtb->vtb_type) {
|
||||||
case VTB_MEMORY:
|
case VTB_MEMORY:
|
||||||
case VTB_RINGBUFFER:
|
case VTB_RINGBUFFER:
|
||||||
if ((vtb->vtb_flags & VTB_ALLOCED) && (p != NULL))
|
if ((vtb->vtb_flags & VTB_ALLOCED) && (p != 0))
|
||||||
free((void *)p, M_DEVBUF);
|
free((void *)p, M_DEVBUF);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -93,7 +93,7 @@ sc_vtb_init(sc_vtb_t *vtb, int type, int cols, int rows, void *buf, int wait)
|
|||||||
vtb->vtb_cols = cols;
|
vtb->vtb_cols = cols;
|
||||||
vtb->vtb_rows = rows;
|
vtb->vtb_rows = rows;
|
||||||
vtb->vtb_size = cols*rows;
|
vtb->vtb_size = cols*rows;
|
||||||
vtb->vtb_buffer = NULL;
|
vtb->vtb_buffer = 0;
|
||||||
vtb->vtb_tail = 0;
|
vtb->vtb_tail = 0;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@ -104,7 +104,7 @@ sc_vtb_init(sc_vtb_t *vtb, int type, int cols, int rows, void *buf, int wait)
|
|||||||
(vm_offset_t)malloc(cols*rows*sizeof(u_int16_t)*2,
|
(vm_offset_t)malloc(cols*rows*sizeof(u_int16_t)*2,
|
||||||
M_DEVBUF,
|
M_DEVBUF,
|
||||||
((wait) ? M_WAITOK : M_NOWAIT) | M_ZERO);
|
((wait) ? M_WAITOK : M_NOWAIT) | M_ZERO);
|
||||||
if (vtb->vtb_buffer != NULL) {
|
if (vtb->vtb_buffer != 0) {
|
||||||
vtb->vtb_flags |= VTB_ALLOCED;
|
vtb->vtb_flags |= VTB_ALLOCED;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -132,11 +132,11 @@ sc_vtb_destroy(sc_vtb_t *vtb)
|
|||||||
vtb->vtb_tail = 0;
|
vtb->vtb_tail = 0;
|
||||||
|
|
||||||
p = vtb->vtb_buffer;
|
p = vtb->vtb_buffer;
|
||||||
vtb->vtb_buffer = NULL;
|
vtb->vtb_buffer = 0;
|
||||||
switch (vtb->vtb_type) {
|
switch (vtb->vtb_type) {
|
||||||
case VTB_MEMORY:
|
case VTB_MEMORY:
|
||||||
case VTB_RINGBUFFER:
|
case VTB_RINGBUFFER:
|
||||||
if ((vtb->vtb_flags & VTB_ALLOCED) && (p != NULL))
|
if ((vtb->vtb_flags & VTB_ALLOCED) && (p != 0))
|
||||||
free((void *)p, M_DEVBUF);
|
free((void *)p, M_DEVBUF);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user